From b6b26852dc3efc245ecb131eca224f734e90b05d Mon Sep 17 00:00:00 2001 From: guodeqing Date: Mon, 12 Jun 2023 19:42:39 +0800 Subject: [PATCH 0001/2135] =?UTF-8?q?!I7AJWG=20=E6=96=B0=E5=A2=9EFFRT?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20Signed-off-by:=20guodeqi?= =?UTF-8?q?ng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ffrt/c/condition_variable.h | 150 ++++ zh-cn/native_sdk/ffrt/c/mutex.h | 83 ++ zh-cn/native_sdk/ffrt/c/queue.h | 139 ++++ zh-cn/native_sdk/ffrt/c/sleep.h | 47 ++ zh-cn/native_sdk/ffrt/c/task.h | 205 +++++ zh-cn/native_sdk/ffrt/c/type_def.h | 155 ++++ .../native_sdk/ffrt/cpp/condition_variable.h | 122 +++ zh-cn/native_sdk/ffrt/cpp/mutex.h | 60 ++ zh-cn/native_sdk/ffrt/cpp/queue.h | 229 ++++++ zh-cn/native_sdk/ffrt/cpp/sleep.h | 51 ++ zh-cn/native_sdk/ffrt/cpp/task.h | 736 ++++++++++++++++++ zh-cn/native_sdk/ffrt/ffrt.h | 33 + 12 files changed, 2010 insertions(+) create mode 100644 zh-cn/native_sdk/ffrt/c/condition_variable.h create mode 100644 zh-cn/native_sdk/ffrt/c/mutex.h create mode 100644 zh-cn/native_sdk/ffrt/c/queue.h create mode 100644 zh-cn/native_sdk/ffrt/c/sleep.h create mode 100644 zh-cn/native_sdk/ffrt/c/task.h create mode 100644 zh-cn/native_sdk/ffrt/c/type_def.h create mode 100644 zh-cn/native_sdk/ffrt/cpp/condition_variable.h create mode 100644 zh-cn/native_sdk/ffrt/cpp/mutex.h create mode 100644 zh-cn/native_sdk/ffrt/cpp/queue.h create mode 100644 zh-cn/native_sdk/ffrt/cpp/sleep.h create mode 100644 zh-cn/native_sdk/ffrt/cpp/task.h create mode 100644 zh-cn/native_sdk/ffrt/ffrt.h diff --git a/zh-cn/native_sdk/ffrt/c/condition_variable.h b/zh-cn/native_sdk/ffrt/c/condition_variable.h new file mode 100644 index 00000000..b00f2aab --- /dev/null +++ b/zh-cn/native_sdk/ffrt/c/condition_variable.h @@ -0,0 +1,150 @@ +/* + * 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. + */ + + /** + * @file condition_variable.h + * + * @brief 声明条件变量提供的C接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_C_CONDITION_VARIABLE_H +#define FFRT_API_C_CONDITION_VARIABLE_H +#include +#include "type_def.h" + +typedef enum { + ffrt_clock_realtime = CLOCK_REALTIME, + ffrt_clock_monotonic = CLOCK_MONOTONIC +} ffrt_clockid_t; + +/** + * @brief 初始化条件变量属性. + * + * @param attr 条件变量属性指针. + * @return 初始化条件变量属性成功返回ffrt_thrd_success, + 初始化条件变量属性失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_condattr_init(ffrt_condattr_t* attr); + +/** + * @brief 销毁条件变量属性. + * + * @param attr 条件变量属性指针. + * @return 销毁条件变量属性成功返回ffrt_thrd_success, + 销毁条件变量属性失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_condattr_destroy(ffrt_condattr_t* attr); + +/** + * @brief 设置条件变量的时钟属性. + * + * @param attr 条件变量属性指针. + * @param clock 时钟类型. + * @return 设置条件变量的时钟属性成功返回ffrt_thrd_success, + 设置条件变量的时钟属性失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_condattr_setclock(ffrt_condattr_t* attr, ffrt_clockid_t clock); + +/** + * @brief 获取条件变量的时钟属性. + * + * @param attr 条件变量属性指针. + * @param clock 时钟属性指针. + * @return 获取条件变量的时钟属性成功返回ffrt_thrd_success, + 获取条件变量的时钟属性失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_condattr_getclock(const ffrt_condattr_t* attr, ffrt_clockid_t* clock); + +/** + * @brief 初始化条件变量. + * + * @param cond 条件变量指针. + * @param attr 条件变量属性指针. + * @return 初始化条件变量成功返回ffrt_thrd_success, + 初始化条件变量失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_cond_init(ffrt_cond_t* cond, const ffrt_condattr_t* attr); + +/** + * @brief 唤醒阻塞在条件变量上的一个任务. + * + * @param cond 条件变量指针. + * @return 唤醒成功返回ffrt_thrd_success, + 唤醒失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_cond_signal(ffrt_cond_t* cond); + +/** + * @brief 唤醒阻塞在条件变量上的所有任务. + * + * @param cond 条件变量指针. + * @return 唤醒成功返回ffrt_thrd_success, + 唤醒失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_cond_broadcast(ffrt_cond_t* cond); + +/** + * @brief 条件变量等待函数,条件变量不满足时阻塞当前任务. + * + * @param cond 条件变量指针. + * @param mutex mutex指针. + * @return 等待后被成功唤醒返回ffrt_thrd_success, + 等待失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_cond_wait(ffrt_cond_t* cond, ffrt_mutex_t* mutex); + +/** + * @brief 条件变量超时等待函数,条件变量不满足时阻塞当前任务,超时等待返回. + * + * @param cond 条件变量指针. + * @param mutex mutex指针. + * @param time_point 最大等待到的时间点,超过这个时间点等待返回. + * @return 等待后被成功唤醒返回ffrt_thrd_success, + 等待超时返回ffrt_thrd_timedout. + 等待失败ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_cond_timedwait(ffrt_cond_t* cond, ffrt_mutex_t* mutex, const struct timespec* time_point); + +/** + * @brief 销毁掉件变量. + * + * @param cond 条件变量指针. + * @return 销毁条件变量成功返回ffrt_thrd_success, + 销毁条件变量失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_cond_destroy(ffrt_cond_t* cond); +#endif diff --git a/zh-cn/native_sdk/ffrt/c/mutex.h b/zh-cn/native_sdk/ffrt/c/mutex.h new file mode 100644 index 00000000..126876c4 --- /dev/null +++ b/zh-cn/native_sdk/ffrt/c/mutex.h @@ -0,0 +1,83 @@ +/* + * 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. + */ + + /** + * @file mutex.h + * + * @brief 声明mutex提供的C接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_C_MUTEX_H +#define FFRT_API_C_MUTEX_H +#include "type_def.h" + +/** + * @brief 初始化mutex. + * + * @param mutex mutex指针. + * @param attr mutex属性. + * @return 初始化mutex成功返回ffrt_thrd_success, + 初始化mutex失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_mutex_init(ffrt_mutex_t* mutex, const ffrt_mutexattr_t* attr); + +/** + * @brief 获取mutex. + * + * @param mutex mutex指针. + * @return 获取mutex成功返回ffrt_thrd_success, + 获取mutex失败返回ffrt_thrd_error,或者阻塞当前任务. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_mutex_lock(ffrt_mutex_t* mutex); + +/** + * @brief 释放mutex. + * + * @param mutex mutex指针. + * @return 释放mutex成功返回ffrt_thrd_success, + 释放mutex失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_mutex_unlock(ffrt_mutex_t* mutex); + +/** + * @brief 尝试获取mutex. + * + * @param mutex mutex指针. + * @return 获取mutex成功返回ffrt_thrd_success, + 获取mutex失败返回ffrt_thrd_error或ffrt_thrd_busy. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_mutex_trylock(ffrt_mutex_t* mutex); + +/** + * @brief 销毁mutex. + * + * @param mutex mutex指针. + * @return 销毁mutex成功返回ffrt_thrd_success, + 销毁mutex失败返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_mutex_destroy(ffrt_mutex_t* mutex); +#endif diff --git a/zh-cn/native_sdk/ffrt/c/queue.h b/zh-cn/native_sdk/ffrt/c/queue.h new file mode 100644 index 00000000..7a1a3faa --- /dev/null +++ b/zh-cn/native_sdk/ffrt/c/queue.h @@ -0,0 +1,139 @@ +/* + * 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. + */ + +/** + * @file queue.h + * + * @brief 声明串行队列提供的C接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_C_QUEUE_H +#define FFRT_API_C_QUEUE_H + +#include "type_def.h" + +typedef enum { ffrt_queue_serial, ffrt_queue_max } ffrt_queue_type_t; +typedef void* ffrt_queue_t; + +/** + * @brief 初始化串行队列属性. + * + * @param attr 串行队列属性指针. + * @return 执行成功时返回0, + 执行成功时返回-1. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_queue_attr_init(ffrt_queue_attr_t* attr); + +/** + * @brief 销毁串行队列属性. + * + * @param attr 串行队列属性指针. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_queue_attr_destroy(ffrt_queue_attr_t* attr); + +/** + * @brief 设置串行队列qos属性. + * + * @param attr 串行队列属性指针. + * @param attr qos属性值. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_queue_attr_set_qos(ffrt_queue_attr_t* attr, ffrt_qos_t qos); + +/** + * @brief 获取串行队列qos属性. + * + * @param attr 串行队列属性指针. + * @return 返回串行队列的qos属性 + * @since 10 + * @version 1.0 + */ +FFRT_C_API ffrt_qos_t ffrt_queue_attr_get_qos(const ffrt_queue_attr_t* attr); + +/** + * @brief 创建队列. + * + * @param type 队列类型. + * @param name 队列名字. + * @param attr 队列属性. + * @return 创建队列成功返回非空队列句柄 + 创建队列失败返回空指针 + * @since 10 + * @version 1.0 + */ +FFRT_C_API ffrt_queue_t ffrt_queue_create(ffrt_queue_type_t type, const char* name, const ffrt_queue_attr_t* attr); + +/** + * @brief 销毁队列. + * + * @param queue 队列句柄. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_queue_destroy(ffrt_queue_t queue); + +/** + * @brief 提交一个任务到队列中调度执行. + * + * @param queue 队列句柄. + * @param f 任务的执行体. + * @param attr 任务属性. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_queue_submit(ffrt_queue_t queue, ffrt_function_header_t* f, const ffrt_task_attr_t* attr); + +/** + * @brief 提交一个任务到队列中调度执行,并返回任务句柄. + * + * @param queue 队列句柄. + * @param f 任务的执行体. + * @param attr 任务属性. + * @return 提交成功返回非空任务句柄 + 提交失败返回空指针 + * @since 10 + * @version 1.0 + */ +FFRT_C_API ffrt_task_handle_t ffrt_queue_submit_h( + ffrt_queue_t queue, ffrt_function_header_t* f, const ffrt_task_attr_t* attr); + +/** + * @brief 等待队列中一个任务执行完成. + * + * @param handle 任务句柄. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_queue_wait(ffrt_task_handle_t handle); + +/** + * @brief 取消队列中一个任务. + * + * @param handle 任务句柄. + * @return 取消任务成功返回0 + 取消任务失败返回-1 + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_queue_cancel(ffrt_task_handle_t handle); + +#endif // FFRT_API_C_QUEUE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/ffrt/c/sleep.h b/zh-cn/native_sdk/ffrt/c/sleep.h new file mode 100644 index 00000000..5131388e --- /dev/null +++ b/zh-cn/native_sdk/ffrt/c/sleep.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/** + * @file sleep.h + * + * @brief 声明sleep和yield C接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_C_SLEEP_H +#define FFRT_API_C_SLEEP_H +#include +#include "type_def.h" + +/** + * @brief 延迟usec微妙. + * + * @param usec延迟时间,单位微妙. + * @return 执行成功时返回ffrt_thrd_success, + 执行成功时返回ffrt_thrd_error. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_usleep(uint64_t usec); + +/** + * @brief 当前任务主动放权,让其他任务有机会调度执行. + * + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_yield(); +#endif diff --git a/zh-cn/native_sdk/ffrt/c/task.h b/zh-cn/native_sdk/ffrt/c/task.h new file mode 100644 index 00000000..1aa83368 --- /dev/null +++ b/zh-cn/native_sdk/ffrt/c/task.h @@ -0,0 +1,205 @@ +/* + * 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. + */ + + /** + * @file task.h + * + * @brief 声明任务提供的C接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_C_TASK_H +#define FFRT_API_C_TASK_H +#include "type_def.h" + +/** + * @brief 初始化任务属性. + * + * @param attr 任务属性指针. + * @return 初始化任务属性成功返回0, + 初始化任务属性失败返回-1. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_task_attr_init(ffrt_task_attr_t* attr); + +/** + * @brief 设置任务名字. + * + * @param attr 任务属性指针. + * @param name 任务名字. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_task_attr_set_name(ffrt_task_attr_t* attr, const char* name); + +/** + * @brief 获取任务名字. + * + * @param attr 任务属性指针. + * @return 获取任务名字成功返回非空指针, + 获取任务名字失败返回空指针. + * @since 10 + * @version 1.0 + */ +FFRT_C_API const char* ffrt_task_attr_get_name(const ffrt_task_attr_t* attr); + +/** + * @brief 销毁任务属性. + * + * @param attr 任务属性指针. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_task_attr_destroy(ffrt_task_attr_t* attr); + +/** + * @brief 设置任务qos. + * + * @param attr 任务属性指针. + * @param pos 任务pos类型. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_task_attr_set_qos(ffrt_task_attr_t* attr, ffrt_qos_t qos); + +/** + * @brief 获取任务qos. + * + * @param attr 任务属性指针. + * @return 返回任务的qos,默认返回ffrt_qos_default + * @since 10 + * @version 1.0 + */ +FFRT_C_API ffrt_qos_t ffrt_task_attr_get_qos(const ffrt_task_attr_t* attr); + +/** + * @brief 设置任务延迟时间. + * + * @param attr 任务属性指针. + * @param delay_us 任务延迟时间,单位微妙. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_task_attr_set_delay(ffrt_task_attr_t* attr, uint64_t delay_us); + +/** + * @brief 获取任务延迟时间. + * + * @param attr 任务属性指针. + * @return 返回任务的延迟时间 + * @since 10 + * @version 1.0 + */ +FFRT_C_API uint64_t ffrt_task_attr_get_delay(const ffrt_task_attr_t* attr); + +/** + * @brief 更新任务qos. + * + * @param qos 更新的qos,更新当前任务的qos. + * @return 更新任务qos成功返回0, + 更新任务qos成功返回-1. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_this_task_update_qos(ffrt_qos_t qos); + +/** + * @brief 获取任务id. + * + * @return 返回当前任务的id + * @since 10 + * @version 1.0 + */ +FFRT_C_API uint64_t ffrt_this_task_get_id(); + +/** + * @brief 申请函数执行结构的内存. + * + * @param kind 函数执行结构类型,支持通用和队列函数执行结构类型. + * @return 申请函数执行结构成功返回非空指针, + 申请函数执行结构失败返回空指针. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void *ffrt_alloc_auto_managed_function_storage_base(ffrt_function_kind_t kind); + +/** + * @brief 提交任务调度执行. + * + * @param f 任务执行体封装的指针. + * @param in_deps 输入依赖指针. + * @param out_deps 输出依赖指针. + * @param attr 任务属性. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_submit_base(ffrt_function_header_t* f, const ffrt_deps_t* in_deps, const ffrt_deps_t* out_deps, + const ffrt_task_attr_t* attr); + +/** + * @brief 提交任务调度执行并返回任务句柄. + * + * @param f 任务执行体封装的指针. + * @param in_deps 输入依赖指针. + * @param out_deps 输出依赖指针. + * @param attr 任务属性. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +FFRT_C_API ffrt_task_handle_t ffrt_submit_h_base(ffrt_function_header_t* f, const ffrt_deps_t* in_deps, + const ffrt_deps_t* out_deps, const ffrt_task_attr_t* attr); + +/** + * @brief 销毁任务句柄. + * + * @param handle 任务句柄. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_task_handle_destroy(ffrt_task_handle_t handle); + +/** + * @brief 跳过指定任务. + * + * @param handle 任务句柄. + * @return 跳过指定任务成功返回0, + 跳过指定任务失败返回-1. + * @since 10 + * @version 1.0 + */ +FFRT_C_API int ffrt_skip(ffrt_task_handle_t handle); + +/** + * @brief 等待依赖的任务完成,当前任务开始执行. + * + * @param deps 依赖的指针. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_wait_deps(const ffrt_deps_t* deps); + +/** + * @brief 等待之前所有提交任务完成,当前任务开始执行. + * + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_wait(); + +#endif diff --git a/zh-cn/native_sdk/ffrt/c/type_def.h b/zh-cn/native_sdk/ffrt/c/type_def.h new file mode 100644 index 00000000..eb0ef3f6 --- /dev/null +++ b/zh-cn/native_sdk/ffrt/c/type_def.h @@ -0,0 +1,155 @@ +/* + * 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. + */ + + /** + * @file type_def.h + * + * @brief 定义通用类型. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_C_TYPE_DEF_H +#define FFRT_API_C_TYPE_DEF_H +#include +#include + +#ifdef __cplusplus +#define FFRT_C_API extern "C" +#else +#define FFRT_C_API +#endif + +/** + * @brief 任务的qos类型. + * + */ +typedef enum { + /** 继承当前任务qos属性 */ + ffrt_qos_inherit = -1, + /** 后台任务 */ + ffrt_qos_background, + /** 实时工具 */ + ffrt_qos_utility, + /** 默认类型 */ + ffrt_qos_default, + /** 用户期望 */ + ffrt_qos_user_initiated, +} ffrt_qos_t; + +typedef void(*ffrt_function_t)(void*); + +/** + * @brief 任务执行体. + * + */ +typedef struct { + /** 任务执行函数 */ + ffrt_function_t exec; + /** 任务销毁函数 */ + ffrt_function_t destroy; + uint64_t reserve[2]; +} ffrt_function_header_t; + +/** + * @brief 多种类型数据结构分配大小定义. + * + */ +typedef enum { + /** 任务属性 */ + ffrt_task_attr_storage_size = 128, + /** 任务执行体 */ + ffrt_auto_managed_function_storage_size = 64 + sizeof(ffrt_function_header_t), + /** 互斥锁 */ + ffrt_mutex_storage_size = 64, + /** 条件变量 */ + ffrt_cond_storage_size = 64, + /** 队列属性 */ + ffrt_queue_attr_storage_size = 128, +} ffrt_storage_size_t; + +/** + * @brief 任务类型. + * + */ +typedef enum { + /** 通用任务类型 */ + ffrt_function_kind_general, + /** 队列任务类型 */ + ffrt_function_kind_queue +} ffrt_function_kind_t; + +/** + * @brief 数据依赖数据结构. + * + */ +typedef struct { + /** 依赖个数 */ + uint32_t len; + /** 依赖数据 */ + const void* const * items; +} ffrt_deps_t; + +typedef struct { + uint32_t storage[(ffrt_task_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; +} ffrt_task_attr_t; + +typedef struct { + uint32_t storage[(ffrt_queue_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; +} ffrt_queue_attr_t; + +typedef void* ffrt_task_handle_t; + +typedef enum { + ffrt_error = -1, + ffrt_success = 0, + ffrt_error_nomem = ENOMEM, + ffrt_error_timedout = ETIMEDOUT, + ffrt_error_busy = EBUSY, + ffrt_error_inval = EINVAL +} ffrt_error_t; + +typedef struct { + long storage; +} ffrt_condattr_t; + +typedef struct { + long storage; +} ffrt_mutexattr_t; + +typedef struct { + uint32_t storage[(ffrt_thread_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; +} ffrt_thread_attr_t; + +typedef struct { + uint32_t storage[(ffrt_mutex_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; +} ffrt_mutex_t; + +typedef struct { + uint32_t storage[(ffrt_cond_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; +} ffrt_cond_t; + +#ifdef __cplusplus +namespace ffrt { +enum qos { + qos_inherit = ffrt_qos_inherit, + qos_background = ffrt_qos_background, + qos_utility = ffrt_qos_utility, + qos_default = ffrt_qos_default, + qos_user_initiated = ffrt_qos_user_initiated, +}; +} +#endif +#endif diff --git a/zh-cn/native_sdk/ffrt/cpp/condition_variable.h b/zh-cn/native_sdk/ffrt/cpp/condition_variable.h new file mode 100644 index 00000000..60e38662 --- /dev/null +++ b/zh-cn/native_sdk/ffrt/cpp/condition_variable.h @@ -0,0 +1,122 @@ +/* + * 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. + */ + +/** + * @file condition_variable.h + * + * @brief 声明条件变量提供的C++接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_CPP_CONDITION_VARIABLE_H +#define FFRT_API_CPP_CONDITION_VARIABLE_H +#include +#include +#include "mutex.h" +#include "c/condition_variable.h" + +namespace ffrt { +enum class cv_status { no_timeout, timeout }; + +class condition_variable : public ffrt_cond_t { +public: + condition_variable() + { + ffrt_cond_init(this, nullptr); + } + + ~condition_variable() noexcept + { + ffrt_cond_destroy(this); + } + + condition_variable(const condition_variable&) = delete; + condition_variable& operator=(const condition_variable&) = delete; + + template + bool wait_until( + std::unique_lock& lk, const std::chrono::time_point& tp, Pred&& pred) noexcept + { + while (!pred()) { + if (wait_until(lk, tp) == cv_status::timeout) { + return pred(); + } + } + return true; + } + + template + cv_status wait_until(std::unique_lock& lk, const std::chrono::time_point& tp) noexcept + { + return _wait_for(lk, tp - Clock::now()); + } + + template + cv_status wait_for(std::unique_lock& lk, const std::chrono::duration& sleep_time) noexcept + { + return _wait_for(lk, sleep_time); + } + + template + bool wait_for( + std::unique_lock& lk, const std::chrono::duration& sleepTime, Pred&& pred) noexcept + { + return wait_until(lk, std::chrono::steady_clock::now() + sleepTime, std::forward(pred)); + } + + template + void wait(std::unique_lock& lk, Pred&& pred) + { + while (!pred()) { + wait(lk); + } + } + + void wait(std::unique_lock& lk) + { + ffrt_cond_wait(this, lk.mutex()); + } + + void notify_one() noexcept + { + ffrt_cond_signal(this); + } + + void notify_all() noexcept + { + ffrt_cond_broadcast(this); + } + +private: + template + cv_status _wait_for(std::unique_lock& lk, const std::chrono::duration& dur) noexcept + { + timespec ts; + std::chrono::nanoseconds _T0 = std::chrono::steady_clock::now().time_since_epoch(); + _T0 += std::chrono::duration_cast(dur); + ts.tv_sec = std::chrono::duration_cast(_T0).count(); + _T0 -= std::chrono::seconds(ts.tv_sec); + ts.tv_nsec = static_cast(_T0.count()); + + auto ret = ffrt_cond_timedwait(this, lk.mutex(), &ts); + if (ret == ffrt_success) { + return cv_status::no_timeout; + } + return cv_status::timeout; + } +}; +} // namespace ffrt +#endif diff --git a/zh-cn/native_sdk/ffrt/cpp/mutex.h b/zh-cn/native_sdk/ffrt/cpp/mutex.h new file mode 100644 index 00000000..7777a9a0 --- /dev/null +++ b/zh-cn/native_sdk/ffrt/cpp/mutex.h @@ -0,0 +1,60 @@ +/* + * 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. + */ + + /** + * @file mutex.h + * + * @brief 声明mutex提供的C++接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_CPP_MUTEX_H +#define FFRT_API_CPP_MUTEX_H +#include "c/mutex.h" + +namespace ffrt { +class mutex : public ffrt_mutex_t { +public: + mutex() + { + ffrt_mutex_init(this, nullptr); + } + + ~mutex() + { + ffrt_mutex_destroy(this); + } + + mutex(mutex const&) = delete; + void operator=(mutex const&) = delete; + + inline bool try_lock() + { + return ffrt_mutex_trylock(this) == ffrt_success ? true : false; + } + + inline void lock() + { + ffrt_mutex_lock(this); + } + + inline void unlock() + { + ffrt_mutex_unlock(this); + } +}; +} // namespace ffrt +#endif diff --git a/zh-cn/native_sdk/ffrt/cpp/queue.h b/zh-cn/native_sdk/ffrt/cpp/queue.h new file mode 100644 index 00000000..60e35a17 --- /dev/null +++ b/zh-cn/native_sdk/ffrt/cpp/queue.h @@ -0,0 +1,229 @@ +/* + * 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. + */ + +/** + * @file queue.h + * + * @brief 声明串行队列提供的C++接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_CPP_QUEUE_H +#define FFRT_API_CPP_QUEUE_H + +#include "c/queue.h" +#include "cpp/task.h" + +namespace ffrt { +class queue_attr : public ffrt_queue_attr_t { +public: + queue_attr() + { + ffrt_queue_attr_init(this); + } + + ~queue_attr() + { + ffrt_queue_attr_destroy(this); + } + + queue_attr(const queue_attr&) = delete; + queue_attr& operator=(const queue_attr&) = delete; + + + /** + * @brief 设置串行队列qos属性. + * + * @param attr qos属性值. + * @since 10 + * @version 1.0 + */ + inline queue_attr& qos(enum qos qos) + { + ffrt_queue_attr_set_qos(this, static_cast(qos)); + return *this; + } + + /** + * @brief 获取串行队列qos属性. + * + * @return 返回串行队列的qos属性 + * @since 10 + * @version 1.0 + */ + inline enum qos qos() const + { + return static_cast(ffrt_queue_attr_get_qos(this)); + } +}; + +class queue { +public: + queue(const char* name, const queue_attr& attr = {}) + { + queue_handle = ffrt_queue_create(ffrt_queue_serial, name, &attr); + } + + ~queue() + { + ffrt_queue_destroy(queue_handle); + } + + queue(queue const&) = delete; + void operator=(queue const&) = delete; + + /** + * @brief 提交一个任务到队列中调度执行. + * + * @param func 任务执行体函数闭包. + * @since 10 + * @version 1.0 + */ + inline void submit(std::function& func) + { + ffrt_queue_submit(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), nullptr); + } + + /** + * @brief 提交一个特定属性的任务到队列中调度执行. + * + * @param func 任务执行体函数闭包. + * @param attr 任务属性. + * @since 10 + * @version 1.0 + */ + inline void submit(std::function& func, const task_attr& attr) + { + ffrt_queue_submit(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), &attr); + } + + /** + * @brief 提交一个任务到队列中调度执行. + * + * @param func 任务执行体函数闭包. + * @since 10 + * @version 1.0 + */ + inline void submit(std::function&& func) + { + ffrt_queue_submit(queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), nullptr); + } + + /** + * @brief 提交一个特定属性的任务到队列中调度执行. + * + * @param func 任务执行体函数闭包. + * @param attr 任务属性. + * @since 10 + * @version 1.0 + */ + inline void submit(std::function&& func, const task_attr& attr) + { + ffrt_queue_submit(queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), &attr); + } + + /** + * @brief 提交一个任务到队列中调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @return 提交成功返回非空任务句柄 + 提交失败返回空指针 + * @since 10 + * @version 1.0 + */ + inline task_handle submit_h(std::function& func) + { + return ffrt_queue_submit_h(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), nullptr); + } + + /** + * @brief 提交一个特定属性的任务到队列中调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param attr 任务属性. + * @return 提交成功返回非空任务句柄 + 提交失败返回空指针 + * @since 10 + * @version 1.0 + */ + inline task_handle submit_h(std::function& func, const task_attr& attr) + { + return ffrt_queue_submit_h(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), &attr); + } + + /** + * @brief 提交一个任务到队列中调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @return 提交成功返回非空任务句柄 + 提交失败返回空指针 + * @since 10 + * @version 1.0 + */ + inline task_handle submit_h(std::function&& func) + { + return ffrt_queue_submit_h( + queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), nullptr); + } + + /** + * @brief 提交一个特定属性的任务到队列中调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param attr 任务属性. + * @return 提交成功返回非空任务句柄 + 提交失败返回空指针 + * @since 10 + * @version 1.0 + */ + inline task_handle submit_h(std::function&& func, const task_attr& attr) + { + return ffrt_queue_submit_h( + queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), &attr); + } + + /** + * @brief 取消任务. + * + * @param handle 任务句柄. + * @return 取消任务成功返回0 + 取消任务成功返回-1 + * @since 10 + * @version 1.0 + */ + inline int cancel(task_handle& handle) + { + return ffrt_queue_cancel(handle); + } + + /** + * @brief 等待任务执行完成. + * + * @param handle 任务句柄. + * @since 10 + * @version 1.0 + */ + inline void wait(task_handle& handle) + { + return ffrt_queue_wait(handle); + } + +private: + ffrt_queue_t queue_handle = nullptr; +}; +} // namespace ffrt + +#endif // FFRT_API_CPP_QUEUE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/ffrt/cpp/sleep.h b/zh-cn/native_sdk/ffrt/cpp/sleep.h new file mode 100644 index 00000000..24df1eba --- /dev/null +++ b/zh-cn/native_sdk/ffrt/cpp/sleep.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +/** + * @file sleep.h + * + * @brief 声明sleep和yield C++接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_CPP_SLEEP_H +#define FFRT_API_CPP_SLEEP_H +#include +#include +#include "c/sleep.h" + +namespace ffrt { +namespace this_task { +static inline void yield() +{ + ffrt_yield(); +} + +template +inline void sleep_for(const std::chrono::duration<_Rep, _Period>& d) +{ + ffrt_usleep(std::chrono::duration_cast(d).count()); +} + +template +inline void sleep_until( + const std::chrono::time_point<_Clock, _Duration>& abs_time) +{ + sleep_for(abs_time.time_since_epoch() - _Clock::now().time_since_epoch()); +} +} // namespace this_task +} // namespace ffrt +#endif diff --git a/zh-cn/native_sdk/ffrt/cpp/task.h b/zh-cn/native_sdk/ffrt/cpp/task.h new file mode 100644 index 00000000..113b9d61 --- /dev/null +++ b/zh-cn/native_sdk/ffrt/cpp/task.h @@ -0,0 +1,736 @@ +/* + * 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. + */ + + /** + * @file task.h + * + * @brief 声明任务提供的C++接口. + * + * @since 10 + * @version 1.0 + */ +#ifndef FFRT_API_CPP_TASK_H +#define FFRT_API_CPP_TASK_H +#include +#include +#include +#include +#include "c/task.h" + +namespace ffrt { +class task_attr : public ffrt_task_attr_t { +public: + task_attr() + { + ffrt_task_attr_init(this); + } + + ~task_attr() + { + ffrt_task_attr_destroy(this); + } + + task_attr(const task_attr&) = delete; + task_attr& operator=(const task_attr&) = delete; + + /** + * @brief 设置任务名字. + * + * @param name 任务名字. + * @since 10 + * @version 1.0 + */ + inline task_attr& name(const char* name) + { + ffrt_task_attr_set_name(this, name); + return *this; + } + + /** + * @brief 获取任务名字. + * + * @return 返回任务名字. + * @since 10 + * @version 1.0 + */ + inline const char* name() const + { + return ffrt_task_attr_get_name(this); + } + + /** + * @brief 设置任务qos. + * + * @param qos qos类型. + * @since 10 + * @version 1.0 + */ + inline task_attr& qos(enum qos qos) + { + ffrt_task_attr_set_qos(this, static_cast(qos)); + return *this; + } + + /** + * @brief 获取任务qos. + * + * @return 返回任务qos. + * @since 10 + * @version 1.0 + */ + inline enum qos qos() const + { + return static_cast(ffrt_task_attr_get_qos(this)); + } + + /** + * @brief 设置任务延迟时间. + * + * @param delay_us 延迟时间,单位是微妙. + * @since 10 + * @version 1.0 + */ + inline task_attr& delay(uint64_t delay_us) + { + ffrt_task_attr_set_delay(this, delay_us); + return *this; + } + + /** + * @brief 获取任务延迟时间. + * + * @return 返回任务延迟时间. + * @since 10 + * @version 1.0 + */ + inline uint64_t delay() const + { + return ffrt_task_attr_get_delay(this); + } +}; + +class task_handle { +public: + task_handle() : p(nullptr) + { + } + task_handle(ffrt_task_handle_t p) : p(p) + { + } + + ~task_handle() + { + if (p) { + ffrt_task_handle_destroy(p); + } + } + + task_handle(task_handle const&) = delete; + void operator=(task_handle const&) = delete; + + inline task_handle(task_handle&& h) + { + *this = std::move(h); + } + + inline task_handle& operator=(task_handle&& h) + { + if (p) { + ffrt_task_handle_destroy(p); + } + p = h.p; + h.p = nullptr; + return *this; + } + + inline operator void* () const + { + return p; + } + +private: + ffrt_task_handle_t p = nullptr; +}; + +template +struct function { + template + function(ffrt_function_header_t h, CT&& c) : header(h), closure(std::forward(c)) {} + ffrt_function_header_t header; + T closure; +}; + +template +void exec_function_wrapper(void* t) +{ + auto f = reinterpret_cast>*>(t); + f->closure(); +} + +template +void destroy_function_wrapper(void* t) +{ + auto f = reinterpret_cast>*>(t); + f->closure = nullptr; +} + +template +inline ffrt_function_header_t* create_function_wrapper(T&& func, + ffrt_function_kind_t kind = ffrt_function_kind_general) +{ + using function_type = function>; + static_assert(sizeof(function_type) <= ffrt_auto_managed_function_storage_size, + "size of function must be less than ffrt_auto_managed_function_storage_size"); + + auto p = ffrt_alloc_auto_managed_function_storage_base(kind); + auto f = + new (p)function_type({ exec_function_wrapper, destroy_function_wrapper, { 0 } }, std::forward(func)); + return reinterpret_cast(f); +} + +/** + * @brief 提交无输入和输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @since 10 + * @version 1.0 + */ +static inline void submit(std::function&& func) +{ + return ffrt_submit_base(create_function_wrapper(std::move(func)), nullptr, nullptr, nullptr); +} + +/** + * @brief 提交有输入依赖无输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @since 10 + * @version 1.0 + */ +static inline void submit(std::function&& func, std::initializer_list in_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); +} + +/** + * @brief 提交有输入输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @since 10 + * @version 1.0 + */ +static inline void submit(std::function&& func, std::initializer_list in_deps, + std::initializer_list out_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); +} + +/** + * @brief 提交有输入输出依赖的特定属性的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @param attr 任务属性. + * @since 10 + * @version 1.0 + */ +static inline void submit(std::function&& func, std::initializer_list in_deps, + std::initializer_list out_deps, const task_attr& attr) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, &attr); +} + +/** + * @brief 提交有输入依赖无输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @since 10 + * @version 1.0 + */ +static inline void submit(std::function&& func, const std::vector& in_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); +} + +/** + * @brief 提交有输入输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @since 10 + * @version 1.0 + */ +static inline void submit(std::function&& func, const std::vector& in_deps, + const std::vector& out_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); +} + +/** + * @brief 提交有输入输出依赖的特定属性的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @param attr 任务属性. + * @since 10 + * @version 1.0 + */ +static inline void submit(std::function&& func, const std::vector& in_deps, + const std::vector& out_deps, const task_attr& attr) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, &attr); +} + +/** + * @brief 提交无输入和输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @since 10 + * @version 1.0 + */ +static inline void submit(const std::function& func) +{ + return ffrt_submit_base(create_function_wrapper(func), nullptr, nullptr, nullptr); +} + +/** + * @brief 提交有输入依赖无输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @since 10 + * @version 1.0 + */ +static inline void submit(const std::function& func, std::initializer_list in_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + return ffrt_submit_base(create_function_wrapper(func), &in, nullptr, nullptr); +} + +/** + * @brief 提交有输入输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @since 10 + * @version 1.0 + */ +static inline void submit(const std::function& func, std::initializer_list in_deps, + std::initializer_list out_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + return ffrt_submit_base(create_function_wrapper(func), &in, &out, nullptr); +} + +/** + * @brief 提交有输入输出依赖的特定属性的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @param attr 任务属性. + * @since 10 + * @version 1.0 + */ +static inline void submit(const std::function& func, std::initializer_list in_deps, + std::initializer_list out_deps, const task_attr& attr) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + return ffrt_submit_base(create_function_wrapper(func), &in, &out, &attr); +} + +/** + * @brief 提交有输入依赖无输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @since 10 + * @version 1.0 + */ +static inline void submit(const std::function& func, const std::vector& in_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + return ffrt_submit_base(create_function_wrapper(func), &in, nullptr, nullptr); +} + +/** + * @brief 提交有输入输出依赖的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @since 10 + * @version 1.0 + */ +static inline void submit(const std::function& func, const std::vector& in_deps, + const std::vector& out_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + return ffrt_submit_base(create_function_wrapper(func), &in, &out, nullptr); +} + +/** + * @brief 提交有输入输出依赖的特定属性的任务调度执行. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @param attr 任务属性. + * @since 10 + * @version 1.0 + */ +static inline void submit(const std::function& func, const std::vector& in_deps, + const std::vector& out_deps, const task_attr& attr) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + return ffrt_submit_base(create_function_wrapper(func), &in, &out, &attr); +} + +/** + * @brief 提交无输入和输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(std::function&& func) +{ + return ffrt_submit_h_base(create_function_wrapper(std::move(func)), nullptr, nullptr, nullptr); +} + +/** + * @brief 提交有输入依赖无输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); +} + +/** + * @brief 提交有输入输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps, + std::initializer_list out_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); +} + +/** + * @brief 提交有输入输出依赖的特定属性的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @param attr 任务属性. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps, + std::initializer_list out_deps, const task_attr& attr) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, &attr); +} + +/** + * @brief 提交有输入依赖无输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(std::function&& func, const std::vector& in_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); +} + +/** + * @brief 提交有输入输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(std::function&& func, const std::vector& in_deps, + const std::vector& out_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); +} + +/** + * @brief 提交有输入输出依赖的特定属性的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @param attr 任务属性. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(std::function&& func, const std::vector& in_deps, + const std::vector& out_deps, const task_attr& attr) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, &attr); +} + +/** + * @brief 提交无输入和输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(const std::function& func) +{ + return ffrt_submit_h_base(create_function_wrapper(func), nullptr, nullptr, nullptr); +} + +/** + * @brief 提交有输入依赖无输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + return ffrt_submit_h_base(create_function_wrapper(func), &in, nullptr, nullptr); +} + +/** + * @brief 提交有输入输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps, + std::initializer_list out_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, nullptr); +} + +/** + * @brief 提交有输入输出依赖的特定属性的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @param attr 任务属性. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps, + std::initializer_list out_deps, const task_attr& attr) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, &attr); +} + +/** + * @brief 提交有输入依赖无输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(const std::function& func, const std::vector& in_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + return ffrt_submit_h_base(create_function_wrapper(func), &in, nullptr, nullptr); +} + +/** + * @brief 提交有输入输出依赖的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(const std::function& func, const std::vector& in_deps, + const std::vector& out_deps) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, nullptr); +} + +/** + * @brief 提交有输入输出依赖的特定属性的任务调度执行并返回任务句柄. + * + * @param func 任务执行体函数闭包. + * @param in_deps 输入依赖. + * @param out_deps 输出依赖. + * @param attr 任务属性. + * @return 提交任务成功返回非空任务句柄, + 提交任务失败返回空指针. + * @since 10 + * @version 1.0 + */ +static inline task_handle submit_h(const std::function& func, const std::vector& in_deps, + const std::vector& out_deps, const task_attr& attr) +{ + ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, &attr); +} + +/** + * @brief 跳过指定任务. + * + * @param handle 任务句柄. + * @return 跳过指定任务成功返回0, + 跳过指定任务失败返回-1. + * @since 10 + * @version 1.0 + */ +static inline int skip(task_handle &handle) +{ + return ffrt_skip(handle); +} + +/** + * @brief 等待之前所有提交任务完成,当前任务开始执行. + * + * @since 10 + * @version 1.0 + */ +static inline void wait() +{ + ffrt_wait(); +} + +/** + * @brief 等待依赖的任务完成,当前任务开始执行. + * + * @param deps 依赖的指针. + * @since 10 + * @version 1.0 + */ +static inline void wait(std::initializer_list deps) +{ + ffrt_deps_t d{static_cast(deps.size()), deps.begin()}; + ffrt_wait_deps(&d); +} + +/** + * @brief 等待依赖的任务完成,当前任务开始执行. + * + * @param deps 依赖的指针. + * @since 10 + * @version 1.0 + */ +static inline void wait(const std::vector& deps) +{ + ffrt_deps_t d{static_cast(deps.size()), deps.data()}; + ffrt_wait_deps(&d); +} + +namespace this_task { +/** + * @brief 获取当前任务id. + * + * @return 返回任务id. + * @since 10 + * @version 1.0 + */ +static inline uint64_t get_id() +{ + return ffrt_this_task_get_id(); +} +} // namespace this_task +} // namespace ffrt +#endif diff --git a/zh-cn/native_sdk/ffrt/ffrt.h b/zh-cn/native_sdk/ffrt/ffrt.h new file mode 100644 index 00000000..e20832e4 --- /dev/null +++ b/zh-cn/native_sdk/ffrt/ffrt.h @@ -0,0 +1,33 @@ +/* + * 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/thread.h" +#include "cpp/future.h" +#include "cpp/queue.h" +#else +#include "c/task.h" +#include "c/mutex.h" +#include "c/condition_variable.h" +#include "c/sleep.h" +#include "c/thread.h" +#include "c/queue.h" +#endif +#endif -- Gitee From b96687beabe8133205996624d1900cec5c3041b2 Mon Sep 17 00:00:00 2001 From: guodeqing Date: Thu, 15 Jun 2023 19:27:43 +0800 Subject: [PATCH 0002/2135] =?UTF-8?q?!I7AJWG=20=E6=96=B0=E5=A2=9EFFRT?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20Signed-off-by:=20guodeqi?= =?UTF-8?q?ng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ffrt/c/sleep.h | 3 +-- zh-cn/native_sdk/ffrt/c/task.h | 4 ++-- zh-cn/native_sdk/ffrt/cpp/condition_variable.h | 10 +++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/zh-cn/native_sdk/ffrt/c/sleep.h b/zh-cn/native_sdk/ffrt/c/sleep.h index 5131388e..1cfc9f0b 100644 --- a/zh-cn/native_sdk/ffrt/c/sleep.h +++ b/zh-cn/native_sdk/ffrt/c/sleep.h @@ -23,7 +23,6 @@ */ #ifndef FFRT_API_C_SLEEP_H #define FFRT_API_C_SLEEP_H -#include #include "type_def.h" /** @@ -43,5 +42,5 @@ FFRT_C_API int ffrt_usleep(uint64_t usec); * @since 10 * @version 1.0 */ -FFRT_C_API void ffrt_yield(); +FFRT_C_API void ffrt_yield(void); #endif diff --git a/zh-cn/native_sdk/ffrt/c/task.h b/zh-cn/native_sdk/ffrt/c/task.h index 1aa83368..d23fac90 100644 --- a/zh-cn/native_sdk/ffrt/c/task.h +++ b/zh-cn/native_sdk/ffrt/c/task.h @@ -124,7 +124,7 @@ FFRT_C_API int ffrt_this_task_update_qos(ffrt_qos_t qos); * @since 10 * @version 1.0 */ -FFRT_C_API uint64_t ffrt_this_task_get_id(); +FFRT_C_API uint64_t ffrt_this_task_get_id(void); /** * @brief 申请函数执行结构的内存. @@ -200,6 +200,6 @@ FFRT_C_API void ffrt_wait_deps(const ffrt_deps_t* deps); * @since 10 * @version 1.0 */ -FFRT_C_API void ffrt_wait(); +FFRT_C_API void ffrt_wait(void); #endif diff --git a/zh-cn/native_sdk/ffrt/cpp/condition_variable.h b/zh-cn/native_sdk/ffrt/cpp/condition_variable.h index 60e38662..9ea17083 100644 --- a/zh-cn/native_sdk/ffrt/cpp/condition_variable.h +++ b/zh-cn/native_sdk/ffrt/cpp/condition_variable.h @@ -105,11 +105,11 @@ private: cv_status _wait_for(std::unique_lock& lk, const std::chrono::duration& dur) noexcept { timespec ts; - std::chrono::nanoseconds _T0 = std::chrono::steady_clock::now().time_since_epoch(); - _T0 += std::chrono::duration_cast(dur); - ts.tv_sec = std::chrono::duration_cast(_T0).count(); - _T0 -= std::chrono::seconds(ts.tv_sec); - ts.tv_nsec = static_cast(_T0.count()); + std::chrono::nanoseconds T0 = std::chrono::steady_clock::now().time_since_epoch(); + T0 += std::chrono::duration_cast(dur); + ts.tv_sec = std::chrono::duration_cast(T0).count(); + T0 -= std::chrono::seconds(ts.tv_sec); + ts.tv_nsec = static_cast(T0.count()); auto ret = ffrt_cond_timedwait(this, lk.mutex(), &ts); if (ret == ffrt_success) { -- Gitee From 88c2f185e3e57e52047529436b24314afbdf460e Mon Sep 17 00:00:00 2001 From: guodeqing Date: Fri, 16 Jun 2023 09:44:29 +0800 Subject: [PATCH 0003/2135] =?UTF-8?q?!I7AJWG=20=E6=96=B0=E5=A2=9EFFRT?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20Signed-off-by:=20guodeqi?= =?UTF-8?q?ng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ffrt/c/condition_variable.h | 20 ++++++------ zh-cn/native_sdk/ffrt/c/mutex.h | 10 +++--- zh-cn/native_sdk/ffrt/c/task.h | 12 ++++---- zh-cn/native_sdk/ffrt/c/type_def.h | 32 ++++++++++---------- zh-cn/native_sdk/ffrt/cpp/queue.h | 8 ++--- zh-cn/native_sdk/ffrt/cpp/task.h | 8 ++--- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/zh-cn/native_sdk/ffrt/c/condition_variable.h b/zh-cn/native_sdk/ffrt/c/condition_variable.h index b00f2aab..7f64b22b 100644 --- a/zh-cn/native_sdk/ffrt/c/condition_variable.h +++ b/zh-cn/native_sdk/ffrt/c/condition_variable.h @@ -36,7 +36,7 @@ typedef enum { * * @param attr 条件变量属性指针. * @return 初始化条件变量属性成功返回ffrt_thrd_success, - 初始化条件变量属性失败返回ffrt_thrd_error. + 初始化条件变量属性失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -47,7 +47,7 @@ FFRT_C_API int ffrt_condattr_init(ffrt_condattr_t* attr); * * @param attr 条件变量属性指针. * @return 销毁条件变量属性成功返回ffrt_thrd_success, - 销毁条件变量属性失败返回ffrt_thrd_error. + 销毁条件变量属性失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -59,7 +59,7 @@ FFRT_C_API int ffrt_condattr_destroy(ffrt_condattr_t* attr); * @param attr 条件变量属性指针. * @param clock 时钟类型. * @return 设置条件变量的时钟属性成功返回ffrt_thrd_success, - 设置条件变量的时钟属性失败返回ffrt_thrd_error. + 设置条件变量的时钟属性失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -71,7 +71,7 @@ FFRT_C_API int ffrt_condattr_setclock(ffrt_condattr_t* attr, ffrt_clockid_t cloc * @param attr 条件变量属性指针. * @param clock 时钟属性指针. * @return 获取条件变量的时钟属性成功返回ffrt_thrd_success, - 获取条件变量的时钟属性失败返回ffrt_thrd_error. + 获取条件变量的时钟属性失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -83,7 +83,7 @@ FFRT_C_API int ffrt_condattr_getclock(const ffrt_condattr_t* attr, ffrt_clockid_ * @param cond 条件变量指针. * @param attr 条件变量属性指针. * @return 初始化条件变量成功返回ffrt_thrd_success, - 初始化条件变量失败返回ffrt_thrd_error. + 初始化条件变量失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -94,7 +94,7 @@ FFRT_C_API int ffrt_cond_init(ffrt_cond_t* cond, const ffrt_condattr_t* attr); * * @param cond 条件变量指针. * @return 唤醒成功返回ffrt_thrd_success, - 唤醒失败返回ffrt_thrd_error. + 唤醒失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -105,7 +105,7 @@ FFRT_C_API int ffrt_cond_signal(ffrt_cond_t* cond); * * @param cond 条件变量指针. * @return 唤醒成功返回ffrt_thrd_success, - 唤醒失败返回ffrt_thrd_error. + 唤醒失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -117,7 +117,7 @@ FFRT_C_API int ffrt_cond_broadcast(ffrt_cond_t* cond); * @param cond 条件变量指针. * @param mutex mutex指针. * @return 等待后被成功唤醒返回ffrt_thrd_success, - 等待失败返回ffrt_thrd_error. + 等待失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -131,7 +131,7 @@ FFRT_C_API int ffrt_cond_wait(ffrt_cond_t* cond, ffrt_mutex_t* mutex); * @param time_point 最大等待到的时间点,超过这个时间点等待返回. * @return 等待后被成功唤醒返回ffrt_thrd_success, 等待超时返回ffrt_thrd_timedout. - 等待失败ffrt_thrd_error. + 等待失败ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -142,7 +142,7 @@ FFRT_C_API int ffrt_cond_timedwait(ffrt_cond_t* cond, ffrt_mutex_t* mutex, const * * @param cond 条件变量指针. * @return 销毁条件变量成功返回ffrt_thrd_success, - 销毁条件变量失败返回ffrt_thrd_error. + 销毁条件变量失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ diff --git a/zh-cn/native_sdk/ffrt/c/mutex.h b/zh-cn/native_sdk/ffrt/c/mutex.h index 126876c4..f9d2f8dd 100644 --- a/zh-cn/native_sdk/ffrt/c/mutex.h +++ b/zh-cn/native_sdk/ffrt/c/mutex.h @@ -31,7 +31,7 @@ * @param mutex mutex指针. * @param attr mutex属性. * @return 初始化mutex成功返回ffrt_thrd_success, - 初始化mutex失败返回ffrt_thrd_error. + 初始化mutex失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -42,7 +42,7 @@ FFRT_C_API int ffrt_mutex_init(ffrt_mutex_t* mutex, const ffrt_mutexattr_t* attr * * @param mutex mutex指针. * @return 获取mutex成功返回ffrt_thrd_success, - 获取mutex失败返回ffrt_thrd_error,或者阻塞当前任务. + 获取mutex失败返回ffrt_thrd_error,或者阻塞当前任务. * @since 10 * @version 1.0 */ @@ -53,7 +53,7 @@ FFRT_C_API int ffrt_mutex_lock(ffrt_mutex_t* mutex); * * @param mutex mutex指针. * @return 释放mutex成功返回ffrt_thrd_success, - 释放mutex失败返回ffrt_thrd_error. + 释放mutex失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ @@ -64,7 +64,7 @@ FFRT_C_API int ffrt_mutex_unlock(ffrt_mutex_t* mutex); * * @param mutex mutex指针. * @return 获取mutex成功返回ffrt_thrd_success, - 获取mutex失败返回ffrt_thrd_error或ffrt_thrd_busy. + 获取mutex失败返回ffrt_thrd_error或ffrt_thrd_busy. * @since 10 * @version 1.0 */ @@ -75,7 +75,7 @@ FFRT_C_API int ffrt_mutex_trylock(ffrt_mutex_t* mutex); * * @param mutex mutex指针. * @return 销毁mutex成功返回ffrt_thrd_success, - 销毁mutex失败返回ffrt_thrd_error. + 销毁mutex失败返回ffrt_thrd_error. * @since 10 * @version 1.0 */ diff --git a/zh-cn/native_sdk/ffrt/c/task.h b/zh-cn/native_sdk/ffrt/c/task.h index d23fac90..34c9ed4f 100644 --- a/zh-cn/native_sdk/ffrt/c/task.h +++ b/zh-cn/native_sdk/ffrt/c/task.h @@ -30,7 +30,7 @@ * * @param attr 任务属性指针. * @return 初始化任务属性成功返回0, - 初始化任务属性失败返回-1. + 初始化任务属性失败返回-1. * @since 10 * @version 1.0 */ @@ -51,7 +51,7 @@ FFRT_C_API void ffrt_task_attr_set_name(ffrt_task_attr_t* attr, const char* name * * @param attr 任务属性指针. * @return 获取任务名字成功返回非空指针, - 获取任务名字失败返回空指针. + 获取任务名字失败返回空指针. * @since 10 * @version 1.0 */ @@ -149,7 +149,7 @@ FFRT_C_API void *ffrt_alloc_auto_managed_function_storage_base(ffrt_function_kin */ FFRT_C_API void ffrt_submit_base(ffrt_function_header_t* f, const ffrt_deps_t* in_deps, const ffrt_deps_t* out_deps, const ffrt_task_attr_t* attr); - + /** * @brief 提交任务调度执行并返回任务句柄. * @@ -161,10 +161,10 @@ FFRT_C_API void ffrt_submit_base(ffrt_function_header_t* f, const ffrt_deps_t* i 提交任务失败返回空指针. * @since 10 * @version 1.0 - */ + */ FFRT_C_API ffrt_task_handle_t ffrt_submit_h_base(ffrt_function_header_t* f, const ffrt_deps_t* in_deps, const ffrt_deps_t* out_deps, const ffrt_task_attr_t* attr); - + /** * @brief 销毁任务句柄. * @@ -182,7 +182,7 @@ FFRT_C_API void ffrt_task_handle_destroy(ffrt_task_handle_t handle); 跳过指定任务失败返回-1. * @since 10 * @version 1.0 - */ + */ FFRT_C_API int ffrt_skip(ffrt_task_handle_t handle); /** diff --git a/zh-cn/native_sdk/ffrt/c/type_def.h b/zh-cn/native_sdk/ffrt/c/type_def.h index eb0ef3f6..df25998c 100644 --- a/zh-cn/native_sdk/ffrt/c/type_def.h +++ b/zh-cn/native_sdk/ffrt/c/type_def.h @@ -37,15 +37,15 @@ * */ typedef enum { - /** 继承当前任务qos属性 */ + /** 继承当前任务qos属性 */ ffrt_qos_inherit = -1, - /** 后台任务 */ + /** 后台任务 */ ffrt_qos_background, - /** 实时工具 */ + /** 实时工具 */ ffrt_qos_utility, - /** 默认类型 */ + /** 默认类型 */ ffrt_qos_default, - /** 用户期望 */ + /** 用户期望 */ ffrt_qos_user_initiated, } ffrt_qos_t; @@ -56,9 +56,9 @@ typedef void(*ffrt_function_t)(void*); * */ typedef struct { - /** 任务执行函数 */ + /** 任务执行函数 */ ffrt_function_t exec; - /** 任务销毁函数 */ + /** 任务销毁函数 */ ffrt_function_t destroy; uint64_t reserve[2]; } ffrt_function_header_t; @@ -68,15 +68,15 @@ typedef struct { * */ typedef enum { - /** 任务属性 */ + /** 任务属性 */ ffrt_task_attr_storage_size = 128, - /** 任务执行体 */ + /** 任务执行体 */ ffrt_auto_managed_function_storage_size = 64 + sizeof(ffrt_function_header_t), - /** 互斥锁 */ + /** 互斥锁 */ ffrt_mutex_storage_size = 64, - /** 条件变量 */ + /** 条件变量 */ ffrt_cond_storage_size = 64, - /** 队列属性 */ + /** 队列属性 */ ffrt_queue_attr_storage_size = 128, } ffrt_storage_size_t; @@ -85,9 +85,9 @@ typedef enum { * */ typedef enum { - /** 通用任务类型 */ + /** 通用任务类型 */ ffrt_function_kind_general, - /** 队列任务类型 */ + /** 队列任务类型 */ ffrt_function_kind_queue } ffrt_function_kind_t; @@ -96,9 +96,9 @@ typedef enum { * */ typedef struct { - /** 依赖个数 */ + /** 依赖个数 */ uint32_t len; - /** 依赖数据 */ + /** 依赖数据 */ const void* const * items; } ffrt_deps_t; diff --git a/zh-cn/native_sdk/ffrt/cpp/queue.h b/zh-cn/native_sdk/ffrt/cpp/queue.h index 60e35a17..714e4866 100644 --- a/zh-cn/native_sdk/ffrt/cpp/queue.h +++ b/zh-cn/native_sdk/ffrt/cpp/queue.h @@ -101,7 +101,7 @@ public: * @brief 提交一个特定属性的任务到队列中调度执行. * * @param func 任务执行体函数闭包. - * @param attr 任务属性. + * @param attr 任务属性. * @since 10 * @version 1.0 */ @@ -126,7 +126,7 @@ public: * @brief 提交一个特定属性的任务到队列中调度执行. * * @param func 任务执行体函数闭包. - * @param attr 任务属性. + * @param attr 任务属性. * @since 10 * @version 1.0 */ @@ -153,7 +153,7 @@ public: * @brief 提交一个特定属性的任务到队列中调度执行并返回任务句柄. * * @param func 任务执行体函数闭包. - * @param attr 任务属性. + * @param attr 任务属性. * @return 提交成功返回非空任务句柄 提交失败返回空指针 * @since 10 @@ -183,7 +183,7 @@ public: * @brief 提交一个特定属性的任务到队列中调度执行并返回任务句柄. * * @param func 任务执行体函数闭包. - * @param attr 任务属性. + * @param attr 任务属性. * @return 提交成功返回非空任务句柄 提交失败返回空指针 * @since 10 diff --git a/zh-cn/native_sdk/ffrt/cpp/task.h b/zh-cn/native_sdk/ffrt/cpp/task.h index 113b9d61..d39cdcd2 100644 --- a/zh-cn/native_sdk/ffrt/cpp/task.h +++ b/zh-cn/native_sdk/ffrt/cpp/task.h @@ -339,7 +339,7 @@ static inline void submit(const std::function& func, std::initializer_li /** * @brief 提交有输入输出依赖的任务调度执行. * - * @param func 任务执行体函数闭包. + * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @param out_deps 输出依赖. * @since 10 @@ -464,8 +464,8 @@ static inline task_handle submit_h(std::function&& func, std::initialize static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps, std::initializer_list out_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); } @@ -722,7 +722,7 @@ static inline void wait(const std::vector& deps) namespace this_task { /** * @brief 获取当前任务id. - * + * * @return 返回任务id. * @since 10 * @version 1.0 -- Gitee From de48381e77cfd31a8d564f8ccf00ea18a7a4d6b2 Mon Sep 17 00:00:00 2001 From: guodeqing Date: Fri, 16 Jun 2023 10:20:31 +0800 Subject: [PATCH 0004/2135] =?UTF-8?q?!I7AJWG=20=E6=96=B0=E5=A2=9EFFRT?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20Signed-off-by:=20guodeqi?= =?UTF-8?q?ng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ffrt/cpp/task.h | 44 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/zh-cn/native_sdk/ffrt/cpp/task.h b/zh-cn/native_sdk/ffrt/cpp/task.h index d39cdcd2..4f43537d 100644 --- a/zh-cn/native_sdk/ffrt/cpp/task.h +++ b/zh-cn/native_sdk/ffrt/cpp/task.h @@ -222,14 +222,14 @@ static inline void submit(std::function&& func) */ static inline void submit(std::function&& func, std::initializer_list in_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); } /** * @brief 提交有输入输出依赖的任务调度执行. * - * @param func 任务执行体函数闭包. + * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @param out_deps 输出依赖. * @since 10 @@ -238,8 +238,8 @@ static inline void submit(std::function&& func, std::initializer_list&& func, std::initializer_list in_deps, std::initializer_list out_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); } @@ -256,8 +256,8 @@ static inline void submit(std::function&& func, std::initializer_list&& func, std::initializer_list in_deps, std::initializer_list out_deps, const task_attr& attr) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, &attr); } @@ -271,7 +271,7 @@ static inline void submit(std::function&& func, std::initializer_list&& func, const std::vector& in_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); } @@ -287,8 +287,8 @@ static inline void submit(std::function&& func, const std::vector&& func, const std::vector& in_deps, const std::vector& out_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); } @@ -305,8 +305,8 @@ static inline void submit(std::function&& func, const std::vector&& func, const std::vector& in_deps, const std::vector& out_deps, const task_attr& attr) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, &attr); } @@ -332,7 +332,7 @@ static inline void submit(const std::function& func) */ static inline void submit(const std::function& func, std::initializer_list in_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; return ffrt_submit_base(create_function_wrapper(func), &in, nullptr, nullptr); } @@ -348,8 +348,8 @@ static inline void submit(const std::function& func, std::initializer_li static inline void submit(const std::function& func, std::initializer_list in_deps, std::initializer_list out_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; return ffrt_submit_base(create_function_wrapper(func), &in, &out, nullptr); } @@ -359,15 +359,15 @@ static inline void submit(const std::function& func, std::initializer_li * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @param out_deps 输出依赖. - * @param attr 任务属性. + * @param attr 任务属性. * @since 10 * @version 1.0 */ static inline void submit(const std::function& func, std::initializer_list in_deps, std::initializer_list out_deps, const task_attr& attr) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; return ffrt_submit_base(create_function_wrapper(func), &in, &out, &attr); } @@ -381,7 +381,7 @@ static inline void submit(const std::function& func, std::initializer_li */ static inline void submit(const std::function& func, const std::vector& in_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; return ffrt_submit_base(create_function_wrapper(func), &in, nullptr, nullptr); } @@ -397,8 +397,8 @@ static inline void submit(const std::function& func, const std::vector& func, const std::vector& in_deps, const std::vector& out_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; return ffrt_submit_base(create_function_wrapper(func), &in, &out, nullptr); } @@ -619,13 +619,13 @@ static inline task_handle submit_h(const std::function& func, std::initi * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(const std::function& func, const std::vector& in_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; return ffrt_submit_h_base(create_function_wrapper(func), &in, nullptr, nullptr); } -- Gitee From caa07628d17a1838e976b8e0fe75bc54a8a4fca2 Mon Sep 17 00:00:00 2001 From: guodeqing Date: Fri, 16 Jun 2023 15:09:27 +0800 Subject: [PATCH 0005/2135] =?UTF-8?q?!I7AJWG=20=E6=96=B0=E5=A2=9EFFRT?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20Signed-off-by:=20guodeqi?= =?UTF-8?q?ng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ffrt/c/condition_variable.h | 4 +- zh-cn/native_sdk/ffrt/c/mutex.h | 4 +- zh-cn/native_sdk/ffrt/c/queue.h | 2 +- zh-cn/native_sdk/ffrt/c/sleep.h | 2 +- zh-cn/native_sdk/ffrt/c/task.h | 26 ++--- zh-cn/native_sdk/ffrt/c/type_def.h | 32 +++--- .../native_sdk/ffrt/cpp/condition_variable.h | 2 +- zh-cn/native_sdk/ffrt/cpp/mutex.h | 2 +- zh-cn/native_sdk/ffrt/cpp/queue.h | 3 +- zh-cn/native_sdk/ffrt/cpp/sleep.h | 2 +- zh-cn/native_sdk/ffrt/cpp/task.h | 108 +++++++++--------- 11 files changed, 93 insertions(+), 94 deletions(-) diff --git a/zh-cn/native_sdk/ffrt/c/condition_variable.h b/zh-cn/native_sdk/ffrt/c/condition_variable.h index 7f64b22b..d5bb7963 100644 --- a/zh-cn/native_sdk/ffrt/c/condition_variable.h +++ b/zh-cn/native_sdk/ffrt/c/condition_variable.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_C_CONDITION_VARIABLE_H #define FFRT_API_C_CONDITION_VARIABLE_H #include @@ -128,7 +128,7 @@ FFRT_C_API int ffrt_cond_wait(ffrt_cond_t* cond, ffrt_mutex_t* mutex); * * @param cond 条件变量指针. * @param mutex mutex指针. - * @param time_point 最大等待到的时间点,超过这个时间点等待返回. + * @param time_point 最大等待到的时间点,超过这个时间点等待返回. * @return 等待后被成功唤醒返回ffrt_thrd_success, 等待超时返回ffrt_thrd_timedout. 等待失败ffrt_thrd_error. diff --git a/zh-cn/native_sdk/ffrt/c/mutex.h b/zh-cn/native_sdk/ffrt/c/mutex.h index f9d2f8dd..9ea8cd00 100644 --- a/zh-cn/native_sdk/ffrt/c/mutex.h +++ b/zh-cn/native_sdk/ffrt/c/mutex.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_C_MUTEX_H #define FFRT_API_C_MUTEX_H #include "type_def.h" @@ -29,7 +29,7 @@ * @brief 初始化mutex. * * @param mutex mutex指针. - * @param attr mutex属性. + * @param attr mutex属性. * @return 初始化mutex成功返回ffrt_thrd_success, 初始化mutex失败返回ffrt_thrd_error. * @since 10 diff --git a/zh-cn/native_sdk/ffrt/c/queue.h b/zh-cn/native_sdk/ffrt/c/queue.h index 7a1a3faa..a1e26fdf 100644 --- a/zh-cn/native_sdk/ffrt/c/queue.h +++ b/zh-cn/native_sdk/ffrt/c/queue.h @@ -76,7 +76,7 @@ FFRT_C_API ffrt_qos_t ffrt_queue_attr_get_qos(const ffrt_queue_attr_t* attr); * @param name 队列名字. * @param attr 队列属性. * @return 创建队列成功返回非空队列句柄 - 创建队列失败返回空指针 + 创建队列失败返回空指针 * @since 10 * @version 1.0 */ diff --git a/zh-cn/native_sdk/ffrt/c/sleep.h b/zh-cn/native_sdk/ffrt/c/sleep.h index 1cfc9f0b..ba67490f 100644 --- a/zh-cn/native_sdk/ffrt/c/sleep.h +++ b/zh-cn/native_sdk/ffrt/c/sleep.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_C_SLEEP_H #define FFRT_API_C_SLEEP_H #include "type_def.h" diff --git a/zh-cn/native_sdk/ffrt/c/task.h b/zh-cn/native_sdk/ffrt/c/task.h index 34c9ed4f..59f48454 100644 --- a/zh-cn/native_sdk/ffrt/c/task.h +++ b/zh-cn/native_sdk/ffrt/c/task.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_C_TASK_H #define FFRT_API_C_TASK_H #include "type_def.h" @@ -90,7 +90,7 @@ FFRT_C_API ffrt_qos_t ffrt_task_attr_get_qos(const ffrt_task_attr_t* attr); * @brief 设置任务延迟时间. * * @param attr 任务属性指针. - * @param delay_us 任务延迟时间,单位微妙. + * @param delay_us 任务延迟时间,单位微秒. * @since 10 * @version 1.0 */ @@ -129,7 +129,7 @@ FFRT_C_API uint64_t ffrt_this_task_get_id(void); /** * @brief 申请函数执行结构的内存. * - * @param kind 函数执行结构类型,支持通用和队列函数执行结构类型. + * @param kind 函数执行结构类型,支持通用和队列函数执行结构类型. * @return 申请函数执行结构成功返回非空指针, 申请函数执行结构失败返回空指针. * @since 10 @@ -140,8 +140,8 @@ FFRT_C_API void *ffrt_alloc_auto_managed_function_storage_base(ffrt_function_kin /** * @brief 提交任务调度执行. * - * @param f 任务执行体封装的指针. - * @param in_deps 输入依赖指针. + * @param f 任务执行体封装的指针. + * @param in_deps 输入依赖指针. * @param out_deps 输出依赖指针. * @param attr 任务属性. * @since 10 @@ -153,22 +153,22 @@ FFRT_C_API void ffrt_submit_base(ffrt_function_header_t* f, const ffrt_deps_t* i /** * @brief 提交任务调度执行并返回任务句柄. * - * @param f 任务执行体封装的指针. - * @param in_deps 输入依赖指针. + * @param f 任务执行体封装的指针. + * @param in_deps 输入依赖指针. * @param out_deps 输出依赖指针. * @param attr 任务属性. * @return 提交任务成功返回非空任务句柄, 提交任务失败返回空指针. * @since 10 * @version 1.0 - */ + */ FFRT_C_API ffrt_task_handle_t ffrt_submit_h_base(ffrt_function_header_t* f, const ffrt_deps_t* in_deps, const ffrt_deps_t* out_deps, const ffrt_task_attr_t* attr); /** * @brief 销毁任务句柄. * - * @param handle 任务句柄. + * @param handle 任务句柄. * @since 10 * @version 1.0 */ @@ -177,18 +177,18 @@ FFRT_C_API void ffrt_task_handle_destroy(ffrt_task_handle_t handle); /** * @brief 跳过指定任务. * - * @param handle 任务句柄. + * @param handle 任务句柄. * @return 跳过指定任务成功返回0, 跳过指定任务失败返回-1. * @since 10 * @version 1.0 - */ + */ FFRT_C_API int ffrt_skip(ffrt_task_handle_t handle); /** * @brief 等待依赖的任务完成,当前任务开始执行. * - * @param deps 依赖的指针. + * @param deps 依赖的指针. * @since 10 * @version 1.0 */ @@ -196,7 +196,7 @@ FFRT_C_API void ffrt_wait_deps(const ffrt_deps_t* deps); /** * @brief 等待之前所有提交任务完成,当前任务开始执行. - * + * * @since 10 * @version 1.0 */ diff --git a/zh-cn/native_sdk/ffrt/c/type_def.h b/zh-cn/native_sdk/ffrt/c/type_def.h index df25998c..7e4b01e3 100644 --- a/zh-cn/native_sdk/ffrt/c/type_def.h +++ b/zh-cn/native_sdk/ffrt/c/type_def.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_C_TYPE_DEF_H #define FFRT_API_C_TYPE_DEF_H #include @@ -39,13 +39,13 @@ typedef enum { /** 继承当前任务qos属性 */ ffrt_qos_inherit = -1, - /** 后台任务 */ + /** 后台任务 */ ffrt_qos_background, - /** 实时工具 */ + /** 实时工具 */ ffrt_qos_utility, - /** 默认类型 */ + /** 默认类型 */ ffrt_qos_default, - /** 用户期望 */ + /** 用户期望 */ ffrt_qos_user_initiated, } ffrt_qos_t; @@ -56,9 +56,9 @@ typedef void(*ffrt_function_t)(void*); * */ typedef struct { - /** 任务执行函数 */ + /** 任务执行函数 */ ffrt_function_t exec; - /** 任务销毁函数 */ + /** 任务销毁函数 */ ffrt_function_t destroy; uint64_t reserve[2]; } ffrt_function_header_t; @@ -68,15 +68,15 @@ typedef struct { * */ typedef enum { - /** 任务属性 */ + /** 任务属性 */ ffrt_task_attr_storage_size = 128, - /** 任务执行体 */ + /** 任务执行体 */ ffrt_auto_managed_function_storage_size = 64 + sizeof(ffrt_function_header_t), - /** 互斥锁 */ + /** 互斥锁 */ ffrt_mutex_storage_size = 64, - /** 条件变量 */ + /** 条件变量 */ ffrt_cond_storage_size = 64, - /** 队列属性 */ + /** 队列属性 */ ffrt_queue_attr_storage_size = 128, } ffrt_storage_size_t; @@ -85,9 +85,9 @@ typedef enum { * */ typedef enum { - /** 通用任务类型 */ + /** 通用任务类型 */ ffrt_function_kind_general, - /** 队列任务类型 */ + /** 队列任务类型 */ ffrt_function_kind_queue } ffrt_function_kind_t; @@ -96,9 +96,9 @@ typedef enum { * */ typedef struct { - /** 依赖个数 */ + /** 依赖个数 */ uint32_t len; - /** 依赖数据 */ + /** 依赖数据 */ const void* const * items; } ffrt_deps_t; diff --git a/zh-cn/native_sdk/ffrt/cpp/condition_variable.h b/zh-cn/native_sdk/ffrt/cpp/condition_variable.h index 9ea17083..035580c4 100644 --- a/zh-cn/native_sdk/ffrt/cpp/condition_variable.h +++ b/zh-cn/native_sdk/ffrt/cpp/condition_variable.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_CPP_CONDITION_VARIABLE_H #define FFRT_API_CPP_CONDITION_VARIABLE_H #include diff --git a/zh-cn/native_sdk/ffrt/cpp/mutex.h b/zh-cn/native_sdk/ffrt/cpp/mutex.h index 7777a9a0..5f4ef8f1 100644 --- a/zh-cn/native_sdk/ffrt/cpp/mutex.h +++ b/zh-cn/native_sdk/ffrt/cpp/mutex.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_CPP_MUTEX_H #define FFRT_API_CPP_MUTEX_H #include "c/mutex.h" diff --git a/zh-cn/native_sdk/ffrt/cpp/queue.h b/zh-cn/native_sdk/ffrt/cpp/queue.h index 714e4866..6e77d9f8 100644 --- a/zh-cn/native_sdk/ffrt/cpp/queue.h +++ b/zh-cn/native_sdk/ffrt/cpp/queue.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_CPP_QUEUE_H #define FFRT_API_CPP_QUEUE_H @@ -43,7 +43,6 @@ public: queue_attr(const queue_attr&) = delete; queue_attr& operator=(const queue_attr&) = delete; - /** * @brief 设置串行队列qos属性. * diff --git a/zh-cn/native_sdk/ffrt/cpp/sleep.h b/zh-cn/native_sdk/ffrt/cpp/sleep.h index 24df1eba..42d633b2 100644 --- a/zh-cn/native_sdk/ffrt/cpp/sleep.h +++ b/zh-cn/native_sdk/ffrt/cpp/sleep.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_CPP_SLEEP_H #define FFRT_API_CPP_SLEEP_H #include diff --git a/zh-cn/native_sdk/ffrt/cpp/task.h b/zh-cn/native_sdk/ffrt/cpp/task.h index 4f43537d..58ac7aa7 100644 --- a/zh-cn/native_sdk/ffrt/cpp/task.h +++ b/zh-cn/native_sdk/ffrt/cpp/task.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_CPP_TASK_H #define FFRT_API_CPP_TASK_H #include @@ -196,14 +196,14 @@ inline ffrt_function_header_t* create_function_wrapper(T&& func, auto p = ffrt_alloc_auto_managed_function_storage_base(kind); auto f = - new (p)function_type({ exec_function_wrapper, destroy_function_wrapper, { 0 } }, std::forward(func)); + new (p)function_type({exec_function_wrapper, destroy_function_wrapper, {0}}, std::forward(func)); return reinterpret_cast(f); } /** * @brief 提交无输入和输出依赖的任务调度执行. * - * @param func 任务执行体函数闭包. + * @param func 任务执行体函数闭包. * @since 10 * @version 1.0 */ @@ -215,7 +215,7 @@ static inline void submit(std::function&& func) /** * @brief 提交有输入依赖无输出依赖的任务调度执行. * - * @param func 任务执行体函数闭包. + * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @since 10 * @version 1.0 @@ -246,10 +246,10 @@ static inline void submit(std::function&& func, std::initializer_list&& func, std::initializer_list&& func, const std::vector&& func, const std::vector&& func, const std::vector& func) /** * @brief 提交有输入依赖无输出依赖的任务调度执行. * - * @param func 任务执行体函数闭包. + * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @since 10 * @version 1.0 @@ -356,7 +356,7 @@ static inline void submit(const std::function& func, std::initializer_li /** * @brief 提交有输入输出依赖的特定属性的任务调度执行. * - * @param func 任务执行体函数闭包. + * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @param out_deps 输出依赖. * @param attr 任务属性. @@ -374,7 +374,7 @@ static inline void submit(const std::function& func, std::initializer_li /** * @brief 提交有输入依赖无输出依赖的任务调度执行. * - * @param func 任务执行体函数闭包. + * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @since 10 * @version 1.0 @@ -388,7 +388,7 @@ static inline void submit(const std::function& func, const std::vector& func, const std::vector& func, const std::vector& in_deps, const std::vector& out_deps, const task_attr& attr) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; return ffrt_submit_base(create_function_wrapper(func), &in, &out, &attr); } @@ -425,7 +425,7 @@ static inline void submit(const std::function& func, const std::vector&& func) * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); } @@ -457,7 +457,7 @@ static inline task_handle submit_h(std::function&& func, std::initialize * @param in_deps 输入依赖. * @param out_deps 输出依赖. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ @@ -477,15 +477,15 @@ static inline task_handle submit_h(std::function&& func, std::initialize * @param out_deps 输出依赖. * @param attr 任务属性. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps, std::initializer_list out_deps, const task_attr& attr) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, &attr); } @@ -495,13 +495,13 @@ static inline task_handle submit_h(std::function&& func, std::initialize * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(std::function&& func, const std::vector& in_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); } @@ -512,15 +512,15 @@ static inline task_handle submit_h(std::function&& func, const std::vect * @param in_deps 输入依赖. * @param out_deps 输出依赖. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(std::function&& func, const std::vector& in_deps, const std::vector& out_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); } @@ -532,15 +532,15 @@ static inline task_handle submit_h(std::function&& func, const std::vect * @param out_deps 输出依赖. * @param attr 任务属性. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(std::function&& func, const std::vector& in_deps, const std::vector& out_deps, const task_attr& attr) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, &attr); } @@ -549,7 +549,7 @@ static inline task_handle submit_h(std::function&& func, const std::vect * * @param func 任务执行体函数闭包. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ @@ -564,13 +564,13 @@ static inline task_handle submit_h(const std::function& func) * @param func 任务执行体函数闭包. * @param in_deps 输入依赖. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; return ffrt_submit_h_base(create_function_wrapper(func), &in, nullptr, nullptr); } @@ -581,15 +581,15 @@ static inline task_handle submit_h(const std::function& func, std::initi * @param in_deps 输入依赖. * @param out_deps 输出依赖. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps, std::initializer_list out_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, nullptr); } @@ -601,15 +601,15 @@ static inline task_handle submit_h(const std::function& func, std::initi * @param out_deps 输出依赖. * @param attr 任务属性. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps, std::initializer_list out_deps, const task_attr& attr) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.begin()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, &attr); } @@ -636,15 +636,15 @@ static inline task_handle submit_h(const std::function& func, const std: * @param in_deps 输入依赖. * @param out_deps 输出依赖. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ static inline task_handle submit_h(const std::function& func, const std::vector& in_deps, const std::vector& out_deps) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, nullptr); } @@ -663,15 +663,15 @@ static inline task_handle submit_h(const std::function& func, const std: static inline task_handle submit_h(const std::function& func, const std::vector& in_deps, const std::vector& out_deps, const task_attr& attr) { - ffrt_deps_t in{static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out{static_cast(out_deps.size()), out_deps.data()}; + ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; + ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, &attr); } /** * @brief 跳过指定任务. * - * @param handle 任务句柄. + * @param handle 任务句柄. * @return 跳过指定任务成功返回0, 跳过指定任务失败返回-1. * @since 10 @@ -684,7 +684,7 @@ static inline int skip(task_handle &handle) /** * @brief 等待之前所有提交任务完成,当前任务开始执行. - * + * * @since 10 * @version 1.0 */ @@ -696,26 +696,26 @@ static inline void wait() /** * @brief 等待依赖的任务完成,当前任务开始执行. * - * @param deps 依赖的指针. + * @param deps 依赖的指针. * @since 10 * @version 1.0 */ static inline void wait(std::initializer_list deps) { - ffrt_deps_t d{static_cast(deps.size()), deps.begin()}; + ffrt_deps_t d {static_cast(deps.size()), deps.begin()}; ffrt_wait_deps(&d); } /** * @brief 等待依赖的任务完成,当前任务开始执行. * - * @param deps 依赖的指针. + * @param deps 依赖的指针. * @since 10 * @version 1.0 */ static inline void wait(const std::vector& deps) { - ffrt_deps_t d{static_cast(deps.size()), deps.data()}; + ffrt_deps_t d {static_cast(deps.size()), deps.data()}; ffrt_wait_deps(&d); } -- Gitee From ae17dfc7a11f983b9e957f20f2671772fc9d81bc Mon Sep 17 00:00:00 2001 From: guodeqing Date: Fri, 16 Jun 2023 15:30:33 +0800 Subject: [PATCH 0006/2135] =?UTF-8?q?!I7AJWG=20=E6=96=B0=E5=A2=9EFFRT?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20Signed-off-by:=20guodeqi?= =?UTF-8?q?ng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ffrt/c/queue.h | 2 +- zh-cn/native_sdk/ffrt/cpp/task.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/ffrt/c/queue.h b/zh-cn/native_sdk/ffrt/c/queue.h index a1e26fdf..bf97b063 100644 --- a/zh-cn/native_sdk/ffrt/c/queue.h +++ b/zh-cn/native_sdk/ffrt/c/queue.h @@ -20,7 +20,7 @@ * * @since 10 * @version 1.0 - */ + */ #ifndef FFRT_API_C_QUEUE_H #define FFRT_API_C_QUEUE_H diff --git a/zh-cn/native_sdk/ffrt/cpp/task.h b/zh-cn/native_sdk/ffrt/cpp/task.h index 58ac7aa7..3634d4c0 100644 --- a/zh-cn/native_sdk/ffrt/cpp/task.h +++ b/zh-cn/native_sdk/ffrt/cpp/task.h @@ -196,7 +196,7 @@ inline ffrt_function_header_t* create_function_wrapper(T&& func, auto p = ffrt_alloc_auto_managed_function_storage_base(kind); auto f = - new (p)function_type({exec_function_wrapper, destroy_function_wrapper, {0}}, std::forward(func)); + new(p)function_type({exec_function_wrapper, destroy_function_wrapper, {0}}, std::forward(func)); return reinterpret_cast(f); } @@ -656,7 +656,7 @@ static inline task_handle submit_h(const std::function& func, const std: * @param out_deps 输出依赖. * @param attr 任务属性. * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. + 提交任务失败返回空指针. * @since 10 * @version 1.0 */ -- Gitee From ea0383f06b199791a49a3cc5fa9410e019163f69 Mon Sep 17 00:00:00 2001 From: guodeqing Date: Fri, 16 Jun 2023 15:49:57 +0800 Subject: [PATCH 0007/2135] =?UTF-8?q?!I7AJWG=20=E6=96=B0=E5=A2=9EFFRT?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=20Signed-off-by:=20guodeqi?= =?UTF-8?q?ng=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ffrt/cpp/task.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/ffrt/cpp/task.h b/zh-cn/native_sdk/ffrt/cpp/task.h index 3634d4c0..84599a98 100644 --- a/zh-cn/native_sdk/ffrt/cpp/task.h +++ b/zh-cn/native_sdk/ffrt/cpp/task.h @@ -196,7 +196,7 @@ inline ffrt_function_header_t* create_function_wrapper(T&& func, auto p = ffrt_alloc_auto_managed_function_storage_base(kind); auto f = - new(p)function_type({exec_function_wrapper, destroy_function_wrapper, {0}}, std::forward(func)); + new (p) function_type({exec_function_wrapper, destroy_function_wrapper, {0}}, std::forward(func)); return reinterpret_cast(f); } -- Gitee From 1d0cb44896f34aaedfe9acedb0350f17e86f94ce Mon Sep 17 00:00:00 2001 From: huangkaixing Date: Sat, 29 Jul 2023 11:16:22 +0800 Subject: [PATCH 0008/2135] update doc Signed-off-by: huangkaixing --- zh-cn/native_sdk/media/image/image_mdk.h | 34 +- .../native_sdk/media/image/image_mdk_common.h | 123 +++- .../media/image/image_pixel_map_mdk.h | 619 ++++++++++++++++++ .../media/image/image_pixel_map_napi.h | 325 +-------- .../media/image/image_receiver_mdk.h | 83 ++- .../native_sdk/media/image/image_source_mdk.h | 244 ++++++- 6 files changed, 1067 insertions(+), 361 deletions(-) create mode 100644 zh-cn/native_sdk/media/image/image_pixel_map_mdk.h diff --git a/zh-cn/native_sdk/media/image/image_mdk.h b/zh-cn/native_sdk/media/image/image_mdk.h index 85d8a28d..681db785 100644 --- a/zh-cn/native_sdk/media/image/image_mdk.h +++ b/zh-cn/native_sdk/media/image/image_mdk.h @@ -137,8 +137,11 @@ ImageNative* OH_Image_InitImageNative(napi_env env, napi_value source); * * @param native 表示指向 {@link ImageNative} native层对象的指针。 * @param rect 表示作为转换结果的 {@link OhosImageRect} 对象指针。 - * @return 如果操作成功返回 {@link OHOS_IMAGE_RESULT_SUCCESS}; - * 如果操作失败返回其他的错误码。 + * @return 如果操作成功返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果JNI环境异常返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED {@link IRNdkErrCode}; + * 如果参数错误返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}。 * @see ImageNative, OhosImageRect * @since 10 * @version 2.0 @@ -150,8 +153,11 @@ int32_t OH_Image_ClipRect(const ImageNative* native, struct OhosImageRect* rect) * * @param native 表示 {@link ImageNative} native对象的指针。 * @param size 表示作为转换结果的 {@link OhosImageSize} 对象的指针。 - * @return 如果操作成功返回 {@link OHOS_IMAGE_RESULT_SUCCESS}; - * 如果操作失败返回其他的错误码。 + * @return 如果操作成功返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果JNI环境异常返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED {@link IRNdkErrCode}; + * 如果参数错误返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}。 * @see ImageNative, OhosImageSize * @since 10 * @version 2.0 @@ -163,8 +169,11 @@ int32_t OH_Image_Size(const ImageNative* native, struct OhosImageSize* size); * * @param native 表示 {@link ImageNative} native对象的指针。 * @param format 表示作为转换结果的图像格式对象的指针。 - * @return 如果操作成功返回 {@link OHOS_IMAGE_RESULT_SUCCESS}; - * 如果操作失败返回其他的错误码。 + * @return 如果操作成功返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果JNI环境异常返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED {@link IRNdkErrCode}; + * 如果参数错误返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}。 * @see ImageNative * @since 10 * @version 2.0 @@ -177,8 +186,11 @@ int32_t OH_Image_Format(const ImageNative* native, int32_t* format); * @param native 表示 {@link ImageNative} native对象的指针。 * @param componentType 表示所需组件的组件类型。 * @param componentNative 表示转换结果的 {@link OhosImageComponent} 对象的指针。 - * @return 如果操作成功返回 {@link OHOS_IMAGE_RESULT_SUCCESS}; - * 如果操作失败返回其他的错误码。 + * @return 如果操作成功返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果JNI环境异常返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED {@link IRNdkErrCode}; + * 如果参数错误返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}。 * @see ImageNative, OhosImageComponent * @since 10 * @version 2.0 @@ -192,8 +204,10 @@ int32_t OH_Image_GetComponent(const ImageNative* native, * 而是释放被 {@link OH_Image_InitImageNative} 解析的 {@link ImageNative} native 对象。 * * @param native 表示 {@link ImageNative} native对象的指针。 - * @return 如果操作成功返回 {@link OHOS_IMAGE_RESULT_SUCCESS}; - * 如果操作失败返回其他的错误码。 + * @return 如果操作成功返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果JNI环境异常返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果参数错误返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}。 * @see ImageNative, OH_Image_InitImageNative * @since 10 * @version 2.0 diff --git a/zh-cn/native_sdk/media/image/image_mdk_common.h b/zh-cn/native_sdk/media/image/image_mdk_common.h index d56931f6..46631672 100644 --- a/zh-cn/native_sdk/media/image/image_mdk_common.h +++ b/zh-cn/native_sdk/media/image/image_mdk_common.h @@ -35,24 +35,129 @@ #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_COMMON_H_ #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_COMMON_H_ -namespace OHOS { -namespace Media { +#include + #ifdef __cplusplus extern "C" { #endif - +#define IMAGE_RESULT_BASE 62980096 /** * @brief 可能被使用的接口返回值的枚举。 * * @since 10 * @version 2.0 */ -enum { - /** 成功的结果 */ - OHOS_IMAGE_RESULT_SUCCESS = 0, - /** 无效参数 */ - OHOS_IMAGE_RESULT_BAD_PARAMETER = -1, -}; +typedef enum { + IMAGE_RESULT_SUCCESS = 0, // 操作成功 + IMAGE_RESULT_BAD_PARAMETER = -1, // 无效参数 + IMAGE_RESULT_IMAGE_RESULT_BASE = IMAGE_RESULT_BASE, // 操作失败 + IMAGE_RESULT_ERR_IPC = IMAGE_RESULT_BASE + 1, // ipc 错误 + IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST = IMAGE_RESULT_BASE + 2, // 共享内存失败 + IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL = IMAGE_RESULT_BASE + 3, // 共享内存数据异常 + IMAGE_RESULT_DECODE_ABNORMAL = IMAGE_RESULT_BASE + 4, // 图像解码失败 + IMAGE_RESULT_DATA_ABNORMAL = IMAGE_RESULT_BASE + 5, // 图像输入数据异常 + IMAGE_RESULT_MALLOC_ABNORMAL = IMAGE_RESULT_BASE + 6, // 图像内存分配异常 + IMAGE_RESULT_DATA_UNSUPPORT = IMAGE_RESULT_BASE + 7, // 图像类型不支持 + IMAGE_RESULT_INIT_ABNORMAL = IMAGE_RESULT_BASE + 8, // 图像初始化失败 + IMAGE_RESULT_GET_DATA_ABNORMAL = IMAGE_RESULT_BASE + 9, // 图像获取数据错误 + IMAGE_RESULT_TOO_LARGE = IMAGE_RESULT_BASE + 10, // 图像数据过大 + IMAGE_RESULT_TRANSFORM = IMAGE_RESULT_BASE + 11, // 图像转换错误 + IMAGE_RESULT_COLOR_CONVERT = IMAGE_RESULT_BASE + 12, // 图像颜色转换错误 + IMAGE_RESULT_CROP = IMAGE_RESULT_BASE + 13, // 裁剪错误 + IMAGE_RESULT_SOURCE_DATA = IMAGE_RESULT_BASE + 14, // 图像源数据错误 + IMAGE_RESULT_SOURCE_DATA_INCOMPLETE = IMAGE_RESULT_BASE + 15, // 图像源数据不完整 + IMAGE_RESULT_MISMATCHED_FORMAT = IMAGE_RESULT_BASE + 16, // 图像格式不匹配 + IMAGE_RESULT_UNKNOWN_FORMAT = IMAGE_RESULT_BASE + 17, // 图像未知格式 + IMAGE_RESULT_SOURCE_UNRESOLVED = IMAGE_RESULT_BASE + 18, // 图像源未解析 + IMAGE_RESULT_INVALID_PARAMETER = IMAGE_RESULT_BASE + 19, // 图像无效参数 + IMAGE_RESULT_DECODE_FAILED = IMAGE_RESULT_BASE + 20, // 解码失败 + IMAGE_RESULT_PLUGIN_REGISTER_FAILED = IMAGE_RESULT_BASE + 21, // 注册插件失败 + IMAGE_RESULT_PLUGIN_CREATE_FAILED = IMAGE_RESULT_BASE + 22, // 创建插件失败 + IMAGE_RESULT_ENCODE_FAILED = IMAGE_RESULT_BASE + 23, // 图像编码失败 + IMAGE_RESULT_ADD_PIXEL_MAP_FAILED = IMAGE_RESULT_BASE + 24, // 图像添加像素位图失败 + IMAGE_RESULT_HW_DECODE_UNSUPPORT = IMAGE_RESULT_BASE + 25, // 图像硬解码不支持 + IMAGE_RESULT_DECODE_HEAD_ABNORMAL = IMAGE_RESULT_BASE + 26, // 图像头解码失败 + IMAGE_RESULT_DECODE_EXIF_UNSUPPORT = IMAGE_RESULT_BASE + 27, // 图像解码EXIF不支持 + IMAGE_RESULT_PROPERTY_NOT_EXIST = IMAGE_RESULT_BASE + 28, // 图像属性不存在 + + IMAGE_RESULT_MEDIA_DATA_UNSUPPORT = IMAGE_RESULT_BASE + 30, // 媒体类型不支持 + IMAGE_RESULT_MEDIA_TOO_LARGE = IMAGE_RESULT_BASE + 31, // 媒体数据过大 + IMAGE_RESULT_MEDIA_MALLOC_FAILED = IMAGE_RESULT_BASE + 32, // 媒体分配内存失败 + IMAGE_RESULT_MEDIA_END_OF_STREAM = IMAGE_RESULT_BASE + 33, // 媒体数据流结束失败 + IMAGE_RESULT_MEDIA_IO_ABNORMAL = IMAGE_RESULT_BASE + 34, // 媒体输入输出流异常 + IMAGE_RESULT_MEDIA_MALFORMED = IMAGE_RESULT_BASE + 35, // 媒体功能异常 + IMAGE_RESULT_MEDIA_BUFFER_TOO_SMALL = IMAGE_RESULT_BASE + 36, // 媒体数据过小错误 + IMAGE_RESULT_MEDIA_OUT_OF_RANGE = IMAGE_RESULT_BASE + 37, // 媒体超出范围错误 + IMAGE_RESULT_MEDIA_STATUS_ABNORMAL = IMAGE_RESULT_BASE + 38, // 媒体状态异常错误 + IMAGE_RESULT_MEDIA_VALUE_INVALID = IMAGE_RESULT_BASE + 39, // 媒体值无效 + IMAGE_RESULT_MEDIA_NULL_POINTER = IMAGE_RESULT_BASE + 40, // 媒体操作失败 + IMAGE_RESULT_MEDIA_INVALID_OPERATION = IMAGE_RESULT_BASE + 41, // 媒体操作无效 + IMAGE_RESULT_MEDIA_ERR_PLAYER_NOT_INIT = IMAGE_RESULT_BASE + 42, // 媒体初始化异常 + IMAGE_RESULT_MEDIA_EARLY_PREPARE = IMAGE_RESULT_BASE + 43, // 媒体过早预处理 + IMAGE_RESULT_MEDIA_SEEK_ERR = IMAGE_RESULT_BASE + 44, // 媒体查找失败 + IMAGE_RESULT_MEDIA_PERMISSION_DENIED = IMAGE_RESULT_BASE + 45, // 媒体权限拒绝 + IMAGE_RESULT_MEDIA_DEAD_OBJECT = IMAGE_RESULT_BASE + 46, // 媒体对象注销 + IMAGE_RESULT_MEDIA_TIMED_OUT = IMAGE_RESULT_BASE + 47, // 媒体超时 + IMAGE_RESULT_MEDIA_TRACK_NOT_ALL_SUPPORTED = IMAGE_RESULT_BASE + 48, // 媒体能力不支持 + IMAGE_RESULT_MEDIA_ADAPTER_INIT_FAILED = IMAGE_RESULT_BASE + 49, // 媒体适配器初始化失败 + IMAGE_RESULT_MEDIA_WRITE_PARCEL_FAIL = IMAGE_RESULT_BASE + 50, // 写入parcel失败 + IMAGE_RESULT_MEDIA_READ_PARCEL_FAIL = IMAGE_RESULT_BASE + 51, // 读取parcel失败 + IMAGE_RESULT_MEDIA_NO_AVAIL_BUFFER = IMAGE_RESULT_BASE + 52, // 无效数据 + IMAGE_RESULT_MEDIA_INVALID_PARAM = IMAGE_RESULT_BASE + 53, // 媒体接口发现无效参数 + IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_EXIST = IMAGE_RESULT_BASE + 54, // 媒体代码适配器不存在 + IMAGE_RESULT_MEDIA_CREATE_CODEC_ADAPTER_FAILED = IMAGE_RESULT_BASE + 55, // 媒体创建代码适配器失败 + IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_INIT = IMAGE_RESULT_BASE + 56, // 媒体代码适配器未初始化 + IMAGE_RESULT_MEDIA_ZCODEC_CREATE_FAILED = IMAGE_RESULT_BASE + 57, // 媒体代码创建失败 + IMAGE_RESULT_MEDIA_ZCODEC_NOT_EXIST = IMAGE_RESULT_BASE + 58, // 媒体代码不存在 + IMAGE_RESULT_MEDIA_JNI_CLASS_NOT_EXIST = IMAGE_RESULT_BASE + 59, // 媒体JNI层类不存在 + IMAGE_RESULT_MEDIA_JNI_METHOD_NOT_EXIST = IMAGE_RESULT_BASE + 60, // 媒体JNI层方法不存在 + IMAGE_RESULT_MEDIA_JNI_NEW_OBJ_FAILED = IMAGE_RESULT_BASE + 61, // 媒体JNI层创建对象失败 + IMAGE_RESULT_MEDIA_JNI_COMMON_ERROR = IMAGE_RESULT_BASE + 62, // 媒体JNI层异常 + IMAGE_RESULT_MEDIA_DISTRIBUTE_NOT_SUPPORT = IMAGE_RESULT_BASE + 63, // 媒体不支持分布 + IMAGE_RESULT_MEDIA_SOURCE_NOT_SET = IMAGE_RESULT_BASE + 64, // 媒体源未设置 + IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_INIT = IMAGE_RESULT_BASE + 65, // 媒体rtsp适配器未初始化 + IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_EXIST = IMAGE_RESULT_BASE + 66, // 媒体rtsp适配器不存在 + IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT = IMAGE_RESULT_BASE + 67, // 媒体不支持rtsp surface + IMAGE_RESULT_MEDIA_RTSP_CAPTURE_NOT_INIT = IMAGE_RESULT_BASE + 68, // 媒体rtsp capture初始化失败 + IMAGE_RESULT_MEDIA_RTSP_SOURCE_URL_INVALID = IMAGE_RESULT_BASE + 69, // 媒体rtsp源路径无效 + IMAGE_RESULT_MEDIA_RTSP_VIDEO_TRACK_NOT_FOUND = IMAGE_RESULT_BASE + 70, // 媒体rtsp未发现视频能力 + IMAGE_RESULT_MEDIA_RTSP_CAMERA_NUM_REACH_MAX = IMAGE_RESULT_BASE + 71, // rtsp相机数量达到最大数量 + IMAGE_RESULT_MEDIA_SET_VOLUME = IMAGE_RESULT_BASE + 72, // 媒体设置卷失败 + IMAGE_RESULT_MEDIA_NUMBER_OVERFLOW = IMAGE_RESULT_BASE + 73, // 媒体操作次数溢出 + IMAGE_RESULT_MEDIA_DIS_PLAYER_UNSUPPORTED = IMAGE_RESULT_BASE + 74, // 媒体分布式播放器不支持 + IMAGE_RESULT_MEDIA_DENCODE_ICC_FAILED = IMAGE_RESULT_BASE + 75, // 图像解码ICC失败 + IMAGE_RESULT_MEDIA_ENCODE_ICC_FAILED = IMAGE_RESULT_BASE + 76, // 图像编码CC失败 + + IMAGE_RESULT_MEDIA_READ_PIXELMAP_FAILED = IMAGE_RESULT_BASE + 150, // 读取像素位图失败 + IMAGE_RESULT_MEDIA_WRITE_PIXELMAP_FAILED = IMAGE_RESULT_BASE + 151, // 写入像素位图失败 + IMAGE_RESULT_MEDIA_PIXELMAP_NOT_ALLOW_MODIFY = IMAGE_RESULT_BASE + 152, // 像素位图不允许修改 + IMAGE_RESULT_MEDIA_CONFIG_FAILED = IMAGE_RESULT_BASE + 153, // 配置失败 + IMAGE_RESULT_JNI_ENV_ABNORMAL = IMAGE_RESULT_BASE + 154, // JNI环境异常 + IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED = IMAGE_RESULT_BASE + 155, // surface申请内存失败 + IMAGE_RESULT_CREATE_SURFACE_FAILED = IMAGE_RESULT_BASE + 156, // 创建surface失败 + IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED = IMAGE_RESULT_BASE + 157, // 从surface获取参数失败 + IMAGE_RESULT_GET_SURFACE_FAILED = IMAGE_RESULT_BASE + 158, // 获取sufrace失败 + IMAGE_RESULT_SURFACE_ACQUIRE_BUFFER_FAILED = IMAGE_RESULT_BASE + 159, // 申请内存失败 + IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED = IMAGE_RESULT_BASE + 160, // 申请内存失败 + IMAGE_RESULT_REGISTER_LISTENER_FAILED = IMAGE_RESULT_BASE + 161, // 注册监听失败 + IMAGE_RESULT_REGISTER_BUFFER_FAILED = IMAGE_RESULT_BASE + 162, // 注册内存失败 + IMAGE_RESULT_FREAD_FAILED = IMAGE_RESULT_BASE + 163, // 读取文件失败 + IMAGE_RESULT_PEEK_FAILED = IMAGE_RESULT_BASE + 164, // 检测文件失败 + IMAGE_RESULT_SEEK_FAILED = IMAGE_RESULT_BASE + 165, // 查找文件失败 + IMAGE_RESULT_STREAM_SIZE_ERROR = IMAGE_RESULT_BASE + 166, // 数据流损坏 + IMAGE_RESULT_FILE_FD_ERROR = IMAGE_RESULT_BASE + 167, // 文件描述符损坏 + IMAGE_RESULT_FILE_DAMAGED = IMAGE_RESULT_BASE + 168, // 文件损坏 + IMAGE_RESULT_CREATE_DECODER_FAILED = IMAGE_RESULT_BASE + 169, // 创建解码失败 + IMAGE_RESULT_CREATE_ENCODER_FAILED = IMAGE_RESULT_BASE + 170, // 创建编码失败 + IMAGE_RESULT_CHECK_FORMAT_ERROR = IMAGE_RESULT_BASE + 171, // 检查格式失败 + IMAGE_RESULT_THIRDPART_SKIA_ERROR = IMAGE_RESULT_BASE + 172, // skia解码失败 + IMAGE_RESULT_HW_DECODE_FAILED = IMAGE_RESULT_BASE + 173, // 硬解码失败 + IMAGE_RESULT_ALLOCATER_TYPE_ERROR = IMAGE_RESULT_BASE + 174, // 内存类型校验失败 + IMAGE_RESULT_ALPHA_TYPE_ERROR = IMAGE_RESULT_BASE + 175, // 透明度类型失败 + IMAGE_RESULT_INDEX_INVALID = IMAGE_RESULT_BASE + 176, // 参数无效 + + IMAGE_RESULT_MEDIA_UNKNOWN = IMAGE_RESULT_BASE + 200, // 媒体未知错误 +} IRNdkErrCode; /** * @brief 定义图像大小。 diff --git a/zh-cn/native_sdk/media/image/image_pixel_map_mdk.h b/zh-cn/native_sdk/media/image/image_pixel_map_mdk.h new file mode 100644 index 00000000..34b75105 --- /dev/null +++ b/zh-cn/native_sdk/media/image/image_pixel_map_mdk.h @@ -0,0 +1,619 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup image + * @{ + * + * @brief 提供获取pixelmap的数据和信息的接口方法。 + * + * @Syscap SystemCapability.Multimedia.Image + * @since 10 + * @version 1.0 + */ + +/** + * @file image_pixel_map_mdk.h + * + * @brief 声明可以锁定并访问pixelmap数据的方法,声明解锁的方法。 + * Need link libpixelmapndk.z.so + * + * @since 10 + * @version 1.0 + */ + +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXEL_MAP_MDK_H_ +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXEL_MAP_MDK_H_ +#include +#include "napi/native_api.h" +#include "image_mdk_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 定义native层像素位图信息。 + * @since 10 + * @version 1.0 + */ +struct NativePixelMap_; + +/** + * @brief 定义native层pixelmap数据类型名称。 + * @since 10 + * @version 1.0 + */ +typedef struct NativePixelMap_ NativePixelMap; + +/** + * @brief 用于定义 pixel map 的相关信息。 + * + * @since 10 + * @version 1.0 + */ +typedef struct OhosPixelMapInfos { + /** 图片的宽, 用pixels表示 */ + uint32_t width; + /** 图片的高, 用pixels表示 */ + uint32_t height; + /** 每行的bytes数 */ + uint32_t rowSize; + /** Pixel 的格式 */ + int32_t pixelFormat; +} OhosPixelMapInfos; + +/** + * @brief PixelMap 透明度类型的枚举。 + * + * @since 10 + * @version 1.0 + */ +enum { + /** + * 未知的格式 + */ + OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0, + /** + * 不透明的格式 + */ + OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1, + /** + * 预乘的格式 + */ + OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2, + /** + * 预除的格式 + */ + OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 +}; + +/** + * @brief PixelMap 编辑类型的枚举。 + * + * @since 10 + * @version 1.0 + */ +enum { + /** + * 只读的格式 + */ + OHOS_PIXEL_MAP_READ_ONLY = 0, + /** + * 可编辑的格式 + */ + OHOS_PIXEL_MAP_EDITABLE = 1, +}; + +/** + * @brief 用于定义创建 pixel map 设置选项的相关信息。 + * + * @since 10 + * @version 1.0 + */ +struct OhosPixelMapCreateOps { + /** 图片的宽, 用pixels表示 */ + uint32_t width; + /** 图片的高, 用pixels表示 */ + uint32_t height; + /** 图片的格式 */ + int32_t pixelFormat; + /** 图片的编辑类型 */ + uint32_t editable; + /** 图片的alpha类型 */ + uint32_t alphaType; + /** 图片的缩放类型 */ + uint32_t scaleMode; +}; + +/** + * @brief @brief 创建PixelMap对象。 + * + * @param env napi的环境指针。 + * @param info pixel map 数据设置项。 + * @param buf 图片的buffer数据。 + * @param len 图片大小信息。 + * @param res 应用层的 PixelMap 对象的指针。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果图像头解码失败则返回 IMAGE_RESULT_DECODE_HEAD_ABNORMAL {@link IRNdkErrCode}; + * 如果创建解码器失败则返回 IMAGE_RESULT_CREATE_DECODER_FAILED {@link IRNdkErrCode}; + * 如果创建编码器失败则返回 IMAGE_RESULT_CREATE_ENCODER_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像解码失败则返回 IMAGE_RESULT_DECODE_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果图像初始化失败则返回 IMAGE_RESULT_INIT_ABNORMAL {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果图像添加像素位图失败则返回 IMAGE_RESULT_ENCODE_FAILED {@link IRNdkErrCode}; + * 如果图像不支持硬件解码则返回 IMAGE_RESULT_HW_DECODE_UNSUPPORT {@link IRNdkErrCode}; + * 如果硬件解码失败则返回 IMAGE_RESULT_HW_DECODE_FAILED {@link IRNdkErrCode}; + * 如果ipc失败则返回 IMAGE_RESULT_INDEX_INVALID {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see CreatePixelMap + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_CreatePixelMap(napi_env env, OhosPixelMapCreateOps info, + void* buf, size_t len, napi_value* res); + +/** + * @brief 根据Alpha通道的信息,来生成一个仅包含Alpha通道信息的PixelMap对象。 + * + * @param env napi的环境指针。 + * @param source PixelMap数据设置项。 + * @param alpha alpha通道的指针。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果图像头解码失败则返回 IMAGE_RESULT_DECODE_HEAD_ABNORMAL {@link IRNdkErrCode}; + * 如果创建解码器失败则返回 IMAGE_RESULT_CREATE_DECODER_FAILED {@link IRNdkErrCode}; + * 如果创建编码器失败则返回 IMAGE_RESULT_CREATE_ENCODER_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像解码失败则返回 IMAGE_RESULT_DECODE_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果图像初始化失败则返回 IMAGE_RESULT_INIT_ABNORMAL {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果图像添加像素位图失败则返回 IMAGE_RESULT_ENCODE_FAILED {@link IRNdkErrCode}; + * 如果图像不支持硬件解码则返回 IMAGE_RESULT_HW_DECODE_UNSUPPORT {@link IRNdkErrCode}; + * 如果硬件解码失败则返回 IMAGE_RESULT_HW_DECODE_FAILED {@link IRNdkErrCode}; + * 如果ipc失败则返回 IMAGE_RESULT_INDEX_INVALID {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see CreateAlphaPixelMap + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_CreateAlphaPixelMap(napi_env env, napi_value source, napi_value* alpha); + +/** + * @brief 初始化PixelMap对象数据。 + * + * @param env napi的环境指针。 + * @param source PixelMap 数据设置项。 + * @return 操作成功则返回NativePixelMap的指针;如果操作失败,则返回错误码。 + * @see InitNativePixelMap + * @since 10 + * @version 1.0 + */ +NativePixelMap* OH_PixelMap_InitNativePixelMap(napi_env env, napi_value source); + +/** + * @brief 获取PixelMap对象每行字节数。 + * + * @param native NativePixelMap的指针。 + * @param num PixelMap对象的每行字节数指针。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 + * @see GetBytesNumberPerRow + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_GetBytesNumberPerRow(const NativePixelMap* native, int32_t* num); + +/** + * @brief 获取PixelMap对象是否可编辑的状态。 + * + * @param native NativePixelMap的指针。 + * @param editable PixelMap 对象是否可编辑的指针。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 + * @see GetIsEditable + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_GetIsEditable(const NativePixelMap* native, int32_t* editable); + +/** + * @brief 获取PixelMap对象是否支持Alpha通道。 + * + * @param native NativePixelMap的指针。 + * @param alpha 是否支持Alpha的指针。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 + * @see IsSupportAlpha + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_IsSupportAlpha(const NativePixelMap* native, int32_t* alpha); + +/** + * @brief 设置PixelMap对象的Alpha通道。 + * + * @param native NativePixelMap的指针。 + * @param alpha Alpha通道。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 + * @see SetAlphaAble + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_SetAlphaAble(const NativePixelMap* native, int32_t alpha); + +/** + * @brief 获取PixelMap对象像素密度。 + * + * @param native NativePixelMap的指针。 + * @param density 像素密度指针。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 + * @see GetDensity + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_GetDensity(const NativePixelMap* native, int32_t* density); + +/** + * @brief 设置PixelMap对象像素密度。 + * + * @param native NativePixelMap的指针。 + * @param density 像素密度。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 + * @see GetDensity + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_SetDensity(const NativePixelMap* native, int32_t density); + +/** + * @brief 设置PixelMap对象的透明度。 + * + * @param native NativePixelMap的指针。 + * @param opacity 透明度。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 + * @see SetOpacity + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_SetOpacity(const NativePixelMap* native, float opacity); + +/** + * @brief 设置PixelMap对象的缩放。 + * + * @param native NativePixelMap的指针。 + * @param x 缩放宽度。 + * @param y 缩放高度。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果图像初始化失败则返回 IMAGE_RESULT_INIT_ABNORMAL {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see Scale + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_Scale(const NativePixelMap* native, float x, float y); + +/** + * @brief 设置PixelMap对象的偏移。 + * + * @param native NativePixelMap的指针。 + * @param x 水平偏移量。 + * @param y 垂直偏移量。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see Translate + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_Translate(const NativePixelMap* native, float x, float y); + +/** + * @brief 设置PixelMap对象的旋转。 + * + * @param native NativePixelMap的指针。 + * @param angle 旋转角度。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see Rotate + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_Rotate(const NativePixelMap* native, float angle); + +/** + * @brief 设置PixelMap对象的翻转。 + * + * @param native NativePixelMap的指针。 + * @param x 根据水平方向x轴进行图片翻转。 + * @param y 根据垂直方向y轴进行图片翻转。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see Flip + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_Flip(const NativePixelMap* native, int32_t x, int32_t y); + +/** + * @brief 设置PixelMap对象的裁剪。 + * + * @param native NativePixelMap的指针。 + * @param x 目标图片左上角的x坐标。 + * @param y 目标图片左上角的y坐标。 + * @param width 裁剪区域的宽度。 + * @param height 裁剪区域的高度。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see Crop + * @since 10 + * @version 1.0 + */ +int32_t OH_PixelMap_Crop(const NativePixelMap* native, int32_t x, int32_t y, int32_t width, int32_t height); + +/** + * @brief 获取PixelMap对象图像信息。 + * + * @param native NativePixelMap的指针。 + * @param info 图像信息指针。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see OhosPixelMapInfos + * @since 10 + * @version 2.0 + */ +int32_t OH_PixelMap_GetImageInfo(const NativePixelMap* native, OhosPixelMapInfos *info); + +/** + * @brief 获取native PixelMap 对象数据的内存地址,并锁定该内存。 + * + * @param native NativePixelMap的指针。 + * @param addr 用于指向的内存地址的双指针对象。 + * @see UnAccessPixels + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see AccessPixels + * @since 10 + * @version 2.0 + */ +int32_t OH_PixelMap_AccessPixels(const NativePixelMap* native, void** addr); + +/** +/** + * @brief 释放native PixelMap对象数据的内存锁,用于匹配方法{@link OH_PixelMap_AccessPixels}。 + * + * @param native NativePixelMap的指针。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像获取数据失败则返回 IMAGE_RESULT_GET_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果解码失败则返回 IMAGE_RESULT_DECODE_FAILED {@link IRNdkErrCode}; + * 如果检查格式失败则返回 IMAGE_RESULT_CHECK_FORMAT_ERROR {@link IRNdkErrCode}; + * 如果skia能力失败则返回 IMAGE_RESULT_THIRDPART_SKIA_ERROR {@link IRNdkErrCode}; + * 如果图像输入数据失败则返回 IMAGE_RESULT_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果共享内存失败则返回 IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST {@link IRNdkErrCode}; + * 如果共享内存数据错误则返回 IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL {@link IRNdkErrCode}; + * 如果图像分配内存失败则返回 IMAGE_RESULT_MALLOC_ABNORMAL {@link IRNdkErrCode}; + * 如果图像数据不支持则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果裁剪失败失败则返回 IMAGE_RESULT_CROP {@link IRNdkErrCode}; + * 如果图像格式未知则返回 IMAGE_RESULT_UNKNOWN_FORMAT {@link IRNdkErrCode}; + * 如果注册插件失败失败则返回 IMAGE_RESULT_PLUGIN_REGISTER_FAILED {@link IRNdkErrCode}; + * 如果创建插件失败失败则返回 IMAGE_RESULT_PLUGIN_CREATE_FAILED {@link IRNdkErrCode}; + * 如果属性无效则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果透明度类型错误则返回 IMAGE_RESULT_ALPHA_TYPE_ERROR {@link IRNdkErrCode}; + * 如果内存分配类型错误则返回 IMAGE_RESULT_ALLOCATER_TYPE_ERROR {@link IRNdkErrCode}。 + * @see UnAccessPixels + * @since 10 + * @version 2.0 + */ +int32_t OH_PixelMap_UnAccessPixels(const NativePixelMap* native); + +#ifdef __cplusplus +}; +#endif +/** @} */ + +#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXEL_MAP_NAPI_H_ diff --git a/zh-cn/native_sdk/media/image/image_pixel_map_napi.h b/zh-cn/native_sdk/media/image/image_pixel_map_napi.h index 729f5fea..cfdd15c9 100644 --- a/zh-cn/native_sdk/media/image/image_pixel_map_napi.h +++ b/zh-cn/native_sdk/media/image/image_pixel_map_napi.h @@ -33,12 +33,12 @@ * @version 1.0 */ -#ifndef IMAGE_PIXEL_MAP_NAPI_H -#define IMAGE_PIXEL_MAP_NAPI_H -#include +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXEL_MAP_NAPI_H_ +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXEL_MAP_NAPI_H_ +#include #include "napi/native_api.h" -#include "napi/native_node_api.h" - +namespace OHOS { +namespace Media { #ifdef __cplusplus extern "C" { #endif @@ -46,6 +46,7 @@ extern "C" { /** * @brief 函数方法返回值的错误码的枚举。 * + * @deprecated since 10 * @since 8 * @version 1.0 */ @@ -59,6 +60,7 @@ enum { /** * @brief pixel 格式的枚举。 * + * @deprecated since 10 * @since 8 * @version 1.0 */ @@ -81,6 +83,7 @@ enum { /** * @brief 用于定义 pixel map 的相关信息。 * + * @deprecated since 10 * @since 8 * @version 1.0 */ @@ -95,45 +98,6 @@ struct OhosPixelMapInfo { int32_t pixelFormat; }; -/** - * @brief 用于定义 napi PixelMap 的相关信息。 - * @since 10 - * @version 2.0 - */ -struct NativePixelMap; - -/** - * @brief 用于定义NativePixelMap数据类型名称。 - * @since 10 - * @version 2.0 - */ -typedef struct NativePixelMap NativePixelMap; - -/** - * @brief PixelMap alpha 类型的枚举。 - * - * @since 10 - * @version 2.0 - */ -enum { - /** - * 未知的格式 - */ - OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0, - /** - * 不透明的格式 - */ - OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1, - /** - * 预乘的格式 - */ - OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2, - /** - * 预除的格式 - */ - OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 -}; - /** * @brief PixelMap 缩放类型的枚举。 * @@ -151,47 +115,10 @@ enum { OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1, }; -/** - * @brief PixelMap 编辑类型的枚举。 - * - * @since 10 - * @version 2.0 - */ -enum { - /** - * 只读的格式 - */ - OHOS_PIXEL_MAP_READ_ONLY = 0, - /** - * 可编辑的格式 - */ - OHOS_PIXEL_MAP_EDITABLE = 1, -}; - -/** - * @brief 用于定义创建 pixel map 设置选项的相关信息。 - * - * @since 10 - * @version 2.0 - */ -struct OhosPixelMapCreateOps { - /** 图片的宽, 用pixels表示 */ - uint32_t width; - /** 图片的高, 用pixels表示 */ - uint32_t height; - /** 图片的格式 */ - int32_t pixelFormat; - /** 图片的编辑类型 */ - uint32_t editable; - /** 图片的alpha类型 */ - uint32_t alphaType; - /** 图片的缩放类型 */ - uint32_t scaleMode; -} - /** * @brief 获取 PixelMap 的信息,并记录信息到{@link OhosPixelMapInfo}结构中。 * + * @deprecated since 10 * @param env napi的环境指针。 * @param value 应用层的 PixelMap 对象。 * @param info 用于保存信息的指针对象。 更多细节, 参看 {@link OhosPixelMapInfo}。 @@ -208,6 +135,7 @@ int32_t OH_GetImageInfo(napi_env env, napi_value value, OhosPixelMapInfo *info); * 函数执行成功后,*addrPtr就是获取的待访问的内存地址。访问操作完成后,必须要使用{@link OH_UnAccessPixels}来释放锁,否则的话资源无法被释放。 * 待解锁后,内存地址就不可以再被访问和操作。 * + * @deprecated since 10 * @param env napi的环境指针。 * @param value 应用层的 PixelMap 对象。 * @param addrPtr 用于指向的内存地址的双指针对象。 @@ -221,6 +149,7 @@ int32_t OH_AccessPixels(napi_env env, napi_value value, void** addrPtr); /** * @brief 释放PixelMap对象数据的内存锁, 用于匹配方法{@link OH_AccessPixels}。 * + * @deprecated since 10 * @param env napi的环境指针。 * @param value 应用层的 PixelMap 对象。 * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 @@ -230,236 +159,10 @@ int32_t OH_AccessPixels(napi_env env, napi_value value, void** addrPtr); */ int32_t OH_UnAccessPixels(napi_env env, napi_value value); -/** - * @brief 创建PixelMap对象。 - * - * @param env napi的环境指针。 - * @param info pixel map 数据设置项。 - * @param buf 图片的buffer数据。 - * @param len 图片大小信息。 - * @param res 应用层的 PixelMap 对象的指针。 - * @return 操作成功则返回 PixelMap 对象;如果操作失败,则返回错误码。 - * @see CreatePixelMap - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_CreatePixelMap(napi_env env, OhosPixelMapCreateOps info, - void* buf, size_t len, napi_value* res); - -/** - * @brief 根据Alpha通道的信息,来生成一个仅包含Alpha通道信息的PixelMap对象。 - * - * @param env napi的环境指针。 - * @param source PixelMap数据设置项。 - * @param alpha alpha通道的指针。 - * @return 操作成功则返回 PixelMap 对象;如果操作失败,则返回错误码。 - * @see CreateAlphaPixelMap - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_CreateAlphaPixelMap(napi_env env, napi_value source, napi_value* alpha); - -/** - * @brief 初始化PixelMap对象数据。 - * - * @param env napi的环境指针。 - * @param source PixelMap 数据设置项。 - * @return 操作成功则返回NativePixelMap的指针;如果操作失败,则返回错误码。 - * @see InitNativePixelMap - * @since 10 - * @version 2.0 - */ -NativePixelMap* OH_PixelMap_InitNativePixelMap(napi_env env, napi_value source); - -/** - * @brief 获取PixelMap对象每行字节数。 - * - * @param native NativePixelMap的指针。 - * @param num PixelMap对象的每行字节数指针。 - * @return 操作成功则返回 PixelMap 对象每行字节数;如果操作失败,则返回错误码。 - * @see GetBytesNumberPerRow - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_GetBytesNumberPerRow(const NativePixelMap* native, int32_t* num); - -/** - * @brief 获取PixelMap对象是否可编辑的状态。 - * - * @param native NativePixelMap的指针。 - * @param editable PixelMap 对象是否可编辑的指针。 - * @return 操作成功则返回编辑类型的枚举值;如果操作失败,则返回错误码。 - * @see GetIsEditable - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_GetIsEditable(const NativePixelMap* native, int32_t* editable); - -/** - * @brief 获取PixelMap对象是否支持Alpha通道。 - * - * @param native NativePixelMap的指针。 - * @param alpha 是否支持Alpha的指针。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see IsSupportAlpha - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_IsSupportAlpha(const NativePixelMap* native, int32_t* alpha); - -/** - * @brief 设置PixelMap对象的Alpha通道。 - * - * @param native NativePixelMap的指针。 - * @param alpha Alpha通道。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see SetAlphaAble - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_SetAlphaAble(const NativePixelMap* native, int32_t alpha); - -/** - * @brief 获取PixelMap对象像素密度。 - * - * @param native NativePixelMap的指针。 - * @param density 像素密度指针。 - * @return 操作成功则返回像素密度;如果操作失败,则返回错误码。 - * @see GetDensity - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_GetDensity(const NativePixelMap* native, int32_t* density); - -/** - * @brief 设置PixelMap对象像素密度。 - * - * @param native NativePixelMap的指针。 - * @param density 像素密度。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see GetDensity - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_SetDensity(const NativePixelMap* native, int32_t density); - -/** - * @brief 设置PixelMap对象的透明度。 - * - * @param native NativePixelMap的指针。 - * @param opacity 透明度。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see SetOpacity - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_SetOpacity(const NativePixelMap* native, float opacity); - -/** - * @brief 设置PixelMap对象的缩放。 - * - * @param native NativePixelMap的指针。 - * @param x 缩放宽度。 - * @param y 缩放高度。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see Scale - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_Scale(const NativePixelMap* native, float x, float y); - -/** - * @brief 设置PixelMap对象的偏移。 - * - * @param native NativePixelMap的指针。 - * @param x 水平偏移量。 - * @param y 垂直偏移量。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see Translate - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_Translate(const NativePixelMap* native, float x, float y); - -/** - * @brief 设置PixelMap对象的旋转。 - * - * @param native NativePixelMap的指针。 - * @param angle 旋转角度。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see Rotate - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_Rotate(const NativePixelMap* native, float angle); - -/** - * @brief 设置PixelMap对象的翻转。 - * - * @param native NativePixelMap的指针。 - * @param x 根据水平方向x轴进行图片翻转。 - * @param y 根据垂直方向y轴进行图片翻转。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see Flip - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_Flip(const NativePixelMap* native, int32_t x, int32_t y); - -/** - * @brief 设置PixelMap对象的裁剪。 - * - * @param native NativePixelMap的指针。 - * @param x 目标图片左上角的x坐标。 - * @param y 目标图片左上角的y坐标。 - * @param width 裁剪区域的宽度。 - * @param height 裁剪区域的高度。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see Crop - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_Crop(const NativePixelMap* native, int32_t x, int32_t y, int32_t width, int32_t height); - -/** - * @brief 获取PixelMap对象图像信息。 - * - * @param native NativePixelMap的指针。 - * @param info 图像信息指针。 - * @return 操作成功则返回0;如果操作失败,则返回错误码。 - * @see OhosPixelMapInfo - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_GetImageInfo(const NativePixelMap* native, OhosPixelMapInfo *info); - -/** - * @brief 获取native PixelMap 对象数据的内存地址,并锁定该内存。 - * - * @param native NativePixelMap的指针。 - * @param addr 用于指向的内存地址的双指针对象。 - * @see UnAccessPixels - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_AccessPixels(const NativePixelMap* native, void** addr); - -/** - * @brief 释放native PixelMap对象数据的内存锁,用于匹配方法{@link OH_PixelMap_AccessPixels}。 - * - * @param native NativePixelMap的指针。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 - * @see AccessPixels - * @since 10 - * @version 2.0 - */ -int32_t OH_PixelMap_UnAccessPixels(const NativePixelMap* native); - #ifdef __cplusplus }; #endif - /** @} */ -#endif // IMAGE_PIXEL_MAP_NAPI_H - +} // namespace Media +} // namespace OHOS +#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXEL_MAP_NAPI_H_ diff --git a/zh-cn/native_sdk/media/image/image_receiver_mdk.h b/zh-cn/native_sdk/media/image/image_receiver_mdk.h index 2725b866..774782d4 100644 --- a/zh-cn/native_sdk/media/image/image_receiver_mdk.h +++ b/zh-cn/native_sdk/media/image/image_receiver_mdk.h @@ -35,13 +35,10 @@ #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_RECEIVER_MDK_H_ #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_RECEIVER_MDK_H_ -#include #include "napi/native_api.h" #include "image_mdk_common.h" #include "image_mdk.h" -namespace OHOS { -namespace Media { #ifdef __cplusplus extern "C" { #endif @@ -93,7 +90,17 @@ struct OhosImageReceiverInfo { * @param env napi的环境指针。 * @param info ImageReceiver 数据设置项。 * @param res 应用层的 ImageReceiver 对象的指针。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果创建surface失败则返回 IMAGE_RESULT_CREATE_SURFACE_FAILED {@link IRNdkErrCode}; + * 如果surface分配内存失败则返回 IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED {@link IRNdkErrCode}; + * 如果获取surface失败则返回 IMAGE_RESULT_GET_SURFACE_FAILED {@link IRNdkErrCode}; + * 如果媒体rtsp surface不支持则返回 IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果媒体类型不支持失败则返回 IMAGE_RESULT_MEDIA_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see OhosImageReceiverInfo * @since 10 * @version 2.0 @@ -118,7 +125,14 @@ ImageReceiverNative* OH_Image_Receiver_InitImageReceiverNative(napi_env env, nap * @param native native层的{@link ImageReceiverNative}指针。 * @param id 指向字符缓冲区的指针,用于获取字符串的id。 * @param len id所对应的字符缓冲区的大小。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果获取surface失败则返回 IMAGE_RESULT_GET_SURFACE_FAILED {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果媒体类型不支持失败则返回 IMAGE_RESULT_MEDIA_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see ImageReceiverNative * @since 10 * @version 2.0 @@ -130,7 +144,17 @@ int32_t OH_Image_Receiver_GetReceivingSurfaceId(const ImageReceiverNative* nativ * * @param native native层的{@link ImageReceiverNative}指针。 * @param image 获取到的应用层的 Image 指针对象。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果创建surface失败则返回 IMAGE_RESULT_CREATE_SURFACE_FAILED {@link IRNdkErrCode}; + * 如果surface分配内存失败则返回 IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED {@link IRNdkErrCode}; + * 如果获取surface失败则返回 IMAGE_RESULT_GET_SURFACE_FAILED {@link IRNdkErrCode}; + * 如果媒体rtsp surface不支持则返回 IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果媒体类型不支持失败则返回 IMAGE_RESULT_MEDIA_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see ImageReceiverNative * @since 10 * @version 2.0 @@ -142,7 +166,17 @@ int32_t OH_Image_Receiver_ReadLatestImage(const ImageReceiverNative* native, nap * * @param native native层的{@link ImageReceiverNative}指针。 * @param image 读取到的应用层的 Image 指针对象。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果创建surface失败则返回 IMAGE_RESULT_CREATE_SURFACE_FAILED {@link IRNdkErrCode}; + * 如果surface分配内存失败则返回 IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED {@link IRNdkErrCode}; + * 如果获取surface失败则返回 IMAGE_RESULT_GET_SURFACE_FAILED {@link IRNdkErrCode}; + * 如果媒体rtsp surface不支持则返回 IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果媒体类型不支持失败则返回 IMAGE_RESULT_MEDIA_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see ImageReceiverNative * @since 10 * @version 2.0 @@ -154,7 +188,14 @@ int32_t OH_Image_Receiver_ReadNextImage(const ImageReceiverNative* native, napi_ * * @param native native层的{@link ImageReceiverNative}指针。 * @param callback {@link OH_Image_Receiver_On_Callback}事件的回调函数。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果从surface获取参数失败返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果获取surface失败则返回 IMAGE_RESULT_GET_SURFACE_FAILED {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}; + * 如果媒体类型不支持失败则返回 IMAGE_RESULT_MEDIA_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see ImageReceiverNative * @since 10 * @version 2.0 @@ -166,7 +207,11 @@ int32_t OH_Image_Receiver_On(const ImageReceiverNative* native, OH_Image_Receive * * @param native native层的{@link ImageReceiverNative}指针。 * @param size 作为结果的{@link OhosImageSize}指针。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see ImageReceiverNative, OH_Image_Receiver_On_Callback * @since 10 * @version 2.0 @@ -178,7 +223,11 @@ int32_t OH_Image_Receiver_GetSize(const ImageReceiverNative* native, struct Ohos * * @param native native层的{@link ImageReceiverNative}指针。 * @param capacity 作为结果的指向容量的指针。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see ImageReceiverNative, OhosImageSize * @since 10 * @version 2.0 @@ -190,7 +239,11 @@ int32_t OH_Image_Receiver_GetCapacity(const ImageReceiverNative* native, int32_t * * @param native native层的{@link ImageReceiverNative}指针。 * @param format 作为结果的指向格式的指针。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果JNI环境异常则返回 IMAGE_RESULT_JNI_ENV_ABNORMAL {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see ImageReceiverNative * @since 10 @@ -202,7 +255,10 @@ int32_t OH_Image_Receiver_GetFormat(const ImageReceiverNative* native, int32_t* * @brief 释放native层 {@link ImageReceiverNative} 对象。注意: 此方法不能释放应用层ImageReceiver对象。 * * @param native native层的{@link ImageReceiverNative}指针。 - * @return 操作成功则返回 {@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,则返回错误码。 + * @return 如果操作成功则返回 IMAGE_RESULT_SUCCESS {@link IRNdkErrCode}; + * 如果参数错误则返回 IMAGE_RESULT_BAD_PARAMETER {@link IRNdkErrCode}; + * 如果参数无效则返回 IMAGE_RESULT_INVALID_PARAMETER {@link IRNdkErrCode}; + * 如果图像类型不支持失败则返回 IMAGE_RESULT_DATA_UNSUPPORT {@link IRNdkErrCode}。 * @see ImageReceiverNative * @since 10 * @version 2.0 @@ -212,6 +268,5 @@ int32_t OH_Image_Receiver_Release(ImageReceiverNative* native); }; #endif /** @} */ -} // namespace Media -} // namespace OHOS + #endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_RECEIVER_MDK_H_ diff --git a/zh-cn/native_sdk/media/image/image_source_mdk.h b/zh-cn/native_sdk/media/image/image_source_mdk.h index f12eb5d9..235bce82 100644 --- a/zh-cn/native_sdk/media/image/image_source_mdk.h +++ b/zh-cn/native_sdk/media/image/image_source_mdk.h @@ -39,8 +39,6 @@ #include #include "napi/native_api.h" #include "image_mdk_common.h" -namespace OHOS { -namespace Media { #ifdef __cplusplus extern "C" { #endif @@ -393,7 +391,24 @@ struct OhosImageSourceUpdateData { * @param src 表明创建一个图像源的信息。查看{@link OhosImageSource}获取更多细节。 * @param ops 表明创建一个图像源的选项。查看{@link OhosImageSourceOps}。 * @param res 表明JavaScript native层APIImageSource对象的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS},如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果图像源数据不完整,返回{@link IMAGE_RESULT_SOURCE_DATA_INCOMPLETE}; + * 如果图像源数据错误,返回{@link IMAGE_RESULT_SOURCE_DATA}; + * 如果图像获取数据错误,返回{@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果图像数据太大,返回{@link IMAGE_RESULT_TOO_LARGE}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果图像解码 EXIF 不支持,返回{@link IMAGE_RESULT_DECODE_EXIF_UNSUPPORT}; + * 如果图像属性不存在,返回{@link IMAGE_RESULT_PROPERTY_NOT_EXIST}; + * 如果文件损坏,返回{@link IMAGE_RESULT_FILE_DAMAGED}; + * 如果文件 FD 错误,返回{@link IMAGE_RESULT_FILE_FD_ERROR}; + * 如果数据流错误,返回{@link IMAGE_RESULT_STREAM_SIZE_ERROR}; + * 如果查找文件失败,返回{@link IMAGE_RESULT_SEEK_FAILED}; + * 如果速览文件失败,返回{@link IMAGE_RESULT_PEEK_FAILED}; + * 如果读取文件失败,返回{@link IMAGE_RESULT_FREAD_FAILED}。 * @see {@link OhosImageSource}, {@link OhosImageSourceOps} * * @Syscap SystemCapability.Multimedia.Image @@ -411,7 +426,24 @@ int32_t OH_ImageSource_Create(napi_env env, struct OhosImageSource* src, * @param src 表明创建一个图像源的信息。这里只接收缓冲区类型。查看{@link OhosImageSource}获取更多细节 * @param ops 表明创建一个图像源的选项。查看{@link OhosImageSourceOps}。 * @param res 表明JavaScript native层APIImageSource对象的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果图像源数据不完整,返回{@link IMAGE_RESULT_SOURCE_DATA_INCOMPLETE}; + * 如果图像源数据错误,返回{@link IMAGE_RESULT_SOURCE_DATA}; + * 如果图像获取数据错误,返回{@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果图像数据太大,返回{@link IMAGE_RESULT_TOO_LARGE}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果图像解码 EXIF 不支持,返回{@link IMAGE_RESULT_DECODE_EXIF_UNSUPPORT}; + * 如果图像属性不存在,返回{@link IMAGE_RESULT_PROPERTY_NOT_EXIST}; + * 如果文件损坏,返回{@link IMAGE_RESULT_FILE_DAMAGED}; + * 如果文件 FD 错误,返回{@link IMAGE_RESULT_FILE_FD_ERROR}; + * 如果数据流错误,返回{@link IMAGE_RESULT_STREAM_SIZE_ERROR}; + * 如果查找文件失败,返回{@link IMAGE_RESULT_SEEK_FAILED}; + * 如果速览文件失败,返回{@link IMAGE_RESULT_PEEK_FAILED}; + * 如果读取文件失败,返回{@link IMAGE_RESULT_FREAD_FAILED}。 * @see {@link OhosImageSource}, {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData} * * @Syscap SystemCapability.Multimedia.Image @@ -428,7 +460,12 @@ int32_t OH_ImageSource_CreateIncremental(napi_env env, struct OhosImageSource* s * 当supportedFormatList为nullptr并且size以res为0作为输入时,它将以ressize返回支持的格式大小。 * 为了获得所有的格式标记,它需要比supportedFormatList中的结果大小大的足够空间, * 还需要为{@link-OhosImageSourceSupportedFormat}项目中的每个格式提供足够的空间。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果检查格式不对,返回{@IMAGE_RESULT_CHECK_FORMAT_ERROR }。 * @see {@link OhosImageSourceSupportedFormatList}, {@link OhosImageSourceSupportedFormat} * * @Syscap SystemCapability.Multimedia.Image @@ -456,7 +493,35 @@ ImageSourceNative* OH_ImageSource_InitNative(napi_env env, napi_value source); * @param native 表明native层{@link ImageSourceNative}值的指针。 * @param ops 表明为了解码图像源的选项,查看{@link OhosImageDecodingOps}。 * @param res 表明JavaScript native层APIPixelMap对象的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果创建解码器失败,返回 {@link IMAGE_RESULT_CREATE_DECODER_FAILED}; + * 如果创建编码器失败,返回 {@link IMAGE_RESULT_CREATE_ENCODER_FAILED}; + * 如果检查格式不对,返回{@IMAGE_RESULT_CHECK_FORMAT_ERROR }; + * 如果skia错误,返回 {@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}。 + * 如果共享内存错误,返回 {@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}; + * 如果共享内存数据异常,返回 {@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}; + * 如果图片解码异常,返回 {@link IMAGE_RESULT_DECODE_ABNORMAL}; + * 如果图像错误,返回 {@link IMAGE_RESULT_MALLOC_ABNORMAL}; + * 如果图片初始化错误,返回 {@link IMAGE_RESULT_DATA_UNSUPPORT}; + * 如果图片输入数据错误,返回 {@link IMAGE_RESULT_INIT_ABNORMAL}; + * 如果裁剪错误,返回 {@link IMAGE_RESULT_CROP}; + * 如果图片格式未知,返回 {@link IMAGE_RESULT_UNKNOWN_FORMAT}; + * 如果注册插件失败,返回 {@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}; + * 如果创建插件失败。返回 {@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}; + * 如果增加位图失败,返回 {@link IMAGE_RESULT_ENCODE_FAILED}; + * 如果不支持图片硬解码,返回 {@link IMAGE_RESULT_HW_DECODE_UNSUPPORT}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_HW_DECODE_FAILED}; + * 如果ipc失败,返回 {@link IMAGE_RESULT_ERR_IPC}; + * 如果索引无效,返回 {@link IMAGE_RESULT_INDEX_INVALID}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_ALPHA_TYPE_ERROR}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}。 * @see {@link ImageSourceNative}, {@link OhosImageDecodingOps} * * @Syscap SystemCapability.Multimedia.Image @@ -472,7 +537,37 @@ int32_t OH_ImageSource_CreatePixelMap(const ImageSourceNative* native, * @param native 表明native层 {@link ImageSourceNative} 值的指针。 * @param ops 表明为了解码图像源的选项,查看{@link OhosImageDecodingOps}。 * @param res 表明JavaScript native层APIPixelMap 列表对象的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果创建解码器失败,返回 {@link IMAGE_RESULT_CREATE_DECODER_FAILED}; + * 如果创建编码器失败,返回 {@link IMAGE_RESULT_CREATE_ENCODER_FAILED}; + * 如果检查格式不对,返回{@IMAGE_RESULT_CHECK_FORMAT_ERROR }; + * 如果skia错误,返回 {@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}。 + * 如果共享内存错误,返回 {@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}; + * 如果共享内存数据异常,返回 {@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}; + * 如果图片解码异常,返回 {@link IMAGE_RESULT_DECODE_ABNORMAL}; + * 如果图像错误,返回 {@link IMAGE_RESULT_MALLOC_ABNORMAL}; + * 如果图片初始化错误,返回 {@link IMAGE_RESULT_DATA_UNSUPPORT}; + * 如果图片输入数据错误,返回 {@link IMAGE_RESULT_INIT_ABNORMAL}; + * 如果裁剪错误,返回 {@link IMAGE_RESULT_CROP}; + * 如果图片格式未知,返回 {@link IMAGE_RESULT_UNKNOWN_FORMAT}; + * 如果注册插件失败,返回 {@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}; + * 如果创建插件失败。返回 {@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}; + * 如果增加位图失败,返回 {@link IMAGE_RESULT_ENCODE_FAILED}; + * 如果不支持图片硬解码,返回 {@link IMAGE_RESULT_HW_DECODE_UNSUPPORT}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_HW_DECODE_FAILED}; + * 如果ipc失败,返回 {@link IMAGE_RESULT_ERR_IPC}; + * 如果索引无效,返回 {@link IMAGE_RESULT_INDEX_INVALID}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_ALPHA_TYPE_ERROR}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}; + * 如果解码的EXIF不支持,返回 {@link IMAGE_RESULT_DECODE_EXIF_UNSUPPORT}; + * 如果图片属性不存在,返回 {@link IMAGE_RESULT_PROPERTY_NOT_EXIST}。 * @see {@link ImageSourceNative}, {@link OhosImageDecodingOps} * * @Syscap SystemCapability.Multimedia.Image @@ -489,7 +584,24 @@ int32_t OH_ImageSource_CreatePixelMapList(const ImageSourceNative* native, * @param res 表明延迟时间列表 {@link OhosImageSourceDelayTimeList} 的指针。 * 当输入的res中delayTimeList是空指针并且size是0时,将通过res的size中返回延迟时间列表大小 * 为了获取延迟时间,需要比返回的delayTimeList大小值大的足够空间 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果创建解码器失败,返回 {@link IMAGE_RESULT_CREATE_DECODER_FAILED}; + * 如果skia错误,返回 {@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}; + * 如果图片解码异常, {@link IMAGE_RESULT_DECODE_ABNORMAL}; + * 如果图片初始化错误,返回 {@link IMAGE_RESULT_DATA_UNSUPPORT}; + * 如果图片格式未知,返回 {@link IMAGE_RESULT_UNKNOWN_FORMAT}; + * 如果注册插件失败,返回 {@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}; + * 如果创建插件失败。返回 {@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}; + * 如果索引无效,返回 {@link IMAGE_RESULT_INDEX_INVALID}; + * 如果解码的EXIF不支持,返回 {@link IMAGE_RESULT_DECODE_EXIF_UNSUPPORT}; + * 如果图片属性不存在,返回 {@link IMAGE_RESULT_PROPERTY_NOT_EXIST}。 * @see {@link ImageSourceNative}, {@link OhosImageSourceDelayTimeList} * * @Syscap SystemCapability.Multimedia.Image @@ -504,7 +616,24 @@ int32_t OH_ImageSource_GetDelayTime(const ImageSourceNative* native, * * @param native 表明native层 {@link ImageSourceNative} 值的指针。 * @param res 表明帧计数的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果创建解码器失败,返回 {@link IMAGE_RESULT_CREATE_DECODER_FAILED}; + * 如果skia错误,返回 {@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}。 + * 如果图片解码异常, {@link IMAGE_RESULT_DECODE_ABNORMAL}; + * 如果图片初始化错误,返回 {@link IMAGE_RESULT_DATA_UNSUPPORT}; + * 如果图片格式未知,返回 {@link IMAGE_RESULT_UNKNOWN_FORMAT}; + * 如果注册插件失败,返回 {@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}; + * 如果创建插件失败。返回 {@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}; + * 如果索引无效,返回 {@link IMAGE_RESULT_INDEX_INVALID}; + * 如果解码的EXIF不支持,返回 {@link IMAGE_RESULT_DECODE_EXIF_UNSUPPORT}; + * 如果图片属性不存在,返回 {@link IMAGE_RESULT_PROPERTY_NOT_EXIST}。 * @see {@link ImageSourceNative} * * @Syscap SystemCapability.Multimedia.Image @@ -519,7 +648,24 @@ int32_t OH_ImageSource_GetFrameCount(const ImageSourceNative* native, uint32_t * * @param native 表明native层 {@link ImageSourceNative} 值的指针。 * @param index 表明帧计数的指针。 * @param info 表明图像源信息{@link OhosImageSourceInfo}的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果创建解码器失败,返回 {@link IMAGE_RESULT_CREATE_DECODER_FAILED}; + * 如果skia错误,返回 {@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}。 + * 如果图片解码异常, {@link IMAGE_RESULT_DECODE_ABNORMAL}; + * 如果图片初始化错误,返回 {@link IMAGE_RESULT_DATA_UNSUPPORT}; + * 如果图片格式未知,返回 {@link IMAGE_RESULT_UNKNOWN_FORMAT}; + * 如果注册插件失败,返回 {@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}; + * 如果创建插件失败。返回 {@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}; + * 如果索引无效,返回 {@link IMAGE_RESULT_INDEX_INVALID}; + * 如果解码的EXIF不支持,返回 {@link IMAGE_RESULT_DECODE_EXIF_UNSUPPORT}; + * 如果图片属性不存在,返回 {@link IMAGE_RESULT_PROPERTY_NOT_EXIST}。 * @see {@link ImageSourceNative}, {@link OhosImageSourceInfo} * * @Syscap SystemCapability.Multimedia.Image @@ -537,7 +683,24 @@ int32_t OH_ImageSource_GetImageInfo(const ImageSourceNative* native, int32_t ind * @param value 表明作为结果的属性值{@link OhosImageSourceProperty}的指针。 * 当输入的value中value是空指针并且size是0时,将通过value中的size返回属性值的大小。 * 为了获取属性值,需要比value中的结果大小大的足够的空间。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果创建解码器失败,返回 {@link IMAGE_RESULT_CREATE_DECODER_FAILED}; + * 如果skia错误,返回 {@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}。 + * 如果图片解码异常, {@link IMAGE_RESULT_DECODE_ABNORMAL}; + * 如果图片初始化错误,返回 {@link IMAGE_RESULT_DATA_UNSUPPORT}; + * 如果图片格式未知,返回 {@link IMAGE_RESULT_UNKNOWN_FORMAT}; + * 如果注册插件失败,返回 {@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}; + * 如果创建插件失败。返回 {@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}; + * 如果索引无效,返回 {@link IMAGE_RESULT_INDEX_INVALID}; + * 如果解码的EXIF不支持,返回 {@link IMAGE_RESULT_DECODE_EXIF_UNSUPPORT}; + * 如果图片属性不存在,返回 {@link IMAGE_RESULT_PROPERTY_NOT_EXIST}。 * @see {@link ImageSourceNative}, {@link OhosImageSourceProperty} * * @Syscap SystemCapability.Multimedia.Image @@ -553,7 +716,24 @@ int32_t OH_ImageSource_GetImageProperty(const ImageSourceNative* native, * @param native 表明native层 {@link ImageSourceNative} 值的指针 * @param key 表明属性关键字{@link OhosImageSourceProperty}的指针。 * @param value 为了修改表明属性值{@link OhosImageSourceProperty}的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果创建解码器失败,返回 {@link IMAGE_RESULT_CREATE_DECODER_FAILED}; + * 如果skia错误,返回 {@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}; + * 如果图片解码异常, {@link IMAGE_RESULT_DECODE_ABNORMAL}; + * 如果图片初始化错误,返回 {@link IMAGE_RESULT_DATA_UNSUPPORT}; + * 如果图片格式未知,返回 {@link IMAGE_RESULT_UNKNOWN_FORMAT}; + * 如果注册插件失败,返回 {@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}; + * 如果创建插件失败。返回 {@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}; + * 如果索引无效,返回 {@link IMAGE_RESULT_INDEX_INVALID}; + * 如果解码的EXIF不支持,返回 {@link IMAGE_RESULT_DECODE_EXIF_UNSUPPORT}; + * 如果图片属性不存在,返回 {@link IMAGE_RESULT_PROPERTY_NOT_EXIST}。 * @see {@link ImageSourceNative}, {@link OhosImageSourceProperty} * * @Syscap SystemCapability.Multimedia.Image @@ -568,7 +748,35 @@ int32_t OH_ImageSource_ModifyImageProperty(const ImageSourceNative* native, * * @param native 表明native层 {@link ImageSourceNative} 值的指针。 * @param data 表明更新数据信息{@link OhosImageSourceUpdateData}的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果解码失败,返回{@link IMAGE_RESULT_DECODE_FAILED}; + * 如果图像解码头错误,返回{@link IMAGE_RESULT_DECODE_HEAD_ABNORMAL}; + * 如果创建解码器失败,返回 {@link IMAGE_RESULT_CREATE_DECODER_FAILED}; + * 如果创建编码器失败,返回 {@link IMAGE_RESULT_CREATE_ENCODER_FAILED}; + * 如果检查格式不对,返回{@IMAGE_RESULT_CHECK_FORMAT_ERROR }; + * 如果skia错误,返回 {@link IMAGE_RESULT_THIRDPART_SKIA_ERROR}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}; + * 如果共享内存错误,返回 {@link IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST}; + * 如果共享内存数据异常,返回 {@link IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL}; + * 如果图片解码异常,返回{@link IMAGE_RESULT_DECODE_ABNORMAL}; + * 如果图像错误,返回 {@link IMAGE_RESULT_MALLOC_ABNORMAL}; + * 如果图片初始化错误,返回 {@link IMAGE_RESULT_DATA_UNSUPPORT}; + * 如果图片输入数据错误,返回 {@link IMAGE_RESULT_INIT_ABNORMAL}; + * 如果裁剪错误,返回 {@link IMAGE_RESULT_CROP}; + * 如果图片格式未知,返回 {@link IMAGE_RESULT_UNKNOWN_FORMAT}; + * 如果注册插件失败,返回 {@link IMAGE_RESULT_PLUGIN_REGISTER_FAILED}; + * 如果创建插件失败。返回 {@link IMAGE_RESULT_PLUGIN_CREATE_FAILED}; + * 如果增加位图失败,返回 {@link IMAGE_RESULT_ENCODE_FAILED}; + * 如果不支持图片硬解码,返回 {@link IMAGE_RESULT_HW_DECODE_UNSUPPORT}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_HW_DECODE_FAILED}; + * 如果ipc失败,返回 {@link IMAGE_RESULT_ERR_IPC}; + * 如果索引无效,返回 {@link IMAGE_RESULT_INDEX_INVALID}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_ALPHA_TYPE_ERROR}; + * 如果硬解码失败,返回 {@link IMAGE_RESULT_ALLOCATER_TYPE_ERROR}。 * @see {@link ImageSourceNative}, {@link OhosImageSourceUpdateData} * * @Syscap SystemCapability.Multimedia.Image @@ -582,7 +790,12 @@ int32_t OH_ImageSource_UpdateData(const ImageSourceNative* native, struct OhosIm * @brief 释放native层图像源 ImageSourceNative。 * * @param native 表明native层 {@link ImageSourceNative} 值的指针。 - * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS};如果操作失败,返回其他结果代码。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * 如果获取图片数据异常,返回 {@link IMAGE_RESULT_GET_DATA_ABNORMAL}; + * 如果输入图片数据错误,返回 {@link IMAGE_RESULT_DATA_ABNORMAL}。 * @see {@link ImageSourceNative}, {@link OH_ImageSource_Create}, {@link OH_ImageSource_CreateIncremental} * * @Syscap SystemCapability.Multimedia.Image @@ -593,7 +806,4 @@ int32_t OH_ImageSource_Release(ImageSourceNative* native); #ifdef __cplusplus }; #endif -/** @} */ -} // namespace Media -} // namespace OHOS #endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H_ \ No newline at end of file -- Gitee From ba02be9813d7a610cff5a00f168d4cfc2674773c Mon Sep 17 00:00:00 2001 From: shegangbin Date: Tue, 18 Jul 2023 18:27:18 +0800 Subject: [PATCH 0009/2135] native_buffer new interface Signed-off-by: shegangbin --- zh-cn/native_sdk/graphic/native_buffer.h | 135 ++++++++++++++++++++++- 1 file changed, 131 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index 46a98cab..f93f3b39 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -32,6 +32,8 @@ * * @brief 定义获取和使用NativeBuffer的相关函数 * + * @library libnative_buffer.so + * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer * @since 9 * @version 1.0 */ @@ -54,6 +56,114 @@ struct OH_NativeBuffer; */ typedef struct OH_NativeBuffer OH_NativeBuffer; +/** + * @brief OH_NativeBuffer的用途。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 10 + * @version 1.0 + */ +enum OH_NativeBuffer_Usage { + /** + * CPU可读 + */ + NATIVEBUFFER_USAGE_CPU_READ = (1ULL << 0), + /** + * CPU可写 + */ + NATIVEBUFFER_USAGE_CPU_WRITE = (1ULL << 1), + /** + * 直接内存访问缓冲区 + */ + NATIVEBUFFER_USAGE_MEM_DMA = (1ULL << 3), +}; + +/** + * @brief OH_NativeBuffer的格式。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 10 + * @version 1.0 + */ +enum OH_NativeBuffer_Format { + /** + * RGB565格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGB_565 = 3, + /** + * RGBA5658格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_5658, + /** + * RGBX4444格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGBX_4444, + /** + * RGBA4444格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_4444, + /** + * RGB444格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGB_444, + /** + * RGBX5551格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGBX_5551, + /** + * RGBA5551格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_5551, + /** + * RGB555格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGB_555, + /** + * RGBX8888格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGBX_8888, + /** + * RGBA8888格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_8888, + /** + * RGB888格式 + */ + NATIVEBUFFER_PIXEL_FMT_RGB_888, + /** + * BGR565格式 + */ + NATIVEBUFFER_PIXEL_FMT_BGR_565, + /** + * BGRX4444格式 + */ + NATIVEBUFFER_PIXEL_FMT_BGRX_4444, + /** + * BGRA4444格式 + */ + NATIVEBUFFER_PIXEL_FMT_BGRA_4444, + /** + * BGRX5551格式 + */ + NATIVEBUFFER_PIXEL_FMT_BGRX_5551, + /** + * BGRA5551格式 + */ + NATIVEBUFFER_PIXEL_FMT_BGRA_5551, + /** + * BGRX8888格式 + */ + NATIVEBUFFER_PIXEL_FMT_BGRX_8888, + /** + * BGRA8888格式 + */ + NATIVEBUFFER_PIXEL_FMT_BGRA_8888, + /** + * 无效格式 + */ + NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF +}; + /** * @brief OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性 * @@ -62,10 +172,27 @@ typedef struct OH_NativeBuffer OH_NativeBuffer; * @version 1.0 */ typedef struct { - int32_t width; // 宽度(像素) - int32_t height; // 高度(像素) - int32_t format; // 像素格式 - int32_t usage; // buffer的用途说明 + /** + * 宽度(像素) + */ + int32_t width; + /** + * 高度(像素) + */ + int32_t height; + /** + * 像素格式 + */ + int32_t format; + /** + * buffer的用途说明 + */ + int32_t usage; + /** + * 本地窗口缓冲区步幅 + * @since 10 + */ + int32_t stride; } OH_NativeBuffer_Config; /** -- Gitee From 1fb40842d484558cabb9d87661a35f97c20af8c4 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Thu, 24 Aug 2023 14:44:39 +0800 Subject: [PATCH 0010/2135] update docs Signed-off-by: Annie_wang --- en/native_sdk/database/rdb/oh_cursor.h | 237 +++++++++++ en/native_sdk/database/rdb/oh_predicates.h | 391 ++++++++++++++++++ en/native_sdk/database/rdb/oh_value_object.h | 118 ++++++ en/native_sdk/database/rdb/oh_values_bucket.h | 142 +++++++ en/native_sdk/database/rdb/relational_store.h | 326 +++++++++++++++ .../rdb/relational_store_error_code.h | 316 ++++++++++++++ 6 files changed, 1530 insertions(+) create mode 100644 en/native_sdk/database/rdb/oh_cursor.h create mode 100644 en/native_sdk/database/rdb/oh_predicates.h create mode 100644 en/native_sdk/database/rdb/oh_value_object.h create mode 100644 en/native_sdk/database/rdb/oh_values_bucket.h create mode 100644 en/native_sdk/database/rdb/relational_store.h create mode 100644 en/native_sdk/database/rdb/relational_store_error_code.h diff --git a/en/native_sdk/database/rdb/oh_cursor.h b/en/native_sdk/database/rdb/oh_cursor.h new file mode 100644 index 00000000..ead52a92 --- /dev/null +++ b/en/native_sdk/database/rdb/oh_cursor.h @@ -0,0 +1,237 @@ +/* + * 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 OH_CURSOR_H +#define OH_CURSOR_H + +/** + * @addtogroup RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * A complete set of mechanisms for managing local databases is provided based on the underlying SQLite. + * To satisfy different needs in complicated scenarios, the RDB module provides a series of methods 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 oh_cursor.h + * + * @brief Provides methods to access the result set obtained by querying an RDB store. + * + * A result set is a set of results returned by query(). + * + * @since 10 + */ + +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the types of the fields in an RDB store. + * + * @since 10 + */ +typedef enum OH_ColumnType { + /** NULL */ + TYPE_NULL = 0, + /** INT64 */ + TYPE_INT64, + /** REAL */ + TYPE_REAL, + /** Text */ + TYPE_TEXT, + /** BLOB */ + TYPE_BLOB, +} OH_ColumnType; + +/** + * @brief Defines the result set. + * + * You can use the APIs to access the result set obtained by querying the RDB store. + * + * @since 10 + */ +typedef struct OH_Cursor { + /** @brief Unique identifier of the OH_Cursor struct. */ + int64_t id; + + /** + * @brief Obtains the number of columns in a result set. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param count Indicates the pointer to the number of columns in the result set obtained. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getColumnCount)(OH_Cursor *cursor, int *count); + + /** + * @brief Obtains the type of the data in the column specified by the column index. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param columnIndex Indicates the index of the column in the result set. + * @param columnType Indicates the pointer to the data type obtained. For details, see {@link OH_ColumnType}. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor, OH_ColumnType. + * @since 10 + */ + int (*getColumnType)(OH_Cursor *cursor, int32_t columnIndex, OH_ColumnType *columnType); + + /** + * @brief Obtains the column index based on the specified column name. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param name Indicates the pointer to the name of the column in the result set. + * @param columnIndex Indicates the pointer to the index of the column obtained. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getColumnIndex)(OH_Cursor *cursor, const char *name, int *columnIndex); + + /** + * @brief Obtains the column name based on the specified column index. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param columnIndex Indicates the index of the column in the result set. + * @param name Indicates the pointer to the column name obtained. + * @param length Indicates the length of the column name obtained. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getColumnName)(OH_Cursor *cursor, int32_t columnIndex, char *name, int length); + + /** + * @brief Obtains the number of rows in a result set. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param count Indicates the pointer to the number of rows in the result set obtained. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getRowCount)(OH_Cursor *cursor, int *count); + + /** + * @brief Goes to the next row of the result set. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*goToNextRow)(OH_Cursor *cursor); + + /** + * @brief Obtains information about the memory required when the column data type in the result set is BLOB or TEXT. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param columnIndex Indicates the index of the column in the result set. + * @param size Indicates the pointer to the memory size obtained. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getSize)(OH_Cursor *cursor, int32_t columnIndex, size_t *size); + + /** + * @brief Obtains the value in the form of a string based on the specified column and the current row. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param columnIndex Indicates the index of the column in the result set. + * @param value Indicates the pointer to the string obtained. + * @param length Indicates the length of the value, which is obtained by getSize(). + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getText)(OH_Cursor *cursor, int32_t columnIndex, char *value, int length); + + /** + * @brief Obtains the value of the int64_t type based on the specified column and the current row. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param columnIndex Indicates the index of the column in the result set. + * @param value Indicates the pointer to the value obtained. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getInt64)(OH_Cursor *cursor, int32_t columnIndex, int64_t *value); + + /** + * @brief Obtains the value of the double type based on the specified column and the current row. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param columnIndex Indicates the index of the column in the result set. + * @param value Indicates the pointer to the value obtained. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getReal)(OH_Cursor *cursor, int32_t columnIndex, double *value); + + /** + * @brief Obtains the value in the form of a byte array based on the specified column and the current row. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param columnIndex Indicates the index of the column in the result set. + * @param value Indicates the pointer to the string obtained. + * @param length Indicates the length of the value, which is obtained by getSize(). + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*getBlob)(OH_Cursor *cursor, int32_t columnIndex, unsigned char *value, int length); + + /** + * @brief Checks whether the value in the specified column is null. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @param columnIndex Indicates the index of the column in the result set. + * @param isNull Indicates the pointer to the check result. The value true means the value is null; + * the value false means the opposite. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*isNull)(OH_Cursor *cursor, int32_t columnIndex, bool *isNull); + + /** + * @brief Destroys a result set. + * + * @param cursor Indicates the pointer to the {@link OH_Cursor} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Cursor. + * @since 10 + */ + int (*destroy)(OH_Cursor *cursor); +} OH_Cursor; + +#ifdef __cplusplus +}; +#endif + +#endif // OH_CURSOR_H diff --git a/en/native_sdk/database/rdb/oh_predicates.h b/en/native_sdk/database/rdb/oh_predicates.h new file mode 100644 index 00000000..243461ef --- /dev/null +++ b/en/native_sdk/database/rdb/oh_predicates.h @@ -0,0 +1,391 @@ +/* + * 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 OH_PREDICATES_H +#define OH_PREDICATES_H + +/** + * @addtogroup RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * A complete set of mechanisms for managing local databases is provided based on the underlying SQLite. + * To satisfy different needs in complicated scenarios, the RDB module provides a series of methods 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 oh_predicates.h + * + * @brief Represents a predicate for a relational database (RDB). + * + * @since 10 + */ + +#include +#include +#include "oh_value_object.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the sorting types. + * + * @since 10 + */ +typedef enum OH_OrderType { + /** Ascending order. */ + ASC = 0, + /** Descending order. */ + DESC = 1, +} OH_OrderType; + +/** + * @brief Defines a Predicates instance. + * + * @since 10 + */ +typedef struct OH_Predicates { + /** Unique identifier of the OH_Predicates struct. */ + int64_t id; + + /** + * @brief Sets a Predicates instance to match the field whose value is equal to the specified value. + * + * This method is equivalent to "=" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*equalTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates instance to match the field whose value is not equal to the specified value. + * + * This method is equivalent to "!=" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*notEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Adds a left parenthesis to the Predicates instance. + * + * This method is equivalent to "(" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @return Returns a Predicates instance with a left parenthesis. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*beginWrap)(OH_Predicates *predicates); + + /** + * @brief Adds a right parenthesis to the Predicates instance. + * + * This method is equivalent to ")" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @return Returns a Predicates instance with a right parenthesis. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*endWrap)(OH_Predicates *predicates); + + /** + * @brief Adds the OR operator to the Predicates instance. + * + * This method is equivalent to "OR" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @return Returns a Predicates instance with the OR operator. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*orOperate)(OH_Predicates *predicates); + + /** + * @brief Adds the AND operator to the Predicates instance. + * + * This method is equivalent to "AND" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @return Returns a Predicates instance with the AND operator. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*andOperate)(OH_Predicates *predicates); + + /** + * @brief Sets a Predicates instance to match the field whose value is null. + * + * This method is equivalent to "IS NULL" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @return Returns the Predicates instance created. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*isNull)(OH_Predicates *predicates, const char *field); + + /** + * @brief Sets a Predicates instance to match the field whose value is not null. + * + * This method is equivalent to "IS NOT NULL" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @return Returns the Predicates instance created. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*isNotNull)(OH_Predicates *predicates, const char *field); + + /** + * @brief Sets a Predicates instance to match a string that is similar to the specified value. + * + * This method is equivalent to "LIKE" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*like)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates instance to match the field whose value is within the specified range. + * + * This method is equivalent to "BETWEEN" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value range to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*between)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates instance to match the field whose value is out of the specified range. + * + * This method is equivalent to "NOT BETWEEN" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the range to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*notBetween)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates instance to match the field with value greater than the specified value. + * + * This method is equivalent to ">" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*greaterThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates instance to match the field with value less than the specified value. + * + * This method is equivalent to "<" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*lessThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates instance to match the field with value greater than or equal to + * the specified value. + * This method is equivalent to ">=" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*greaterThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates instance to match the field with value less than or equal to the specified value. + * + * This method is equivalent to "<=" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*lessThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates instance to sort the values in a column in ascending or descending order. + * + * This method is equivalent to "ORDER BY" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the column name in the database table. + * @param type Indicates the sorting type {@link OH_OrderType}. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_OrderType. + * @since 10 + */ + OH_Predicates *(*orderBy)(OH_Predicates *predicates, const char *field, OH_OrderType type); + + /** + * @brief Sets a Predicates instance to filter out duplicate records. + * + * This method is equivalent to "DISTINCT" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @return Returns a Predicates instance that can filter duplicate records. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*distinct)(OH_Predicates *predicates); + + /** + * @brief Sets a Predicates instance that specifies the maximum number of records. + * + * This method is equivalent to "LIMIT" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param value Indicates the maximum number of data records. + * @return Returns the Predicates instance created. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*limit)(OH_Predicates *predicates, unsigned int value); + + /** + * @brief Sets a Predicates instance that specifies the start position of the returned result. + * + * This method is equivalent to "OFFSET" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param rowOffset Indicates the start position of the returned result. The value is a positive integer. + * @return Returns the Predicates instance created. + * @see OH_Predicates. + * @since 10 + * @version 1.0 + */ + OH_Predicates *(*offset)(OH_Predicates *predicates, unsigned int rowOffset); + + /** + * @brief Sets a Predicates instance to group rows that have the same value into summary rows. + * + * This method is equivalent to "GROUP BY" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param fields Indicates the pointer to the columns to group. + * @param length Indicates the length of the fields value. + * @return Returns the Predicates instance created. + * @see OH_Predicates. + * @since 10 + */ + OH_Predicates *(*groupBy)(OH_Predicates *predicates, char const *const *fields, int length); + + /** + * @brief Sets a Predicates to match the field with the value within the specified range. + * + * This method is equivalent to "IN" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the name of the column in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + */ + OH_Predicates *(*in)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Sets a Predicates to match the field with the value out of the specified range. + * + * This method is equivalent to "NOT IN" in SQL statements. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @param field Indicates the pointer to the name of the column in the database table. + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance, which is the value to match. + * @return Returns the Predicates instance created. + * @see OH_Predicates, OH_VObject. + * @since 10 + * @version 1.0 + */ + OH_Predicates *(*notIn)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); + + /** + * @brief Clears a Predicates instance. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @return Returns the Predicates instance cleared. + * @see OH_Predicates. + * @since 10 + * @version 1.0 + */ + OH_Predicates *(*clear)(OH_Predicates *predicates); + + /** + * @brief Destroys a {@link OH_Predicates} instance and reclaims the memory occupied. + * + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Predicates. + * @since 10 + */ + int (*destroy)(OH_Predicates *predicates); +} OH_Predicates; + +#ifdef __cplusplus +}; +#endif + +#endif // OH_PREDICATES_H diff --git a/en/native_sdk/database/rdb/oh_value_object.h b/en/native_sdk/database/rdb/oh_value_object.h new file mode 100644 index 00000000..5c9f6e74 --- /dev/null +++ b/en/native_sdk/database/rdb/oh_value_object.h @@ -0,0 +1,118 @@ +/* +* 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 OH_VALUE_OBJECT_H +#define OH_VALUE_OBJECT_H + +/** + * @addtogroup RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * A complete set of mechanisms for managing local databases is provided based on the underlying SQLite. + * To satisfy different needs in complicated scenarios, the RDB module provides a series of methods 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 oh_value_object.h + * + * @brief Provides data conversion methods. + * + * @since 10 + */ + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines the allowed data field types. + * + * @since 10 + */ +typedef struct OH_VObject { + /** Unique identifier of the OH_VObject struct. */ + int64_t id; + + /** + * @brief Converts an int64 value or array into a value of the {@link OH_VObject} type. + * + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. + * @param value Indicates the pointer to the value or array to convert. + * @param count Indicates the number or length of the parameters to convert. If value points to a single + * parameter, count is 1. If value points to an array, count specifies the array length. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VObject. + * @since 10 + */ + int (*putInt64)(OH_VObject *valueObject, int64_t *value, uint32_t count); + + /** + * @brief Converts a double value or array into a value of the {@link OH_VObject} type. + * + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. + * @param value Indicates the pointer to the double value or array to convert. + * @param count Indicates the number or length of the parameters to convert. If value points to a single + * parameter, count is 1. If value points to an array, count specifies the array length. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VObject. + * @since 10 + */ + int (*putDouble)(OH_VObject *valueObject, double *value, uint32_t count); + + /** + * @brief Converts a character array of the char type into a value of the {@link OH_VObject} type. + * + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. + * @param value Indicates the pointer to the character array to convert. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VObject. + * @since 10 + */ + int (*putText)(OH_VObject *valueObject, const char *value); + + /** + * @brief Converts a string array of the char type into a value of the {@link OH_VObject} type. + * + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. + * @param value Indicates the pointer to the string array to convert. + * @param count Indicates the length of the string array to convert. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VObject. + * @since 10 + */ + int (*putTexts)(OH_VObject *valueObject, const char **value, uint32_t count); + + /** + * @brief Destroys a {@link OH_VObject} instance and reclaims the memory occupied. + * + * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VObject. + * @since 10 + */ + int (*destroy)(OH_VObject *valueObject); +} OH_VObject; + +#ifdef __cplusplus +}; +#endif + +#endif // OH_VALUE_OBJECT_H diff --git a/en/native_sdk/database/rdb/oh_values_bucket.h b/en/native_sdk/database/rdb/oh_values_bucket.h new file mode 100644 index 00000000..2b056383 --- /dev/null +++ b/en/native_sdk/database/rdb/oh_values_bucket.h @@ -0,0 +1,142 @@ +/* + * 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 OH_VALUES_BUCKET_H +#define OH_VALUES_BUCKET_H + +/** + * @addtogroup RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * A complete set of mechanisms for managing local databases is provided based on the underlying SQLite. + * To satisfy different needs in complicated scenarios, the RDB module provides a series of methods 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 oh_values_bucket.h + * + * @brief Defines the types of the key and value in a key-value (KV) pair. + * + * @since 10 + */ + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines the types of the key and value in a KV pair. + * + * @since 10 + */ +typedef struct OH_VBucket { + /** Unique identifier of the OH_VBucket struct. */ + int64_t id; + + /** Number of the KV pairs in the struct. */ + uint16_t capability; + + /** + * @brief Puts a char value into the {@link OH_VBucket} instance in the given column. + * + * @param bucket Indicates the pointer to the {@link OH_VBucket} instance. + * @param field Indicates the pointer to the column name. + * @param value Indicates the pointer to the value to put. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VBucket. + * @since 10 + */ + int (*putText)(OH_VBucket *bucket, const char *field, const char *value); + + /** + * @brief Puts an int64_t value into the {@link OH_VBucket} instance in the given column. + * + * @param bucket Indicates the pointer to the {@link OH_VBucket} instance. + * @param field Indicates the pointer to the column name. + * @param value Indicates the value to put. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VBucket. + * @since 10 + */ + int (*putInt64)(OH_VBucket *bucket, const char *field, int64_t value); + + /** + * @brief Puts a double value into the {@link OH_VBucket} instance in the given column. + * + * @param bucket Indicates the pointer to the {@link OH_VBucket} instance. + * @param field Indicates the pointer to the column name. + * @param value Indicates the value to put. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VBucket. + * @since 10 + */ + int (*putReal)(OH_VBucket *bucket, const char *field, double value); + + /** + * @brief Puts a const uint8_t value into the {@link OH_VBucket} object in the given column. + * + * @param bucket Indicates the pointer to the {@link OH_VBucket} instance. + * @param field Indicates the pointer to the column name. + * @param value Indicates the pointer to the value to put. + * @param size Indicates the length of the value. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VBucket. + * @since 10 + */ + int (*putBlob)(OH_VBucket *bucket, const char *field, const uint8_t *value, uint32_t size); + + /** + * @brief Puts null into the {@link OH_VBucket} instance in the given column. + * + * @param bucket Indicates the pointer to the {@link OH_VBucket} instance. + * @param field Indicates the pointer to the column name. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VBucket. + * @since 10 + */ + int (*putNull)(OH_VBucket *bucket, const char *field); + + /** + * @brief Clears an {@link OH_VBucket} instance. + * + * @param bucket Indicates the pointer to the {@link OH_VBucket} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VBucket. + * @since 10 + */ + int (*clear)(OH_VBucket *bucket); + + /** + * @brief Destroys a {@link OH_VBucket} instance and reclaims the memory occupied. + * + * @param bucket Indicates the pointer to the {@link OH_VBucket} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_VBucket. + * @since 10 + */ + int (*destroy)(OH_VBucket *bucket); +} OH_VBucket; + +#ifdef __cplusplus +}; +#endif + +#endif // OH_VALUES_BUCKET_H diff --git a/en/native_sdk/database/rdb/relational_store.h b/en/native_sdk/database/rdb/relational_store.h new file mode 100644 index 00000000..f0d22418 --- /dev/null +++ b/en/native_sdk/database/rdb/relational_store.h @@ -0,0 +1,326 @@ +/* + * 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 RELATIONAL_STORE_H +#define RELATIONAL_STORE_H + +/** + * @addtogroup RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * A complete set of mechanisms for managing local databases is provided based on the underlying SQLite. + * To satisfy different needs in complicated scenarios, the RDB module provides a series of methods 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.h + * + * @brief Provides methods for managing relational database (RDB) stores. + * + * @since 10 + */ + +#include "oh_cursor.h" +#include "oh_predicates.h" +#include "oh_value_object.h" +#include "oh_values_bucket.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the RDB store security levels. + * + * @since 10 + */ +typedef enum OH_Rdb_SecurityLevel { + /** + * @brief S1: indicates the low security level. + * + * If data leakage occurs, minor impact will be caused. + */ + S1 = 1, + /** + * @brief S2: indicates the medium security level. + * + * If data leakage occurs, moderate impact will be caused. + */ + S2, + /** + * @brief S3: indicates the high security level. + * + If data leakage occurs, major impact will be caused. + */ + S3, + /** + * @brief S4: indicates the critical security level. + * + * If data leakage occurs, critical impact will be caused. + */ + S4 +} OH_Rdb_SecurityLevel; + +/** + * @brief Defines the RDB store configuration. + * + * @since 10 + */ +#pragma pack(1) +typedef struct { + /** Size of the struct. */ + int selfSize; + /** Database file path. */ + const char *dataBaseDir; + /** Application bundle name. */ + const char *bundleName; + /** Application module name. */ + const char *moduleName; + /** Whether to encrypt the RDB store. */ + bool isEncrypt; + /** RDB store security level. For details, see {@link OH_Rdb_SecurityLevel}. */ + int securityLevel; +} OH_Rdb_Config; +#pragma pack() + +/** + * @brief Defines the database type. + * + * @since 10 + */ +typedef struct { + /** Unique identifier of the OH_Rdb_Store struct. */ + int64_t id; +} OH_Rdb_Store; + +/** + * @brief Creates an {@link OH_VObject} instance. + * + * @return Returns the pointer to the {@link OH_VObject} instance created if the operation is successful; + * returns NULL otherwise. + * @see OH_VObject. + * @since 10 + */ +OH_VObject *OH_Rdb_CreateValueObject(void); + +/** + * @brief Creates an {@link OH_VBucket} instance. + * + * @return Returns the pointer to the {@link OH_VBucket} instance created if the operation is successful; + * returns NULL otherwise. + * @see OH_VBucket. + * @since 10 + */ +OH_VBucket *OH_Rdb_CreateValuesBucket(void); + +/** + * @brief Creates an {@link OH_Predicates} instance. + * + * @param table Indicates the pointer to the name of the database table. + * @return Returns the pointer to the {@link OH_Predicates} instance created if the operation is successful; + * returns NULL otherwise. + * @see OH_Predicates. + * @since 10 + */ +OH_Predicates *OH_Rdb_CreatePredicates(const char *table); + +/** + * @brief Obtains an {@link OH_Rdb_Store} instance for RDB store operations. + * + * @param config Indicates the pointer to the {@link OH_Rdb_Config} instance, which is the RDB store configuration. + * @param errCode Indicates the pointer to the function execution status. + * @return Returns the pointer to the {@link OH_Rdb_Store} instance created if the operation is successful; + * returns NULL otherwise. + * @see OH_Rdb_Config, OH_Rdb_Store. + * @since 10 + */ +OH_Rdb_Store *OH_Rdb_GetOrOpen(const OH_Rdb_Config *config, int *errCode); + +/** + * @brief Destroys a {@link OH_Rdb_Store} instance and reclaims the memory occupied. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_CloseStore(OH_Rdb_Store *store); + +/** + * @brief Deletes an RDB store based on the specified database file configuration. + * + * @param path Indicates the pointer to the database file path. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @since 10 + */ +int OH_Rdb_DeleteStore(const OH_Rdb_Config *config); + +/** + * @brief Insert a row of data into a table. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param table Indicates the pointer to the name of the target table. + * @param valuesBucket Indicates the pointer to the data row {@link OH_VBucket} to insert. + * @return Returns the row ID if the operation is successful; returns an error code otherwise. + * @see OH_Rdb_Store, OH_VBucket. + * @since 10 + */ +int OH_Rdb_Insert(OH_Rdb_Store *store, const char *table, OH_VBucket *valuesBucket); + +/** + * @brief Updates data in an RDB store based on specified conditions. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param valuesBucket Indicates the pointer to the data {@link OH_VBucket} to be written to the table. + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance, which specifies the update conditions. + * @return Returns the number of updated rows if the operation is successful; returns an error code otherwise. + * @see OH_Rdb_Store, OH_Bucket, OH_Predicates. + * @since 10 + */ +int OH_Rdb_Update(OH_Rdb_Store *store, OH_VBucket *valuesBucket, OH_Predicates *predicates); + +/** + * @brief Deletes data from an RDB store based on specified conditions. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance, which specifies the deletion + * conditions. + * @return Returns the number of rows deleted if the operation is successful; returns an error code otherwise. + * @see OH_Rdb_Store, OH_Predicates. + * @since 10 + */ +int OH_Rdb_Delete(OH_Rdb_Store *store, OH_Predicates *predicates); + +/** + * @brief Queries data in an RDB store based on specified conditions. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param predicates Indicates the pointer to the {@link OH_Predicates} instance, which specifies the query conditions. + * @param columnNames Indicates the pointer to the columns to be queried. If this parameter is not specified, + * the query applies to all columns. + * @param length Indicates the length of the columnNames array. + * @return Returns the pointer to the {@link OH_Cursor} instance if the operation is successful; returns NULL otherwise. + * @see OH_Rdb_Store, OH_Predicates, OH_Cursor. + * @since 10 + */ +OH_Cursor *OH_Rdb_Query(OH_Rdb_Store *store, OH_Predicates *predicates, const char *const *columnNames, int length); + +/** + * @brief Executes an SQL statement that contains specified arguments but returns no value. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param sql Indicates the pointer to the SQL statement to execute. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_Execute(OH_Rdb_Store *store, const char *sql); + +/** + * @brief Executes the SQL statement to query data in an RDB store. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param sql Indicates the pointer to the SQL statement to execute. + * @return Returns the pointer to the {@link OH_Cursor} instance if the operation is successful; returns NULL otherwise. + * @see OH_Rdb_Store. + * @since 10 + */ +OH_Cursor *OH_Rdb_ExecuteQuery(OH_Rdb_Store *store, const char *sql); + +/** + * @brief Starts the transaction before executing an SQL statement. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_BeginTransaction(OH_Rdb_Store *store); + +/** + * @brief Rolls back the SQL statements executed. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_RollBack(OH_Rdb_Store *store); + +/** + * @brief Submits the SQL statements executed. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_Commit(OH_Rdb_Store *store); + +/** + * @brief Backs up an RDB store in the specified directory. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param databasePath Indicates the pointer to the backup file path of the database. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_Backup(OH_Rdb_Store *store, const char *databasePath); + +/** + * @brief Restores an RDB store from the specified database backup file. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param databasePath Indicates the pointer to the backup file path of the database. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_Restore(OH_Rdb_Store *store, const char *databasePath); + +/** + * @brief Obtains the RDB store version. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param version Indicates the pointer to the version number. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_GetVersion(OH_Rdb_Store *store, int *version); + +/** + * @brief Sets the RDB store version. + * + * @param store Indicates the pointer to the {@link OH_Rdb_Store} instance. + * @param version Indicates the version to set. + * @return Returns the operation result. If the operation fails, an error code is returned. + * @see OH_Rdb_Store. + * @since 10 + */ +int OH_Rdb_SetVersion(OH_Rdb_Store *store, int version); + +#ifdef __cplusplus +}; +#endif + +#endif // RELATIONAL_STORE_H diff --git a/en/native_sdk/database/rdb/relational_store_error_code.h b/en/native_sdk/database/rdb/relational_store_error_code.h new file mode 100644 index 00000000..71d32aa4 --- /dev/null +++ b/en/native_sdk/database/rdb/relational_store_error_code.h @@ -0,0 +1,316 @@ +/* + * 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 RELATIONAL_STORE_ERRNO_CODE_H +#define RELATIONAL_STORE_ERRNO_CODE_H + +/** + * @addtogroup RDB + * @{ + * + * The relational database (RDB) store manages data based on relational models. + * A complete set of mechanisms for managing local databases is provided based on the underlying SQLite. + * To satisfy different needs in complicated scenarios, the RDB module provides a series of methods 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 Declares the error code information about a relational database (RDB) store. + * + * @since 10 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the error codes. + * + * @since 10 + */ +typedef enum OH_Rdb_ErrCode { + /** + * Execution failed. + */ + RDB_ERR = -1, + + /** + * Execution successful. + */ + RDB_OK = 0, + + /** + * Error code base. + */ + E_BASE = 14800000, + + /** + * Capability not supported. + */ + RDB_E_NOT_SUPPORTED = 801, + + /** + * Error codes for common exceptions. + */ + RDB_E_ERROR = E_BASE, + + /** + * Invalid parameter. + */ + RDB_E_INVALID_ARGS = (E_BASE + 1), + + /** + * Failed to update data because the RDB store is read-only. + */ + RDB_E_CANNOT_UPDATE_READONLY = (E_BASE + 2), + + /** + * Failed to delete the file. + */ + RDB_E_REMOVE_FILE = (E_BASE + 3), + + /** + * The table name is empty. + */ + RDB_E_EMPTY_TABLE_NAME = (E_BASE + 5), + + /** + * The KV pair is empty. + */ + RDB_E_EMPTY_VALUES_BUCKET = (E_BASE + 6), + + /** + * Failed to execute the SQL statement for query. + */ + RDB_E_EXECUTE_IN_STEP_QUERY = (E_BASE + 7), + + /** + * Invalid column index. + */ + RDB_E_INVALID_COLUMN_INDEX = (E_BASE + 8), + + /** + * Invalid column type. + */ + RDB_E_INVALID_COLUMN_TYPE = (E_BASE + 9), + + /** + * The file name is empty. + */ + RDB_E_EMPTY_FILE_NAME = (E_BASE + 10), + + /** + * Invalid file path. + */ + RDB_E_INVALID_FILE_PATH = (E_BASE + 11), + + /** + * Failed to start the transaction. + */ + RDB_E_TRANSACTION_IN_EXECUTE = (E_BASE + 12), + + /** + * Failed to precompile the SQL statement. + */ + RDB_E_INVALID_STATEMENT = (E_BASE + 13), + + /** + * Failed to write data in a read connection. + */ + RDB_E_EXECUTE_WRITE_IN_READ_CONNECTION = (E_BASE + 14), + + /** + * Failed to start the transaction in a read connection. + */ + RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTION = (E_BASE + 15), + + /** + * The transaction to start does not exist in the database session. + */ + RDB_E_NO_TRANSACTION_IN_SESSION = (E_BASE + 16), + + /** + * Failed to execute multiple queries a database session. + */ + RDB_E_MORE_STEP_QUERY_IN_ONE_SESSION = (E_BASE + 17), + + /** + * The result set does not contain any record. + */ + RDB_E_NO_ROW_IN_QUERY = (E_BASE + 18), + + /** + * The number of bound parameters in the SQL statement is invalid. + */ + RDB_E_INVALID_BIND_ARGS_COUNT = (E_BASE + 19), + + /** + * Invalid object type. + */ + RDB_E_INVALID_OBJECT_TYPE = (E_BASE + 20), + + /** + * Invalid conflict resolution type. + */ + RDB_E_INVALID_CONFLICT_FLAG = (E_BASE + 21), + + /** + * The HAVING keyword can be used only after GROUP BY. + */ + RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BY = (E_BASE + 22), + + /** + * The result set in step format is not supported. + */ + RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SET = (E_BASE + 23), + + /** + * Failed to query the result set. + */ + RDB_E_STEP_RESULT_SET_CROSS_THREADS = (E_BASE + 24), + + /** + * The result set query statement is not executed. + */ + RDB_E_STEP_RESULT_QUERY_NOT_EXECUTED = (E_BASE + 25), + + /** + * The cursor is already in the last row of the result set. + */ + RDB_E_STEP_RESULT_IS_AFTER_LAST = (E_BASE + 26), + + /** + * The number of result set query times exceeds the limit. + */ + RDB_E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 27), + + /** + * The SQL statement is not precompiled. + */ + RDB_E_STATEMENT_NOT_PREPARED = (E_BASE + 28), + + /** + * Incorrect database execution result. + */ + RDB_E_EXECUTE_RESULT_INCORRECT = (E_BASE + 29), + + /** + * The result set is closed. + */ + RDB_E_STEP_RESULT_CLOSED = (E_BASE + 30), + + /** + * Relative path. + */ + RDB_E_RELATIVE_PATH = (E_BASE + 31), + + /** + * The new encrypt key file is empty. + */ + RDB_E_EMPTY_NEW_ENCRYPT_KEY = (E_BASE + 32), + + /** + * The RDB store is non-encrypted, which is cannot be changed. + */ + RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 33), + + /** + * The database does not respond when the database key is updated. + */ + RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSY = (E_BASE + 34), + + /** + * The precompiled SQL statement is not initialized. + */ + RDB_E_STEP_STATEMENT_NOT_INIT = (E_BASE + 35), + + /** + * The WAL mode does not support the ATTACH operation. + */ + RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE = (E_BASE + 36), + + /** + * Failed to create the folder. + */ + RDB_E_CREATE_FOLDER_FAIL = (E_BASE + 37), + + /** + * Failed to build the SQL statements. + */ + RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 38), + + /** + * The database session does not provide a connection. + */ + RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY = (E_BASE + 39), + + /** + * The transaction does not exist in the database session. + */ + RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40), + + /** + * The current operation is not supported. + */ + RDB_E_NOT_SUPPORT = (E_BASE + 41), + + /** + * Invalid PARCEL. + */ + RDB_E_INVALID_PARCEL = (E_BASE + 42), + + /** + * Failed to execute query. + */ + RDB_E_QUERY_IN_EXECUTE = (E_BASE + 43), + + /** + * Failed to set the persistence of the database file in WAL mode. + */ + RDB_E_SET_PERSIST_WAL = (E_BASE + 44), + + /** + * The database does not exist. + */ + RDB_E_DB_NOT_EXIST = (E_BASE + 45), + + /** + * The number of read connections to set is greater than the limit. + */ + RDB_E_ARGS_READ_CON_OVERLOAD = (E_BASE + 46), + + /** + * The WAL log file size exceeds the default value. + */ + RDB_E_WAL_SIZE_OVER_LIMIT = (E_BASE + 47), + + /** + * The number of database connections has reached the limit. + */ + RDB_E_CON_OVER_LIMIT = (E_BASE + 48) +} OH_Rdb_ErrCode; + +#ifdef __cplusplus +}; +#endif + +#endif // RELATIONAL_STORE_ERRNO_CODE_H -- Gitee From 38fd6a213a8e8e07cd204fd4daa1d995013cd125 Mon Sep 17 00:00:00 2001 From: Gloria Date: Fri, 25 Aug 2023 10:18:31 +0800 Subject: [PATCH 0011/2135] added En docs Signed-off-by: Gloria --- en/native_sdk/graphic/native_buffer.h | 202 ++++++++++++++++++++++---- en/native_sdk/graphic/native_vsync.h | 71 ++++++--- 2 files changed, 224 insertions(+), 49 deletions(-) diff --git a/en/native_sdk/graphic/native_buffer.h b/en/native_sdk/graphic/native_buffer.h index a4325f05..2947a5e2 100644 --- a/en/native_sdk/graphic/native_buffer.h +++ b/en/native_sdk/graphic/native_buffer.h @@ -20,7 +20,8 @@ * @addtogroup OH_NativeBuffer * @{ * - * @brief 提供NativeBuffer功能 + * @brief Provides the capabilities of NativeBuffer. Using the functions provided by this module, + * you can apply for, use, and release the shared memory, and query its attributes. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer * @since 9 @@ -30,8 +31,10 @@ /** * @file native_buffer.h * - * @brief 定义获取和使用NativeBuffer的相关函数 + * @brief Declares the functions for obtaining and using NativeBuffer. * + * @library libnative_buffer.so + * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer * @since 9 * @version 1.0 */ @@ -42,74 +45,213 @@ extern "C" { #endif +/** + * @brief Provides the declaration of an OH_NativeBuffer struct. + * @since 9 + */ struct OH_NativeBuffer; + +/** + * @brief Provides the declaration of an OH_NativeBuffer struct. + * @since 9 + */ typedef struct OH_NativeBuffer OH_NativeBuffer; /** - * @brief OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性 + * @brief Enumerates the OH_NativeBuffer usages. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 10 + * @version 1.0 + */ +enum OH_NativeBuffer_Usage { + /** + * Read by the CPU. + */ + NATIVEBUFFER_USAGE_CPU_READ = (1ULL << 0), + /** + * Write by the CPU. + */ + NATIVEBUFFER_USAGE_CPU_WRITE = (1ULL << 1), + /** + * Direct memory access to the buffer. + */ + NATIVEBUFFER_USAGE_MEM_DMA = (1ULL << 3), +}; + +/** + * @brief Enumerates the OH_NativeBuffer formats. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 10 + * @version 1.0 + */ +enum OH_NativeBuffer_Format { + /** + * RGB565. + */ + NATIVEBUFFER_PIXEL_FMT_RGB_565 = 3, + /** + * RGBA5658. + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_5658, + /** + * RGBX4444. + */ + NATIVEBUFFER_PIXEL_FMT_RGBX_4444, + /** + * RGBA4444. + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_4444, + /** + * RGB444. + */ + NATIVEBUFFER_PIXEL_FMT_RGB_444, + /** + * RGBX5551. + */ + NATIVEBUFFER_PIXEL_FMT_RGBX_5551, + /** + * RGBA5551. + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_5551, + /** + * RGB555. + */ + NATIVEBUFFER_PIXEL_FMT_RGB_555, + /** + * RGBX8888. + */ + NATIVEBUFFER_PIXEL_FMT_RGBX_8888, + /** + * RGBA8888. + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_8888, + /** + * RGB888. + */ + NATIVEBUFFER_PIXEL_FMT_RGB_888, + /** + * BGR565. + */ + NATIVEBUFFER_PIXEL_FMT_BGR_565, + /** + * BGRX4444. + */ + NATIVEBUFFER_PIXEL_FMT_BGRX_4444, + /** + * BGRA4444. + */ + NATIVEBUFFER_PIXEL_FMT_BGRA_4444, + /** + * BGRX5551. + */ + NATIVEBUFFER_PIXEL_FMT_BGRX_5551, + /** + * BGRA5551. + */ + NATIVEBUFFER_PIXEL_FMT_BGRA_5551, + /** + * BGRX8888. + */ + NATIVEBUFFER_PIXEL_FMT_BGRX_8888, + /** + * BGRA8888. + */ + NATIVEBUFFER_PIXEL_FMT_BGRA_8888, + /** + * Invalid format. + */ + NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF +}; + +/** + * @brief Defines the OH_NativeBuffer attribute configuration, which is used when you apply for + * a new OH_NativeBuffer instance or query the attributes of an existing instance. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer * @since 9 * @version 1.0 */ typedef struct { - int32_t width; // 宽度(像素) - int32_t height; // 高度(像素) - int32_t format; // 像素格式 - int32_t usage; // buffer的用途说明 + /** + * Width, in pixels. + */ + int32_t width; + /** + * Height, in pixels. + */ + int32_t height; + /** + * Pixel map format. + */ + int32_t format; + /** + * Description of the buffer usage. + */ + int32_t usage; + /** + * Stride of the local window buffer. + * @since 10 + */ + int32_t stride; } OH_NativeBuffer_Config; /** - * @brief 通过OH_NativeBuffer_Config创建OH_NativeBuffer实例,每次调用都会产生一个新的OH_NativeBuffer实例 + * @brief Creates an OH_NativeBuffer instance based on an OH_NativeBuffer_Config struct. + * A new OH_NativeBuffer instance is created each time this function is called. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer - * @param config 参数是一个指向OH_NativeBuffer属性的指针,类型为OH_NativeBuffer_Config - * @return 创建成功则返回一个指向OH_NativeBuffer结构体实例的指针,否则返回NULL + * @param config Pointer to an OH_NativeBuffer_Config instance. + * @return Returns the pointer to the OH_NativeBuffer instance created if the operation is successful; + * returns NULL otherwise. * @since 9 * @version 1.0 */ OH_NativeBuffer* OH_NativeBuffer_Alloc(const OH_NativeBuffer_Config* config); /** - * @brief 将OH_NativeBuffer对象的引用计数加1 + * @brief Increases the reference count of an OH_NativeBuffer instance by 1. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer - * @param buffer 参数是一个指向OH_NativeBuffer实例的指针 - * @return 返回一个由GSError定义的int32_t类型的错误码 + * @param buffer Pointer to an OH_NativeBuffer instance. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 */ int32_t OH_NativeBuffer_Reference(OH_NativeBuffer *buffer); /** - * @brief 将OH_NativeBuffer对象的引用计数减1,当引用计数为0的时候,该NativeBuffer对象会被析构掉 + * @brief Decreases the reference count of an OH_NativeBuffer instance by 1 and + * when the reference count reaches 0, destroys the instance. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer - * @param buffer 参数是一个指向OH_NativeBuffer实例的指针 - * @return 返回一个由GSError定义的int32_t类型的错误码 + * @param buffer Pointer to an OH_NativeBuffer instance. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 */ int32_t OH_NativeBuffer_Unreference(OH_NativeBuffer *buffer); /** - * @brief 用于获取OH_NativeBuffer的属性 + * @brief Obtains the attributes of an OH_NativeBuffer instance. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer - * @param buffer 参数是一个指向OH_NativeBuffer实例的指针 - * @param config 参数是一个指向OH_NativeBuffer_Config的指针,用于接收OH_NativeBuffer的属性 + * @param buffer Pointer to an OH_NativeBuffer instance. + * @param config Pointer to an OH_NativeBuffer_Config instance, which is used to + * receive the attributes of OH_NativeBuffer. * @since 9 * @version 1.0 */ void OH_NativeBuffer_GetConfig(OH_NativeBuffer *buffer, OH_NativeBuffer_Config* config); /** - * @brief 将OH_NativeBuffer对应的ION内存映射到进程空间 + * @brief Maps the ION memory corresponding to an OH_NativeBuffer instance to the process address space. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer - * @param buffer 参数是一个指向OH_NativeBuffer实例的指针 - * @param virAddr 参数是一个二级指针,二级指针指向虚拟内存的地址 - * @return 返回一个由GSError定义的int32_t类型的错误码 + * @param buffer Pointer to an OH_NativeBuffer instance. + * @param virAddr Double pointer to the address of the virtual memory. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 */ @@ -117,22 +259,22 @@ void OH_NativeBuffer_GetConfig(OH_NativeBuffer *buffer, OH_NativeBuffer_Config* int32_t OH_NativeBuffer_Map(OH_NativeBuffer *buffer, void **virAddr); /** - * @brief 将OH_NativeBuffer对应的ION内存从进程空间移除 + * @brief Unmaps the ION memory corresponding to an OH_NativeBuffer instance from the process address space. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer - * @param buffer 参数是一个指向OH_NativeBuffer实例的指针 - * @return 返回一个由GSError定义的int32_t类型的错误码 + * @param buffer Pointer to an OH_NativeBuffer instance. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 */ int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); /** - * @brief 获取OH_NativeBuffer的序列号 + * @brief Obtains the sequence number of an OH_NativeBuffer instance. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer - * @param buffer 参数是一个指向OH_NativeBuffer实例的指针 - * @return 返回对应OH_NativeBuffer的唯一序列号 + * @param buffer Pointer to an OH_NativeBuffer instance. + * @return Returns the unique sequence number of the OH_NativeBuffer instance. * @since 9 * @version 1.0 */ @@ -143,4 +285,4 @@ uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); #endif /** @} */ -#endif \ No newline at end of file +#endif diff --git a/en/native_sdk/graphic/native_vsync.h b/en/native_sdk/graphic/native_vsync.h index b17473e5..6aa5a113 100644 --- a/en/native_sdk/graphic/native_vsync.h +++ b/en/native_sdk/graphic/native_vsync.h @@ -20,19 +20,19 @@ * @addtogroup NativeVsync * @{ * - * @brief 提供NativeVsync功能 + * @brief Provides the capabilities of native virtual synchronization (VSync). * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @since 8 + * @since 9 * @version 1.0 */ /** * @file native_vsync.h * - * @brief 定义获取和使用NativeVsync的相关函数 + * @brief Declares the functions for obtaining and using NativeVSync. * - * @since 8 + * @since 9 * @version 1.0 */ @@ -40,46 +40,79 @@ extern "C" { #endif +/** + * @brief Provides the declaration of an OH_NativeVSync struct. + * @since 9 + */ struct OH_NativeVSync; + +/** + * @brief Provides the declaration of an OH_NativeVSync struct. + * @since 9 + */ typedef struct OH_NativeVSync OH_NativeVSync; + +/** + * @brief Defines the pointer to a VSync callback function. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync + * @param timestamp VSync timestamp. + * @param data Custom data. + * @since 9 + * @version 1.0 + */ typedef void (*OH_NativeVSync_FrameCallback)(long long timestamp, void *data); /** - * @brief 创建一个OH_NativeVSync实例,每次调用都会产生一个新的实例 + * @brief Creates an OH_NativeVSync instance. A new OH_NativeVSync instance is created + * each time this function is called. * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @param name 参数表示一个vsync连接的名字 - * @param length 参数是name的长度 - * @return 返回一个指向OH_NativeVSync实例的指针 - * @since 8 + * @param name Pointer to the name that associates with an OH_NativeVSync instance. + * @param length Length of the name. + * @return Returns the pointer to an OH_NativeVSync instance. + * @since 9 * @version 1.0 */ OH_NativeVSync* OH_NativeVSync_Create(const char* name, unsigned int length); /** - * @brief 销毁OH_NativeVSync实例 + * @brief Destroys an OH_NativeVSync instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @param nativeVsync 参数是一个指向OH_NativeVSync实例的指针 - * @since 8 + * @param nativeVsync Pointer to an OH_NativeVSync instance. + * @since 9 * @version 1.0 */ void OH_NativeVSync_Destroy(OH_NativeVSync* nativeVsync); /** - * @brief 请求下一次vsync信号,当信号到来时,调用回调函数callback + * @brief Requests the next VSync signal. When the signal arrives, a callback function is invoked. * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @param nativeVsync 参数是一个指向OH_NativeVSync实例的指针 - * @param callback 参数是一个OH_NativeVSync_FrameCallback类型的函数指针,当下一次vsync信号到来时会被调用 - * @param data 参数是一个指向用户自定义数据结构的指针,类型是void* - * @return 返回一个由GSError定义的int32_t类型的错误码 - * @since 8 + * @param nativeVsync Pointer to an OH_NativeVSync instance. + * @param callback Function pointer of the OH_NativeVSync_FrameCallback type. + * This function pointer will be called when the next VSync signal arrives. + * @param data Pointer to the custom data struct. The type is void*. + * @return Returns 0 if the operation is successful. + * @since 9 * @version 1.0 */ int OH_NativeVSync_RequestFrame(OH_NativeVSync* nativeVsync, OH_NativeVSync_FrameCallback callback, void* data); + +/** + * @brief Obtains the VSync period. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync + * @param nativeVsync Pointer to an OH_NativeVSync instance. + * @param period Pointer to the VSync period. + * @return Returns 0 if the operation is successful. + * @since 10 + * @version 1.0 + */ +int OH_NativeVSync_GetPeriod(OH_NativeVSync* nativeVsync, long long* period); #ifdef __cplusplus } #endif -#endif \ No newline at end of file +#endif -- Gitee From 4d412baf13238f26885459811f22e9c69f0d3ec8 Mon Sep 17 00:00:00 2001 From: lihuihui Date: Fri, 25 Aug 2023 10:35:10 +0800 Subject: [PATCH 0012/2135] rdb Signed-off-by: lihuihui --- zh-cn/native_sdk/database/rdb/relational_store.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zh-cn/native_sdk/database/rdb/relational_store.h b/zh-cn/native_sdk/database/rdb/relational_store.h index 2824f40a..32a7c881 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store.h +++ b/zh-cn/native_sdk/database/rdb/relational_store.h @@ -88,6 +88,8 @@ typedef struct { int selfSize; /** 数据库文件路径。 */ const char *dataBaseDir; + /** 数据库名称。 */ + const char *storeName; /** 应用包名。 */ const char *bundleName; /** 应用模块名。 */ -- Gitee From fd65acb1a1838f122a8585baa0eb8edf7505fcfc Mon Sep 17 00:00:00 2001 From: lihuihui Date: Fri, 25 Aug 2023 16:42:06 +0800 Subject: [PATCH 0013/2135] rdb Signed-off-by: lihuihui --- zh-cn/native_sdk/database/rdb/relational_store.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/database/rdb/relational_store.h b/zh-cn/native_sdk/database/rdb/relational_store.h index 32a7c881..59345f07 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store.h +++ b/zh-cn/native_sdk/database/rdb/relational_store.h @@ -210,7 +210,7 @@ int OH_Rdb_Delete(OH_Rdb_Store *store, OH_Predicates *predicates); * @param store 表示指向{@link OH_Rdb_Store}实例的指针。 * @param predicates 表示指向{@link OH_Predicates}实例的指针,指定查询条件。 * @param columnNames 表示要查询的列。如果值为空,则查询应用于所有列。 - * @param length 表示columnNames数组的长度。 + * @param length 表示columnNames数组的长度,该参数用户需保证其正确性。 * @return 如果查询成功则返回一个指向{@link OH_Cursor}结构体实例的指针,否则返回NULL。 * @see OH_Rdb_Store, OH_Predicates, OH_Cursor. * @since 10 -- Gitee From 7fcf400c8bebfb0ee8dceca315c93d554b176653 Mon Sep 17 00:00:00 2001 From: lihuihui Date: Mon, 28 Aug 2023 15:12:23 +0800 Subject: [PATCH 0014/2135] rdb Signed-off-by: lihuihui --- zh-cn/native_sdk/database/rdb/relational_store.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/database/rdb/relational_store.h b/zh-cn/native_sdk/database/rdb/relational_store.h index 59345f07..a8b5d85f 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store.h +++ b/zh-cn/native_sdk/database/rdb/relational_store.h @@ -210,7 +210,7 @@ int OH_Rdb_Delete(OH_Rdb_Store *store, OH_Predicates *predicates); * @param store 表示指向{@link OH_Rdb_Store}实例的指针。 * @param predicates 表示指向{@link OH_Predicates}实例的指针,指定查询条件。 * @param columnNames 表示要查询的列。如果值为空,则查询应用于所有列。 - * @param length 表示columnNames数组的长度,该参数用户需保证其正确性。 + * @param length 表示columnNames数组的长度。若length大于columnNames数组的实际长度,则会访问越界。 * @return 如果查询成功则返回一个指向{@link OH_Cursor}结构体实例的指针,否则返回NULL。 * @see OH_Rdb_Store, OH_Predicates, OH_Cursor. * @since 10 -- Gitee From ed8931c14ee0fa77bb8e869bf0623008d1ba035e Mon Sep 17 00:00:00 2001 From: wuchengwen Date: Mon, 11 Sep 2023 09:54:58 +0800 Subject: [PATCH 0015/2135] fix:add permission tag Signed-off-by: wuchengwen --- zh-cn/native_sdk/usb/usb_ddk_api.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zh-cn/native_sdk/usb/usb_ddk_api.h b/zh-cn/native_sdk/usb/usb_ddk_api.h index 0eae136f..9e97e58b 100644 --- a/zh-cn/native_sdk/usb/usb_ddk_api.h +++ b/zh-cn/native_sdk/usb/usb_ddk_api.h @@ -48,6 +48,7 @@ extern "C" { /** * @brief 初始化DDK。 * + * @permission ohos.permission.ACCESS_DDK_USB * @return 成功返回0,否则返回负数。 * @since 10 * @version 1.0 @@ -57,6 +58,7 @@ int32_t OH_Usb_Init(void); /** * @brief 释放DDK * + * @permission ohos.permission.ACCESS_DDK_USB * @since 10 * @version 1.0 */ @@ -65,6 +67,7 @@ void OH_Usb_Release(void); /** * @brief 获取设备描述符。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId 设备ID,代表要获取描述符的设备。 * @param desc 设备描述符,详细定义请参考{@link UsbDeviceDescriptor}。 * @return 成功返回0,否则返回负数。 @@ -76,6 +79,7 @@ int32_t OH_Usb_GetDeviceDescriptor(uint64_t deviceId, struct UsbDeviceDescriptor /** * @brief 获取配置描述符。请在描述符使用完后使用{@link OH_Usb_FreeConfigDescriptor}释放描述符,否则会造成内存泄露。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId 设备ID,代表要获取配置描述符的设备。 * @param configIndex 配置id,对应USB协议中的{@link bConfigurationValue}。 * @param config 配置描述符,包含USB协议中定义的标准配置描述符,以及与其关联的接口描述符和端点描述符。 @@ -89,6 +93,7 @@ int32_t OH_Usb_GetConfigDescriptor( /** * @brief 释放配置描述符,请在描述符使用完后释放描述符,否则会造成内存泄露。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param config 配置描述符,通过{@link OH_Usb_GetConfigDescriptor}获得的配置描述符。 * @since 10 * @version 1.0 @@ -98,6 +103,7 @@ void OH_Usb_FreeConfigDescriptor(const struct UsbDdkConfigDescriptor * const con /** * @brief 声明接口。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId 设备ID,代表要操作的设备。 * @param interfaceIndex 接口索引,对应USB协议中的{@link bInterfaceNumber}。 * @param interfaceHandle 接口操作句柄,接口声明成功后,该参数将会被赋值。 @@ -110,6 +116,7 @@ int32_t OH_Usb_ClaimInterface(uint64_t deviceId, uint8_t interfaceIndex, uint64_ /** * @brief 释放接口。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle 接口操作句柄,代表要释放的接口。 * @return 成功返回0,否则返回负数。 * @since 10 @@ -120,6 +127,7 @@ int32_t OH_Usb_ReleaseInterface(uint64_t interfaceHandle); /** * @brief 激活接口的备用设置。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle 接口操作句柄,代表要操作的接口。 * @param settingIndex 备用设置索引,对应USB协议中的{@link bAlternateSetting}。 * @return 成功返回0,否则返回负数。 @@ -131,6 +139,7 @@ int32_t OH_Usb_SelectInterfaceSetting(uint64_t interfaceHandle, uint8_t settingI /** * @brief 获取接口当前激活的备用设置。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle 接口操作句柄,代表要操作的接口。 * @param settingIndex 备用设置索引,对应USB协议中的{@link bAlternateSetting}。 * @return 成功返回0,否则返回负数。 @@ -142,6 +151,7 @@ int32_t OH_Usb_GetCurrentInterfaceSetting(uint64_t interfaceHandle, uint8_t *set /** * @brief 发送控制读请求,该接口为同步接口。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle 接口操作句柄,代表要操作的接口。 * @param setup 请求相关的参数,详细定义请参考{@link UsbControlRequestSetup}。 * @param timeout 超时时间,单位为毫秒。 @@ -157,6 +167,7 @@ int32_t OH_Usb_SendControlReadRequest(uint64_t interfaceHandle, const struct Usb /** * @brief 发送控制写请求,该接口为同步接口。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle 接口操作句柄,代表要操作的接口。 * @param setup 请求相关的参数,详细定义请参考{@link UsbControlRequestSetup}。 * @param timeout 超时时间,单位为毫秒。 @@ -172,6 +183,7 @@ int32_t OH_Usb_SendControlWriteRequest(uint64_t interfaceHandle, const struct Us /** * @brief 发送管道请求,该接口为同步接口。中断传输和批量传输都使用该接口发送请求。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param pipe 要传输数据的管道信息。 * @param devMmap 数据缓冲区,可以通过{@link OH_Usb_CreateDeviceMemMap}获得。 * @return 成功返回0,否则返回负数。 @@ -183,6 +195,7 @@ int32_t OH_Usb_SendPipeRequest(const struct UsbRequestPipe *pipe, UsbDeviceMemMa /** * @brief 创建缓冲区。请在缓冲区使用完后,调用{@link OH_Usb_DestroyDeviceMemMap}销毁缓冲区,否则会造成资源泄露。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId 设备ID,代表要创建缓冲区的设备。 * @param size 缓冲区的大小。 * @param devMmap 创建的缓冲区通过该参数返回给调用者。 @@ -195,6 +208,7 @@ int32_t OH_Usb_CreateDeviceMemMap(uint64_t deviceId, size_t size, UsbDeviceMemMa /** * @brief 销毁缓冲区。请在缓冲区使用完后及时销毁缓冲区,否则会造成资源泄露。 * + * @permission ohos.permission.ACCESS_DDK_USB * @param devMmap 销毁由{@link OH_Usb_CreateDeviceMemMap}创建的缓冲区。 * @since 10 * @version 1.0 -- Gitee From 1623ad513586b581411e2257eb870690deccdd04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=9B=E5=B0=9A=E5=8D=8E?= Date: Fri, 15 Sep 2023 02:58:03 +0000 Subject: [PATCH 0016/2135] =?UTF-8?q?update=20zh-cn/native=5Fsdk/usb/usb?= =?UTF-8?q?=5Fddk=5Fapi.h.=20=E6=A0=87=E9=A2=98Ddk=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=A4=A7=E5=86=99DDK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 葛尚华 --- zh-cn/native_sdk/usb/usb_ddk_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/usb/usb_ddk_api.h b/zh-cn/native_sdk/usb/usb_ddk_api.h index 9e97e58b..38604067 100644 --- a/zh-cn/native_sdk/usb/usb_ddk_api.h +++ b/zh-cn/native_sdk/usb/usb_ddk_api.h @@ -16,7 +16,7 @@ #define USB_DDK_API_H /** - * @addtogroup UsbDdk + * @addtogroup UsbDDK * @{ * * @brief 提供USB DDK接口,包括主机侧打开和关闭接口、管道同步异步读写通信、控制传输、中断传输等。 -- Gitee From c306ceeb6deadeead3b29929ef68866691003427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=9B=E5=B0=9A=E5=8D=8E?= Date: Fri, 15 Sep 2023 02:58:43 +0000 Subject: [PATCH 0017/2135] =?UTF-8?q?update=20zh-cn/native=5Fsdk/usb/usb?= =?UTF-8?q?=5Fddk=5Ftypes.h.=20=E6=A0=87=E9=A2=98Ddk=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=A4=A7=E5=86=99DDK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 葛尚华 --- zh-cn/native_sdk/usb/usb_ddk_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/usb/usb_ddk_types.h b/zh-cn/native_sdk/usb/usb_ddk_types.h index ac6ced32..8b4f90ae 100644 --- a/zh-cn/native_sdk/usb/usb_ddk_types.h +++ b/zh-cn/native_sdk/usb/usb_ddk_types.h @@ -16,7 +16,7 @@ #ifndef USB_DDK_TYPES_H #define USB_DDK_TYPES_H /** - * @addtogroup UsbDdk + * @addtogroup UsbDDK * @{ * * @brief 提供USB DDK接口,包括主机侧打开和关闭接口、管道同步异步读写通信、控制传输、中断传输等。 -- Gitee From b8ab2e91d1be4438c64695d558265c8a70a767d4 Mon Sep 17 00:00:00 2001 From: shegangbin Date: Mon, 18 Sep 2023 09:12:34 +0800 Subject: [PATCH 0018/2135] add so in headers Signed-off-by: shegangbin --- zh-cn/native_sdk/graphic/external_window.h | 1 + zh-cn/native_sdk/graphic/native_image.h | 1 + zh-cn/native_sdk/graphic/native_vsync.h | 1 + zh-cn/native_sdk/graphic/vulkan_ohos.h | 1 + 4 files changed, 4 insertions(+) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index 812a188f..fa6b4b7b 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -32,6 +32,7 @@ * * @brief 定义获取和使用NativeWindow的相关函数 * + * @library libnative_window.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index f4201de9..b36b4b71 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -32,6 +32,7 @@ * * @brief 定义获取和使用NativeImage的相关函数 * + * @library libnative_image.so * @since 9 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_vsync.h b/zh-cn/native_sdk/graphic/native_vsync.h index 29d25730..c862a1e3 100644 --- a/zh-cn/native_sdk/graphic/native_vsync.h +++ b/zh-cn/native_sdk/graphic/native_vsync.h @@ -32,6 +32,7 @@ * * @brief 定义获取和使用NativeVsync的相关函数 * + * @library libnative_vsync.so * @since 9 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/vulkan_ohos.h b/zh-cn/native_sdk/graphic/vulkan_ohos.h index cb18d465..8d54ad70 100644 --- a/zh-cn/native_sdk/graphic/vulkan_ohos.h +++ b/zh-cn/native_sdk/graphic/vulkan_ohos.h @@ -29,6 +29,7 @@ * * @brief 定义了OpenHarmony平台扩展的Vulkan接口。引用文件:。 * + * @library libvulkan.so * @since 10 * @version 1.0 */ -- Gitee From 1398db2f35e2a752af839d1c3bdf95a7da03f69b Mon Sep 17 00:00:00 2001 From: geshanghua Date: Tue, 19 Sep 2023 15:38:04 +0800 Subject: [PATCH 0019/2135] Description:Add a reference to the .so library Feature or Bugfix:Bugfix Binary Source: No Signed-off-by: geshanghua --- zh-cn/native_sdk/usb/usb_ddk_api.h | 2 +- zh-cn/native_sdk/usb/usb_ddk_types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/usb/usb_ddk_api.h b/zh-cn/native_sdk/usb/usb_ddk_api.h index 38604067..67c00656 100644 --- a/zh-cn/native_sdk/usb/usb_ddk_api.h +++ b/zh-cn/native_sdk/usb/usb_ddk_api.h @@ -32,7 +32,7 @@ * @brief 声明用于主机侧访问设备的USB DDK接口。 * * 引用文件: - * + * @library libusb_ndk.z.so * @since 10 * @version 1.0 */ diff --git a/zh-cn/native_sdk/usb/usb_ddk_types.h b/zh-cn/native_sdk/usb/usb_ddk_types.h index 8b4f90ae..9591e6ad 100644 --- a/zh-cn/native_sdk/usb/usb_ddk_types.h +++ b/zh-cn/native_sdk/usb/usb_ddk_types.h @@ -32,7 +32,7 @@ * @brief 提供USB DDK中的枚举变量、结构体定义与宏定义。 * * 引用文件: - * + * @library libusb_ndk.z.so * @since 10 * @version 1.0 */ -- Gitee From f9cb03881cde0d4a424ceb02193a7e78d9c4c0d0 Mon Sep 17 00:00:00 2001 From: marui Date: Wed, 20 Sep 2023 16:49:21 +0800 Subject: [PATCH 0020/2135] 9.20 add .so Signed-off-by: marui --- zh-cn/native_sdk/database/rdb/oh_cursor.h | 2 +- zh-cn/native_sdk/database/rdb/oh_predicates.h | 2 +- zh-cn/native_sdk/database/rdb/oh_value_object.h | 2 +- zh-cn/native_sdk/database/rdb/oh_values_bucket.h | 2 +- zh-cn/native_sdk/database/rdb/relational_store.h | 2 +- zh-cn/native_sdk/database/rdb/relational_store_error_code.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zh-cn/native_sdk/database/rdb/oh_cursor.h b/zh-cn/native_sdk/database/rdb/oh_cursor.h index 8a61c671..73a49e21 100644 --- a/zh-cn/native_sdk/database/rdb/oh_cursor.h +++ b/zh-cn/native_sdk/database/rdb/oh_cursor.h @@ -33,7 +33,7 @@ * @brief 提供通过查询数据库生成的数据库结果集的访问方法。 * * 结果集是指用户调用关系型数据库查询接口之后返回的结果集合,提供了多种灵活的数据访问方式,以便用户获取各项数据。 - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/oh_predicates.h b/zh-cn/native_sdk/database/rdb/oh_predicates.h index 2d9a0dd4..ce8188b0 100644 --- a/zh-cn/native_sdk/database/rdb/oh_predicates.h +++ b/zh-cn/native_sdk/database/rdb/oh_predicates.h @@ -31,7 +31,7 @@ * @file oh_predicates.h * * @brief 表示关系型数据库(RDB)的谓词。 - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/oh_value_object.h b/zh-cn/native_sdk/database/rdb/oh_value_object.h index c7fdd65b..8647b11f 100644 --- a/zh-cn/native_sdk/database/rdb/oh_value_object.h +++ b/zh-cn/native_sdk/database/rdb/oh_value_object.h @@ -31,7 +31,7 @@ * @file oh_value_object.h * * @brief 提供类型转换方法。 - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/oh_values_bucket.h b/zh-cn/native_sdk/database/rdb/oh_values_bucket.h index 57f35317..f28e7102 100644 --- a/zh-cn/native_sdk/database/rdb/oh_values_bucket.h +++ b/zh-cn/native_sdk/database/rdb/oh_values_bucket.h @@ -31,7 +31,7 @@ * @file oh_values_bucket.h * * @brief 用于存储键值对的类型。 - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/relational_store.h b/zh-cn/native_sdk/database/rdb/relational_store.h index a8b5d85f..ffd9de6a 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store.h +++ b/zh-cn/native_sdk/database/rdb/relational_store.h @@ -32,7 +32,7 @@ * @file relational_store.h * * @brief 提供管理关系数据库(RDB)方法的接口。 - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/relational_store_error_code.h b/zh-cn/native_sdk/database/rdb/relational_store_error_code.h index fcc75408..31ab3a86 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store_error_code.h +++ b/zh-cn/native_sdk/database/rdb/relational_store_error_code.h @@ -32,7 +32,7 @@ * @file relational_store_error_code.h * * @brief 声明关系型数据库(RDB)的错误码信息。 - * + * @library native_rdb_ndk_header.so * @since 10 */ -- Gitee From e7e5fae1e1fbc8f2efc8add2474b43ee89bf55dc Mon Sep 17 00:00:00 2001 From: chengfeng27 Date: Thu, 21 Sep 2023 17:43:06 +0800 Subject: [PATCH 0021/2135] add libso name Signed-off-by: chengfeng27 --- zh-cn/native_sdk/ai/mindspore/context.h | 245 ++++++++++------------ zh-cn/native_sdk/ai/mindspore/data_type.h | 1 + zh-cn/native_sdk/ai/mindspore/format.h | 1 + zh-cn/native_sdk/ai/mindspore/model.h | 89 ++++---- zh-cn/native_sdk/ai/mindspore/status.h | 2 + zh-cn/native_sdk/ai/mindspore/tensor.h | 123 +++++------ zh-cn/native_sdk/ai/mindspore/types.h | 1 + 7 files changed, 228 insertions(+), 234 deletions(-) diff --git a/zh-cn/native_sdk/ai/mindspore/context.h b/zh-cn/native_sdk/ai/mindspore/context.h index 19f78681..09e76a61 100644 --- a/zh-cn/native_sdk/ai/mindspore/context.h +++ b/zh-cn/native_sdk/ai/mindspore/context.h @@ -28,7 +28,8 @@ * @file context.h * * @brief 提供了Context相关的接口,可以配置运行时信息。 - * + * + * @library libmindspore_lite_ndk.so * @since 9 */ #ifndef MINDSPORE_INCLUDE_C_API_CONTEXT_C_H @@ -52,13 +53,13 @@ typedef void *OH_AI_ContextHandle; /** * @brief Mindspore的运行设备信息的指针。 - * + * * @since 9 */ typedef void *OH_AI_DeviceInfoHandle; /** - * \brief 创建一个上下文的对象。 + * @brief 创建一个上下文的对象。 * * @return 指向上下文信息的{@link OH_AI_ContextHandle}。 * @since 9 @@ -66,351 +67,337 @@ typedef void *OH_AI_DeviceInfoHandle; OH_AI_API OH_AI_ContextHandle OH_AI_ContextCreate(); /** - * \brief 释放上下文对象。 + * @brief 释放上下文对象。 * - * \param context 指向{@link OH_AI_ContextHandle}的二级指针,上下文销毁后会对context置为空指针。 + * @param context 指向{@link OH_AI_ContextHandle}的二级指针,上下文销毁后会对context置为空指针。 * @since 9 */ OH_AI_API void OH_AI_ContextDestroy(OH_AI_ContextHandle *context); /** - * \brief 设置运行时的线程数量。 + * @brief 设置运行时的线程数量。 * - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle} - * \param thread_num 运行时的线程数量。 + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle} + * @param thread_num 运行时的线程数量。 * @since 9 */ OH_AI_API void OH_AI_ContextSetThreadNum(OH_AI_ContextHandle context, int32_t thread_num); /** - * \brief 获取线程数量。 + * @brief 获取线程数量。 * - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 - * \return 当前的线程数量。 + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 + * @return 当前的线程数量。 * @since 9 */ OH_AI_API int32_t OH_AI_ContextGetThreadNum(const OH_AI_ContextHandle context); /** - * \brief 设置运行时线程绑定CPU核心的策略,按照CPU物理核频率分为大、中、小三种类型的核心,并且仅需绑大核或者绑中核,不需要绑小核。 + * @brief 设置运行时线程绑定CPU核心的策略,按照CPU物理核频率分为大、中、小三种类型的核心,并且仅需绑大核或者绑中核,不需要绑小核。 * - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 - * \param mode 绑核策略。一共有三种策略,0为不绑核, 1为大核优先, 2为中核优先。 + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 + * @param mode 绑核策略。一共有三种策略,0为不绑核, 1为大核优先, 2为中核优先。 * @since 9 */ OH_AI_API void OH_AI_ContextSetThreadAffinityMode(OH_AI_ContextHandle context, int mode); /** - * \brief 获取运行时线程绑定CPU核心的策略。 + * @brief 获取运行时线程绑定CPU核心的策略。 * - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 - * \return 绑核策略。一共有三种策略,0为不绑核, 1为大核优先, 2为中核优先。 + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 + * @return 绑核策略。一共有三种策略,0为不绑核, 1为大核优先, 2为中核优先。 * @since 9 */ OH_AI_API int OH_AI_ContextGetThreadAffinityMode(const OH_AI_ContextHandle context); /** - * \brief 设置运行时线程绑定CPU核心的列表。 + * @brief 设置运行时线程绑定CPU核心的列表。 * * 例如:当core_list=[2,6,8]时,则线程会在CPU的第2,6,8个核心上运行。 * 如果对于同一个上下文对象,调用了{@link OH_AI_ContextSetThreadAffinityMode}和{@link OH_AI_ContextSetThreadAffinityCoreList} * 这两个函数,则仅{@link OH_AI_ContextSetThreadAffinityCoreList}的core_list参数生效,而{@link OH_AI_ContextSetThreadAffinityMode}的 mode参数不生效。 * - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 - * \param core_list CPU绑核的列表。 - * \param core_num 核的数量,它就代表{@link core_list}的长度。 + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 + * @param core_list CPU绑核的列表。 + * @param core_num 核的数量,它就代表{@link core_list}的长度。 * @since 9 */ OH_AI_API void OH_AI_ContextSetThreadAffinityCoreList(OH_AI_ContextHandle context, const int32_t *core_list, size_t core_num); /** - * \brief 获取CPU绑核列表。 - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 - * \param core_num 该参数是输出参数,表示核的数量。 - * \return CPU绑核列表。此列表对象由{@link OH_AI_ContextHandle}管理,调用者无须手动释放。 + * @brief 获取CPU绑核列表。 * + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 + * @param core_num 该参数是输出参数,表示核的数量。 + * @return CPU绑核列表。此列表对象由{@link OH_AI_ContextHandle}管理,调用者无须手动释放。 * @since 9 */ OH_AI_API const int32_t *OH_AI_ContextGetThreadAffinityCoreList(const OH_AI_ContextHandle context, size_t *core_num); /** - * \brief 设置运行时是否支持并行。此接口特性当前未开启,设置无效。 + * @brief 设置运行时是否支持并行。此接口特性当前未开启,设置无效。 * - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 - * \param is_parallel 是否支持并行。true 为支持并行, false 为不支持并行。 + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 + * @param is_parallel 是否支持并行。true 为支持并行, false 为不支持并行。 * @since 9 */ OH_AI_API void OH_AI_ContextSetEnableParallel(OH_AI_ContextHandle context, bool is_parallel); /** - * \brief 获取是否支持算子间并行。 + * @brief 获取是否支持算子间并行。 * - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 - * \return 是否支持并行。true 为支持并行, false 为不支持并行。 + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 + * @return 是否支持并行。true 为支持并行, false 为不支持并行。 * @since 9 */ OH_AI_API bool OH_AI_ContextGetEnableParallel(const OH_AI_ContextHandle context); /** - * \brief 将一个用户定义的运行设备信息附加到推理上下文中。 + * @brief 将一个用户定义的运行设备信息附加到推理上下文中。 * - * \param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param context 指向上下文信息实例的{@link OH_AI_ContextHandle}。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 * @since 9 */ OH_AI_API void OH_AI_ContextAddDeviceInfo(OH_AI_ContextHandle context, OH_AI_DeviceInfoHandle device_info); /** - * \brief 创建一个设备信息对象。 - * - * \param device_type 设备类型, 具体见{@link OH_AI_DeviceType}。 + * @brief 创建一个设备信息对象。 * - * \return 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param device_type 设备类型, 具体见{@link OH_AI_DeviceType}。 + * @return 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 * @since 9 */ OH_AI_API OH_AI_DeviceInfoHandle OH_AI_DeviceInfoCreate(OH_AI_DeviceType device_type); /** - * \brief 释放设备信息实例。注意:设备信息实例被添加到context后,无须调用者手动释放。 + * @brief 释放设备信息实例。注意:设备信息实例被添加到context后,无须调用者手动释放。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 * @since 9 */ OH_AI_API void OH_AI_DeviceInfoDestroy(OH_AI_DeviceInfoHandle *device_info); /** - * \brief 设置供应商的名称。 + * @brief 设置供应商的名称。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \param provider 供应商的名称。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param provider 供应商的名称。 * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetProvider(OH_AI_DeviceInfoHandle device_info, const char *provider); /** - * \brief 获取生产商的名称。 + * @brief 获取生产商的名称。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * - * \return 生产商的名称。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @return 生产商的名称。 * @since 9 */ OH_AI_API const char *OH_AI_DeviceInfoGetProvider(const OH_AI_DeviceInfoHandle device_info); /** - * \brief 设置生产商设备的名称。 + * @brief 设置生产商设备的名称。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \param device 生产商设备名称。例如: CPU。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param device 生产商设备名称。例如: CPU。 * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetProviderDevice(OH_AI_DeviceInfoHandle device_info, const char *device); /** - * \brief 获取生产商设备的名称。 - * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @brief 获取生产商设备的名称。 * - * \return 生产商设备的名称。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @return 生产商设备的名称。 * @since 9 */ OH_AI_API const char *OH_AI_DeviceInfoGetProviderDevice(const OH_AI_DeviceInfoHandle device_info); /** - * \brief 获取设备的类型。 + * @brief 获取设备的类型。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \return 生产商设备类型。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @return 生产商设备类型。 * @since 9 */ OH_AI_API OH_AI_DeviceType OH_AI_DeviceInfoGetDeviceType(const OH_AI_DeviceInfoHandle device_info); /** - * \brief 设置是否开启float16推理模式,仅CPU/GPU设备可用。 + * @brief 设置是否开启float16推理模式,仅CPU/GPU设备可用。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \param is_fp16 是否开启float16推理模式。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param is_fp16 是否开启float16推理模式。 * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetEnableFP16(OH_AI_DeviceInfoHandle device_info, bool is_fp16); /** - * \brief 获取是否开启float16推理模式, 仅CPU/GPU设备可用。 + * @brief 获取是否开启float16推理模式, 仅CPU/GPU设备可用。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \return 设置是否开启float16推理模式。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @return 设置是否开启float16推理模式。 * @since 9 */ OH_AI_API bool OH_AI_DeviceInfoGetEnableFP16(const OH_AI_DeviceInfoHandle device_info); /** - * \brief 设置NPU的频率,仅NPU设备可用。 + * @brief 设置NPU的频率,仅NPU设备可用。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \param frequency 频率类型,取值范围为0-4,默认是3。1表示低功耗,2表示平衡,3表示高性能,4表示超高性能。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param frequency 频率类型,取值范围为0-4,默认是3。1表示低功耗,2表示平衡,3表示高性能,4表示超高性能。 * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetFrequency(OH_AI_DeviceInfoHandle device_info, int frequency); /** - * \brief 获取NPU的频率类型,仅NPU设备可用。 - * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @brief 获取NPU的频率类型,仅NPU设备可用。 * - * \return NPU的频率类型。取值范围为0-4,1表示低功耗,2表示平衡,3表示高性能,4表示超高性能。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @return NPU的频率类型。取值范围为0-4,1表示低功耗,2表示平衡,3表示高性能,4表示超高性能。 * @since 9 */ OH_AI_API int OH_AI_DeviceInfoGetFrequency(const OH_AI_DeviceInfoHandle device_info); /** - * \brief 获取系统中所有NNRT硬件设备的描述信息。 + * @brief 获取系统中所有NNRT硬件设备的描述信息。 * - * \param num 输出参数,返回设备数量。 - * - * \return 指向NNRT设备描述信息实例数组的指针。当获取失败时,返回NULL。 + * @param num 输出参数,返回设备数量。 + * @return 指向NNRT设备描述信息实例数组的指针。当获取失败时,返回NULL。 * @since 10 */ OH_AI_API NNRTDeviceDesc *OH_AI_GetAllNNRTDeviceDescs(size_t *num); /** - * \brief 获取NNRT设备描述信息数组中的元素指针。 - * - * \param descs NNRT设备描述信息数组。 - * \param index 数组元素索引。 + * @brief 获取NNRT设备描述信息数组中的元素指针。 * - * \return NNRT设备描述信息类型指针。 + * @param descs NNRT设备描述信息数组。 + * @param index 数组元素索引。 + * @return NNRT设备描述信息类型指针。 * @since 10 */ OH_AI_API NNRTDeviceDesc *OH_AI_GetElementOfNNRTDeviceDescs(NNRTDeviceDesc *descs, size_t index); /** - * \brief 销毁从{@link OH_AI_GetAllNNRTDeviceDescs}获取的NNRT描写信息实例数组。 + * @brief 销毁从{@link OH_AI_GetAllNNRTDeviceDescs}获取的NNRT描写信息实例数组。 * - * \param desc 指向NNRT设备描述信息实例数组的二重指针。销毁结束,desc指向内容会被置为NULL。 + * @param desc 指向NNRT设备描述信息实例数组的二重指针。销毁结束,desc指向内容会被置为NULL。 * @since 10 */ OH_AI_API void OH_AI_DestroyAllNNRTDeviceDescs(NNRTDeviceDesc **desc); /** - * \brief 从特定的NNRT设备描述信息实例获取NNRT设备ID。注意,此ID只对NNRT有效。 + * @brief 从特定的NNRT设备描述信息实例获取NNRT设备ID。注意,此ID只对NNRT有效。 * - * \param desc 指向NNRT设备描述信息实例的指针。 - * - * \return NNRT设备ID。 + * @param desc 指向NNRT设备描述信息实例的指针。 + * @return NNRT设备ID。 * @since 10 */ OH_AI_API size_t OH_AI_GetDeviceIdFromNNRTDeviceDesc(const NNRTDeviceDesc *desc); /** - * \brief 从特定的NNRT设备描述信息实例获取NNRT设备名称。 - * - * \param desc 指向NNRT设备描述信息实例的指针。 + * @brief 从特定的NNRT设备描述信息实例获取NNRT设备名称。 * - * \return NNRT设备名称,指向一个常量字符串的指针,该常量字符串由desc持有,调用者无需单独释放此指针。 + * @param desc 指向NNRT设备描述信息实例的指针。 + * @return NNRT设备名称,指向一个常量字符串的指针,该常量字符串由desc持有,调用者无需单独释放此指针。 * @since 10 */ OH_AI_API const char *OH_AI_GetNameFromNNRTDeviceDesc(const NNRTDeviceDesc *desc); /** - * \brief 从特定的NNRT设备描述信息实例获取NNRT设备类型。 - * - * \param desc 指向NNRT设备描述信息实例的指针。 + * @brief 从特定的NNRT设备描述信息实例获取NNRT设备类型。 * - * \return {@link OH_AI_NNRTDeviceType} NNRT设备类型。 + * @param desc 指向NNRT设备描述信息实例的指针。 + * @return {@link OH_AI_NNRTDeviceType} NNRT设备类型。 * @since 10 */ OH_AI_API OH_AI_NNRTDeviceType OH_AI_GetTypeFromNNRTDeviceDesc(const NNRTDeviceDesc *desc); /** - * \brief 查找指定名称的NNRT设备,根据找到的第一个设备信息,创建NNRT设备信息。 + * @brief 查找指定名称的NNRT设备,根据找到的第一个设备信息,创建NNRT设备信息。 * - * \param name 目标NNRT设备名。 - * - * \return 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param name 目标NNRT设备名。 + * @return 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 * @since 10 */ OH_AI_API OH_AI_DeviceInfoHandle OH_AI_CreateNNRTDeviceInfoByName(const char *name); /** - * \brief 查找指定类型的NNRT设备,根据找到的第一个设备信息,创建NNRT设备信息。 - * - * \param type {@link OH_AI_NNRTDeviceType} 目标NNRT设备类型。 + * @brief 查找指定类型的NNRT设备,根据找到的第一个设备信息,创建NNRT设备信息。 * - * \return 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param type {@link OH_AI_NNRTDeviceType} 目标NNRT设备类型。 + * @return 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 * @since 10 */ OH_AI_API OH_AI_DeviceInfoHandle OH_AI_CreateNNRTDeviceInfoByType(OH_AI_NNRTDeviceType type); /** - * \brief 设置NNRT设备ID,仅NNRT设备可用。 + * @brief 设置NNRT设备ID,仅NNRT设备可用。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \param device_id NNRT设备ID。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param device_id NNRT设备ID。 * @since 10 */ OH_AI_API void OH_AI_DeviceInfoSetDeviceId(OH_AI_DeviceInfoHandle device_info, size_t device_id); /** - * \brief 获取NNRT设备ID,仅NNRT设备可用。 + * @brief 获取NNRT设备ID,仅NNRT设备可用。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * - * \return NNRT设备ID。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @return NNRT设备ID。 * @since 10 */ OH_AI_API size_t OH_AI_DeviceInfoGetDeviceId(const OH_AI_DeviceInfoHandle device_info); /** - * \brief 设置NNRT性能模式,仅NNRT设备可用。 + * @brief 设置NNRT性能模式,仅NNRT设备可用。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \param mode {@link OH_AI_PerformanceMode} NNRT性能模式。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param mode {@link OH_AI_PerformanceMode} NNRT性能模式。 * @since 10 */ OH_AI_API void OH_AI_DeviceInfoSetPerformanceMode(OH_AI_DeviceInfoHandle device_info, OH_AI_PerformanceMode mode); /** - * \brief 获取NNRT性能模式,仅NNRT设备可用。 - * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @brief 获取NNRT性能模式,仅NNRT设备可用。 * - * \return {@link OH_AI_PerformanceMode} NNRT性能模式。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @return {@link OH_AI_PerformanceMode} NNRT性能模式。 * @since 10 */ OH_AI_API OH_AI_PerformanceMode OH_AI_DeviceInfoGetPerformanceMode(const OH_AI_DeviceInfoHandle device_info); /** - * \brief 设置NNRT任务优先级,仅NNRT设备可用。 + * @brief 设置NNRT任务优先级,仅NNRT设备可用。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \param priority {@link OH_AI_Priority} NNRT任务优先级。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param priority {@link OH_AI_Priority} NNRT任务优先级。 * @since 10 */ OH_AI_API void OH_AI_DeviceInfoSetPriority(OH_AI_DeviceInfoHandle device_info, OH_AI_Priority priority); /** - * \brief 获取NNRT任务优先级,仅NNRT设备可用。 - * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @brief 获取NNRT任务优先级,仅NNRT设备可用。 * - * \return {@link OH_AI_Priority} NNRT任务优先级。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @return {@link OH_AI_Priority} NNRT任务优先级。 * @since 10 */ OH_AI_API OH_AI_Priority OH_AI_DeviceInfoGetPriority(const OH_AI_DeviceInfoHandle device_info); /** - * \brief 向设备信息中添加键/值对形式的扩展配置。只对NNRT设备信息有效。 + * @brief 向设备信息中添加键/值对形式的扩展配置。只对NNRT设备信息有效。 + * * 注意:当前仅支持{"CachePath": "YourCachePath"},{"CacheVersion": "YouCacheVersion"}, * {"QuantParam": "YourQuantConfig"} 三种键值对配置,用户根据使用情况替换具体的值。 * - * \param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * \param name 单个扩展项的键,格式为C字符串。 - * \param value 单个扩展项的值内容首地址。 - * \param value_size 单个扩展项的值内容长度。 - * - * \return {@link OH_AI_Status} 执行状态码,若成功返回OH_AI_STATUS_SUCCESS,失败则返回具体错误码。 + * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 + * @param name 单个扩展项的键,格式为C字符串。 + * @param value 单个扩展项的值内容首地址。 + * @param value_size 单个扩展项的值内容长度。 + * @return {@link OH_AI_Status} 执行状态码,若成功返回OH_AI_STATUS_SUCCESS,失败则返回具体错误码。 * @since 10 */ OH_AI_API OH_AI_Status OH_AI_DeviceInfoAddExtension(OH_AI_DeviceInfoHandle device_info, const char *name, diff --git a/zh-cn/native_sdk/ai/mindspore/data_type.h b/zh-cn/native_sdk/ai/mindspore/data_type.h index 892dabb4..7ac218b0 100644 --- a/zh-cn/native_sdk/ai/mindspore/data_type.h +++ b/zh-cn/native_sdk/ai/mindspore/data_type.h @@ -29,6 +29,7 @@ * * @brief 声明了张量的数据的类型。 * + * @library libmindspore_lite_ndk.so * @since 9 */ #ifndef MINDSPORE_INCLUDE_C_API_DATA_TYPE_C_H diff --git a/zh-cn/native_sdk/ai/mindspore/format.h b/zh-cn/native_sdk/ai/mindspore/format.h index a6b56d31..b7505b79 100644 --- a/zh-cn/native_sdk/ai/mindspore/format.h +++ b/zh-cn/native_sdk/ai/mindspore/format.h @@ -29,6 +29,7 @@ * * @brief 提供张量数据的排列格式。 * + * @library libmindspore_lite_ndk.so * @since 9 */ #ifndef MINDSPORE_INCLUDE_C_API_FORMAT_C_H diff --git a/zh-cn/native_sdk/ai/mindspore/model.h b/zh-cn/native_sdk/ai/mindspore/model.h index 96916548..bf5ac350 100644 --- a/zh-cn/native_sdk/ai/mindspore/model.h +++ b/zh-cn/native_sdk/ai/mindspore/model.h @@ -29,6 +29,7 @@ * * @brief 提供了模型相关接口,可以用于模型创建、模型推理等。 * + * @library libmindspore_lite_ndk.so * @since 9 */ @@ -103,76 +104,76 @@ typedef bool (*OH_AI_KernelCallBack)(const OH_AI_TensorHandleArray inputs, const const OH_AI_CallBackParam kernel_Info); /** - * \brief 创建一个模型对象。 + * @brief 创建一个模型对象。 * - * \return 模型对象指针。 + * @return 模型对象指针。 * @since 9 */ OH_AI_API OH_AI_ModelHandle OH_AI_ModelCreate(); /** - * \brief 释放一个模型对象。 + * @brief 释放一个模型对象。 * - * \param model 模型对象指针。 + * @param model 模型对象指针。 * @since 9 */ OH_AI_API void OH_AI_ModelDestroy(OH_AI_ModelHandle *model); /** - * \brief 从内存缓冲区加载并编译MindSpore模型。 + * @brief 从内存缓冲区加载并编译MindSpore模型。 * * 注意,同一个{@link OH_AI_ContextHandle}对象仅能传递给{@link OH_AI_ModelBuild}或者{@link OH_AI_ModelBuildFromFile}一次, * 如果多次调用该函数需要创建多个不同的{@link OH_AI_ContextHandle}。 * - * \param model 模型对象指针。 - * \param model_data 内存中已经加载的模型数据地址。 - * \param data_size 模型数据的长度。 - * \param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 - * \param model_context 模型运行时的上下文环境,具体见 {@link OH_AI_ContextHandle}。 - * \return 枚举类型的状态码{@link OH_AI_Status},若返回MSStatus::kMSStatusSuccess则证明创建成功。 + * @param model 模型对象指针。 + * @param model_data 内存中已经加载的模型数据地址。 + * @param data_size 模型数据的长度。 + * @param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 + * @param model_context 模型运行时的上下文环境,具体见 {@link OH_AI_ContextHandle}。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回MSStatus::kMSStatusSuccess则证明创建成功。 * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *model_data, size_t data_size, OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context); /** - * \brief 通过模型文件加载并编译MindSpore模型。 + * @brief 通过模型文件加载并编译MindSpore模型。 * * 注意,同一个{@link OH_AI_ContextHandle}对象仅能传递给{@link OH_AI_ModelBuild}或者{@link OH_AI_ModelBuildFromFile}一次, * 如果多次调用该函数需要创建多个不同的{@link OH_AI_ContextHandle}。 * - * \param model 模型对象指针。 - * \param model_path 模型文件路径。 - * \param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 - * \param model_context 模型运行时的上下文环境,具体见 {@link OH_AI_ContextHandle}。 - * \return 枚举类型的状态码{@link OH_AI_Status},若返回MSStatus::kMSStatusSuccess则证明创建成功。 + * @param model 模型对象指针。 + * @param model_path 模型文件路径。 + * @param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 + * @param model_context 模型运行时的上下文环境,具体见 {@link OH_AI_ContextHandle}。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回MSStatus::kMSStatusSuccess则证明创建成功。 * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelBuildFromFile(OH_AI_ModelHandle model, const char *model_path, OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context); /** - * \brief 调整已编译模型的输入形状。 + * @brief 调整已编译模型的输入形状。 * - * \param model 模型对象指针。 - * \param inputs 模型输入对应的张量数组结构体。 - * \param shape_infos 输入形状信息数组,按模型输入顺序排列的由形状信息组成的数组,模型会按顺序依次调整张量形状。 - * \param shape_info_num 形状信息数组的长度。 - * \return 枚举类型的状态码{@link OH_AI_Status},若返回MSStatus::kMSStatusSuccess则证明创建成功。 + * @param model 模型对象指针。 + * @param inputs 模型输入对应的张量数组结构体。 + * @param shape_infos 输入形状信息数组,按模型输入顺序排列的由形状信息组成的数组,模型会按顺序依次调整张量形状。 + * @param shape_info_num 形状信息数组的长度。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回MSStatus::kMSStatusSuccess则证明创建成功。 * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelResize(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, OH_AI_ShapeInfo *shape_infos, size_t shape_info_num); /** - * \brief 执行模型推理。 + * @brief 执行模型推理。 * - * \param model 模型对象指针。 - * \param inputs 模型输入对应的张量数组结构体。 - * \param outputs 模型输出对应的张量数组结构体的指针。 - * \param before 模型推理前执行的回调函数。 - * \param after 模型推理后执行的回调函数。 - * \return 枚举类型的状态码{@link OH_AI_Status},若返回MSStatus::kMSStatusSuccess则证明创建成功。 + * @param model 模型对象指针。 + * @param inputs 模型输入对应的张量数组结构体。 + * @param outputs 模型输出对应的张量数组结构体的指针。 + * @param before 模型推理前执行的回调函数。 + * @param after 模型推理后执行的回调函数。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回MSStatus::kMSStatusSuccess则证明创建成功。 * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelPredict(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, @@ -180,39 +181,39 @@ OH_AI_API OH_AI_Status OH_AI_ModelPredict(OH_AI_ModelHandle model, const OH_AI_T const OH_AI_KernelCallBack after); /** - * \brief 获取模型的输入张量数组结构体。 + * @brief 获取模型的输入张量数组结构体。 * - * \param model 模型对象指针。 - * \return 模型输入对应的张量数组结构体。 + * @param model 模型对象指针。 + * @return 模型输入对应的张量数组结构体。 * @since 9 */ OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetInputs(const OH_AI_ModelHandle model); /** - * \brief 获取模型的输出张量数组结构体。 + * @brief 获取模型的输出张量数组结构体。 * - * \param model 模型对象指针。 - * \return 模型输出对应的张量数组结构体。 + * @param model 模型对象指针。 + * @return 模型输出对应的张量数组结构体。 * @since 9 */ OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetOutputs(const OH_AI_ModelHandle model); /** - * \brief 通过张量名获取模型的输入张量。 + * @brief 通过张量名获取模型的输入张量。 * - * \param model 模型对象指针。 - * \param tensor_name 张量名称。 - * \return tensor_name所对应的输入张量的张量指针,如果输入中没有该张量则返回空。 + * @param model 模型对象指针。 + * @param tensor_name 张量名称。 + * @return tensor_name所对应的输入张量的张量指针,如果输入中没有该张量则返回空。 * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); /** - * \brief 通过张量名获取模型的输出张量。 + * @brief 通过张量名获取模型的输出张量。 * - * \param model 模型对象指针。 - * \param tensor_name 张量名称。 - * \return tensor_name所对应的输入张量的张量指针,如果输出中没有该张量则返回空。 + * @param model 模型对象指针。 + * @param tensor_name 张量名称。 + * @return tensor_name所对应的输入张量的张量指针,如果输出中没有该张量则返回空。 * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetOutputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); diff --git a/zh-cn/native_sdk/ai/mindspore/status.h b/zh-cn/native_sdk/ai/mindspore/status.h index 7b0c717f..fcc78760 100644 --- a/zh-cn/native_sdk/ai/mindspore/status.h +++ b/zh-cn/native_sdk/ai/mindspore/status.h @@ -28,6 +28,8 @@ * @file status.h * * @brief 提供了Mindspore Lite运行时的状态码。 + * + * @library libmindspore_lite_ndk.so * @since 9 */ #ifndef MINDSPORE_INCLUDE_C_API_STATUS_C_H diff --git a/zh-cn/native_sdk/ai/mindspore/tensor.h b/zh-cn/native_sdk/ai/mindspore/tensor.h index 83a73ded..df8b750b 100644 --- a/zh-cn/native_sdk/ai/mindspore/tensor.h +++ b/zh-cn/native_sdk/ai/mindspore/tensor.h @@ -29,6 +29,7 @@ * * @brief 提供了张量相关的接口,可用于创建和修改张量信息。 * + * @library libmindspore_lite_ndk.so * @since 9 */ @@ -52,192 +53,192 @@ extern "C" { typedef void *OH_AI_TensorHandle; /** - * \brief 创建一个张量对象。 + * @brief 创建一个张量对象。 * - * \param name 张量名称 - * \param type 张量的数据类型 - * \param shape 张量的维度数组。 - * \param shape_num 张量维度数组长度。 - * \param data 指向数据的指针。 - * \param data_len 数据的长度。 + * @param name 张量名称 + * @param type 张量的数据类型 + * @param shape 张量的维度数组。 + * @param shape_num 张量维度数组长度。 + * @param data 指向数据的指针。 + * @param data_len 数据的长度。 + * + * @return 指向张量对象句柄。 * - * \return 指向张量对象句柄。 - * * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_TensorCreate(const char *name, OH_AI_DataType type, const int64_t *shape, size_t shape_num, const void *data, size_t data_len); /** - * \brief 释放张量对象。 + * @brief 释放张量对象。 + * + * @param tensor 指向张量句柄的二级指针。 * - * \param tensor 指向张量句柄的二级指针。 - * * @since 9 */ OH_AI_API void OH_AI_TensorDestroy(OH_AI_TensorHandle *tensor); /** - * \brief 深拷贝一个张量。 + * @brief 深拷贝一个张量。 * - * \param tensor 待拷贝张量的指针。 + * @param tensor 待拷贝张量的指针。 * - * \return 指向新张量对象句柄。 + * @return 指向新张量对象句柄。 * * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_TensorClone(OH_AI_TensorHandle tensor); /** - * \brief 设置张量的名称。 + * @brief 设置张量的名称。 * - * \param tensor 张量对象句柄。 - * \param name 张量名称。 + * @param tensor 张量对象句柄。 + * @param name 张量名称。 * * @since 9 */ OH_AI_API void OH_AI_TensorSetName(OH_AI_TensorHandle tensor, const char *name); /** - * \brief 获取张量的名称。 + * @brief 获取张量的名称。 * - * \param tensor 张量对象句柄。 + * @param tensor 张量对象句柄。 * - * \return 张量的名称。 + * @return 张量的名称。 * * @since 9 */ OH_AI_API const char *OH_AI_TensorGetName(const OH_AI_TensorHandle tensor); /** - * \brief 设置张量的数据类型。 + * @brief 设置张量的数据类型。 * - * \param tensor 张量对象句柄。 - * \param type 数据类型,具体见{@link OH_AI_DataType}。 + * @param tensor 张量对象句柄。 + * @param type 数据类型,具体见{@link OH_AI_DataType}。 * * @since 9 */ OH_AI_API void OH_AI_TensorSetDataType(OH_AI_TensorHandle tensor, OH_AI_DataType type); /** - * \brief 获取张量类型。 + * @brief 获取张量类型。 * - * \param tensor 张量对象句柄。 + * @param tensor 张量对象句柄。 * - * \return 张量的数据类型。 + * @return 张量的数据类型。 * * @since 9 */ OH_AI_API OH_AI_DataType OH_AI_TensorGetDataType(const OH_AI_TensorHandle tensor); /** - * \brief 设置张量的形状。 + * @brief 设置张量的形状。 * - * \param tensor 张量对象句柄。 - * \param shape 形状数组。 - * \param shape_num 张量形状数组长度。 + * @param tensor 张量对象句柄。 + * @param shape 形状数组。 + * @param shape_num 张量形状数组长度。 * * @since 9 */ OH_AI_API void OH_AI_TensorSetShape(OH_AI_TensorHandle tensor, const int64_t *shape, size_t shape_num); /** - * \brief 获取张量的形状。 + * @brief 获取张量的形状。 * - * \param tensor 张量对象句柄。 - * \param shape_num 该参数是输出参数,形状数组的长度会写入该变量。 + * @param tensor 张量对象句柄。 + * @param shape_num 该参数是输出参数,形状数组的长度会写入该变量。 * - * \return 形状数组。 + * @return 形状数组。 * * @since 9 */ OH_AI_API const int64_t *OH_AI_TensorGetShape(const OH_AI_TensorHandle tensor, size_t *shape_num); /** - * \brief 设置张量数据的排列方式。 + * @brief 设置张量数据的排列方式。 * - * \param tensor 张量对象句柄。 - * \param format 张量数据排列方式。 + * @param tensor 张量对象句柄。 + * @param format 张量数据排列方式。 * * @since 9 */ OH_AI_API void OH_AI_TensorSetFormat(OH_AI_TensorHandle tensor, OH_AI_Format format); /** - * \brief 获取张量数据的排列方式。 + * @brief 获取张量数据的排列方式。 * - * \param tensor 张量对象句柄。 + * @param tensor 张量对象句柄。 * - * \return 张量数据的排列方式。 + * @return 张量数据的排列方式。 * * @since 9 */ OH_AI_API OH_AI_Format OH_AI_TensorGetFormat(const OH_AI_TensorHandle tensor); /** - * \brief 设置张量的数据。 + * @brief 设置张量的数据。 * - * \param tensor 张量对象句柄。 - * \param data 指向数据的指针。 + * @param tensor 张量对象句柄。 + * @param data 指向数据的指针。 * * @since 9 */ OH_AI_API void OH_AI_TensorSetData(OH_AI_TensorHandle tensor, void *data); /** - * \brief 获取张量数据的指针。 + * @brief 获取张量数据的指针。 * - * \param tensor 张量对象句柄。 + * @param tensor 张量对象句柄。 * - * \return 张量数据的指针。 + * @return 张量数据的指针。 * * @since 9 */ OH_AI_API const void *OH_AI_TensorGetData(const OH_AI_TensorHandle tensor); /** - * \brief 获取可变的张量数据指针。如果数据为空则会开辟内存。 + * @brief 获取可变的张量数据指针。如果数据为空则会开辟内存。 * - * \param tensor 张量对象句柄。 + * @param tensor 张量对象句柄。 * - * \return 张量数据的指针。 + * @return 张量数据的指针。 * * @since 9 */ OH_AI_API void *OH_AI_TensorGetMutableData(const OH_AI_TensorHandle tensor); /** - * \brief 获取张量元素数量。 + * @brief 获取张量元素数量。 * - * \param tensor 张量对象句柄。 + * @param tensor 张量对象句柄。 * - * \return 张量的元素数量。 + * @return 张量的元素数量。 * * @since 9 */ OH_AI_API int64_t OH_AI_TensorGetElementNum(const OH_AI_TensorHandle tensor); /** - * \brief 获取张量中的数据的字节数大小。 + * @brief 获取张量中的数据的字节数大小。 * - * \param tensor 张量对象句柄。 + * @param tensor 张量对象句柄。 * - * \return 张量数据的字节数大小。 + * @return 张量数据的字节数大小。 * * @since 9 */ OH_AI_API size_t OH_AI_TensorGetDataSize(const OH_AI_TensorHandle tensor); /** - * \brief 设置张量为用户自行管理的数据。此接口常用于复用用户数据作为模型输入,可减少一次数据拷贝。 + * @brief 设置张量为用户自行管理的数据。此接口常用于复用用户数据作为模型输入,可减少一次数据拷贝。 * 注意:此数据对于张量来说是外部数据,张量销毁时不会主动释放,由调用者负责释放。另外,在此张量 * 使用过程中,调用者须确保此数据有效。 * - * \param tensor 张量对象句柄。 - * \param data 用户数据首地址。 - * \param data_size 用户数据长度。 + * @param tensor 张量对象句柄。 + * @param data 用户数据首地址。 + * @param data_size 用户数据长度。 * - * \return 执行状态码。若成功返回OH_AI_STATUS_SUCCESS,否则返回具体错误码。 + * @return 执行状态码。若成功返回OH_AI_STATUS_SUCCESS,否则返回具体错误码。 * * @since 10 */ diff --git a/zh-cn/native_sdk/ai/mindspore/types.h b/zh-cn/native_sdk/ai/mindspore/types.h index 914483f2..5ead46a3 100644 --- a/zh-cn/native_sdk/ai/mindspore/types.h +++ b/zh-cn/native_sdk/ai/mindspore/types.h @@ -29,6 +29,7 @@ * * @brief 提供了MindSpore Lite支持的模型文件类型和设备类型。 * + * @library libmindspore_lite_ndk.so * @since 9 */ -- Gitee From 9b8d30d6eef0e07dcf434d44fdb572ec08dea498 Mon Sep 17 00:00:00 2001 From: gWX1231951 Date: Wed, 20 Sep 2023 18:50:27 +0800 Subject: [PATCH 0022/2135] =?UTF-8?q?=E6=B7=BB=E5=8A=A0.so=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gWX1231951 --- .../ai/neural_network_runtime/neural_network_runtime.h | 1 + .../ai/neural_network_runtime/neural_network_runtime_type.h | 1 + 2 files changed, 2 insertions(+) diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index a670ae14..7c2f506e 100644 --- a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -31,6 +31,7 @@ * * 注意:Neural Network Runtime的接口目前均不支持多线程调用。\n * + * @library libneural_network_runtime.so * @since 9 * @version 1.0 */ diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index 9163d098..0118ed45 100644 --- a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -29,6 +29,7 @@ * * @brief Neural Network Runtime定义的结构体和枚举值。 * + * @library libneural_network_runtime.so * @since 9 * @version 1.0 */ -- Gitee From 08735e978facd90258303fea718fd58fea2de0eb Mon Sep 17 00:00:00 2001 From: lilanqing Date: Sun, 8 Oct 2023 10:19:33 +0800 Subject: [PATCH 0023/2135] add lib comment Signed-off-by: lilanqing --- zh-cn/native_sdk/ace/native_interface_xcomponent.h | 1 + zh-cn/native_sdk/ace/native_xcomponent_key_event.h | 1 + 2 files changed, 2 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index 09381149..53ed97ad 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -28,6 +28,7 @@ * * @brief 声明用于访问Native XComponent的API。 * + * @library libace_ndk.z.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/ace/native_xcomponent_key_event.h b/zh-cn/native_sdk/ace/native_xcomponent_key_event.h index b7f81a0a..cb6e6a99 100644 --- a/zh-cn/native_sdk/ace/native_xcomponent_key_event.h +++ b/zh-cn/native_sdk/ace/native_xcomponent_key_event.h @@ -23,6 +23,7 @@ * * @brief 声明用于访问Native XComponent键盘事件所使用到的枚举类型。 * + * @library libace_ndk.z.so * @since 10 * @version 1.0 */ -- Gitee From 6982300e9c8fb20cd0d58a6ab7126039d4af5007 Mon Sep 17 00:00:00 2001 From: Gloria Date: Tue, 10 Oct 2023 15:37:29 +0800 Subject: [PATCH 0024/2135] updated docs (EN) against ZH Signed-off-by: Gloria --- en/native_sdk/graphic/external_window.h | 169 +++++----- en/native_sdk/graphic/native_image.h | 87 +++-- en/native_sdk/graphic/native_vsync.h | 5 +- en/native_sdk/graphic/vulkan_ohos.h | 408 ++++++++++++++++++++++++ 4 files changed, 563 insertions(+), 106 deletions(-) create mode 100644 en/native_sdk/graphic/vulkan_ohos.h diff --git a/en/native_sdk/graphic/external_window.h b/en/native_sdk/graphic/external_window.h index d9ac4c0b..4f279aeb 100644 --- a/en/native_sdk/graphic/external_window.h +++ b/en/native_sdk/graphic/external_window.h @@ -20,7 +20,7 @@ * @addtogroup NativeWindow * @{ * - * @brief Provides the native window capability for connection to the EGL. + * @brief Provides the NativeWindow capability for connection to the EGL. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @since 8 @@ -30,8 +30,9 @@ /** * @file external_window.h * - * @brief Defines the functions for obtaining and using a native window. + * @brief Defines the functions for obtaining and using NativeWindow. * + * @library libnative_window.so * @since 8 * @version 1.0 */ @@ -45,27 +46,32 @@ extern "C" { /** - * @brief Defines the NativeWindow structure. + * @brief Defines the NativeWindow struct. + * @since 8 */ struct NativeWindow; /** - * @brief Defines the NativeWindowBuffer structure. + * @brief Defines the NativeWindowBuffer struct. + * @since 8 */ struct NativeWindowBuffer; /** - * @brief Provides the function of accessing the NativeWindow. + * @brief Provides access to OHNativeWindow. + * @since 8 */ typedef struct NativeWindow OHNativeWindow; /** - * @brief Provides the function of accessing the NativeWindowBuffer. + * @brief Provides access to OHNativeWindowBuffer. + * @since 8 */ typedef struct NativeWindowBuffer OHNativeWindowBuffer; /** - * @brief Defines the rectangle (dirty region) where the content is to be updated in the local native window. + * @brief Defines the rectangle (dirty region) where the content is to be updated in the local OHNativeWindow. + * @since 8 */ typedef struct Region { /** If rects is a null pointer, the buffer size is the same as the size of the dirty region by default. */ @@ -82,6 +88,7 @@ typedef struct Region { /** * @brief Enumerates the operation codes in the OH_NativeWindow_NativeWindowHandleOpt function. + * @since 8 */ enum NativeWindowOperation { /** @@ -109,13 +116,13 @@ enum NativeWindowOperation { */ SET_FORMAT, /** - * Obtaining the usage mode of the local window buffer. + * Obtaining the read/write mode of the local window buffer. * Variable argument in the function: * [Output] int32_t *usage. */ GET_USAGE, /** - * Setting the usage mode for the local window buffer. + * Setting the read/write mode for the local window buffer. * Variable argument in the function: * [Input] int32_t usage. */ @@ -190,6 +197,8 @@ enum NativeWindowOperation { /** * @brief Enumerates the scaling modes. + * @since 9 + * @deprecated This enum is deprecated since API version 10. No substitute enum is provided. */ typedef enum { /** @@ -205,13 +214,16 @@ typedef enum { */ OH_SCALING_MODE_SCALE_CROP, /** - * The window is cropped to the size of the buffer's cropping rectangle. Pixels outside the cropping rectangle are considered completely transparent. + * The window is cropped to the size of the buffer's cropping rectangle. + * Pixels outside the cropping rectangle are considered completely transparent. */ OH_SCALING_MODE_NO_SCALE_CROP, } OHScalingMode; /** * @brief Enumerates the HDR metadata keys. + * @since 9 + * @deprecated This enum is deprecated since API version 10. No substitute enum is provided. */ typedef enum { OH_METAKEY_RED_PRIMARY_X = 0, /**< X coordinate of the red primary color. */ @@ -232,6 +244,8 @@ typedef enum { /** * @brief Defines the HDR metadata. + * @since 9 + * @deprecated This struct is deprecated since API version 10. No substitute struct is provided. */ typedef struct { OHHDRMetadataKey key; /**< Key of the HDR metadata. */ @@ -240,64 +254,70 @@ typedef struct { /** * @brief Defines the extended data handle. + * @since 9 + * @deprecated This struct is deprecated since API version 10. No substitute struct is provided. */ typedef struct { - int32_t fd; /**< File descriptor handle. The value -1 indicates that the handle is not supported. */ + int32_t fd; /**< File descriptor handle. The value -1 means that the handle is not supported. */ uint32_t reserveInts; /**< Number of reserved arrays. */ - int32_t reserve[0]; /**< Reserve array. */ + int32_t reserve[0]; /**< Reserved array. */ } OHExtDataHandle; /** - * @brief Creates a NativeWindow instance. A new NativeWindow instance is created each time this function is called. + * @brief Creates an OHNativeWindow instance. + * A new OHNativeWindow instance is created each time this function is called. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param pSurface Indicates the pointer to a ProduceSurface. The type is sptr. - * @return Returns the pointer to the NativeWindow instance created. + * @param pSurface Pointer to a ProduceSurface. The type is sptr. + * @return Returns the pointer to the OHNativeWindow instance created. * @since 8 * @version 1.0 */ OHNativeWindow* OH_NativeWindow_CreateNativeWindow(void* pSurface); /** - * @brief Decreases the reference count of a NativeWindow instance by 1 and when the reference count reaches 0, destroys the instance. + * @brief Decreases the reference count of an OHNativeWindow instance by 1 and + * when the reference count reaches 0, destroys the instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. + * @param window Pointer to an OHNativeWindow instance. * @since 8 * @version 1.0 */ void OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window); /** - * @brief Creates a NativeWindowBuffer instance. A new NativeWindowBuffer instance is created each time this function is called. + * @brief Creates an OHNativeWindowBuffer instance. + * A new OHNativeWindowBuffer instance is created each time this function is called. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param pSurfaceBuffer Indicates the pointer to a produce buffer. The type is sptr. - * @return Returns the pointer to the NativeWindowBuffer instance created. + * @param pSurfaceBuffer Pointer to a produce buffer. The type is sptr. + * @return Returns the pointer to the OHNativeWindowBuffer instance created. * @since 8 * @version 1.0 */ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(void* pSurfaceBuffer); /** - * @brief Decreases the reference count of a NativeWindowBuffer instance by 1 and when the reference count reaches 0, destroys the instance. + * @brief Decreases the reference count of an OHNativeWindowBuffer instance by 1 and + * when the reference count reaches 0, destroys the instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param buffer Indicates the pointer to a NativeWindowBuffer instance. + * @param buffer Pointer to an OHNativeWindowBuffer instance. * @since 8 * @version 1.0 */ void OH_NativeWindow_DestroyNativeWindowBuffer(OHNativeWindowBuffer* buffer); /** - * @brief Requests a NativeWindowBuffer through a NativeWindow instance for content production. + * @brief Requests an OHNativeWindowBuffer through an OHNativeWindow instance for content production. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. - * @param buffer Indicates the double pointer to a NativeWindowBuffer instance. - * @param fenceFd Indicates the pointer to a file descriptor handle. - * @return Returns an error code defined in GSError. + * @param window Pointer to an OHNativeWindow instance. + * @param buffer Double pointer to an OHNativeWindowBuffer instance. + * @param fenceFd Pointer to a file descriptor handle. + * @return Returns 0 if the operation is successful. * @since 8 * @version 1.0 */ @@ -305,14 +325,15 @@ int32_t OH_NativeWindow_NativeWindowRequestBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer, int *fenceFd); /** - * @brief Flushes the NativeWindowBuffer filled with the content to the buffer queue through a NativeWindow instance for content consumption. + * @brief Flushes the OHNativeWindowBuffer filled with the content to the buffer queue + * through an OHNativeWindow instance for content consumption. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. - * @param buffer Indicates the pointer to a NativeWindowBuffer instance. - * @param fenceFd Indicates a file descriptor handle, which is used for timing synchronization. - * @param region Indicates a dirty region where content is updated. - * @return Returns an error code defined in GSError. + * @param window Pointer to an OHNativeWindow instance. + * @param buffer Pointer to an OHNativeWindowBuffer instance. + * @param fenceFd File descriptor handle, which is used for timing synchronization. + * @param region Dirty region where content is updated. + * @return Returns 0 if the operation is successful. * @since 8 * @version 1.0 */ @@ -320,35 +341,37 @@ int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNative int fenceFd, Region region); /** - * @brief Returns the NativeWindowBuffer to the buffer queue through a NativeWindow instance, without filling in any content. The NativeWindowBuffer can be used for another request. + * @brief Returns the OHNativeWindowBuffer to the buffer queue through an OHNativeWindow instance, + * without filling in any content. The OHNativeWindowBuffer can be used for a new request. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. - * @param buffer Indicates the pointer to a NativeWindowBuffer instance. - * @return Returns an error code defined in GSError. + * @param window Pointer to an OHNativeWindow instance. + * @param buffer Pointer to an OHNativeWindowBuffer instance. + * @return Returns 0 if the operation is successful. * @since 8 * @version 1.0 */ int32_t OH_NativeWindow_NativeWindowAbortBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); /** - * @brief Sets or obtains the attributes of a native window, including the width, height, and content format. + * @brief Sets or obtains the attributes of an OHNativeWindow instance, + * including the width, height, and content format. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. - * @param code Indicates the operation code. For details, see {@link NativeWindowOperation}. - * @param ... Indicates the variable argument, which must correspond to the operation code. - * @return Returns an error code defined in GSError. + * @param window Pointer to an OHNativeWindow instance. + * @param code Operation code. For details, see {@link NativeWindowOperation}. + * @param ... Variable argument, which must correspond to the operation code. + * @return Returns 0 if the operation is successful. * @since 8 * @version 1.0 */ int32_t OH_NativeWindow_NativeWindowHandleOpt(OHNativeWindow *window, int code, ...); /** - * @brief Obtains the pointer to a BufferHandle of a NativeWindowBuffer instance. + * @brief Obtains the pointer to a BufferHandle of an OHNativeWindowBuffer instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param buffer Indicates the pointer to a NativeWindowBuffer instance. + * @param buffer Pointer to an OHNativeWindowBuffer instance. * @return Returns the pointer to the BufferHandle instance obtained. * @since 8 * @version 1.0 @@ -359,8 +382,8 @@ BufferHandle *OH_NativeWindow_GetBufferHandleFromNative(OHNativeWindowBuffer *bu * @brief Adds the reference count of a native object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param obj Indicates the pointer to a NativeWindow or NativeWindowBuffer instance. - * @return Returns an error code defined in GSError. + * @param obj Pointer to an OHNativeWindow or OHNativeWindowBuffer instance. + * @return Returns 0 if the operation is successful. * @since 8 * @version 1.0 */ @@ -370,8 +393,8 @@ int32_t OH_NativeWindow_NativeObjectReference(void *obj); * @brief Decreases the reference count of a native object and when the reference count reaches 0, destroys this object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param obj Indicates the pointer to a NativeWindow or NativeWindowBuffer instance. - * @return Returns an error code defined in GSError. + * @param obj Pointer to an OHNativeWindow or OHNativeWindowBuffer instance. + * @return Returns 0 if the operation is successful. * @since 8 * @version 1.0 */ @@ -381,7 +404,7 @@ int32_t OH_NativeWindow_NativeObjectUnreference(void *obj); * @brief Obtains the magic ID of a native object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param obj Indicates the pointer to a NativeWindow or NativeWindowBuffer instance. + * @param obj Pointer to an OHNativeWindow or OHNativeWindowBuffer instance. * @return Returns the magic ID, which is unique for each native object. * @since 8 * @version 1.0 @@ -389,59 +412,63 @@ int32_t OH_NativeWindow_NativeObjectUnreference(void *obj); int32_t OH_NativeWindow_GetNativeObjectMagic(void *obj); /** - * @brief Sets the scaling mode for a native window. + * @brief Sets the scaling mode for an OHNativeWindow instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. - * @param sequence Indicates the sequence of the producer buffer. - * @param scalingMode Indicates the scaling mode to set. For details, see OHScalingMode. - * @return Returns an error code defined in GSError. + * @param window Pointer to an OHNativeWindow instance. + * @param sequence Sequence of the producer buffer. + * @param scalingMode Scaling mode to set. For details, see OHScalingMode. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 + * @deprecated This API is deprecated since API version 10. No substitute API is provided. */ int32_t OH_NativeWindow_NativeWindowSetScalingMode(OHNativeWindow *window, uint32_t sequence, OHScalingMode scalingMode); /** - * @brief Sets the metadata for a native window. + * @brief Sets the metadata for an OHNativeWindow instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. - * @param sequence Indicates the sequence of the producer buffer. - * @param size Indicates the size of the OHHDRMetaData array. - * @param metaData Indicates the pointer to the OHHDRMetaData array. - * @return Returns an error code defined in GSError. + * @param window Pointer to an OHNativeWindow instance. + * @param sequence Sequence of the producer buffer. + * @param size Size of the OHHDRMetaData array. + * @param metaData Pointer to the OHHDRMetaData array. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 + * @deprecated This API is deprecated since API version 10. No substitute API is provided. */ int32_t OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow *window, uint32_t sequence, int32_t size, const OHHDRMetaData *metaData); /** - * @brief Sets the metadata set for a native window. + * @brief Sets the metadata set for an OHNativeWindow instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. - * @param sequence Indicates the sequence of the producer buffer. - * @param key Indicates a metadata key. For details, see OHHDRMetadataKey. - * @param size Indicates the size of the uint8_t vector. - * @param metaData Indicates the pointer to the uint8_t vector. - * @return Returns an error code defined in GSError. + * @param window Pointer to an OHNativeWindow instance. + * @param sequence Sequence of the producer buffer. + * @param key Metadata key. For details, see OHHDRMetadataKey. + * @param size Size of the uint8_t vector. + * @param metaData Pointer to the uint8_t vector. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 + * @deprecated This API is deprecated since API version 10. No substitute API is provided. */ int32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t *metaData); /** - * @brief Sets a tunnel handle for a native window. + * @brief Sets a tunnel handle for an OHNativeWindow instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window Indicates the pointer to a NativeWindow instance. - * @param handle Indicates the pointer to an OHExtDataHandle. - * @return Returns an error code defined in GSError. + * @param window Pointer to an OHNativeWindow instance. + * @param handle Pointer to an OHExtDataHandle. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 + * @deprecated This API is deprecated since API version 10. No substitute API is provided. */ int32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, const OHExtDataHandle *handle); diff --git a/en/native_sdk/graphic/native_image.h b/en/native_sdk/graphic/native_image.h index 126da941..5b7dc7fc 100644 --- a/en/native_sdk/graphic/native_image.h +++ b/en/native_sdk/graphic/native_image.h @@ -20,7 +20,8 @@ * @addtogroup OH_NativeImage * @{ * - * @brief 提供NativeImage功能. + * @brief Provides the capabilities of NativeImage. Functioning as a data consumer, this module is used to + * associate data with the OpenGL texture. It is used in the OpenGL environment. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage * @since 9 @@ -30,29 +31,44 @@ /** * @file native_image.h * - * @brief 定义获取和使用NativeImage的相关函数. + * @brief Defines the functions for obtaining and using NativeImage. * + * @library libnative_image.so * @since 9 * @version 1.0 */ #include -#include "native_window.h" #ifdef __cplusplus extern "C" { #endif +/** + * @brief Defines the OH_NativeImage struct. + * @since 9 + */ struct OH_NativeImage; + +/** + * @brief Defines the OH_NativeImage struct. + * @since 9 + */ typedef struct OH_NativeImage OH_NativeImage; /** - * @brief 创建一个OH_NativeImage实例,该实例与OPENGL ES的纹理ID和纹理目标相关联. + * @brief Provides access to NativeWindow. + * @since 9 + */ +typedef struct NativeWindow OHNativeWindow; + +/** + * @brief Creates an OH_NativeImage instance to be associated with the OpenGL ES texture ID and target. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage - * @param textureId参数是OPENGL ES的纹理ID,OH_NativeImage实例会与之相关联. - * @param textureTarget 参数是OPENGL ES的纹理目标. - * @return 返回一个指向OH_NativeImage实例的指针. + * @param textureId OpenGL ES texture ID. + * @param textureTarget OpenGL ES texture target. + * @return Returns the pointer to the OH_NativeImage instance created; * returns NULL otherwise. * @since 9 * @version 1.0 @@ -60,36 +76,39 @@ typedef struct OH_NativeImage OH_NativeImage; OH_NativeImage* OH_NativeImage_Create(uint32_t textureId, uint32_t textureTarget); /** - * @brief 获取与OH_NativeImage相关联的OHNativeWindow指针. 该OHNativeWindow后续不再需要时需要调用\n - * OH_NativeWindow_DestroyNativeWindow释放. + * @brief Obtains an OHNativeWindow instance associated with an OH_NativeImage instance. + * You need to call OH_NativeWindow_DestroyNativeWindow to release the OHNativeWindow instance + * when it is no longer required. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage - * @param image是指向OH_NativeImage实例的指针. - * @return 成功则返回一个指向OHNativeWindow实例的指针,否则返回NULL. + * @param image Pointer to an OH_NativeImage instance. + * @return Returns a pointer to the OHNativeWindow instance if the operation is successful; + * returns NULL otherwise. * @since 9 * @version 1.0 */ OHNativeWindow* OH_NativeImage_AcquireNativeWindow(OH_NativeImage* image); /** - * @brief 将OH_NativeImage实例附加到当前OPENGL ES上下文, 且该OPENGL ES纹理会绑定到 \n - * GL_TEXTURE_EXTERNAL_OES, 并通过OH_NativeImage进行更新. + * @brief Attaches an OH_NativeImage instance to the current OpenGL ES context. + * The OpenGL ES texture will be bound to an GL_TEXTURE_EXTERNAL_OES instance and updated + * through the OH_NativeImage instance. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage - * @param image是指向OH_NativeImage实例的指针. - * @param textureId是OH_NativeImage要附加到的OPENGL ES纹理的id. - * @return 返回一个由SurfaceError定义的int32_t类型的错误码. + * @param image Pointer to an OH_NativeImage instance. + * @param textureId ID of the OpenGL ES texture to which the OH_NativeImage instance is to be attached. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 */ int32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId); /** - * @brief 将OH_NativeImage实例从当前OPENGL ES上下文分离. + * @brief Detaches an OH_NativeImage instance from the current OpenGL ES context. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage - * @param image是指向OH_NativeImage实例的指针. - * @return 返回一个由SurfaceError定义的int32_t类型的错误码. + * @param image Pointer to an OH_NativeImage instance. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 */ @@ -97,45 +116,47 @@ int32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId); int32_t OH_NativeImage_DetachContext(OH_NativeImage* image); /** - * @brief 通过OH_NativeImage获取最新帧更新相关联的OPENGL ES纹理. + * @brief Updates the OpenGL ES texture associated with the latest frame through an OH_NativeImage instance. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage - * @param image是指向OH_NativeImage实例的指针. - * @return 返回一个由SurfaceError定义的int32_t类型的错误码. + * @param image Pointer to an OH_NativeImage instance. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 */ int32_t OH_NativeImage_UpdateSurfaceImage(OH_NativeImage* image); /** - * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳. + * @brief Obtains the timestamp of the texture image + * that recently called the OH_NativeImage_UpdateSurfaceImage function. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage - * @param image是指向OH_NativeImage实例的指针. - * @return 返回纹理图像的相关时间戳. + * @param image Pointer to an OH_NativeImage instance. + * @return Returns the timestamp of the texture image. * @since 9 * @version 1.0 */ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); /** - * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵. + * @brief Obtains the transform matrix of the texture image + * that recently called the OH_NativeImage_UpdateSurfaceImage function. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage - * @param image是指向OH_NativeImage实例的指针. - * @param matrix用来存储要获取的4*4的变化矩阵. - * @return 返回一个由SurfaceError定义的int32_t类型的错误码. + * @param image Pointer to an OH_NativeImage instance. + * @param matrix Buffer used to store the 4 x 4 transform matrix obtained. + * @return Returns 0 if the operation is successful. * @since 9 * @version 1.0 */ int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]); /** - * @brief 销毁通过OH_NativeImage_Create创建的OH_NativeImage实例, 销毁后该\n - * OH_NativeImage指针会被赋值为空. + * @brief Destroys an OH_NativeImage instance created by calling OH_NativeImage_Create. + * After the instance is destroyed, the pointer to the OH_NativeImage instance is assigned NULL. * * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage - * @param image是指向OH_NativeImage实例的指针. + * @param image Pointer to an OH_NativeImage instance. * @since 9 * @version 1.0 */ @@ -146,4 +167,4 @@ void OH_NativeImage_Destroy(OH_NativeImage** image); #endif /** @} */ -#endif \ No newline at end of file +#endif diff --git a/en/native_sdk/graphic/native_vsync.h b/en/native_sdk/graphic/native_vsync.h index 6aa5a113..ae93bb38 100644 --- a/en/native_sdk/graphic/native_vsync.h +++ b/en/native_sdk/graphic/native_vsync.h @@ -32,6 +32,7 @@ * * @brief Declares the functions for obtaining and using NativeVSync. * + * @library libnative_vsync.so * @since 9 * @version 1.0 */ @@ -64,8 +65,8 @@ typedef struct OH_NativeVSync OH_NativeVSync; typedef void (*OH_NativeVSync_FrameCallback)(long long timestamp, void *data); /** - * @brief Creates an OH_NativeVSync instance. A new OH_NativeVSync instance is created - * each time this function is called. + * @brief Creates an OH_NativeVSync instance. + * A new OH_NativeVSync instance is created each time this function is called. * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync * @param name Pointer to the name that associates with an OH_NativeVSync instance. diff --git a/en/native_sdk/graphic/vulkan_ohos.h b/en/native_sdk/graphic/vulkan_ohos.h new file mode 100644 index 00000000..ce1d18b6 --- /dev/null +++ b/en/native_sdk/graphic/vulkan_ohos.h @@ -0,0 +1,408 @@ +#ifndef VULKAN_OHOS_H_ +#define VULKAN_OHOS_H_ 1 + +/* +** Copyright 2015-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +/** + * @addtogroup Vulkan + * @{ + * + * @brief Provides Vulkan capabilities extended by OpenHarmony. + * This module provides extended APIs for creating a Vulkan surface and obtaining OH_NativeBuffer and + * OH_NativeBuffer properties through OHNativeWindow. + * + * @syscap SystemCapability.Graphic.Vulkan + * @since 10 + * @version 1.0 + */ + +/** + * @file vulkan_ohos.h + * + * @brief Declares the Vulkan APIs extended by OpenHarmony. File to include: + * + * @library libvulkan.so + * @since 10 + * @version 1.0 + */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief Defines the surface extension of OpenHarmony. + * @since 10 + * @version 1.0 + */ +#define VK_OHOS_surface 1 + +/** + * @brief Defines the OHNativeWindow struct. + * @since 10 + * @version 1.0 + */ +typedef struct NativeWindow OHNativeWindow; + +/** + * @brief Defines the surface extension version of OpenHarmony. + * @since 10 + * @version 1.0 + */ +#define VK_OHOS_SURFACE_SPEC_VERSION 1 + +/** + * @brief Defines the surface extension name of OpenHarmony. + * @since 10 + * @version 1.0 + */ +#define VK_OHOS_SURFACE_EXTENSION_NAME "VK_OHOS_surface" + +/** + * @brief Defines the bit mask of the VkFlags type used for the creation of a Vulkan surface. + * It is a reserved flag type. + * @since 10 + * @version 1.0 + */ +typedef VkFlags VkSurfaceCreateFlagsOHOS; + +/** + * @brief Defines the parameters required for creating a Vulkan surface. + * @since 10 + * @version 1.0 + */ +typedef struct VkSurfaceCreateInfoOHOS { + /** + * Struct type. + */ + VkStructureType sType; + /** + * Pointer to the next-level struct. + */ + const void* pNext; + /** + * Reserved flag type. + */ + VkSurfaceCreateFlagsOHOS flags; + /** + * Pointer to an OHNativeWindow instance. + */ + OHNativeWindow* window; +} VkSurfaceCreateInfoOHOS; + +/** + * @brief Defines the function pointer for creating a Vulkan surface. + * + * @syscap SystemCapability.Graphic.Vulkan + * @param instance Vulkan instance. + * @param pCreateInfo Pointer to the VkSurfaceCreateInfoOHOS struct, + * including the parameters required for creating a Vulkan surface. + * @param pAllocator Pointer to a callback function for custom memory allocation. + * If custom memory allocation is not required, pass in NULL, and the default memory allocation function is used. + * @param pSurface Pointer to the Vulkan surface created. The type is VkSurfaceKHR. + * @return Returns VK_SUCCESS if the execution is successful; + * returns an error code of the VkResult type otherwise. + * @since 10 + * @version 1.0 + */ +typedef VkResult (VKAPI_PTR *PFN_vkCreateSurfaceOHOS)( + VkInstance instance, + const VkSurfaceCreateInfoOHOS* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface +); + +#ifndef VK_NO_PROTOTYPES + +/** + * @brief Creates a Vulkan surface. + * + * @syscap SystemCapability.Graphic.Vulkan + * @param instance Vulkan instance. + * @param pCreateInfo Pointer to the VkSurfaceCreateInfoOHOS struct, + * including the parameters required for creating a Vulkan surface. + * @param pAllocator Pointer to a callback function for custom memory allocation. + * If custom memory allocation is not required, pass in NULL, and the default memory allocation function is used. + * @param pSurface Pointer to the Vulkan surface created. The type is VkSurfaceKHR. + * @return Returns VK_SUCCESS if the execution is successful; + * returns an error code of the VkResult type otherwise. + * @since 10 + * @version 1.0 + */ +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSurfaceOHOS( + VkInstance instance, + const VkSurfaceCreateInfoOHOS* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif + + +/** + * @brief Defines the external memory extension of OpenHarmony. + * @since 10 + * @version 1.0 + */ +#define VK_OHOS_external_memory 1 + +/** + * @brief Defines the OH_NativeBuffer struct. + * @since 10 + * @version 1.0 + */ +struct OH_NativeBuffer; + +/** + * @brief Defines the external memory extension version of OpenHarmony. + * @since 10 + * @version 1.0 + */ +#define VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION 1 + +/** + * @brief Defines the external memory extension name of OpenHarmony. + * @since 10 + * @version 1.0 + */ +#define VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME "VK_OHOS_external_memory" + +/** + * @brief Defines the usage of a NativeBuffer. + * @since 10 + * @version 1.0 + */ +typedef struct VkNativeBufferUsageOHOS { + /** + * Struct type. + */ + VkStructureType sType; + /** + * Pointer to the next-level struct. + */ + void* pNext; + /** + * @brief Defines the usage of a NativeBuffer. + */ + uint64_t OHOSNativeBufferUsage; +} VkNativeBufferUsageOHOS; + +/** + * @brief Defines the properties of a NativeBuffer. + * @since 10 + * @version 1.0 + */ +typedef struct VkNativeBufferPropertiesOHOS { + /** + * Struct type. + */ + VkStructureType sType; + /** + * Pointer to the next-level struct. + */ + void* pNext; + /** + * @brief Defines the size of the occupied memory. + */ + VkDeviceSize allocationSize; + /** + * @brief Defines the memory type. + */ + uint32_t memoryTypeBits; +} VkNativeBufferPropertiesOHOS; + +/** + * @brief Defines the format properties of a NativeBuffer. + * @since 10 + * @version 1.0 + */ +typedef struct VkNativeBufferFormatPropertiesOHOS { + /** + * Struct type. + */ + VkStructureType sType; + /** + * Pointer to the next-level struct. + */ + void* pNext; + /** + * Format properties. + */ + VkFormat format; + /** + * Externally defined format. + */ + uint64_t externalFormat; + /** + * Features of the externally defined format. + */ + VkFormatFeatureFlags formatFeatures; + /** + * A group of VkComponentSwizzles. + */ + VkComponentMapping samplerYcbcrConversionComponents; + /** + * Color model. + */ + VkSamplerYcbcrModelConversion suggestedYcbcrModel; + /** + * Color value range. + */ + VkSamplerYcbcrRange suggestedYcbcrRange; + /** + * X chrominance offset. + */ + VkChromaLocation suggestedXChromaOffset; + /** + * Y chrominance offset. + */ + VkChromaLocation suggestedYChromaOffset; +} VkNativeBufferFormatPropertiesOHOS; + +/** + * @brief Defines the pointer to an OH_NativeBuffer struct. + * @since 10 + * @version 1.0 + */ +typedef struct VkImportNativeBufferInfoOHOS { + /** + * Struct type. + */ + VkStructureType sType; + /** + * Pointer to the next-level struct. + */ + const void* pNext; + /** + * Pointer to an OH_NativeBuffer struct. + */ + struct OH_NativeBuffer* buffer; +} VkImportNativeBufferInfoOHOS; + +/** + * @brief Defines a struct used to obtain an OH_NativeBuffer from the Vulkan memory. + * @since 10 + * @version 1.0 + */ +typedef struct VkMemoryGetNativeBufferInfoOHOS { + /** + * Struct type. + */ + VkStructureType sType; + /** + * Pointer to the next-level struct. + */ + const void* pNext; + /** + * VkDeviceMemory instance. + */ + VkDeviceMemory memory; +} VkMemoryGetNativeBufferInfoOHOS; + +/** + * @brief Defines an externally defined format. + * @since 10 + * @version 1.0 + */ +typedef struct VkExternalFormatOHOS { + /** + * Struct type. + */ + VkStructureType sType; + /** + * Pointer to the next-level struct. + */ + void* pNext; + /** + * Externally defined format. + */ + uint64_t externalFormat; +} VkExternalFormatOHOS; + +/** + * @brief Defines a function pointer used to obtain OH_NativeBuffer properties. + * + * @syscap SystemCapability.Graphic.Vulkan + * @param device VkDevice instance. + * @param buffer Pointer to the OH_NativeBuffer struct. + * @param pProperties Pointer to the struct holding the properties of OH_NativeBuffer. + * @return Returns VK_SUCCESS if the execution is successful; + * returns an error code of the VkResult type otherwise. + * @since 10 + * @version 1.0 + */ +typedef VkResult (VKAPI_PTR *PFN_vkGetNativeBufferPropertiesOHOS)( + VkDevice device, + const struct OH_NativeBuffer* buffer, + VkNativeBufferPropertiesOHOS* pProperties +); + +/** + * @brief Defines a function pointer used to obtain an OH_NativeBuffer instance. + * + * @syscap SystemCapability.Graphic.Vulkan + * @param device VkDevice instance. + * @param pInfo Pointer to the VkMemoryGetNativeBufferInfoOHOS struct. + * @param pBuffer Double pointer to the OH_NativeBuffer obtained. + * @return Returns VK_SUCCESS if the execution is successful; + * returns an error code of the VkResult type otherwise. + * @since 10 + * @version 1.0 + */ +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryNativeBufferOHOS)( + VkDevice device, + const VkMemoryGetNativeBufferInfoOHOS* pInfo, + struct OH_NativeBuffer** pBuffer +); + +#ifndef VK_NO_PROTOTYPES + +/** + * @brief Obtains the properties of an OH_NativeBuffer instance. + * + * @syscap SystemCapability.Graphic.Vulkan + * @param device VkDevice instance. + * @param buffer Pointer to the OH_NativeBuffer struct. + * @param pProperties Pointer to the struct holding the properties of OH_NativeBuffer. + * @return Returns VK_SUCCESS if the execution is successful; + * returns an error code of the VkResult type otherwise. + * @since 10 + * @version 1.0 + */ +VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS( + VkDevice device, + const struct OH_NativeBuffer* buffer, + VkNativeBufferPropertiesOHOS* pProperties); + +/** + * @brief Obtains an OH_NativeBuffer instance. + * + * @syscap SystemCapability.Graphic.Vulkan + * @param device VkDevice instance. + * @param pInfo Pointer to the VkMemoryGetNativeBufferInfoOHOS struct. + * @param pBuffer Double pointer to the OH_NativeBuffer obtained. + * @return Returns VK_SUCCESS if the execution is successful; + * returns an error code of the VkResult type otherwise. + * @since 10 + * @version 1.0 + */ +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS( + VkDevice device, + const VkMemoryGetNativeBufferInfoOHOS* pInfo, + struct OH_NativeBuffer** pBuffer); +#endif + +#ifdef __cplusplus +} +#endif + +#endif -- Gitee From e12934cd47e0b7f1fccf0be3ce0160dbc840b6f9 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Wed, 11 Oct 2023 17:05:55 +0800 Subject: [PATCH 0025/2135] update docs Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/context.h | 273 ++++++++---------- en/native_sdk/ai/mindspore/data_type.h | 1 + en/native_sdk/ai/mindspore/format.h | 1 + en/native_sdk/ai/mindspore/model.h | 99 +++---- en/native_sdk/ai/mindspore/status.h | 2 + en/native_sdk/ai/mindspore/tensor.h | 130 ++++----- .../neural_network_runtime.h | 3 +- .../neural_network_runtime_type.h | 1 + en/native_sdk/usb/usb_ddk_api.h | 45 +-- en/native_sdk/usb/usb_ddk_types.h | 128 ++++---- 10 files changed, 332 insertions(+), 351 deletions(-) diff --git a/en/native_sdk/ai/mindspore/context.h b/en/native_sdk/ai/mindspore/context.h index b78815e3..e36ec853 100644 --- a/en/native_sdk/ai/mindspore/context.h +++ b/en/native_sdk/ai/mindspore/context.h @@ -28,7 +28,8 @@ * @file context.h * * @brief Provides **Context** APIs for configuring runtime information. - * + * + * @library libmindspore_lite_ndk.so * @since 9 */ #ifndef MINDSPORE_INCLUDE_C_API_CONTEXT_C_H @@ -44,7 +45,7 @@ extern "C" { #endif /** - * @brief Defines the pointer to the MindSpore context. + * @brief Defines the pointer to the MindSpore context. * * @since 9 */ @@ -52,13 +53,13 @@ typedef void *OH_AI_ContextHandle; /** * @brief Defines the pointer to the MindSpore device information. - * + * * @since 9 */ typedef void *OH_AI_DeviceInfoHandle; /** - * \brief Creates a context object. + * @brief Creates a context object. * * @return {@link OH_AI_ContextHandle} that points to the context. * @since 9 @@ -66,371 +67,337 @@ typedef void *OH_AI_DeviceInfoHandle; OH_AI_API OH_AI_ContextHandle OH_AI_ContextCreate(); /** - * \brief Destroys a context object. + * @brief Destroys a context object. * - * \param context Level-2 pointer to {@link OH_AI_ContextHandle}. After the context is destroyed, - * the pointer is set to null. + * @param context Level-2 pointer to {@link OH_AI_ContextHandle}. After the context is destroyed, the pointer is set to null. * @since 9 */ OH_AI_API void OH_AI_ContextDestroy(OH_AI_ContextHandle *context); /** - * \brief Sets the number of runtime threads. + * @brief Sets the number of runtime threads. * - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \param thread_num Number of runtime threads. + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @param thread_num Number of runtime threads. * @since 9 */ OH_AI_API void OH_AI_ContextSetThreadNum(OH_AI_ContextHandle context, int32_t thread_num); /** - * \brief Obtains the number of threads. + * @brief Obtains the number of threads. * - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \return Number of threads. + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @return Number of threads. * @since 9 */ OH_AI_API int32_t OH_AI_ContextGetThreadNum(const OH_AI_ContextHandle context); /** - * \brief Sets the affinity mode for binding runtime threads to CPU cores, which are classified into large, - * medium, and small cores based on the CPU frequency. You only need to bind the large or medium cores, - * but not small cores. + * @brief Sets the affinity mode for binding runtime threads to CPU cores, which are classified into large, medium, and small cores based on the CPU frequency. You only need to bind the large or medium cores, but not small cores. * - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \param mode Affinity mode. **0**: no affinities; **1**: big cores first; **2**: medium cores first + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @param mode Affinity mode. **0**: no affinities; **1**: big cores first; **2**: medium cores first * @since 9 */ OH_AI_API void OH_AI_ContextSetThreadAffinityMode(OH_AI_ContextHandle context, int mode); /** - * \brief Obtains the affinity mode for binding runtime threads to CPU cores. + * @brief Obtains the affinity mode for binding runtime threads to CPU cores. * - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \return Affinity mode. **0**: no affinities; **1**: big cores first; **2**: medium cores first + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @return Affinity mode. **0**: no affinities; **1**: big cores first; **2**: medium cores first * @since 9 */ OH_AI_API int OH_AI_ContextGetThreadAffinityMode(const OH_AI_ContextHandle context); /** - * \brief Sets the list of CPU cores bound to a runtime thread. + * @brief Sets the list of CPU cores bound to a runtime thread. * * For example, if **core_list** is set to **[2,6,8]**, threads run on the 2nd, 6th, and 8th CPU cores. - * If {@link OH_AI_ContextSetThreadAffinityMode} and {@link OH_AI_ContextSetThreadAffinityCoreList} - * are called for the same context object, - * the **core_list** parameter of {@link OH_AI_ContextSetThreadAffinityCoreList} takes effect, - * but the **mode** parameter of {@link OH_AI_ContextSetThreadAffinityMode} does not. + * If {@link OH_AI_ContextSetThreadAffinityMode} and {@link OH_AI_ContextSetThreadAffinityCoreList} are called for the same context object, + * the **core_list** parameter of {@link OH_AI_ContextSetThreadAffinityCoreList} takes effect, but the **mode** parameter of {@link OH_AI_ContextSetThreadAffinityMode} does not. * - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \param core_list List of bound CPU cores. - * \param core_num Number of cores, which indicates the length of {@link core_list}. + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @param core_list List of bound CPU cores. + * @param core_num Number of cores, which indicates the length of {@link core_list}. * @since 9 */ OH_AI_API void OH_AI_ContextSetThreadAffinityCoreList(OH_AI_ContextHandle context, const int32_t *core_list, size_t core_num); /** - * \brief Obtains the list of bound CPU cores. - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \param core_num Number of CPU cores. - * \return List of bound CPU cores. This list is managed by {@link OH_AI_ContextHandle}. - * The caller does not need to destroy it manually. + * @brief Obtains the list of bound CPU cores. * + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @param core_num Number of CPU cores. + * @return List of bound CPU cores. This list is managed by {@link OH_AI_ContextHandle}. The caller does not need to destroy it manually. * @since 9 */ OH_AI_API const int32_t *OH_AI_ContextGetThreadAffinityCoreList(const OH_AI_ContextHandle context, size_t *core_num); /** - * \brief Sets whether to enable parallelism between operators. The setting is ineffective because the feature of - * this API is not yet available. + * @brief Sets whether to enable parallelism between operators. The setting is ineffective because the feature of this API is not yet available. * - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \param is_parallel Whether to enable parallelism between operators. The value **true** means to enable parallelism - * between operators, and the value **false** means the opposite. + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @param is_parallel Whether to enable parallelism between operators. The value **true** means to enable parallelism between operators, and the value **false** means the opposite. * @since 9 */ OH_AI_API void OH_AI_ContextSetEnableParallel(OH_AI_ContextHandle context, bool is_parallel); /** - * \brief Checks whether parallelism between operators is supported. + * @brief Checks whether parallelism between operators is supported. * - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \return Whether parallelism between operators is supported. The value **true** means that parallelism between - * operators is supported, and the value **false** means the opposite. + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @return Whether parallelism between operators is supported. The value **true** means to enable parallelism between operators, and the value **false** means the opposite. * @since 9 */ OH_AI_API bool OH_AI_ContextGetEnableParallel(const OH_AI_ContextHandle context); /** - * \brief Attaches the custom device information to the inference context. + * @brief Attaches the custom device information to the inference context. * - * \param context {@link OH_AI_ContextHandle} that points to the context instance. - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param context {@link OH_AI_ContextHandle} that points to the context instance. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. * @since 9 */ OH_AI_API void OH_AI_ContextAddDeviceInfo(OH_AI_ContextHandle context, OH_AI_DeviceInfoHandle device_info); /** - * \brief Creates a device information object. - * - * \param device_type Device type. For details, see {@link OH_AI_DeviceType}. + * @brief Creates a device information object. * - * \return {@link OH_AI_DeviceInfoHandle} that points to the device information instance. + * @param device_type Device type. For details, see {@link OH_AI_DeviceType}. + * @return {@link OH_AI_DeviceInfoHandle} that points to the device information instance. * @since 9 */ OH_AI_API OH_AI_DeviceInfoHandle OH_AI_DeviceInfoCreate(OH_AI_DeviceType device_type); /** - * \brief Destroys a device information instance. Note: After the device information instance is added to the context, - * the caller does not need to destroy it separately. + * @brief Destroys a device information instance. Note: After the device information instance is added to the context, the caller does not need to destroy it manually. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. * @since 9 */ OH_AI_API void OH_AI_DeviceInfoDestroy(OH_AI_DeviceInfoHandle *device_info); /** - * \brief Sets the name of a provider. + * @brief Sets the name of a provider. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \param provider Provider name. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param provider Provider name. * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetProvider(OH_AI_DeviceInfoHandle device_info, const char *provider); /** - * \brief Obtains the provider name. + * @brief Obtains the provider name. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * - * \return Provider name. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @return Provider name. * @since 9 */ OH_AI_API const char *OH_AI_DeviceInfoGetProvider(const OH_AI_DeviceInfoHandle device_info); /** - * \brief Sets the name of a provider device. + * @brief Sets the name of a provider device. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \param device Name of the provider device, for example, CPU. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param device Name of the provider device, for example, CPU. * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetProviderDevice(OH_AI_DeviceInfoHandle device_info, const char *device); /** - * \brief Obtains the name of a provider device. - * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @brief Obtains the name of a provider device. * - * \return Name of the provider device. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @return Name of the provider device. * @since 9 */ OH_AI_API const char *OH_AI_DeviceInfoGetProviderDevice(const OH_AI_DeviceInfoHandle device_info); /** - * \brief Obtains the type of a provider device. + * @brief Obtains the type of a provider device. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \return Type of the provider device. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @return Type of the provider device. * @since 9 */ OH_AI_API OH_AI_DeviceType OH_AI_DeviceInfoGetDeviceType(const OH_AI_DeviceInfoHandle device_info); /** - * \brief Sets whether to enable float16 inference. This function is available only for CPU/GPU devices. + * @brief Sets whether to enable float16 inference. This function is available only for CPU/GPU devices. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \param is_fp16 Whether to enable float16 inference. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param is_fp16 Whether to enable float16 inference. * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetEnableFP16(OH_AI_DeviceInfoHandle device_info, bool is_fp16); /** - * \brief Checks whether float16 inference is enabled. This function is available only for CPU/GPU devices. + * @brief Checks whether float16 inference is enabled. This function is available only for CPU/GPU devices. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \return Whether float16 inference is enabled. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @return Whether float16 inference is enabled. * @since 9 */ OH_AI_API bool OH_AI_DeviceInfoGetEnableFP16(const OH_AI_DeviceInfoHandle device_info); /** - * \brief Sets the NPU frequency type. This function is available only for NPU devices. + * @brief Sets the NPU frequency type. This function is available only for NPU devices. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \param frequency NPU frequency type. The value ranges from **0** to **4**. The default value is **3**. - * **1**: low power consumption; **2**: balanced; **3**: high performance; **4**: ultra-high performance + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param frequency NPU frequency type. The value ranges from **0** to **4**. The default value is **3**. **1**: low power consumption; **2**: balanced; **3**: high performance; **4**: ultra-high performance * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetFrequency(OH_AI_DeviceInfoHandle device_info, int frequency); /** - * \brief Obtains the NPU frequency type. This function is available only for NPU devices. + * @brief Obtains the NPU frequency type. This function is available only for NPU devices. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * - * \return Frequency type of the NPU. The value ranges from **0** to **4**. **1**: low power consumption; - * **2**: balanced; **3**: high performance; **4**: ultra-high performance + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @return Frequency type of the NPU. The value ranges from **0** to **4**. **1**: low power consumption; **2**: balanced; **3**: high performance; **4**: ultra-high performance * @since 9 */ OH_AI_API int OH_AI_DeviceInfoGetFrequency(const OH_AI_DeviceInfoHandle device_info); /** - * \brief Obtains the descriptions of all NNRt devices in the system. - * - * \param num Number of NNRt devices. + * @brief Obtains the descriptions of all NNRt devices in the system. * - * \return Pointer to the NNRt device description array. If the operation fails, **NULL** is returned. + * @param num Number of NNRt devices. + * @return Pointer to the NNRt device description array. If the operation fails, **NULL** is returned. * @since 10 */ OH_AI_API NNRTDeviceDesc *OH_AI_GetAllNNRTDeviceDescs(size_t *num); /** - * \brief Obtains the pointer to an element in the NNRt device description array. + * @brief Obtains the pointer to an element in the NNRt device description array. * - * \param descs Array of NNRt device descriptions. - * \param index Index of an array element. - * - * \return Pointer to an element in the NNRt device description array. + * @param descs Array of NNRt device descriptions. + * @param index Index of an array element. + * @return Pointer to an element in the NNRt device description array. * @since 10 */ OH_AI_API NNRTDeviceDesc *OH_AI_GetElementOfNNRTDeviceDescs(NNRTDeviceDesc *descs, size_t index); /** - * \brief Destroys the NNRt device description array obtained by {@link OH_AI_GetAllNNRTDeviceDescs}. + * @brief Destroys the NNRt device description array obtained by {@link OH_AI_GetAllNNRTDeviceDescs}. * - * \param desc Double pointer to the NNRt device description array. After the operation is complete, - * the content pointed to by **desc** is set to **NULL**. + * @param desc Double pointer to the NNRt device description array. After the operation is complete, the content pointed to by **desc** is set to **NULL**. * @since 10 */ OH_AI_API void OH_AI_DestroyAllNNRTDeviceDescs(NNRTDeviceDesc **desc); /** - * \brief Obtains the NNRt device ID from the specified NNRt device description. - * Note that this ID is valid only for NNRt devices. - * - * \param desc Pointer to the NNRt device description. + * @brief Obtains the NNRt device ID from the specified NNRt device description. Note that this ID is valid only for NNRt devices. * - * \return NNRt device ID. + * @param desc Pointer to the NNRt device description. + * @return NNRt device ID. * @since 10 */ OH_AI_API size_t OH_AI_GetDeviceIdFromNNRTDeviceDesc(const NNRTDeviceDesc *desc); /** - * \brief Obtains the NNRt device name from the specified NNRt device description. - * - * \param desc Pointer to the NNRt device description. + * @brief Obtains the NNRt device name from the specified NNRt device description. * - * \return NNRt device name. The value is a pointer that points to a constant string, which is held by **desc**. - * The caller does not need to destroy it separately. + * @param desc Pointer to the NNRt device description. + * @return NNRt device name. The value is a pointer that points to a constant string, which is held by **desc**. The caller does not need to destroy it separately. * @since 10 */ OH_AI_API const char *OH_AI_GetNameFromNNRTDeviceDesc(const NNRTDeviceDesc *desc); /** - * \brief Obtains the NNRt device type from the specified NNRt device description. + * @brief Obtains the NNRt device type from the specified NNRt device description. * - * \param desc Pointer to the NNRt device description. - * - * \return NNRt device type enumerated by {@link OH_AI_NNRTDeviceType}. + * @param desc Pointer to the NNRt device description. + * @return NNRt device type enumerated by {@link OH_AI_NNRTDeviceType}. * @since 10 */ OH_AI_API OH_AI_NNRTDeviceType OH_AI_GetTypeFromNNRTDeviceDesc(const NNRTDeviceDesc *desc); /** - * \brief Searches for the NNRt device with the specified name and creates the NNRt device information based on the - * information about the first found NNRt device. - * - * \param name NNRt device name. + * @brief Searches for the NNRt device with the specified name and creates the NNRt device information based on the information about the first found NNRt device. * - * \return {@link OH_AI_DeviceInfoHandle} that points to the device information instance. + * @param name NNRt device name. + * @return {@link OH_AI_DeviceInfoHandle} that points to the device information instance. * @since 10 */ OH_AI_API OH_AI_DeviceInfoHandle OH_AI_CreateNNRTDeviceInfoByName(const char *name); /** - * \brief Searches for the NNRt device with the specified type and creates the NNRt device information based on the - * information about the first found NNRt device. + * @brief Searches for the NNRt device with the specified type and creates the NNRt device information based on the information about the first found NNRt device. * - * \param type NNRt device type enumerated by {@link OH_AI_NNRTDeviceType}. - * - * \return {@link OH_AI_DeviceInfoHandle} that points to the device information instance. + * @param type NNRt device type enumerated by {@link OH_AI_NNRTDeviceType}. + * @return {@link OH_AI_DeviceInfoHandle} that points to the device information instance. * @since 10 */ OH_AI_API OH_AI_DeviceInfoHandle OH_AI_CreateNNRTDeviceInfoByType(OH_AI_NNRTDeviceType type); /** - * \brief Sets the ID of an NNRt device. This function is available only for NNRt devices. + * @brief Sets the ID of an NNRt device. This function is available only for NNRt devices. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \param device_id NNRt device ID. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param device_id NNRt device ID. * @since 10 */ OH_AI_API void OH_AI_DeviceInfoSetDeviceId(OH_AI_DeviceInfoHandle device_info, size_t device_id); /** - * \brief Obtains the ID of an NNRt device. This function is available only for NNRt devices. - * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @brief Obtains the ID of an NNRt device. This function is available only for NNRt devices. * - * \return NNRt device ID. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @return NNRt device ID. * @since 10 */ OH_AI_API size_t OH_AI_DeviceInfoGetDeviceId(const OH_AI_DeviceInfoHandle device_info); /** - * \brief Sets the performance mode of an NNRt device. This function is available only for NNRt devices. + * @brief Sets the performance mode of an NNRt device. This function is available only for NNRt devices. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \param mode Performance mode enumerated by {@link OH_AI_PerformanceMode}. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param mode Performance mode enumerated by {@link OH_AI_PerformanceMode}. * @since 10 */ OH_AI_API void OH_AI_DeviceInfoSetPerformanceMode(OH_AI_DeviceInfoHandle device_info, OH_AI_PerformanceMode mode); /** - * \brief Obtains the performance mode of an NNRt device. This function is available only for NNRt devices. + * @brief Obtains the performance mode of an NNRt device. This function is available only for NNRt devices. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * - * \return Performance mode enumerated by {@link OH_AI_PerformanceMode}. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @return Performance mode enumerated by {@link OH_AI_PerformanceMode}. * @since 10 */ OH_AI_API OH_AI_PerformanceMode OH_AI_DeviceInfoGetPerformanceMode(const OH_AI_DeviceInfoHandle device_info); /** - * \brief Sets the priority of an NNRT task. This function is available only for NNRt devices. + * @brief Sets the priority of an NNRT task. This function is available only for NNRt devices. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \param priority NNRT task priority enumerated by {@link OH_AI_Priority}. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param priority NNRT task priority enumerated by {@link OH_AI_Priority}. * @since 10 */ OH_AI_API void OH_AI_DeviceInfoSetPriority(OH_AI_DeviceInfoHandle device_info, OH_AI_Priority priority); /** - * \brief Obtains the priority of an NNRT task. This function is available only for NNRt devices. - * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @brief Obtains the priority of an NNRT task. This function is available only for NNRt devices. * - * \return NNRT task priority enumerated by {@link OH_AI_Priority}. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @return NNRT task priority enumerated by {@link OH_AI_Priority}. * @since 10 */ OH_AI_API OH_AI_Priority OH_AI_DeviceInfoGetPriority(const OH_AI_DeviceInfoHandle device_info); /** - * \brief Adds extended configuration in the form of key/value pairs to the device information. - * This function is available only for NNRt device information. - * Note: The key/value pairs currently supported include {"CachePath": "YourCachePath"}, - * {"CacheVersion": "YourCacheVersion"}, and {"QuantParam": "YourQuantConfig". - * You can replace the values as required. + * @brief Adds extended configuration in the form of key/value pairs to the device information. This function is available only for NNRt device information. * - * \param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * \param name Key in an extended key/value pair. The value is a C string. - * \param value Start address of the value in an extended key/value pair. - * \param value_size Length of the value in an extended key/value pair. + * Note: The key/value pairs currently supported include {"CachePath": "YourCachePath"}, {"CacheVersion": "YourCacheVersion"}, + * and {"QuantParam": "YourQuantConfig". You can replace the values as required. * - * \return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_STATUS_SUCCESS** indicates that the - * operation is successful. If the operation fails, an error code is returned. + * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. + * @param name Key in an extended key/value pair. The value is a C string. + * @param value Start address of the value in an extended key/value pair. + * @param value_size Length of the value in an extended key/value pair. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_STATUS_SUCCESS** indicates that the operation is successful. If the operation fails, an error code is returned. * @since 10 */ OH_AI_API OH_AI_Status OH_AI_DeviceInfoAddExtension(OH_AI_DeviceInfoHandle device_info, const char *name, diff --git a/en/native_sdk/ai/mindspore/data_type.h b/en/native_sdk/ai/mindspore/data_type.h index ede1d2f3..2eeeae0b 100644 --- a/en/native_sdk/ai/mindspore/data_type.h +++ b/en/native_sdk/ai/mindspore/data_type.h @@ -29,6 +29,7 @@ * * @brief Declares tensor data types. * + * @library libmindspore_lite_ndk.so * @since 9 */ #ifndef MINDSPORE_INCLUDE_C_API_DATA_TYPE_C_H diff --git a/en/native_sdk/ai/mindspore/format.h b/en/native_sdk/ai/mindspore/format.h index 971fde7a..961b463c 100644 --- a/en/native_sdk/ai/mindspore/format.h +++ b/en/native_sdk/ai/mindspore/format.h @@ -29,6 +29,7 @@ * * @brief Declares tensor data formats. * + * @library libmindspore_lite_ndk.so * @since 9 */ #ifndef MINDSPORE_INCLUDE_C_API_FORMAT_C_H diff --git a/en/native_sdk/ai/mindspore/model.h b/en/native_sdk/ai/mindspore/model.h index 4d09c8b0..ee83b8a2 100644 --- a/en/native_sdk/ai/mindspore/model.h +++ b/en/native_sdk/ai/mindspore/model.h @@ -29,6 +29,7 @@ * * @brief Provides model-related APIs for model creation and inference. * + * @library libmindspore_lite_ndk.so * @since 9 */ @@ -91,7 +92,7 @@ typedef struct OH_AI_CallBackParam } OH_AI_CallBackParam; /** - * @brief Defines the pointer to a callback. + * @brief Defines the pointer to a callback. * * This pointer is used to set the two callback functions in {@link OH_AI_ModelPredict}. * Each callback function must contain three parameters, where **inputs** and **outputs** indicate the input and output tensors of the operator, and **kernel_Info** indicates information about the current operator. @@ -103,76 +104,76 @@ typedef bool (*OH_AI_KernelCallBack)(const OH_AI_TensorHandleArray inputs, const const OH_AI_CallBackParam kernel_Info); /** - * \brief Creates a model object. + * @brief Creates a model object. * - * \return Pointer to the model object. + * @return Pointer to the model object. * @since 9 */ OH_AI_API OH_AI_ModelHandle OH_AI_ModelCreate(); /** - * \brief Destroys a model object. + * @brief Destroys a model object. * - * \param model Pointer to the model object. + * @param model Pointer to the model object. * @since 9 */ OH_AI_API void OH_AI_ModelDestroy(OH_AI_ModelHandle *model); /** - * \brief Loads and builds a MindSpore model from the memory buffer. + * @brief Loads and builds a MindSpore model from the memory buffer. * - * Note that the same {@Link OH_AI_ContextHandle} object can only be passed to {@Link OH_AI_ModelBuild} or {@Link OH_AI_ModelBuildFromFile} once. - * If you call this function multiple times, make sure that you create multiple {@Link OH_AI_ContextHandle} objects accordingly. + * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or {@link OH_AI_ModelBuildFromFile} only once. + * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects accordingly. * - * \param model Pointer to the model object. - * \param model_data Address of the loaded model data in the memory. - * \param data_size Length of the model data. - * \param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. - * \param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. - * \return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @param model Pointer to the model object. + * @param model_data Address of the loaded model data in the memory. + * @param data_size Length of the model data. + * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. + * @param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *model_data, size_t data_size, OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context); /** - * \brief Loads and builds a MindSpore model from a model file. + * @brief Loads and builds a MindSpore model from a model file. * - * Note that the same {@Link OH_AI_ContextHandle} object can only be passed to {@Link OH_AI_ModelBuild} or {@Link OH_AI_ModelBuildFromFile} once. - * If you call this function multiple times, make sure that you create multiple {@Link OH_AI_ContextHandle} objects accordingly. + * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or {@link OH_AI_ModelBuildFromFile} only once. + * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects accordingly. * - * \param model Pointer to the model object. - * \param model_path Path of the model file. - * \param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. - * \param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. - * \return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @param model Pointer to the model object. + * @param model_path Path of the model file. + * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. + * @param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelBuildFromFile(OH_AI_ModelHandle model, const char *model_path, OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context); /** - * \brief Adjusts the input tensor shapes of a built model. + * @brief Adjusts the input tensor shapes of a built model. * - * \param model Pointer to the model object. - * \param inputs Tensor array structure corresponding to the model input. - * \param shape_infos Input shape array, which consists of tensor shapes arranged in the model input sequence. The model adjusts the tensor shapes in sequence. - * \param shape_info_num Length of the input shape array. - * \return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @param model Pointer to the model object. + * @param inputs Tensor array structure corresponding to the model input. + * @param shape_infos Input shape array, which consists of tensor shapes arranged in the model input sequence. The model adjusts the tensor shapes in sequence. + * @param shape_info_num Length of the input shape array. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelResize(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, OH_AI_ShapeInfo *shape_infos, size_t shape_info_num); /** - * \brief Performs model inference. + * @brief Performs model inference. * - * \param model Pointer to the model object. - * \param inputs Tensor array structure corresponding to the model input. - * \param outputs Pointer to the tensor array structure corresponding to the model output. - * \param before Callback function executed before model inference. - * \param after Callback function executed after model inference. - * \return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @param model Pointer to the model object. + * @param inputs Tensor array structure corresponding to the model input. + * @param outputs Pointer to the tensor array structure corresponding to the model output. + * @param before Callback function executed before model inference. + * @param after Callback function executed after model inference. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelPredict(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, @@ -180,39 +181,39 @@ OH_AI_API OH_AI_Status OH_AI_ModelPredict(OH_AI_ModelHandle model, const OH_AI_T const OH_AI_KernelCallBack after); /** - * \brief Obtains the input tensor array structure of a model. + * @brief Obtains the input tensor array structure of a model. * - * \param model Pointer to the model object. - * \return Tensor array structure corresponding to the model input. + * @param model Pointer to the model object. + * @return Tensor array structure corresponding to the model input. * @since 9 */ OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetInputs(const OH_AI_ModelHandle model); /** - * \brief Obtains the output tensor array structure of a model. + * @brief Obtains the output tensor array structure of a model. * - * \param model Pointer to the model object. - * \return Tensor array structure corresponding to the model output. + * @param model Pointer to the model object. + * @return Tensor array structure corresponding to the model output. * @since 9 */ OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetOutputs(const OH_AI_ModelHandle model); /** - * \brief Obtains the input tensor of a model by tensor name. + * @brief Obtains the input tensor of a model by tensor name. * - * \param model Pointer to the model object. - * \param tensor_name Tensor name. - * \return Pointer to the input tensor indicated by **tensor_name**. If the tensor does not exist in the input, **null** will be returned. + * @param model Pointer to the model object. + * @param tensor_name Tensor name. + * @return Pointer to the input tensor indicated by **tensor_name**. If the tensor does not exist in the input, **null** will be returned. * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); /** - * \brief Obtains the output tensor of a model by tensor name. + * @brief Obtains the output tensor of a model by tensor name. * - * \param model Pointer to the model object. - * \param tensor_name Tensor name. - * \return Pointer to the output tensor indicated by **tensor_name**. If the tensor does not exist in the input, **null** will be returned. + * @param model Pointer to the model object. + * @param tensor_name Tensor name. + * @return Pointer to the output tensor indicated by **tensor_name**. If the tensor does not exist in the input, **null** will be returned. * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetOutputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); diff --git a/en/native_sdk/ai/mindspore/status.h b/en/native_sdk/ai/mindspore/status.h index 5381aa1e..80ad7936 100644 --- a/en/native_sdk/ai/mindspore/status.h +++ b/en/native_sdk/ai/mindspore/status.h @@ -28,6 +28,8 @@ * @file status.h * * @brief Provides the status codes of MindSpore Lite. + * + * @library libmindspore_lite_ndk.so * @since 9 */ #ifndef MINDSPORE_INCLUDE_C_API_STATUS_C_H diff --git a/en/native_sdk/ai/mindspore/tensor.h b/en/native_sdk/ai/mindspore/tensor.h index b4055580..554fe5dc 100644 --- a/en/native_sdk/ai/mindspore/tensor.h +++ b/en/native_sdk/ai/mindspore/tensor.h @@ -29,6 +29,7 @@ * * @brief Provides APIs for creating and modifying tensor information. * + * @library libmindspore_lite_ndk.so * @since 9 */ @@ -52,195 +53,192 @@ extern "C" { typedef void *OH_AI_TensorHandle; /** - * \brief Creates a tensor object. + * @brief Creates a tensor object. * - * \param name Tensor name. - * \param type Tensor data type. - * \param shape Tensor dimension array. - * \param shape_num Length of the tensor dimension array. - * \param data Data pointer. - * \param data_len Data length. + * @param name Tensor name. + * @param type Tensor data type. + * @param shape Tensor dimension array. + * @param shape_num Length of the tensor dimension array. + * @param data Data pointer. + * @param data_len Data length. + * + * @return Handle of the tensor object. * - * \return Handle of the tensor object. - * * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_TensorCreate(const char *name, OH_AI_DataType type, const int64_t *shape, size_t shape_num, const void *data, size_t data_len); /** - * \brief Destroys a tensor object. + * @brief Destroys a tensor object. + * + * @param tensor Level-2 pointer to the tensor handle. * - * \param tensor Level-2 pointer to the tensor handle. - * * @since 9 */ OH_AI_API void OH_AI_TensorDestroy(OH_AI_TensorHandle *tensor); /** - * \brief Clones a tensor. + * @brief Clones a tensor. * - * \param tensor Pointer to the tensor to clone. + * @param tensor Pointer to the tensor to clone. * - * \return Handle of the new tensor object. + * @return Handle of the new tensor object. * * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_TensorClone(OH_AI_TensorHandle tensor); /** - * \brief Sets the name of a tensor. + * @brief Sets the name of a tensor. * - * \param tensor Handle of the tensor object. - * \param name Tensor name. + * @param tensor Handle of the tensor object. + * @param name Tensor name. * * @since 9 */ OH_AI_API void OH_AI_TensorSetName(OH_AI_TensorHandle tensor, const char *name); /** - * \brief Obtains the name of a tensor. + * @brief Obtains the name of a tensor. * - * \param tensor Handle of the tensor object. + * @param tensor Handle of the tensor object. * - * \return Tensor name. + * @return Tensor name. * * @since 9 */ OH_AI_API const char *OH_AI_TensorGetName(const OH_AI_TensorHandle tensor); /** - * \brief Sets the data type of a tensor. + * @brief Sets the data type of a tensor. * - * \param tensor Handle of the tensor object. - * \param type Data type. For details, see {@link OH_AI_DataType}. + * @param tensor Handle of the tensor object. + * @param type Data type. For details, see {@link OH_AI_DataType}. * * @since 9 */ OH_AI_API void OH_AI_TensorSetDataType(OH_AI_TensorHandle tensor, OH_AI_DataType type); /** - * \brief Obtains the data type of a tensor. + * @brief Obtains the data type of a tensor. * - * \param tensor Handle of the tensor object. + * @param tensor Handle of the tensor object. * - * \return Data type of the tensor. + * @return Data type of the tensor. * * @since 9 */ OH_AI_API OH_AI_DataType OH_AI_TensorGetDataType(const OH_AI_TensorHandle tensor); /** - * \brief Sets the shape of a tensor. + * @brief Sets the shape of a tensor. * - * \param tensor Handle of the tensor object. - * \param shape Tensor shape array. - * \param shape_num Length of the tensor shape array. + * @param tensor Handle of the tensor object. + * @param shape Tensor shape array. + * @param shape_num Length of the tensor shape array. * * @since 9 */ OH_AI_API void OH_AI_TensorSetShape(OH_AI_TensorHandle tensor, const int64_t *shape, size_t shape_num); /** - * \brief Obtains the shape of a tensor. + * @brief Obtains the shape of a tensor. * - * \param tensor Handle of the tensor object. - * \param shape_num Length of the tensor shape array. + * @param tensor Handle of the tensor object. + * @param shape_num Length of the tensor shape array. * - * \return Tensor shape array. + * @return Tensor shape array. * * @since 9 */ OH_AI_API const int64_t *OH_AI_TensorGetShape(const OH_AI_TensorHandle tensor, size_t *shape_num); /** - * \brief Sets the tensor data format. + * @brief Sets the tensor data format. * - * \param tensor Handle of the tensor object. - * \param format Tensor data format. + * @param tensor Handle of the tensor object. + * @param format Tensor data format. * * @since 9 */ OH_AI_API void OH_AI_TensorSetFormat(OH_AI_TensorHandle tensor, OH_AI_Format format); /** - * \brief Obtains the tensor data format. + * @brief Obtains the tensor data format. * - * \param tensor Handle of the tensor object. + * @param tensor Handle of the tensor object. * - * \return Tensor data format. + * @return Tensor data format. * * @since 9 */ OH_AI_API OH_AI_Format OH_AI_TensorGetFormat(const OH_AI_TensorHandle tensor); /** - * \brief Sets the tensor data. + * @brief Sets the tensor data. * - * \param tensor Handle of the tensor object. - * \param data Data pointer. + * @param tensor Handle of the tensor object. + * @param data Data pointer. * * @since 9 */ OH_AI_API void OH_AI_TensorSetData(OH_AI_TensorHandle tensor, void *data); /** - * \brief Obtains the pointer to tensor data. + * @brief Obtains the pointer to tensor data. * - * \param tensor Handle of the tensor object. + * @param tensor Handle of the tensor object. * - * \return Pointer to tensor data. + * @return Pointer to tensor data. * * @since 9 */ OH_AI_API const void *OH_AI_TensorGetData(const OH_AI_TensorHandle tensor); /** - * \brief Obtains the pointer to variable tensor data. If the data is empty, memory will be allocated. + * @brief Obtains the pointer to variable tensor data. If the data is empty, memory will be allocated. * - * \param tensor Handle of the tensor object. + * @param tensor Handle of the tensor object. * - * \return Pointer to tensor data. + * @return Pointer to tensor data. * * @since 9 */ OH_AI_API void *OH_AI_TensorGetMutableData(const OH_AI_TensorHandle tensor); /** - * \brief Obtains the number of tensor elements. + * @brief Obtains the number of tensor elements. * - * \param tensor Handle of the tensor object. + * @param tensor Handle of the tensor object. * - * \return Number of tensor elements. + * @return Number of tensor elements. * * @since 9 */ OH_AI_API int64_t OH_AI_TensorGetElementNum(const OH_AI_TensorHandle tensor); /** - * \brief Obtains the number of bytes of the tensor data. + * @brief Obtains the number of bytes of the tensor data. * - * \param tensor Handle of the tensor object. + * @param tensor Handle of the tensor object. * - * \return Number of bytes of the tensor data. + * @return Number of bytes of the tensor data. * * @since 9 */ OH_AI_API size_t OH_AI_TensorGetDataSize(const OH_AI_TensorHandle tensor); /** - * \brief Sets the tensor as the user data. This function allows you to reuse user data as the model input, - * which helps to reduce data copy by one time. - * Note: The user data is type of external data for the tensor and is not automatically released when the - * tensor is destroyed. The caller needs to release the data separately. In addition, the caller must ensure - * validity of the user data during use of the tensor. + * @brief Sets the tensor as the user data. This function allows you to reuse user data as the model input, which helps to reduce data copy by one time. + * Note: The user data is type of external data for the tensor and is not automatically released when the tensor is destroyed. The caller needs to release the data. In addition, the caller must ensure validity of the user data + * during use of the tensor. * - * \param tensor Handle of the tensor object. - * \param data Start address of user data. - * \param data_size Length of the user data. + * @param tensor Handle of the tensor object. + * @param data Start address of user data. + * @param data_size Length of the user data. * - * \return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_STATUS_SUCCESS** indicates that - * the operation is successful. If the operation fails, an error code is returned. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_STATUS_SUCCESS** indicates that the operation is successful. If the operation fails, an error code is returned. * * @since 10 */ diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index 740e8c6c..3b504b17 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -28,9 +28,10 @@ * @file neural_network_runtime.h * * @brief Defines the Neural Network Runtime APIs. The AI inference framework uses the Native APIs provided by Neural Network Runtime - * to construct and compile models and perform inference and computing on acceleration hardware. + * to construct and compile models and perform inference and computing on acceleration hardware. * Note: Currently, the APIs of Neural Network Runtime do not support multi-thread calling. \n * + * @library libneural_network_runtime.so * @since 9 * @version 1.0 */ diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index 71aa509a..23be7b1a 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -29,6 +29,7 @@ * * @brief Defines the structure and enumeration for Neural Network Runtime. * + * @library libneural_network_runtime.so * @since 9 * @version 1.0 */ diff --git a/en/native_sdk/usb/usb_ddk_api.h b/en/native_sdk/usb/usb_ddk_api.h index 541579ac..cb9bfd64 100644 --- a/en/native_sdk/usb/usb_ddk_api.h +++ b/en/native_sdk/usb/usb_ddk_api.h @@ -16,11 +16,10 @@ #define USB_DDK_API_H /** - * @addtogroup UsbDdk + * @addtogroup UsbDDK * @{ * - * @brief Provides USB DDK APIs to open and close USB interfaces, perform non-isochronous and isochronous - * data transfer over USB pipes, and implement control transfer and interrupt transfer, etc. + * @brief Provides USB DDK APIs to open and close USB interfaces, perform non-isochronous and isochronous data transfer over USB pipes, and implement control transfer and interrupt transfer, etc. * * @syscap SystemCapability.Driver.USB.Extension * @since 10 @@ -33,7 +32,7 @@ * @brief Declares the USB DDK APIs used by the USB host to access USB devices. * * File to include: - * + * @library libusb_ndk.z.so * @since 10 * @version 1.0 */ @@ -49,6 +48,7 @@ extern "C" { /** * @brief Initializes the DDK. * + * @permission ohos.permission.ACCESS_DDK_USB * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -58,6 +58,7 @@ int32_t OH_Usb_Init(void); /** * @brief Releases the DDK. * + * @permission ohos.permission.ACCESS_DDK_USB * @since 10 * @version 1.0 */ @@ -66,6 +67,7 @@ void OH_Usb_Release(void); /** * @brief Obtains the USB device descriptor. * + * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId ID of the device whose descriptor is to be obtained. * @param desc Device descriptor. For details, see {@link UsbDeviceDescriptor}. * @return 0 if the operation is successful; a negative value otherwise. @@ -75,13 +77,12 @@ void OH_Usb_Release(void); int32_t OH_Usb_GetDeviceDescriptor(uint64_t deviceId, struct UsbDeviceDescriptor *desc); /** - * @brief Obtains the configuration descriptor. To avoid memory leakage, use {@link OH_Usb_FreeConfigDescriptor} - * to release a descriptor after use. + * @brief Obtains the configuration descriptor. To avoid memory leakage, use {@link OH_Usb_FreeConfigDescriptor} to release a descriptor after use. * + * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId ID of the device whose configuration descriptor is to be obtained. * @param configIndex Configuration index, which corresponds to {@link bConfigurationValue} in the USB protocol. - * @param config Configuration descriptor, which includes the standard configuration descriptor defined in the - * USB protocol and the associated interface descriptor and endpoint descriptor. + * @param config Configuration descriptor, which includes the standard configuration descriptor defined in the USB protocol and the associated interface descriptor and endpoint descriptor. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -90,9 +91,9 @@ int32_t OH_Usb_GetConfigDescriptor( uint64_t deviceId, uint8_t configIndex, struct UsbDdkConfigDescriptor ** const config); /** - * @brief Releases the configuration descriptor. To avoid memory leakage, use OH_Usb_FreeConfigDescriptor - * to release a descriptor after use. + * @brief Releases the configuration descriptor. To avoid memory leakage, use OH_Usb_FreeConfigDescriptor to release a descriptor after use. * + * @permission ohos.permission.ACCESS_DDK_USB * @param config Configuration descriptor obtained by calling {@link OH_Usb_GetConfigDescriptor}. * @since 10 * @version 1.0 @@ -102,10 +103,10 @@ void OH_Usb_FreeConfigDescriptor(const struct UsbDdkConfigDescriptor * const con /** * @brief Claims a USB interface. * + * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId ID of the device to be operated. * @param interfaceIndex Interface index, which corresponds to {@link bInterfaceNumber} in the USB protocol. - * @param interfaceHandle Interface operation handle. After the interface is claimed successfully, a value - * will be assigned to this parameter. + * @param interfaceHandle Interface operation handle. After the interface is claimed successfully, a value will be assigned to this parameter. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -115,6 +116,7 @@ int32_t OH_Usb_ClaimInterface(uint64_t deviceId, uint8_t interfaceIndex, uint64_ /** * @brief Releases a USB interface. * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle Interface operation handle. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 @@ -125,9 +127,9 @@ int32_t OH_Usb_ReleaseInterface(uint64_t interfaceHandle); /** * @brief Activates the alternate setting of the USB interface. * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle Interface operation handle. - * @param settingIndex Index of the alternate setting, which corresponds to {@link bAlternateSetting} - * in the USB protocol. + * @param settingIndex Index of the alternate setting, which corresponds to {@link bAlternateSetting} in the USB protocol. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -137,9 +139,9 @@ int32_t OH_Usb_SelectInterfaceSetting(uint64_t interfaceHandle, uint8_t settingI /** * @brief Obtains the activated alternate setting of the USB interface. * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle Interface operation handle. - * @param settingIndex Index of the alternate setting, which corresponds to {@link bAlternateSetting} - * in the USB protocol. + * @param settingIndex Index of the alternate setting, which corresponds to {@link bAlternateSetting} in the USB protocol. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -149,6 +151,7 @@ int32_t OH_Usb_GetCurrentInterfaceSetting(uint64_t interfaceHandle, uint8_t *set /** * @brief Sends a control read transfer request. This API works in a synchronous manner. * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle Interface operation handle. * @param setup Request parameters. For details, see {@link UsbControlRequestSetup}. * @param timeout Timeout threshold, in ms. @@ -164,6 +167,7 @@ int32_t OH_Usb_SendControlReadRequest(uint64_t interfaceHandle, const struct Usb /** * @brief Sends a control write transfer request. This API works in a synchronous manner. * + * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle Interface operation handle. * @param setup Request parameters. For details, see {@link UsbControlRequestSetup}. * @param timeout Timeout threshold, in ms. @@ -177,9 +181,9 @@ int32_t OH_Usb_SendControlWriteRequest(uint64_t interfaceHandle, const struct Us uint32_t timeout, const uint8_t *data, uint32_t dataLen); /** - * @brief Sends a pipe request. This API works in a synchronous manner. This API applies to interrupt transfer - * and bulk transfer. + * @brief Sends a pipe request. This API works in a synchronous manner. This API applies to interrupt transfer and bulk transfer. * + * @permission ohos.permission.ACCESS_DDK_USB * @param pipe Pipe used to transfer data. * @param devMmap Device memory map, which can be obtained by calling {@link OH_Usb_CreateDeviceMemMap}. * @return 0 if the operation is successful; a negative value otherwise. @@ -189,9 +193,9 @@ int32_t OH_Usb_SendControlWriteRequest(uint64_t interfaceHandle, const struct Us int32_t OH_Usb_SendPipeRequest(const struct UsbRequestPipe *pipe, UsbDeviceMemMap *devMmap); /** - * @brief Creates a buffer. To avoid memory leakage, use {@link OH_Usb_DestroyDeviceMemMap} to destroy a buffer - * after use. + * @brief Creates a buffer. To avoid memory leakage, use {@link OH_Usb_DestroyDeviceMemMap} to destroy a buffer after use. * + * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId ID of the device for which the buffer is to be created. * @param size Buffer size. * @param devMmap Data memory map, through which the created buffer is returned to the caller. @@ -204,6 +208,7 @@ int32_t OH_Usb_CreateDeviceMemMap(uint64_t deviceId, size_t size, UsbDeviceMemMa /** * @brief Destroys a buffer. To avoid resource leakage, destroy a buffer in time after use. * + * @permission ohos.permission.ACCESS_DDK_USB * @param devMmap Device memory map created by calling {@link OH_Usb_CreateDeviceMemMap}. * @since 10 * @version 1.0 diff --git a/en/native_sdk/usb/usb_ddk_types.h b/en/native_sdk/usb/usb_ddk_types.h index 6bb4cbd6..4a2ebb85 100644 --- a/en/native_sdk/usb/usb_ddk_types.h +++ b/en/native_sdk/usb/usb_ddk_types.h @@ -13,14 +13,14 @@ * limitations under the License. */ -#ifndef USBDDKTYPES_H -#define USBDDKTYPES_H +#ifndef USB_DDK_TYPES_H +#define USB_DDK_TYPES_H /** - * @addtogroup UsbDdk + * @addtogroup UsbDDK * @{ * - * @brief Provides USB DDK types and declares the macros, enumerated variables, and\n - * data structures required by the USB DDK APIs. + * @brief Provides USB DDK APIs to open and close USB interfaces, perform non-isochronous and isochronous + * data transfer over USB pipes, and implement control transfer and interrupt transfer, etc. * * @syscap SystemCapability.Driver.USB.Extension * @since 10 @@ -32,6 +32,8 @@ * * @brief Provides the enumerated variables, structures, and macros used in USB DDK APIs. * + * File to include: <usb/usb_ddk_types.h> + * @library libusb_ndk.z.so * @since 10 * @version 1.0 */ @@ -43,20 +45,6 @@ extern "C" { #endif /* __cplusplus */ -#define USB_MAXINTERFACES 32 -/** - * @brief Interface claim mode. - * - * @since 10 - * @version 1.0 - */ -typedef enum UsbClaimMode { - /** Claim a USB interface in non-forced mode. */ - USB_CLAIM_UNFORCE, - /** Claim a USB interface in forced mode. (The driver of the USB interface in the kernel will be uninstalled.) */ - USB_CLAIM_FORCE, -} UsbClaimMode; - /** * @brief Setup data for control transfer. It corresponds to Setup Data in the USB protocol. * @@ -64,23 +52,19 @@ typedef enum UsbClaimMode { * @version 1.0 */ typedef struct UsbControlRequestSetup { - /** Request type, corresponding to bmRequestType in the USB protocol. */ - uint8_t requestType; - /** Request command, corresponding to bRequest in the USB protocol. */ - uint8_t requestCmd; - /** Value corresponding to wValue in the USB protocol. Its meaning varies according to the request. */ - uint16_t value; - /** Index corresponding to wIndex in the USB protocol. It is usually used to transfer the index or offset.\n - * Its meaning varies according to the request. - */ - uint16_t index; - /** Data length, corresponding to wLength in the USB protocol. If data is transferred,\n - * this field indicates the number of transferred bytes. - */ - uint16_t length; - /** Timeout duration, in milliseconds. */ - uint32_t timeout; -} __attribute__((packed)) UsbControlRequestSetup; + /** Request type */ + uint8_t bmRequestType; + /** Specific request. */ + uint8_t bRequest; + /** Value corresponding to wValue in the USB protocol. Its meaning varies according to the request. */ + uint16_t wValue; + /** Index corresponding to wIndex in the USB protocol. It is usually used to transfer the index or offset. + Its meaning varies according to the request. */ + uint16_t wIndex; + /** Data length corresponding to wLength in the USB protocol. If data is transferred, + this field indicates the number of transferred bytes. */ + uint16_t wLength; +} __attribute__((aligned(8))) UsbControlRequestSetup; /** * @brief Standard device descriptor, corresponding to Standard Device Descriptor in the USB protocol. @@ -97,9 +81,9 @@ typedef struct UsbDeviceDescriptor { uint16_t bcdUSB; /** Device class code allocated by the USB-IF. */ uint8_t bDeviceClass; - /** Device subclass code allocated by USB-IF. The value is limited by that of bDeviceClass. */ + /** Device subclass code allocated by USB-IF. The value is limited by that of {@link bDeviceClass}. */ uint8_t bDeviceSubClass; - /** Protocol code allocated by USB-IF. The value is limited by that of bDeviceClass and bDeviceSubClass. */ + /** Protocol code allocated by USB-IF. The value is limited by that of {@link bDeviceClass} and {@link bDeviceSubClass}. */ uint8_t bDeviceProtocol; /** Maximum packet size of endpoint 0. Only values 8, 16, 32, and 64 are valid. */ uint8_t bMaxPacketSize0; @@ -117,11 +101,10 @@ typedef struct UsbDeviceDescriptor { uint8_t iSerialNumber; /** Configuration quantity. */ uint8_t bNumConfigurations; -} __attribute__((packed)) UsbDeviceDescriptor; +} __attribute__((aligned(8))) UsbDeviceDescriptor; /** - * @brief Standard configuration descriptor, corresponding to Standard Configuration Descriptor\n - * in the USB protocol. + * @brief Standard configuration descriptor, corresponding to Standard Configuration Descriptor in the USB protocol. * * @since 10 * @version 1.0 @@ -131,9 +114,8 @@ typedef struct UsbConfigDescriptor { uint8_t bLength; /** Descriptor type. */ uint8_t bDescriptorType; - /** Total length of the configuration descriptor, including the configuration, interface, endpoint,\n - * and class- or vendor-specific descriptors. - */ + /** Total length of the configuration descriptor, including the configuration, interface, endpoint, + and class- or vendor-specific descriptors. */ uint16_t wTotalLength; /** Number of interfaces supported by the configuration. */ uint8_t bNumInterfaces; @@ -148,8 +130,7 @@ typedef struct UsbConfigDescriptor { } __attribute__((packed)) UsbConfigDescriptor; /** - * @brief Standard interface descriptor, corresponding to Standard Interface Descriptor - * in the USB protocol. + * @brief Standard interface descriptor, corresponding to Standard Interface Descriptor in the USB protocol. * * @since 10 * @version 1.0 @@ -167,9 +148,9 @@ typedef struct UsbInterfaceDescriptor { uint8_t bNumEndpoints; /** Interface class code allocated by the USB-IF. */ uint8_t bInterfaceClass; - /** Interface subclass code allocated by USB-IF. The value is limited by that of bInterfaceClass. */ + /** Device subclass code allocated by USB-IF. The value is limited by that of {@link bInterfaceClass}. */ uint8_t bInterfaceSubClass; - /** Protocol code allocated by USB-IF. The value is limited by that of bInterfaceClass and bInterfaceSubClass. */ + /** Protocol code allocated by USB-IF. The value is limited by that of {@link bInterfaceClass} and {@link bInterfaceSubClass}. */ uint8_t bInterfaceProtocol; /** Index of the string descriptor that describes the interface. */ uint8_t iInterface; @@ -233,7 +214,7 @@ typedef struct UsbDdkInterfaceDescriptor { } UsbDdkInterfaceDescriptor; /** - * @brief USB interface. + * @brief Defines a USB DDK interface, which is a collection of alternate settings for a particular USB interface. * * @since 10 * @version 1.0 @@ -242,7 +223,7 @@ typedef struct UsbDdkInterface { /** Number of alternate settings of the interface. */ uint8_t numAltsetting; /** Alternate setting of the interface. */ - struct UsbDdkInterfaceDescriptor altsetting[]; + struct UsbDdkInterfaceDescriptor *altsetting; } UsbDdkInterface; /** @@ -255,7 +236,7 @@ typedef struct UsbDdkConfigDescriptor { /** Standard configuration descriptor. */ struct UsbConfigDescriptor configDescriptor; /** Interfaces contained in the configuration. */ - struct UsbDdkInterface *interface[USB_MAXINTERFACES]; + struct UsbDdkInterface *interface; /** Unresolved descriptor, including class- or vendor-specific descriptors. */ uint8_t *extra; /** Length of the unresolved descriptor. */ @@ -275,10 +256,10 @@ typedef struct UsbRequestPipe { uint8_t endpoint; /** Timeout duration, in milliseconds. */ uint32_t timeout; -} __attribute__((packed)) UsbRequestPipe; +} __attribute__((aligned(8))) UsbRequestPipe; /** - * @brief Device memory map created by calling OH_Usb_CreateDeviceMemMap.\n + * @brief Device memory map created by calling OH_Usb_CreateDeviceMemMap. * A buffer using the device memory map can provide better performance. * * @since 10 @@ -289,20 +270,43 @@ typedef struct UsbDeviceMemMap { 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. - */ + /** Offset of the used buffer. The default value is 0, indicating that there is no offset + and the buffer starts from the specified {@link 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. - */ + /** Length of the used buffer. By default, the value is equal to the {@link size}, + indicating that the entire buffer is used. */ uint32_t bufferLength; /** Length of the transferred data. */ uint32_t transferedLength; } UsbDeviceMemMap; -/** @} */ + +/** + * @brief Defines USB DDK error codes. + * + * @since 10 + * @version 1.0 + */ +typedef enum { + /** Operation succeeded. */ + USB_DDK_SUCCESS = 0, + /** Operation failed. */ + USB_DDK_FAILED = -1, + /** Invalid parameter. */ + USB_DDK_INVALID_PARAMETER = -2, + /** Memory-related error, for example, insufficient memory, memory data copy failure, or memory application failure. + */ + USB_DDK_MEMORY_ERROR = -3, + /** Invalid operation. */ + USB_DDK_INVALID_OPERATION = -4, + /** Null pointer exception */ + USB_DDK_NULL_PTR = -5, + /** Device busy. */ + USB_DDK_DEVICE_BUSY = -6, + /** Data transfer timed out. */ + USB_DDK_TIMEOUT = -7 +} UsbDdkErrCode; #ifdef __cplusplus } #endif /* __cplusplus */ - -#endif // USBDDKTYPES_H +/** @} */ +#endif // USB_DDK_TYPES_H -- Gitee From 95de73d1a0ce00a6a562dd67910fc1ce9b1df4fe Mon Sep 17 00:00:00 2001 From: shawn_he Date: Wed, 11 Oct 2023 17:21:41 +0800 Subject: [PATCH 0026/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/usb/usb_ddk_types.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/en/native_sdk/usb/usb_ddk_types.h b/en/native_sdk/usb/usb_ddk_types.h index 4a2ebb85..2d8163d4 100644 --- a/en/native_sdk/usb/usb_ddk_types.h +++ b/en/native_sdk/usb/usb_ddk_types.h @@ -59,10 +59,10 @@ typedef struct UsbControlRequestSetup { /** Value corresponding to wValue in the USB protocol. Its meaning varies according to the request. */ uint16_t wValue; /** Index corresponding to wIndex in the USB protocol. It is usually used to transfer the index or offset. - Its meaning varies according to the request. */ + * Its meaning varies according to the request. */ uint16_t wIndex; /** Data length corresponding to wLength in the USB protocol. If data is transferred, - this field indicates the number of transferred bytes. */ + * this field indicates the number of transferred bytes. */ uint16_t wLength; } __attribute__((aligned(8))) UsbControlRequestSetup; @@ -83,7 +83,8 @@ typedef struct UsbDeviceDescriptor { uint8_t bDeviceClass; /** Device subclass code allocated by USB-IF. The value is limited by that of {@link bDeviceClass}. */ uint8_t bDeviceSubClass; - /** Protocol code allocated by USB-IF. The value is limited by that of {@link bDeviceClass} and {@link bDeviceSubClass}. */ + /** Protocol code allocated by USB-IF. The value is limited by that of {@link bDeviceClass} + * and {@link bDeviceSubClass}. */ uint8_t bDeviceProtocol; /** Maximum packet size of endpoint 0. Only values 8, 16, 32, and 64 are valid. */ uint8_t bMaxPacketSize0; @@ -104,7 +105,8 @@ typedef struct UsbDeviceDescriptor { } __attribute__((aligned(8))) UsbDeviceDescriptor; /** - * @brief Standard configuration descriptor, corresponding to Standard Configuration Descriptor in the USB protocol. + * @brief Standard configuration descriptor, corresponding to Standard Configuration Descriptor + * in the USB protocol. * * @since 10 * @version 1.0 @@ -115,7 +117,7 @@ typedef struct UsbConfigDescriptor { /** Descriptor type. */ uint8_t bDescriptorType; /** Total length of the configuration descriptor, including the configuration, interface, endpoint, - and class- or vendor-specific descriptors. */ + * and class- or vendor-specific descriptors. */ uint16_t wTotalLength; /** Number of interfaces supported by the configuration. */ uint8_t bNumInterfaces; @@ -130,7 +132,8 @@ typedef struct UsbConfigDescriptor { } __attribute__((packed)) UsbConfigDescriptor; /** - * @brief Standard interface descriptor, corresponding to Standard Interface Descriptor in the USB protocol. + * @brief Standard interface descriptor, corresponding to Standard Interface Descriptor + * in the USB protocol. * * @since 10 * @version 1.0 @@ -150,7 +153,8 @@ typedef struct UsbInterfaceDescriptor { uint8_t bInterfaceClass; /** Device subclass code allocated by USB-IF. The value is limited by that of {@link bInterfaceClass}. */ uint8_t bInterfaceSubClass; - /** Protocol code allocated by USB-IF. The value is limited by that of {@link bInterfaceClass} and {@link bInterfaceSubClass}. */ + /** Protocol code allocated by USB-IF. The value is limited by that of {@link bInterfaceClass} + * and {@link bInterfaceSubClass}. */ uint8_t bInterfaceProtocol; /** Index of the string descriptor that describes the interface. */ uint8_t iInterface; @@ -271,10 +275,10 @@ typedef struct UsbDeviceMemMap { /** Buffer size. */ const size_t size; /** Offset of the used buffer. The default value is 0, indicating that there is no offset - and the buffer starts from the specified {@link address}. */ + * and the buffer starts from the specified {@link address}. */ uint32_t offset; /** Length of the used buffer. By default, the value is equal to the {@link size}, - indicating that the entire buffer is used. */ + * indicating that the entire buffer is used. */ uint32_t bufferLength; /** Length of the transferred data. */ uint32_t transferedLength; @@ -293,7 +297,8 @@ typedef enum { USB_DDK_FAILED = -1, /** Invalid parameter. */ USB_DDK_INVALID_PARAMETER = -2, - /** Memory-related error, for example, insufficient memory, memory data copy failure, or memory application failure. + /** Memory-related error, for example, insufficient memory, memory data copy failure, + * or memory application failure. */ USB_DDK_MEMORY_ERROR = -3, /** Invalid operation. */ -- Gitee From c5f6ddfb2376174a7fa37e4b423fe40994cef359 Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 12 Oct 2023 14:01:15 +0800 Subject: [PATCH 0027/2135] add net capi Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 183 +++++++++++ .../native_sdk/net/dns/native_net_conn_type.h | 305 ++++++++++++++++++ 2 files changed, 488 insertions(+) create mode 100644 zh-cn/native_sdk/net/dns/native_net_conn_api.h create mode 100644 zh-cn/native_sdk/net/dns/native_net_conn_type.h diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h new file mode 100644 index 00000000..ac138b81 --- /dev/null +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -0,0 +1,183 @@ +/* + * 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 NATIVE_NET_CONN_API_H +#define NATIVE_NET_CONN_API_H + +/** + * @addtogroup NetConn + * @{ + * + * @brief 为网络管理的数据网络连接模块提供C接口 + * + * @since 10 + * @version 1.0 + */ + +/** + * @file native_net_conn_api.h + * + * @brief 为网络管理的数据网络连接模块定义C接口 + * + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + * @version 1.0 + */ + +#include "native_net_conn_type.h" +#include "netdb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 查询是否有默认激活的数据网络 + * + * @param hasDefaultNet 是否有默认网络 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 10 + * @version 1.0 + */ +int32_t OH_NetConn_HasDefaultNet(int32_t *hasDefaultNet); + +/** + * @brief 获取激活的默认的数据网络 + * + * @param netHandle 存放网络ID + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 10 + * @version 1.0 + */ +int32_t OH_NetConn_GetDefaultNet(OH_NetConn_NetHandle *netHandle); + +/** + * @brief 查询默认数据网络是否记流量 + * + * @param isMetered 是否激活 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 10 + * @version 1.0 + */ +int32_t OH_NetConn_IsDefaultNetMetered(int32_t *isMetered); + +/** + * @brief 查询所有激活的数据网络 + * + * @param netHandleList 网络信息列表 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 10 + * @version 1.0 + */ +int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); + +/** + * @brief 查询某个数据网络的链路信息 + * + * @param netHandle 存放网络ID + * @param info 存放链路信息 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 10 + * @version 1.0 + */ +int32_t OH_NetConn_GetConnectionProperties(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetLinkInfo *info); + +/** + * @brief 查询某个网络的能力集 + * + * @param netHandle 存放网络ID + * @param netAllCapacities 存放能力集 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 10 + * @version 1.0 + */ +int32_t OH_NetConn_GetNetCapabilities(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetAllCapabilities *netAllCapacities); + +/** + * @brief 查询默认的网络代理 + * + * @param httpProxy 存放代理配置信息 + * @return 0 - 成功. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @since 10 + * @version 1.0 + */ +int32_t OH_NetConn_GetDefaultHttpProxy(OH_NetConn_HttpProxy *httpProxy); + +/** + * @brief 查询默认的网络代理 + * + * @param host 所需查询的host名 + * @param param DNS查询相关参数,如netid,mark,flags + * @param res 存放DNS查询结果,以链表形式返回 + * @return 0 - 成功. + * @return 401 - 参数错误. + * @return 2100003 - 内部错误. + * @since 10 + * @version 1.0 +*/ +int32_t OH_NetConn_GetAddressByName(char* host, OH_NetConn_DnsQueryParam *param, struct addrinfo **res); + +/** + * @brief 查询默认的网络代理 + * + * @param res DNS查询结果链表头 + * @return 0 - 成功. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @since 10 + * @version 1.0 +*/ +int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_API_H */ \ No newline at end of file diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h new file mode 100644 index 00000000..40d40034 --- /dev/null +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -0,0 +1,305 @@ +/* + * 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 NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H + +/** + * @addtogroup NetConn + * @{ + * + * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 + * + * @since 10 + * @version 1.0 + */ + +/** + * @file native_net_conn_type.h + * @brief 定义网络连接模块的C接口需要的数据结构 + * + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + * @version 1.0 + * + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OH_NETCONN_MAX_NET_SIZE 32 +#define OH_NETCONN_MAX_BEAR_TYPE_SIZE 32 +#define OH_NETCONN_MAX_CAP_SIZE 32 +#define OH_NETCONN_MAX_ADDR_SIZE 32 +#define OH_NETCONN_MAX_ROUTE_SIZE 64 +#define OH_NETCONN_MAX_EXCLUSION_SIZE 256 +#define OH_NETCONN_MAX_STR_LEN 256 + +/** + * @brief 网络能力集 + * + * @since 10 + * @version 1.0 + */ + +typedef enum OH_NetConn_NetCap { + /* MMS */ + OH_NETCONN_NET_CAPABILITY_MMS = 0, + /* Not Metered */ + OH_NETCONN_NET_CAPABILITY_NOT_METERED = 11, + /* Internet */ + OH_NETCONN_NET_CAPABILITY_INTERNET = 12, + /* Not VPN */ + OH_NETCONN_NET_CAPABILITY_NOT_VPN = 15, + /* Validated */ + OH_NETCONN_NET_CAPABILITY_VALIDATED = 16, + /* Captive portal */ + OH_NETCONN_NET_CAPABILITY_CAPTIVE_PORTAL = 17, + /* Internal Default */ + OH_NETCONN_NET_CAPABILITY_INTERNAL_DEFAULT +} OH_NetConn_NetCap; + +/** + * @brief 网络载体类型 + * + * @since 10 + * @version 1.0 + */ + +typedef enum OH_NetConn_NetBearType { + /* Cellular */ + OH_NETCONN_BEARER_CELLULAR = 0, + /* WIFI */ + OH_NETCONN_BEARER_WIFI = 1, + /* Bluetooth */ + OH_NETCONN_BEARER_BLUETOOTH = 2, + /* Ethernet */ + OH_NETCONN_BEARER_ETHERNET = 3, + /* VPN */ + OH_NETCONN_BEARER_VPN = 4, + /* WIFI aware */ + OH_NETCONN_BEARER_WIFI_AWARE = 5, + /* Default */ + OH_NETCONN_BEARER_DEFAULT +} OH_NetConn_NetBearType; + +/** + * @brief 路由返回类型 + * + * @since 10 + * @version 1.0 + */ + +typedef enum OH_NetConn_RtnType { + /* Unicast */ + OH_NETCONN_RTN_UNICAST = 1, + /* Unreachable */ + OH_NETCONN_RTN_UNREACHABLE = 7, + /* Throw */ + OH_NETCONN_RTN_THROW = 9 +} OH_NetConn_RtnType; + +/** + * @brief IP类型. + * + * @since 10 + * @version 1.0 + */ + +typedef enum { + /* Unknown */ + OH_NETCONN_UNKNOWN = 0x00, + /* IPV4 */ + OH_NETCONN_IPV4 = 0x01, + /* IPV6 */ + OH_NETCONN_IPV6 = 0x02, +} OH_NetConn_IpType; + +/** + * @brief 存放网络ID. + * + * @since 10 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetHandle { + /* Network id */ + int32_t netId; +} OH_NetConn_NetHandle; + +/** + * @brief 网络列表 + * + * @since 10 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetHandleList { + /* List of netHandle */ + OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; + /* Actual size of netHandleList */ + int32_t netHandleListSize; +} OH_NetConn_NetHandleList; + +/** + * @brief 网络能力集 + * + * @since 10 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetAllCapabilities { + /* LinkUpBandwidthKbps */ + uint32_t linkUpBandwidthKbps; + /* LinkDownBandwidthKbps */ + uint32_t linkDownBandwidthKbps; + /* List of capabilities */ + OH_NetConn_NetCap netCaps[OH_NETCONN_MAX_CAP_SIZE]; + /* Actual size of netCaps */ + int32_t netCapsSize; + /* List of bearer types */ + OH_NetConn_NetBearType bearerTypes[OH_NETCONN_MAX_BEAR_TYPE_SIZE]; + /* Actual size of bearerTypes */ + int32_t bearerTypesSize; +} OH_NetConn_NetAllCapabilities; + +/** + * @brief 网络地址 + * + * @since 10 + * @version 1.0 + */ + +typedef struct OH_NetConn_INetAddr { + /* Ip type */ + OH_NetConn_IpType type; + /* Family */ + uint8_t family; + /* Length of prefix */ + uint8_t prefixlen; + /* Port */ + uint8_t port; + /* Address */ + char address[OH_NETCONN_MAX_STR_LEN]; + /* Host name */ + char hostName[OH_NETCONN_MAX_STR_LEN]; +} OH_NetConn_INetAddr; + +/** + * @brief 路由配置信息 + * + * @since 10 + * @version 1.0 + */ + +typedef struct OH_NetConn_Route { + /* Interface */ + char iface[OH_NETCONN_MAX_STR_LEN]; + /* Destination address */ + OH_NetConn_INetAddr destination; + /* Gateway address*/ + OH_NetConn_INetAddr gateway; + /* Return type */ + OH_NetConn_RtnType rtnType; + /* MTU */ + int32_t mtu; + /* Whether is host */ + int32_t isHost; + /* Whether has Gateway*/ + int32_t hasGateway; + /* Whether is default route*/ + int32_t isDefaultRoute; +} OH_NetConn_Route; + +/** + * @brief 代理配置信息 + * + * @since 10 + * @version 1.0 + */ + +typedef struct OH_NetConn_HttpProxy { + /* Host name */ + char host[OH_NETCONN_MAX_STR_LEN]; + /* List of exclusion */ + char exclusionList[OH_NETCONN_MAX_EXCLUSION_SIZE][OH_NETCONN_MAX_STR_LEN]; + /* Actual size of exclusionList */ + int32_t exclusionListSize; + /* Port */ + uint16_t port; +} OH_NetConn_HttpProxy; + +/** + * @brief Network link information + * + * @since 10 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetLinkInfo { + /* Interface name */ + char ifaceName[OH_NETCONN_MAX_STR_LEN]; + /* Domain */ + char domain[OH_NETCONN_MAX_STR_LEN]; + /* TCP butter size */ + char tcpBufferSizes[OH_NETCONN_MAX_STR_LEN]; + /* MTU */ + uint16_t mtu; + /* Address list */ + OH_NetConn_INetAddr netAddrList[OH_NETCONN_MAX_ADDR_SIZE]; + /* Actual size of netAddrList */ + int32_t netAddrListSize; + /* DNS list */ + OH_NetConn_INetAddr dnsList[OH_NETCONN_MAX_ADDR_SIZE]; + /* Actual size od dnsList */ + int32_t dnsListSize; + /* Route list */ + OH_NetConn_Route routeList[OH_NETCONN_MAX_ROUTE_SIZE]; + /* Actual size of routeList */ + int32_t routeListSize; + /* Http proxy */ + OH_NetConn_HttpProxy httpProxy; +} OH_NetConn_NetLinkInfo; + +typedef int (*FuncDnsQueryHook)(int, int, int); + +/** + * @brief Dns Query Parameter + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_NetConn_DnsQueryParam { + /* IP type */ + int32_t type; + /* Network Id */ + int32_t netId; + /* network mark */ + int32_t mark; + /* DNS query flags */ + int32_t flags; + /* pointer to query hook */ + FuncDnsQueryHook qhook; +} OH_NetConn_DnsQueryParam; + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_TYPE_H */ -- Gitee From 2ef830643f93c6431b4bab8265c724b6f7da8deb Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 12 Oct 2023 14:33:38 +0800 Subject: [PATCH 0028/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 113 +------- .../native_sdk/net/dns/native_net_conn_type.h | 242 +----------------- 2 files changed, 8 insertions(+), 347 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index ac138b81..7d8bb915 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -22,7 +22,7 @@ * * @brief 为网络管理的数据网络连接模块提供C接口 * - * @since 10 + * @since 11 * @version 1.0 */ @@ -32,7 +32,7 @@ * @brief 为网络管理的数据网络连接模块定义C接口 * * @syscap SystemCapability.Communication.NetManager.Core - * @since 10 + * @since 11 * @version 1.0 */ @@ -43,111 +43,6 @@ extern "C" { #endif -/** - * @brief 查询是否有默认激活的数据网络 - * - * @param hasDefaultNet 是否有默认网络 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.GET_NETWORK_INFO - * @since 10 - * @version 1.0 - */ -int32_t OH_NetConn_HasDefaultNet(int32_t *hasDefaultNet); - -/** - * @brief 获取激活的默认的数据网络 - * - * @param netHandle 存放网络ID - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.GET_NETWORK_INFO - * @since 10 - * @version 1.0 - */ -int32_t OH_NetConn_GetDefaultNet(OH_NetConn_NetHandle *netHandle); - -/** - * @brief 查询默认数据网络是否记流量 - * - * @param isMetered 是否激活 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.GET_NETWORK_INFO - * @since 10 - * @version 1.0 - */ -int32_t OH_NetConn_IsDefaultNetMetered(int32_t *isMetered); - -/** - * @brief 查询所有激活的数据网络 - * - * @param netHandleList 网络信息列表 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.GET_NETWORK_INFO - * @since 10 - * @version 1.0 - */ -int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); - -/** - * @brief 查询某个数据网络的链路信息 - * - * @param netHandle 存放网络ID - * @param info 存放链路信息 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.GET_NETWORK_INFO - * @since 10 - * @version 1.0 - */ -int32_t OH_NetConn_GetConnectionProperties(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetLinkInfo *info); - -/** - * @brief 查询某个网络的能力集 - * - * @param netHandle 存放网络ID - * @param netAllCapacities 存放能力集 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.GET_NETWORK_INFO - * @since 10 - * @version 1.0 - */ -int32_t OH_NetConn_GetNetCapabilities(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetAllCapabilities *netAllCapacities); - -/** - * @brief 查询默认的网络代理 - * - * @param httpProxy 存放代理配置信息 - * @return 0 - 成功. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @since 10 - * @version 1.0 - */ -int32_t OH_NetConn_GetDefaultHttpProxy(OH_NetConn_HttpProxy *httpProxy); - /** * @brief 查询默认的网络代理 * @@ -157,7 +52,7 @@ int32_t OH_NetConn_GetDefaultHttpProxy(OH_NetConn_HttpProxy *httpProxy); * @return 0 - 成功. * @return 401 - 参数错误. * @return 2100003 - 内部错误. - * @since 10 + * @since 11 * @version 1.0 */ int32_t OH_NetConn_GetAddressByName(char* host, OH_NetConn_DnsQueryParam *param, struct addrinfo **res); @@ -170,7 +65,7 @@ int32_t OH_NetConn_GetAddressByName(char* host, OH_NetConn_DnsQueryParam *param, * @return 401 - 参数错误. * @return 2100002 - 无法连接到服务. * @return 2100003 - 内部错误. - * @since 10 + * @since 11 * @version 1.0 */ int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h index 40d40034..9819e354 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -22,7 +22,7 @@ * * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 * - * @since 10 + * @since 11 * @version 1.0 */ @@ -31,7 +31,7 @@ * @brief 定义网络连接模块的C接口需要的数据结构 * * @syscap SystemCapability.Communication.NetManager.Core - * @since 10 + * @since 11 * @version 1.0 * */ @@ -42,246 +42,12 @@ extern "C" { #endif -#define OH_NETCONN_MAX_NET_SIZE 32 -#define OH_NETCONN_MAX_BEAR_TYPE_SIZE 32 -#define OH_NETCONN_MAX_CAP_SIZE 32 -#define OH_NETCONN_MAX_ADDR_SIZE 32 -#define OH_NETCONN_MAX_ROUTE_SIZE 64 -#define OH_NETCONN_MAX_EXCLUSION_SIZE 256 -#define OH_NETCONN_MAX_STR_LEN 256 - -/** - * @brief 网络能力集 - * - * @since 10 - * @version 1.0 - */ - -typedef enum OH_NetConn_NetCap { - /* MMS */ - OH_NETCONN_NET_CAPABILITY_MMS = 0, - /* Not Metered */ - OH_NETCONN_NET_CAPABILITY_NOT_METERED = 11, - /* Internet */ - OH_NETCONN_NET_CAPABILITY_INTERNET = 12, - /* Not VPN */ - OH_NETCONN_NET_CAPABILITY_NOT_VPN = 15, - /* Validated */ - OH_NETCONN_NET_CAPABILITY_VALIDATED = 16, - /* Captive portal */ - OH_NETCONN_NET_CAPABILITY_CAPTIVE_PORTAL = 17, - /* Internal Default */ - OH_NETCONN_NET_CAPABILITY_INTERNAL_DEFAULT -} OH_NetConn_NetCap; - -/** - * @brief 网络载体类型 - * - * @since 10 - * @version 1.0 - */ - -typedef enum OH_NetConn_NetBearType { - /* Cellular */ - OH_NETCONN_BEARER_CELLULAR = 0, - /* WIFI */ - OH_NETCONN_BEARER_WIFI = 1, - /* Bluetooth */ - OH_NETCONN_BEARER_BLUETOOTH = 2, - /* Ethernet */ - OH_NETCONN_BEARER_ETHERNET = 3, - /* VPN */ - OH_NETCONN_BEARER_VPN = 4, - /* WIFI aware */ - OH_NETCONN_BEARER_WIFI_AWARE = 5, - /* Default */ - OH_NETCONN_BEARER_DEFAULT -} OH_NetConn_NetBearType; - -/** - * @brief 路由返回类型 - * - * @since 10 - * @version 1.0 - */ - -typedef enum OH_NetConn_RtnType { - /* Unicast */ - OH_NETCONN_RTN_UNICAST = 1, - /* Unreachable */ - OH_NETCONN_RTN_UNREACHABLE = 7, - /* Throw */ - OH_NETCONN_RTN_THROW = 9 -} OH_NetConn_RtnType; - -/** - * @brief IP类型. - * - * @since 10 - * @version 1.0 - */ - -typedef enum { - /* Unknown */ - OH_NETCONN_UNKNOWN = 0x00, - /* IPV4 */ - OH_NETCONN_IPV4 = 0x01, - /* IPV6 */ - OH_NETCONN_IPV6 = 0x02, -} OH_NetConn_IpType; - -/** - * @brief 存放网络ID. - * - * @since 10 - * @version 1.0 - */ - -typedef struct OH_NetConn_NetHandle { - /* Network id */ - int32_t netId; -} OH_NetConn_NetHandle; - -/** - * @brief 网络列表 - * - * @since 10 - * @version 1.0 - */ - -typedef struct OH_NetConn_NetHandleList { - /* List of netHandle */ - OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; - /* Actual size of netHandleList */ - int32_t netHandleListSize; -} OH_NetConn_NetHandleList; - -/** - * @brief 网络能力集 - * - * @since 10 - * @version 1.0 - */ - -typedef struct OH_NetConn_NetAllCapabilities { - /* LinkUpBandwidthKbps */ - uint32_t linkUpBandwidthKbps; - /* LinkDownBandwidthKbps */ - uint32_t linkDownBandwidthKbps; - /* List of capabilities */ - OH_NetConn_NetCap netCaps[OH_NETCONN_MAX_CAP_SIZE]; - /* Actual size of netCaps */ - int32_t netCapsSize; - /* List of bearer types */ - OH_NetConn_NetBearType bearerTypes[OH_NETCONN_MAX_BEAR_TYPE_SIZE]; - /* Actual size of bearerTypes */ - int32_t bearerTypesSize; -} OH_NetConn_NetAllCapabilities; - -/** - * @brief 网络地址 - * - * @since 10 - * @version 1.0 - */ - -typedef struct OH_NetConn_INetAddr { - /* Ip type */ - OH_NetConn_IpType type; - /* Family */ - uint8_t family; - /* Length of prefix */ - uint8_t prefixlen; - /* Port */ - uint8_t port; - /* Address */ - char address[OH_NETCONN_MAX_STR_LEN]; - /* Host name */ - char hostName[OH_NETCONN_MAX_STR_LEN]; -} OH_NetConn_INetAddr; - -/** - * @brief 路由配置信息 - * - * @since 10 - * @version 1.0 - */ - -typedef struct OH_NetConn_Route { - /* Interface */ - char iface[OH_NETCONN_MAX_STR_LEN]; - /* Destination address */ - OH_NetConn_INetAddr destination; - /* Gateway address*/ - OH_NetConn_INetAddr gateway; - /* Return type */ - OH_NetConn_RtnType rtnType; - /* MTU */ - int32_t mtu; - /* Whether is host */ - int32_t isHost; - /* Whether has Gateway*/ - int32_t hasGateway; - /* Whether is default route*/ - int32_t isDefaultRoute; -} OH_NetConn_Route; - -/** - * @brief 代理配置信息 - * - * @since 10 - * @version 1.0 - */ - -typedef struct OH_NetConn_HttpProxy { - /* Host name */ - char host[OH_NETCONN_MAX_STR_LEN]; - /* List of exclusion */ - char exclusionList[OH_NETCONN_MAX_EXCLUSION_SIZE][OH_NETCONN_MAX_STR_LEN]; - /* Actual size of exclusionList */ - int32_t exclusionListSize; - /* Port */ - uint16_t port; -} OH_NetConn_HttpProxy; - -/** - * @brief Network link information - * - * @since 10 - * @version 1.0 - */ - -typedef struct OH_NetConn_NetLinkInfo { - /* Interface name */ - char ifaceName[OH_NETCONN_MAX_STR_LEN]; - /* Domain */ - char domain[OH_NETCONN_MAX_STR_LEN]; - /* TCP butter size */ - char tcpBufferSizes[OH_NETCONN_MAX_STR_LEN]; - /* MTU */ - uint16_t mtu; - /* Address list */ - OH_NetConn_INetAddr netAddrList[OH_NETCONN_MAX_ADDR_SIZE]; - /* Actual size of netAddrList */ - int32_t netAddrListSize; - /* DNS list */ - OH_NetConn_INetAddr dnsList[OH_NETCONN_MAX_ADDR_SIZE]; - /* Actual size od dnsList */ - int32_t dnsListSize; - /* Route list */ - OH_NetConn_Route routeList[OH_NETCONN_MAX_ROUTE_SIZE]; - /* Actual size of routeList */ - int32_t routeListSize; - /* Http proxy */ - OH_NetConn_HttpProxy httpProxy; -} OH_NetConn_NetLinkInfo; - -typedef int (*FuncDnsQueryHook)(int, int, int); +typedef int32_t (*FuncDnsQueryHook)(int32_t, int32_t, int32_t); /** * @brief Dns Query Parameter * - * @since 10 + * @since 11 * @version 1.0 */ typedef struct OH_NetConn_DnsQueryParam { -- Gitee From 56a007b7de4bd548561ace637d6d2597d0373f8c Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 12 Oct 2023 18:28:08 +0800 Subject: [PATCH 0029/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 4 +- .../native_sdk/net/dns/native_net_conn_type.h | 71 ------------------- 2 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 zh-cn/native_sdk/net/dns/native_net_conn_type.h diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 7d8bb915..63c1306d 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -47,7 +47,7 @@ extern "C" { * @brief 查询默认的网络代理 * * @param host 所需查询的host名 - * @param param DNS查询相关参数,如netid,mark,flags + * @param netId 网络ID * @param res 存放DNS查询结果,以链表形式返回 * @return 0 - 成功. * @return 401 - 参数错误. @@ -55,7 +55,7 @@ extern "C" { * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetAddressByName(char* host, OH_NetConn_DnsQueryParam *param, struct addrinfo **res); +int32_t OH_NetConn_GetAddressByNameWithNetId(char* host, int32_t * netId, struct addrinfo **res); /** * @brief 查询默认的网络代理 diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h deleted file mode 100644 index 9819e354..00000000 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 NATIVE_NET_CONN_TYPE_H -#define NATIVE_NET_CONN_TYPE_H - -/** - * @addtogroup NetConn - * @{ - * - * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 - * - * @since 11 - * @version 1.0 - */ - -/** - * @file native_net_conn_type.h - * @brief 定义网络连接模块的C接口需要的数据结构 - * - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - * - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef int32_t (*FuncDnsQueryHook)(int32_t, int32_t, int32_t); - -/** - * @brief Dns Query Parameter - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_DnsQueryParam { - /* IP type */ - int32_t type; - /* Network Id */ - int32_t netId; - /* network mark */ - int32_t mark; - /* DNS query flags */ - int32_t flags; - /* pointer to query hook */ - FuncDnsQueryHook qhook; -} OH_NetConn_DnsQueryParam; - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif /* NATIVE_NET_CONN_TYPE_H */ -- Gitee From e575b66ddeb76833eccdb4c959eb10f31949ebdd Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 12 Oct 2023 19:58:55 +0800 Subject: [PATCH 0030/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 4 +- .../native_sdk/net/dns/native_net_conn_type.h | 60 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 zh-cn/native_sdk/net/dns/native_net_conn_type.h diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 63c1306d..8b546363 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -47,7 +47,7 @@ extern "C" { * @brief 查询默认的网络代理 * * @param host 所需查询的host名 - * @param netId 网络ID + * @param param DNS查询netid * @param res 存放DNS查询结果,以链表形式返回 * @return 0 - 成功. * @return 401 - 参数错误. @@ -55,7 +55,7 @@ extern "C" { * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetAddressByNameWithNetId(char* host, int32_t * netId, struct addrinfo **res); +int32_t OH_NetConn_GetAddrInfo(char* host, OH_NetConn_DnsQueryParam *param, struct addrinfo **res); /** * @brief 查询默认的网络代理 diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h new file mode 100644 index 00000000..e1636a30 --- /dev/null +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -0,0 +1,60 @@ +/* + * 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 NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H + +/** + * @addtogroup NetConn + * @{ + * + * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 + * + * @since 11 + * @version 1.0 + */ + +/** + * @file native_net_conn_type.h + * @brief 定义网络连接模块的C接口需要的数据结构 + * + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + * + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Dns Query Parameter + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_NetConn_DnsQueryParam { + int32_t netId; +} OH_NetConn_DnsQueryParam; + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_TYPE_H */ -- Gitee From 143d3e7761e8363053bb348f864c1453abd55a0a Mon Sep 17 00:00:00 2001 From: xujie Date: Fri, 13 Oct 2023 11:03:54 +0800 Subject: [PATCH 0031/2135] fix Signed-off-by: xujie --- zh-cn/native_sdk/net/dns/native_net_conn_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h index e1636a30..dc076029 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -48,9 +48,9 @@ extern "C" { * @since 11 * @version 1.0 */ -typedef struct OH_NetConn_DnsQueryParam { +typedef struct OH_NetConn_DnsContext { int32_t netId; -} OH_NetConn_DnsQueryParam; +} OH_NetConn_DnsContext; #ifdef __cplusplus } -- Gitee From 90c4a1e01c564aa05b8ebb8e622c5a1dbde69bc0 Mon Sep 17 00:00:00 2001 From: xujie Date: Fri, 13 Oct 2023 11:06:41 +0800 Subject: [PATCH 0032/2135] fix Signed-off-by: xujie --- zh-cn/native_sdk/net/dns/native_net_conn_api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 8b546363..f629e2cc 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -47,7 +47,7 @@ extern "C" { * @brief 查询默认的网络代理 * * @param host 所需查询的host名 - * @param param DNS查询netid + * @param context DNS查询netid * @param res 存放DNS查询结果,以链表形式返回 * @return 0 - 成功. * @return 401 - 参数错误. @@ -55,7 +55,7 @@ extern "C" { * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetAddrInfo(char* host, OH_NetConn_DnsQueryParam *param, struct addrinfo **res); +int32_t OH_NetConn_GetAddrInfo(char* host, OH_NetConn_DnsContext *context, struct addrinfo **res); /** * @brief 查询默认的网络代理 -- Gitee From 022149ce9d92cd9e52178d7e8ab0915c112a45be Mon Sep 17 00:00:00 2001 From: xujie Date: Fri, 13 Oct 2023 14:20:05 +0800 Subject: [PATCH 0033/2135] fix Signed-off-by: xujie --- zh-cn/native_sdk/net/dns/native_net_conn_type.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h index dc076029..eb1799bd 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -49,6 +49,7 @@ extern "C" { * @version 1.0 */ typedef struct OH_NetConn_DnsContext { + /* Network Id */ int32_t netId; } OH_NetConn_DnsContext; -- Gitee From ca93ae73be5c6823a7dfcc7c1b3bcbe35bd8e560 Mon Sep 17 00:00:00 2001 From: xujie Date: Fri, 13 Oct 2023 14:59:47 +0800 Subject: [PATCH 0034/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 4 +- .../native_sdk/net/dns/native_net_conn_type.h | 61 ------------------- 2 files changed, 2 insertions(+), 63 deletions(-) delete mode 100644 zh-cn/native_sdk/net/dns/native_net_conn_type.h diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index f629e2cc..78826427 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -47,7 +47,7 @@ extern "C" { * @brief 查询默认的网络代理 * * @param host 所需查询的host名 - * @param context DNS查询netid + * @param netId DNS查询netId * @param res 存放DNS查询结果,以链表形式返回 * @return 0 - 成功. * @return 401 - 参数错误. @@ -55,7 +55,7 @@ extern "C" { * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetAddrInfo(char* host, OH_NetConn_DnsContext *context, struct addrinfo **res); +int32_t OH_NetConn_GetAddrInfo(char* host, int32_t netId, struct addrinfo **res); /** * @brief 查询默认的网络代理 diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h deleted file mode 100644 index eb1799bd..00000000 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 NATIVE_NET_CONN_TYPE_H -#define NATIVE_NET_CONN_TYPE_H - -/** - * @addtogroup NetConn - * @{ - * - * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 - * - * @since 11 - * @version 1.0 - */ - -/** - * @file native_net_conn_type.h - * @brief 定义网络连接模块的C接口需要的数据结构 - * - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - * - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Dns Query Parameter - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_DnsContext { - /* Network Id */ - int32_t netId; -} OH_NetConn_DnsContext; - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif /* NATIVE_NET_CONN_TYPE_H */ -- Gitee From 6d9d3141aff36e99d3708dc48f3550f1be8cdc03 Mon Sep 17 00:00:00 2001 From: xujie Date: Fri, 13 Oct 2023 16:54:11 +0800 Subject: [PATCH 0035/2135] fix Signed-off-by: xujie --- zh-cn/native_sdk/net/dns/native_net_conn_api.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 78826427..31741584 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -47,15 +47,17 @@ extern "C" { * @brief 查询默认的网络代理 * * @param host 所需查询的host名 - * @param netId DNS查询netId + * @param serv 服务名 + * @param hint 指向addrinfo结构体的指针 * @param res 存放DNS查询结果,以链表形式返回 + * @param netId DNS查询netId 为0是使用默认netid查询 * @return 0 - 成功. * @return 401 - 参数错误. * @return 2100003 - 内部错误. * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetAddrInfo(char* host, int32_t netId, struct addrinfo **res); +int32_t OH_NetConn_GetAddrInfo(char* host, char * serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); /** * @brief 查询默认的网络代理 -- Gitee From f2eb50fad2efb1bddbe041d48b19fd6607ed0ee3 Mon Sep 17 00:00:00 2001 From: xujie Date: Fri, 13 Oct 2023 17:13:20 +0800 Subject: [PATCH 0036/2135] fix Signed-off-by: xujie --- zh-cn/native_sdk/net/dns/native_net_conn_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 31741584..ccbb75bd 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -57,7 +57,7 @@ extern "C" { * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetAddrInfo(char* host, char * serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); +int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); /** * @brief 查询默认的网络代理 -- Gitee From dac712dd9e46b4d4b9ad669ca5d41f01d9109aa8 Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 19 Oct 2023 11:06:02 +0800 Subject: [PATCH 0037/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 15 +++++ .../native_sdk/net/dns/native_net_conn_type.h | 66 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 zh-cn/native_sdk/net/dns/native_net_conn_type.h diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index ccbb75bd..b29f6ec5 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -43,6 +43,21 @@ extern "C" { #endif +/** + * @brief Query all active data networks + * + * @param netHandleList 网络信息列表 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 10 + * @version 1.0 + */ +int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); + /** * @brief 查询默认的网络代理 * diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h new file mode 100644 index 00000000..fec5c9bb --- /dev/null +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -0,0 +1,66 @@ +/* + * 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 NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H + +/** + * @addtogroup NetConn + * @{ + * + * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 + * + * @since 10 + * @version 1.0 + */ + +/** + * @file native_net_conn_type.h + * @brief 定义网络连接模块的C接口需要的数据结构 + * + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + * @version 1.0 + * + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OH_NETCONN_MAX_NET_SIZE 32 + +/** + * @brief 网络列表 + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetHandleList { + /* List of netHandle */ + OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; + /* Actual size of netHandleList */ + int32_t netHandleListSize; +} OH_NetConn_NetHandleList; + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_TYPE_H */ \ No newline at end of file -- Gitee From 4ef30b3505ac3d78abe8adbbebb210b13dc51265 Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 19 Oct 2023 11:41:13 +0800 Subject: [PATCH 0038/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 53 ++++++++++--------- .../native_sdk/net/dns/native_net_conn_type.h | 7 +-- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index b29f6ec5..8290738d 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -20,7 +20,7 @@ * @addtogroup NetConn * @{ * - * @brief 为网络管理的数据网络连接模块提供C接口 + * @brief Provide C interface for the data network connection module of network management * * @since 11 * @version 1.0 @@ -29,7 +29,7 @@ /** * @file native_net_conn_api.h * - * @brief 为网络管理的数据网络连接模块定义C接口 + * @brief Provide C interface for the data network connection module of network management * * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -46,42 +46,47 @@ extern "C" { /** * @brief Query all active data networks * - * @param netHandleList 网络信息列表 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @param netHandleList Network Information List + * @return 0 - Success. + * @return 201 - Missing permissions. + * @return 401 - Parameter error. + * @return 2100002 - Unable to connect to service. + * @return 2100003 - Internal error. * @permission ohos.permission.GET_NETWORK_INFO - * @since 10 + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 * @version 1.0 */ int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); /** - * @brief 查询默认的网络代理 + * @brief Query default network proxy * - * @param host 所需查询的host名 - * @param serv 服务名 - * @param hint 指向addrinfo结构体的指针 - * @param res 存放DNS查询结果,以链表形式返回 - * @param netId DNS查询netId 为0是使用默认netid查询 - * @return 0 - 成功. - * @return 401 - 参数错误. - * @return 2100003 - 内部错误. + * @param host The host name to query + * @param serv Service name + * @param hint Pointer to the addrinfo structure + * @param res Store DNS query results and return them in a linked list format + * @param netId DNS query netId, 0 is used for default netid query + * @return 0 - Success. + * @return 401 - Parameter error. + * @return 2100003 - Internal error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); /** - * @brief 查询默认的网络代理 + * @brief Query default network proxy * - * @param res DNS查询结果链表头 - * @return 0 - 成功. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @param res DNS query result chain header + * @return 0 - Success. + * @return 401 - Parameter error. + * @return 2100002 - Unable to connect to service. + * @return 2100003 - Internal error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h index fec5c9bb..25959128 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -20,7 +20,7 @@ * @addtogroup NetConn * @{ * - * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 + * @brief Provide data structure for the C interface of the data network connection module for network management * * @since 10 * @version 1.0 @@ -28,7 +28,7 @@ /** * @file native_net_conn_type.h - * @brief 定义网络连接模块的C接口需要的数据结构 + * @brief Define the data structure required for the C interface of the network connection module * * @syscap SystemCapability.Communication.NetManager.Core * @since 10 @@ -45,8 +45,9 @@ extern "C" { #define OH_NETCONN_MAX_NET_SIZE 32 /** - * @brief 网络列表 + * @brief Network list * + * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ -- Gitee From 730bcef8bbd79d81a5f397cb2d22ab53373e95b7 Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 19 Oct 2023 12:49:17 +0800 Subject: [PATCH 0039/2135] fix Signed-off-by: xujie --- zh-cn/native_sdk/net/dns/native_net_conn_type.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h index 25959128..6586afd4 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -22,7 +22,7 @@ * * @brief Provide data structure for the C interface of the data network connection module for network management * - * @since 10 + * @since 11 * @version 1.0 */ @@ -31,7 +31,7 @@ * @brief Define the data structure required for the C interface of the network connection module * * @syscap SystemCapability.Communication.NetManager.Core - * @since 10 + * @since 11 * @version 1.0 * */ @@ -44,6 +44,18 @@ extern "C" { #define OH_NETCONN_MAX_NET_SIZE 32 +/** + * @brief Store Network ID + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetHandle { + /* Network id */ + int32_t netId; +} OH_NetConn_NetHandle; + /** * @brief Network list * -- Gitee From 76c00584851eb5460833a06dcbcc1e7f3a2ac1bf Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 19 Oct 2023 14:51:44 +0800 Subject: [PATCH 0040/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 53 +++++-------- .../native_sdk/net/dns/native_net_conn_type.h | 79 ------------------- 2 files changed, 20 insertions(+), 112 deletions(-) delete mode 100644 zh-cn/native_sdk/net/dns/native_net_conn_type.h diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 8290738d..f0b40ddd 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -20,7 +20,7 @@ * @addtogroup NetConn * @{ * - * @brief Provide C interface for the data network connection module of network management + * @brief 为网络管理的数据网络连接模块提供C接口 * * @since 11 * @version 1.0 @@ -29,7 +29,7 @@ /** * @file native_net_conn_api.h * - * @brief Provide C interface for the data network connection module of network management + * @brief 为网络管理的数据网络连接模块定义C接口 * * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -44,32 +44,18 @@ extern "C" { #endif /** - * @brief Query all active data networks + * @brief 查询默认的网络代理 * - * @param netHandleList Network Information List - * @return 0 - Success. - * @return 201 - Missing permissions. - * @return 401 - Parameter error. - * @return 2100002 - Unable to connect to service. - * @return 2100003 - Internal error. - * @permission ohos.permission.GET_NETWORK_INFO - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ -int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); - -/** - * @brief Query default network proxy - * - * @param host The host name to query - * @param serv Service name - * @param hint Pointer to the addrinfo structure - * @param res Store DNS query results and return them in a linked list format - * @param netId DNS query netId, 0 is used for default netid query - * @return 0 - Success. - * @return 401 - Parameter error. - * @return 2100003 - Internal error. + * @param host 所需查询的host名 + * @param serv 服务名 + * @param hint 指向addrinfo结构体的指针 + * @param res 存放DNS查询结果,以链表形式返回 + * @param netId DNS查询netId 为0是使用默认netid查询 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -78,13 +64,14 @@ int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); /** - * @brief Query default network proxy + * @brief 查询默认的网络代理 * - * @param res DNS query result chain header - * @return 0 - Success. - * @return 401 - Parameter error. - * @return 2100002 - Unable to connect to service. - * @return 2100003 - Internal error. + * @param res DNS查询结果链表头 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h deleted file mode 100644 index 6586afd4..00000000 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 NATIVE_NET_CONN_TYPE_H -#define NATIVE_NET_CONN_TYPE_H - -/** - * @addtogroup NetConn - * @{ - * - * @brief Provide data structure for the C interface of the data network connection module for network management - * - * @since 11 - * @version 1.0 - */ - -/** - * @file native_net_conn_type.h - * @brief Define the data structure required for the C interface of the network connection module - * - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - * - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define OH_NETCONN_MAX_NET_SIZE 32 - -/** - * @brief Store Network ID - * - * @since 11 - * @version 1.0 - */ - -typedef struct OH_NetConn_NetHandle { - /* Network id */ - int32_t netId; -} OH_NetConn_NetHandle; - -/** - * @brief Network list - * - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ - -typedef struct OH_NetConn_NetHandleList { - /* List of netHandle */ - OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; - /* Actual size of netHandleList */ - int32_t netHandleListSize; -} OH_NetConn_NetHandleList; - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif /* NATIVE_NET_CONN_TYPE_H */ \ No newline at end of file -- Gitee From d818a327c53f1dc59d3bcb93491d19555a8d9aa1 Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 19 Oct 2023 16:28:28 +0800 Subject: [PATCH 0041/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index f0b40ddd..14095ef6 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -20,7 +20,7 @@ * @addtogroup NetConn * @{ * - * @brief 为网络管理的数据网络连接模块提供C接口 + * @brief Provide C interface for the data network connection module of network management. * * @since 11 * @version 1.0 @@ -29,7 +29,7 @@ /** * @file native_net_conn_api.h * - * @brief 为网络管理的数据网络连接模块定义C接口 + * @brief Provide C interface for the data network connection module of network management. * * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -44,13 +44,13 @@ extern "C" { #endif /** - * @brief 查询默认的网络代理 + * @brief 通过netId获取DNS结果. * - * @param host 所需查询的host名 - * @param serv 服务名 - * @param hint 指向addrinfo结构体的指针 - * @param res 存放DNS查询结果,以链表形式返回 - * @param netId DNS查询netId 为0是使用默认netid查询 + * @param host 所需查询的host名. + * @param serv 服务名. + * @param hint 指向addrinfo结构体的指针. + * @param res 存放DNS查询结果,以链表形式返回. + * @param netId DNS查询netId 为0是使用默认netid查询. * @return 0 - 成功. * @return 201 - 缺少权限. * @return 401 - 参数错误. @@ -64,9 +64,9 @@ extern "C" { int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); /** - * @brief 查询默认的网络代理 + * @brief 释放DNS结果. * - * @param res DNS查询结果链表头 + * @param res DNS查询结果链表头. * @return 0 - 成功. * @return 201 - 缺少权限. * @return 401 - 参数错误. -- Gitee From 16ea820159ec61baded082945244696c92a9fb5b Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 20 Oct 2023 11:01:13 +0800 Subject: [PATCH 0042/2135] update docs Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/context.h | 50 ++- en/native_sdk/ai/mindspore/model.h | 33 +- .../neural_network_runtime.h | 422 ++++++++++-------- .../neural_network_runtime_type.h | 110 +++-- en/native_sdk/usb/usb_ddk_api.h | 24 +- 5 files changed, 377 insertions(+), 262 deletions(-) diff --git a/en/native_sdk/ai/mindspore/context.h b/en/native_sdk/ai/mindspore/context.h index e36ec853..298f0614 100644 --- a/en/native_sdk/ai/mindspore/context.h +++ b/en/native_sdk/ai/mindspore/context.h @@ -93,7 +93,8 @@ OH_AI_API void OH_AI_ContextSetThreadNum(OH_AI_ContextHandle context, int32_t th OH_AI_API int32_t OH_AI_ContextGetThreadNum(const OH_AI_ContextHandle context); /** - * @brief Sets the affinity mode for binding runtime threads to CPU cores, which are classified into large, medium, and small cores based on the CPU frequency. You only need to bind the large or medium cores, but not small cores. + * @brief Sets the affinity mode for binding runtime threads to CPU cores, which are classified into large, medium, + * and small cores based on the CPU frequency. You only need to bind the large or medium cores, but not small cores. * * @param context {@link OH_AI_ContextHandle} that points to the context instance. * @param mode Affinity mode. **0**: no affinities; **1**: big cores first; **2**: medium cores first @@ -114,8 +115,9 @@ OH_AI_API int OH_AI_ContextGetThreadAffinityMode(const OH_AI_ContextHandle conte * @brief Sets the list of CPU cores bound to a runtime thread. * * For example, if **core_list** is set to **[2,6,8]**, threads run on the 2nd, 6th, and 8th CPU cores. - * If {@link OH_AI_ContextSetThreadAffinityMode} and {@link OH_AI_ContextSetThreadAffinityCoreList} are called for the same context object, - * the **core_list** parameter of {@link OH_AI_ContextSetThreadAffinityCoreList} takes effect, but the **mode** parameter of {@link OH_AI_ContextSetThreadAffinityMode} does not. + * If {@link OH_AI_ContextSetThreadAffinityMode} and {@link OH_AI_ContextSetThreadAffinityCoreList} are called for + * the same context object, the **core_list** parameter of {@link OH_AI_ContextSetThreadAffinityCoreList} + * takes effect, but the **mode** parameter of {@link OH_AI_ContextSetThreadAffinityMode} does not. * * @param context {@link OH_AI_ContextHandle} that points to the context instance. * @param core_list List of bound CPU cores. @@ -130,16 +132,19 @@ OH_AI_API void OH_AI_ContextSetThreadAffinityCoreList(OH_AI_ContextHandle contex * * @param context {@link OH_AI_ContextHandle} that points to the context instance. * @param core_num Number of CPU cores. - * @return List of bound CPU cores. This list is managed by {@link OH_AI_ContextHandle}. The caller does not need to destroy it manually. + * @return List of bound CPU cores. This list is managed by {@link OH_AI_ContextHandle}. + * The caller does not need to destroy it manually. * @since 9 */ OH_AI_API const int32_t *OH_AI_ContextGetThreadAffinityCoreList(const OH_AI_ContextHandle context, size_t *core_num); /** - * @brief Sets whether to enable parallelism between operators. The setting is ineffective because the feature of this API is not yet available. + * @brief Sets whether to enable parallelism between operators. The setting is ineffective + * because the feature of this API is not yet available. * * @param context {@link OH_AI_ContextHandle} that points to the context instance. - * @param is_parallel Whether to enable parallelism between operators. The value **true** means to enable parallelism between operators, and the value **false** means the opposite. + * @param is_parallel Whether to enable parallelism between operators. The value **true** means to + * enable parallelism between operators, and the value **false** means the opposite. * @since 9 */ OH_AI_API void OH_AI_ContextSetEnableParallel(OH_AI_ContextHandle context, bool is_parallel); @@ -148,7 +153,8 @@ OH_AI_API void OH_AI_ContextSetEnableParallel(OH_AI_ContextHandle context, bool * @brief Checks whether parallelism between operators is supported. * * @param context {@link OH_AI_ContextHandle} that points to the context instance. - * @return Whether parallelism between operators is supported. The value **true** means to enable parallelism between operators, and the value **false** means the opposite. + * @return Whether parallelism between operators is supported. The value **true** means to enable + * parallelism between operators, and the value **false** means the opposite. * @since 9 */ OH_AI_API bool OH_AI_ContextGetEnableParallel(const OH_AI_ContextHandle context); @@ -172,7 +178,8 @@ OH_AI_API void OH_AI_ContextAddDeviceInfo(OH_AI_ContextHandle context, OH_AI_Dev OH_AI_API OH_AI_DeviceInfoHandle OH_AI_DeviceInfoCreate(OH_AI_DeviceType device_type); /** - * @brief Destroys a device information instance. Note: After the device information instance is added to the context, the caller does not need to destroy it manually. + * @brief Destroys a device information instance. Note: After the device information instance is added to + * the context, the caller does not need to destroy it manually. * * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. * @since 9 @@ -246,7 +253,8 @@ OH_AI_API bool OH_AI_DeviceInfoGetEnableFP16(const OH_AI_DeviceInfoHandle device * @brief Sets the NPU frequency type. This function is available only for NPU devices. * * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * @param frequency NPU frequency type. The value ranges from **0** to **4**. The default value is **3**. **1**: low power consumption; **2**: balanced; **3**: high performance; **4**: ultra-high performance + * @param frequency NPU frequency type. The value ranges from **0** to **4**. The default value is **3**. + * **1**: low power consumption; **2**: balanced; **3**: high performance; **4**: ultra-high performance * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetFrequency(OH_AI_DeviceInfoHandle device_info, int frequency); @@ -255,7 +263,8 @@ OH_AI_API void OH_AI_DeviceInfoSetFrequency(OH_AI_DeviceInfoHandle device_info, * @brief Obtains the NPU frequency type. This function is available only for NPU devices. * * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. - * @return Frequency type of the NPU. The value ranges from **0** to **4**. **1**: low power consumption; **2**: balanced; **3**: high performance; **4**: ultra-high performance + * @return Frequency type of the NPU. The value ranges from **0** to **4**. + * **1**: low power consumption; **2**: balanced; **3**: high performance; **4**: ultra-high performance * @since 9 */ OH_AI_API int OH_AI_DeviceInfoGetFrequency(const OH_AI_DeviceInfoHandle device_info); @@ -282,13 +291,15 @@ OH_AI_API NNRTDeviceDesc *OH_AI_GetElementOfNNRTDeviceDescs(NNRTDeviceDesc *desc /** * @brief Destroys the NNRt device description array obtained by {@link OH_AI_GetAllNNRTDeviceDescs}. * - * @param desc Double pointer to the NNRt device description array. After the operation is complete, the content pointed to by **desc** is set to **NULL**. + * @param desc Double pointer to the NNRt device description array. After the operation is complete, + * the content pointed to by **desc** is set to **NULL**. * @since 10 */ OH_AI_API void OH_AI_DestroyAllNNRTDeviceDescs(NNRTDeviceDesc **desc); /** - * @brief Obtains the NNRt device ID from the specified NNRt device description. Note that this ID is valid only for NNRt devices. + * @brief Obtains the NNRt device ID from the specified NNRt device description. + * Note that this ID is valid only for NNRt devices. * * @param desc Pointer to the NNRt device description. * @return NNRt device ID. @@ -300,7 +311,8 @@ OH_AI_API size_t OH_AI_GetDeviceIdFromNNRTDeviceDesc(const NNRTDeviceDesc *desc) * @brief Obtains the NNRt device name from the specified NNRt device description. * * @param desc Pointer to the NNRt device description. - * @return NNRt device name. The value is a pointer that points to a constant string, which is held by **desc**. The caller does not need to destroy it separately. + * @return NNRt device name. The value is a pointer that points to a constant string, which is held by **desc**. + * The caller does not need to destroy it separately. * @since 10 */ OH_AI_API const char *OH_AI_GetNameFromNNRTDeviceDesc(const NNRTDeviceDesc *desc); @@ -315,7 +327,8 @@ OH_AI_API const char *OH_AI_GetNameFromNNRTDeviceDesc(const NNRTDeviceDesc *desc OH_AI_API OH_AI_NNRTDeviceType OH_AI_GetTypeFromNNRTDeviceDesc(const NNRTDeviceDesc *desc); /** - * @brief Searches for the NNRt device with the specified name and creates the NNRt device information based on the information about the first found NNRt device. + * @brief Searches for the NNRt device with the specified name and creates the NNRt device information + * based on the information about the first found NNRt device. * * @param name NNRt device name. * @return {@link OH_AI_DeviceInfoHandle} that points to the device information instance. @@ -324,7 +337,8 @@ OH_AI_API OH_AI_NNRTDeviceType OH_AI_GetTypeFromNNRTDeviceDesc(const NNRTDeviceD OH_AI_API OH_AI_DeviceInfoHandle OH_AI_CreateNNRTDeviceInfoByName(const char *name); /** - * @brief Searches for the NNRt device with the specified type and creates the NNRt device information based on the information about the first found NNRt device. + * @brief Searches for the NNRt device with the specified type and creates the NNRt device information + * based on the information about the first found NNRt device. * * @param type NNRt device type enumerated by {@link OH_AI_NNRTDeviceType}. * @return {@link OH_AI_DeviceInfoHandle} that points to the device information instance. @@ -388,7 +402,8 @@ OH_AI_API void OH_AI_DeviceInfoSetPriority(OH_AI_DeviceInfoHandle device_info, O OH_AI_API OH_AI_Priority OH_AI_DeviceInfoGetPriority(const OH_AI_DeviceInfoHandle device_info); /** - * @brief Adds extended configuration in the form of key/value pairs to the device information. This function is available only for NNRt device information. + * @brief Adds extended configuration in the form of key/value pairs to the device information. + * This function is available only for NNRt device information. * * Note: The key/value pairs currently supported include {"CachePath": "YourCachePath"}, {"CacheVersion": "YourCacheVersion"}, * and {"QuantParam": "YourQuantConfig". You can replace the values as required. @@ -397,7 +412,8 @@ OH_AI_API OH_AI_Priority OH_AI_DeviceInfoGetPriority(const OH_AI_DeviceInfoHandl * @param name Key in an extended key/value pair. The value is a C string. * @param value Start address of the value in an extended key/value pair. * @param value_size Length of the value in an extended key/value pair. - * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_STATUS_SUCCESS** indicates that the operation is successful. If the operation fails, an error code is returned. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_STATUS_SUCCESS** indicates that + * the operation is successful. If the operation fails, an error code is returned. * @since 10 */ OH_AI_API OH_AI_Status OH_AI_DeviceInfoAddExtension(OH_AI_DeviceInfoHandle device_info, const char *name, diff --git a/en/native_sdk/ai/mindspore/model.h b/en/native_sdk/ai/mindspore/model.h index ee83b8a2..f8e83809 100644 --- a/en/native_sdk/ai/mindspore/model.h +++ b/en/native_sdk/ai/mindspore/model.h @@ -95,8 +95,10 @@ typedef struct OH_AI_CallBackParam * @brief Defines the pointer to a callback. * * This pointer is used to set the two callback functions in {@link OH_AI_ModelPredict}. - * Each callback function must contain three parameters, where **inputs** and **outputs** indicate the input and output tensors of the operator, and **kernel_Info** indicates information about the current operator. - * You can use the callback functions to monitor the operator execution status, for example, operator execution time and the operator correctness. + * Each callback function must contain three parameters, where **inputs** and **outputs** indicate + * the input and output tensors of the operator, and **kernel_Info** indicates information about the current operator. + * You can use the callback functions to monitor the operator execution status, for example, operator execution time + * and the operator correctness. * * @since 9 */ @@ -122,7 +124,8 @@ OH_AI_API void OH_AI_ModelDestroy(OH_AI_ModelHandle *model); /** * @brief Loads and builds a MindSpore model from the memory buffer. * - * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or {@link OH_AI_ModelBuildFromFile} only once. + * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or + * {@link OH_AI_ModelBuildFromFile} only once. * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects accordingly. * * @param model Pointer to the model object. @@ -130,7 +133,8 @@ OH_AI_API void OH_AI_ModelDestroy(OH_AI_ModelHandle *model); * @param data_size Length of the model data. * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. * @param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. - * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that + * the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *model_data, size_t data_size, @@ -139,14 +143,16 @@ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *mod /** * @brief Loads and builds a MindSpore model from a model file. * - * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or {@link OH_AI_ModelBuildFromFile} only once. + * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or + * {@link OH_AI_ModelBuildFromFile} only once. * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects accordingly. * * @param model Pointer to the model object. * @param model_path Path of the model file. * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. * @param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. - * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that + * the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelBuildFromFile(OH_AI_ModelHandle model, const char *model_path, @@ -157,9 +163,11 @@ OH_AI_API OH_AI_Status OH_AI_ModelBuildFromFile(OH_AI_ModelHandle model, const c * * @param model Pointer to the model object. * @param inputs Tensor array structure corresponding to the model input. - * @param shape_infos Input shape array, which consists of tensor shapes arranged in the model input sequence. The model adjusts the tensor shapes in sequence. + * @param shape_infos Input shape array, which consists of tensor shapes arranged in the model input sequence. + * The model adjusts the tensor shapes in sequence. * @param shape_info_num Length of the input shape array. - * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that + * the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelResize(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, @@ -173,7 +181,8 @@ OH_AI_API OH_AI_Status OH_AI_ModelResize(OH_AI_ModelHandle model, const OH_AI_Te * @param outputs Pointer to the tensor array structure corresponding to the model output. * @param before Callback function executed before model inference. * @param after Callback function executed after model inference. - * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @return Status code enumerated by {@link OH_AI_Status}. + * The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelPredict(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, @@ -203,7 +212,8 @@ OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetOutputs(const OH_AI_ModelHandle * * @param model Pointer to the model object. * @param tensor_name Tensor name. - * @return Pointer to the input tensor indicated by **tensor_name**. If the tensor does not exist in the input, **null** will be returned. + * @return Pointer to the input tensor indicated by **tensor_name**. If the tensor does not exist in the input, + * **null** will be returned. * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); @@ -213,7 +223,8 @@ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHa * * @param model Pointer to the model object. * @param tensor_name Tensor name. - * @return Pointer to the output tensor indicated by **tensor_name**. If the tensor does not exist in the input, **null** will be returned. + * @return Pointer to the output tensor indicated by **tensor_name**. If the tensor does not exist in the input, + * **null** will be returned. * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetOutputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index 3b504b17..4cd1822a 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -27,9 +27,9 @@ /** * @file neural_network_runtime.h * - * @brief Defines the Neural Network Runtime APIs. The AI inference framework uses the Native APIs provided by Neural Network Runtime - * to construct and compile models and perform inference and computing on acceleration hardware. - * Note: Currently, the APIs of Neural Network Runtime do not support multi-thread calling. \n + * @brief Defines the Neural Network Runtime APIs. The AI inference framework uses the Native APIs provided by Neural + * Network Runtime to construct and compile models and perform inference and computing on acceleration hardware. + * Note: Currently, the APIs of Neural Network Runtime do not support multi-thread calling.\n * * @library libneural_network_runtime.so * @since 9 @@ -46,13 +46,15 @@ extern "C" { #endif /** - * @brief Creates a model instance of the {@link OH_NNModel} type and uses other APIs provided by OH_NNModel to construct the model instance. + * @brief Creates a model instance of the {@link OH_NNModel} type and uses other APIs provided by OH_NNModel to construct + * the model instance. * - * Before composition, call {@link OH_NNModel_Construct} to create a model instance. Based on the model topology, + * Before composition, call {@link OH_NNModel_Construct} to create a model instance. Based on the model topology, * call the {@link OH_NNModel_AddTensor}, {@link OH_NNModel_AddOperation}, and {@link OH_NNModel_SetTensorData} methods - * to fill in the data and operator nodes of the model, and then call {@link OH_NNModel_SpecifyInputsAndOutputs} to specify the inputs and outputs of the model. - * After the model topology is constructed, call {@link OH_NNModel_Finish} to build the model. \n - * After a model instance is used, you need to destroy it by calling {@link OH_NNModel_Destroy} to avoid memory leak. \n + * to fill in the data and operator nodes of the model, and then call {@link OH_NNModel_SpecifyInputsAndOutputs} + * to specify the inputs and outputs of the model. + * After the model topology is constructed, call {@link OH_NNModel_Finish} to build the model.\n + * After a model instance is used, you need to destroy it by calling {@link OH_NNModel_Destroy} to avoid memory leak.\n * * @return Returns the pointer to a {@link OH_NNModel} instance. * @since 9 @@ -65,17 +67,21 @@ OH_NNModel *OH_NNModel_Construct(void); * * The data node and operator parameters in the Neural Network Runtime model are composed of tensors of the model. * This method is used to add tensors to a model instance based on the tensor parameter. - * The sequence of adding tensors is specified by the index value recorded in the model. The {@link OH_NNModel_SetTensorData}, {@link OH_NNModel_AddOperation}, - * and {@link OH_NNModel_SpecifyInputsAndOutputs} methods specifies tensors based on the index value. \n + * The sequence of adding tensors is specified by the index value recorded in the model. The + * {@link OH_NNModel_SetTensorData}, {@link OH_NNModel_AddOperation}, and {@link OH_NNModel_SpecifyInputsAndOutputs} + * methods specifies tensors based on the index value.\n * Neural Network Runtime supports inputs and outputs of the dynamic shape. When adding a data node with a dynamic shape, * you need to set the dimensions that support dynamic changes in tensor.dimensions to -1. - * For example, if tensor.dimensions of a four-dimensional tensor is set to [1, -1, 2, 2], the second dimension supports dynamic changes. \n + * For example, if tensor.dimensions of a four-dimensional tensor is set to [1, -1, 2, 2], the second + * dimension supports dynamic changes.\n * * * @param model Pointer to the {@link OH_NNModel} instance. - * @param tensor Pointer to the {@link OH_NN_Tensor} tensor. The tensor specifies the attributes of the tensor added to the model instance. + * @param tensor Pointer to the {@link OH_NN_Tensor} tensor. The tensor specifies the attributes of the tensor added to + * the model instance. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, see + * {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -86,14 +92,15 @@ OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *ten * * For tensors with constant values (such as model weights), you need to use this method in the composition phase. * The index value of a tensor is determined by the sequence in which the tensor is added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}. \n + * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @param index Index value of a tensor. * @param dataBuffer Pointer to real data. * @param length Length of the data buffer. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -103,27 +110,31 @@ OH_NN_ReturnCode OH_NNModel_SetTensorData(OH_NNModel *model, uint32_t index, con * @brief Adds an operator to a model instance. * * This method is used to add an operator to a model instance. The operator type is specified by op, and - * the operator parameters, inputs, and outputs are specified by paramIndices, inputIndices, and outputIndices respectively. + * the operator parameters, inputs, and outputs are specified by paramIndices, inputIndices, and + * outputIndices respectively. * This method verifies the attributes of operator parameters and the number of input and output parameters. * These attributes must be correctly set when {@link OH_NNModel_AddTensor} is called to add tensors. - * For details about the expected parameters, input attributes, and output attributes of each operator, see {@link OH_NN_OperationType}. \n + * For details about the expected parameters, input attributes, and output attributes of each operator, + * see {@link OH_NN_OperationType}.\n * * - * paramIndices, inputIndices, and outputIndices store index values of tensors. - * Index values are determined by the sequence in which tensors are added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}. \n + * paramIndices, inputIndices, and outputIndices store index values of tensors. + * Index values are determined by the sequence in which tensors are added to the model. + * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n * - * If unnecessary parameters are added for adding an operator, this method returns {@link OH_NN_INVALID_PARAMETER}. + * If unnecessary parameters are added for adding an operator, this method returns {@link OH_NN_INVALID_PARAMETER}. * If no operator parameter is set, the operator uses the default parameter value. - * For details about the default values, see {@link OH_NN_OperationType}. \n + * For details about the default values, see {@link OH_NN_OperationType}.\n * * @param model Pointer to the {@link OH_NNModel} instance. - * @param op Specifies the type of an operator to be added. For details, see the enumerated values of {@link OH_NN_OperationType}. + * @param op Specifies the type of an operator to be added. For details, see the enumerated values of + * {@link OH_NN_OperationType}. * @param paramIndices Pointer to the OH_NN_UInt32Array instance, which is used to set operator parameters. * @param inputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator input. * @param outputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator output. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -136,19 +147,21 @@ OH_NN_ReturnCode OH_NNModel_AddOperation(OH_NNModel *model, /** * @brief Specifies the inputs and outputs of a model. * - * A tensor must be specified as the end-to-end inputs and outputs of a model instance. This type of tensor cannot be set - * using {@link OH_NNModel_SetTensorData}. The OH_NNExecutor method needs to be called in the execution phase to set the input and output data. \n + * A tensor must be specified as the end-to-end inputs and outputs of a model instance. This type of tensor cannot + * be set using {@link OH_NNModel_SetTensorData}. The OH_NNExecutor method needs to be called in the execution + * phase to set the input and output data.\n * - * The index value of a tensor is determined by the sequence in which the tensor is added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}. \n + * The index value of a tensor is determined by the sequence in which the tensor is added to the model. + * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n * - * Currently, the model inputs and outputs cannot be set asynchronously. \n + * Currently, the model inputs and outputs cannot be set asynchronously.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @param inputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator input. * @param outputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator output. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -159,17 +172,17 @@ OH_NN_ReturnCode OH_NNModel_SpecifyInputsAndOutputs(OH_NNModel *model, /** * @brief Completes model composition. * - * After the model topology is set up, call this method to indicate that the composition is complete. After this method is called, + * After the model topology is set up, call this method to indicate that the composition is complete. After this method * additional composition operations cannot be performed. If {@link OH_NNModel_AddTensor}, {@link OH_NNModel_AddOperation}, - * {@link OH_NNModel_SetTensorData}, and {@link OH_NNModel_SpecifyInputsAndOutputs} are called, - * {@link OH_NN_OPERATION_FORBIDDEN} is returned. \n + * is called, {@link OH_NNModel_SetTensorData}, and {@link OH_NNModel_SpecifyInputsAndOutputs} are called, + * {@link OH_NN_OPERATION_FORBIDDEN} is returned.\n * * Before calling {@link OH_NNModel_GetAvailableOperations} and {@link OH_NNCompilation_Construct}, - * you must call this method to complete composition. \n + * you must call this method to complete composition.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -178,11 +191,14 @@ OH_NN_ReturnCode OH_NNModel_Finish(OH_NNModel *model); /** * @brief Releases a model instance. * - * This method needs to be called to release the model instance created by calling {@link OH_NNModel_Construct}. Otherwise, memory leak will occur. \n + * This method needs to be called to release the model instance created by calling {@link OH_NNModel_Construct}. + * Otherwise, memory leak will occur.\n * - * If model or *model is a null pointer, this method only prints warning logs and does not execute the release logic. \n + * If model or *model is a null pointer, this method only prints warning logs and does not execute the + * release logic.\n * - * @param model Level-2 pointer to the {@link OH_NNModel} instance. After a model instance is destroyed, this method sets *model to a null pointer. + * @param model Level-2 pointer to the {@link OH_NNModel} instance. After a model instance is destroyed, + * this method sets *model to a null pointer. * @since 9 * @version 1.0 */ @@ -193,11 +209,13 @@ void OH_NNModel_Destroy(OH_NNModel **model); * * Queries whether underlying device supports operators in a model instance. The device is specified by deviceID, * and the result is represented by the array pointed by isSupported. If the ith operator is supported, - * the value of (*isSupported)[i] is true. Otherwise, the value is false. \n + * the value of (*isSupported)[i] is true. Otherwise, the value is false.\n * - * After this method is successfully executed, (*isSupported) points to the bool array that records the operator support status. - * The operator quantity for the array length is the same as that for the model instance. The memory corresponding to this array is - * managed by Neural Network Runtime and is automatically destroyed after the model instance is destroyed or this method is called again. \n + * After this method is successfully executed, (*isSupported) points to the bool array that records the operator + * support status. + * The operator quantity for the array length is the same as that for the model instance. The memory corresponding to + * this array is managed by Neural Network Runtime and is automatically destroyed after the model instance is destroyed + * or this method is called again.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @param deviceID Device ID to be queried, which can be obtained by using {@link OH_NNDevice_GetAllDevicesID}. @@ -206,7 +224,9 @@ void OH_NNModel_Destroy(OH_NNModel **model); * * @param opCount Number of operators in a model instance, corresponding to the length of the (*isSupported) array. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * * @since 9 * @version 1.0 */ @@ -224,14 +244,14 @@ OH_NN_ReturnCode OH_NNModel_GetAvailableOperations(OH_NNModel *model, * based on the passed {@link OH_NNModel} instance. The {@link OH_NNCompilation_SetDevice} method is called * to set the device to compile on, and {@link OH_NNCompilation_Build} is then called to complete compilation.\n * - * In addition to computing device selection, the OH_NNCompilation module supports features such as model caching, performance preference, - * priority setting, and float16 computing, which can be implemented by the following methods: + * In addition to computing device selection, the OH_NNCompilation module supports features such as model caching, + * performance preference, priority setting, and float16 computing, which can be implemented by the following methods: * - {@link OH_NNCompilation_SetCache} * - {@link OH_NNCompilation_SetPerformanceMode} * - {@link OH_NNCompilation_SetPriority} * - {@link OH_NNCompilation_EnableFloat16}\n * - * After {@link OH_NNCompilation} is created by calling this method, the {@link OH_NNModel} instance can be released. \n + * After {@link OH_NNCompilation} is created by calling this method, the {@link OH_NNModel} instance can be released.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @return Returns the pointer to a {@link OH_NNCompilation} instance. @@ -243,9 +263,9 @@ OH_NNCompilation *OH_NNCompilation_Construct(const OH_NNModel *model); /** * @brief Specifies the device for model compilation and computing. * - * In the compilation phase, you need to specify the device for model compilation and computing. Call {@link OH_NNDevice_GetAllDevicesID} - * to obtain available device IDs. Call {@link OH_NNDevice_GetType} and {@link OH_NNDevice_GetName} to obtain device information - * and pass target device IDs to this method for setting. \n + * In the compilation phase, you need to specify the device for model compilation and computing. + * Call {@link OH_NNDevice_GetAllDevicesID} to obtain available device IDs. Call {@link OH_NNDevice_GetType} and + * {@link OH_NNDevice_GetName} to obtain device information and pass target device IDs to this method for setting.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @param deviceID Device ID. @@ -259,34 +279,37 @@ OH_NN_ReturnCode OH_NNCompilation_SetDevice(OH_NNCompilation *compilation, size_ /** * @brief Set the cache directory and version of the compiled model. * - * On the device that supports caching, a model can be saved as a cache file after being compiled at the device driver layer. + * On the device that supports caching, a model can be saved as a cache file after being compiled at the + * device driver layer. * The model can be directly read from the cache file in the next compilation, saving recompilation time. * This method performs different operations based on the passed cache directory and version:\n * * - No file exists in the cache directory: - * Caches the compiled model to the directory and sets the cache version to version. \n + * Caches the compiled model to the directory and sets the cache version to version.\n * * - A complete cache file exists in the cache directory, and its version is version: - * Reads the cache file in the path and passes the data to the underlying device for conversion into executable model instances. \n + * Reads the cache file in the path and passes the data to the underlying device for conversion into + * executable model instances.\n * * - A complete cache file exists in the cache directory, and its version is earlier than version: - * When model compilation is complete on the underlying device, overwrites the cache file and changes the version number to version. \n + * When model compilation is complete on the underlying device, overwrites the cache file and changes the version number + * to version.\n * * - A complete cache file exists in the cache directory, and its version is later than version: - * Returns the {@link OH_NN_INVALID_PARAMETER} error code without reading the cache file. \n + * Returns the {@link OH_NN_INVALID_PARAMETER} error code without reading the cache file.\n * * - The cache file in the cache directory is incomplete or you do not have the permission to access the cache file. - * Returns the {@link OH_NN_INVALID_FILE} error code. \n + * Returns the {@link OH_NN_INVALID_FILE} error code.\n * * - The cache directory does not exist or you do not have the access permission. - * Returns the {@link OH_NN_INVALID_PATH} error code. \n + * Returns the {@link OH_NN_INVALID_PATH} error code.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param cachePath Directory for storing model cache files. This method creates directories for different devices in the cachePath directory. - * You are advised to use a separate cache directory for each model. + * @param cachePath Directory for storing model cache files. This method creates directories for different devices in the + * cachePath directory. You are advised to use a separate cache directory for each model. * @param version Cache version. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -295,16 +318,19 @@ OH_NN_ReturnCode OH_NNCompilation_SetCache(OH_NNCompilation *compilation, const /** * @brief Sets the performance mode for model computing. * - * Neural Network Runtime allows you to set the performance mode for model computing to meet the requirements of low power consumption - * and ultimate performance. If this method is not called to set the performance mode in the compilation phase, the compilation instance assigns - * the {@link OH_NN_PERFORMANCE_NONE} mode for the model by default. In this case, the device performs computing in the default performance mode. \n + * Neural Network Runtime allows you to set the performance mode for model computing to meet the requirements of low + * power consumption and ultimate performance. If this method is not called to set the performance mode in the + * compilation phase, the compilation instance assigns the {@link OH_NN_PERFORMANCE_NONE} mode for the model by default. + * In this case, the device performs computing in the default performance mode.\n * - * If this method is called on the device that does not support the setting of the performance mode, the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned. \n + * If this method is called on the device that does not support the setting of the performance mode, + * the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param performanceMode Performance mode. For details about the available performance modes, see {@link OH_NN_PerformanceMode}. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @param performanceMode Performance mode. For details about the available performance modes, + * see {@link OH_NN_PerformanceMode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -316,14 +342,15 @@ OH_NN_ReturnCode OH_NNCompilation_SetPerformanceMode(OH_NNCompilation *compilati * * Neural Network Runtime allows you to set computing priorities for models. * The priorities apply only to models created by the process with the same UID. - * The settings will not affect models created by processes with different UIDs on different devices. \n + * The settings will not affect models created by processes with different UIDs on different devices.\n * - * If this method is called on the device that does not support the priority setting, the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned. \n + * If this method is called on the device that does not support the priority setting, the {@link OH_NN_UNAVALIDABLE_DEVICE} + * error code is returned.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @param priority Priority. For details about the optional priorities, see {@link OH_NN_Priority}. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -332,16 +359,17 @@ OH_NN_ReturnCode OH_NNCompilation_SetPriority(OH_NNCompilation *compilation, OH_ /** * @brief Enables float16 for computing. * - * Currently, Neural Network Runtime supports only float32 and int8. If this method is called on a device that supports float16, - * float16 will be used for computing the float32 model to reduce memory usage and execution time. \n + * Currently, Neural Network Runtime supports only float32 and int8. If this method is called on a device that supports + * float16, float16 will be used for computing the float32 model to reduce memory usage and execution time.\n * - * If this method is called on the device that does not support float16, the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned. \n + * If this method is called on the device that does not support float16, the {@link OH_NN_UNAVALIDABLE_DEVICE} + * error code is returned.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param enableFloat16 Indicates whether to enable float16. If this parameter is set to true, float16 inference is performed. - * If this parameter is set to false, float32 inference is performed. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, an error code is returned. - * For details about the error codes, see {@link OH_NN_ReturnCode}. + * @param enableFloat16 Whether to enable float16. If this parameter is set to true, float16 inference is performed. + * If this parameter is set to false, float32 inference is performed. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -350,14 +378,16 @@ OH_NN_ReturnCode OH_NNCompilation_EnableFloat16(OH_NNCompilation *compilation, b /** * @brief Compiles a model. * - * After the compilation configuration is complete, call this method to return the compilation result. The compilation instance pushes the model and - * compilation options to the device for compilation. After this method is called, additional compilation operations cannot be performed. - * If the {@link OH_NNCompilation_SetDevice}, {@link OH_NNCompilation_SetCache}, {@link OH_NNCompilation_SetPerformanceMode}, - * {@link OH_NNCompilation_SetPriority}, and {@link OH_NNCompilation_EnableFloat16} methods are called, {@link OH_NN_OPERATION_FORBIDDEN} is returned. \n + * After the compilation configuration is complete, call this method to return the compilation result. The compilation instance + * pushes the model and compilation options to the device for compilation. After this method is called, additional compilation + * operations cannot be performed. + * If the {@link OH_NNCompilation_SetDevice}, {@link OH_NNCompilation_SetCache}, {@link OH_NNCompilation_SetPerformanceMode}, + * {@link OH_NNCompilation_SetPriority}, and {@link OH_NNCompilation_EnableFloat16} methods are called, + * {@link OH_NN_OPERATION_FORBIDDEN} is returned.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -366,12 +396,14 @@ OH_NN_ReturnCode OH_NNCompilation_Build(OH_NNCompilation *compilation); /** * @brief Releases the Compilation object. * - * This method needs to be called to release the compilation instance created by calling {@link OH_NNCompilation_Construct}. Otherwise, memory leak will occur. \n + * This method needs to be called to release the compilation instance created by calling {@link OH_NNCompilation_Construct}. + * Otherwise, memory leak will occur.\n * - * If compilation or *compilation is a null pointer, this method only prints warning logs and does not execute the release logic. \n + * If compilation or *compilation is a null pointer, this method only prints warning logs and does not execute + * the release logic.\n * - * @param compilation Level-2 pointer to the {@link OH_NNCompilation} instance. After a compilation instance is destroyed, - * this method sets *compilation to a null pointer. + * @param compilation Level-2 pointer to the {@link OH_NNCompilation} instance. After a compilation instance is destroyed, + * this method sets *compilation to a null pointer. * @since 9 * @version 1.0 */ @@ -381,12 +413,12 @@ void OH_NNCompilation_Destroy(OH_NNCompilation **compilation); /** * @brief Creates an executor instance of the {@link OH_NNExecutor} type. * - * This method constructs a model inference executor associated with the device based on the passed compiler. Use {@link OH_NNExecutor_SetInput} - * to set the model input data. After the input data is set, call {@link OH_NNExecutor_Run} to perform inference and then call - * {@link OH_NNExecutor_SetOutput} to obtain the computing result. \n + * This method constructs a model inference executor associated with the device based on the passed compiler. + * Use {@link OH_NNExecutor_SetInput} to set the model input data. After the input data is set, call {@link OH_NNExecutor_Run} + * to perform inference and then call {@link OH_NNExecutor_SetOutput} to obtain the computing result.\n * - * After calling this method to create the {@link OH_NNExecutor} instance, you can release the {@link OH_NNCompilation} - * instance if you do not need to create any other executors. \n + * After calling this method to create the {@link OH_NNExecutor} instance, you can release the {@link OH_NNCompilation} + * instance if you do not need to create any other executors.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @return Pointer to a {@link OH_NNExecutor} instance. @@ -399,8 +431,8 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); * @brief Sets the single input data for a model. * * This method copies the data whose length is specified by length (in bytes) in dataBuffer to the shared memory - * of the underlying device. inputIndex specifies the input to be set and tensor sets information such as the input shape, - * type, and quantization parameters. \n + * of the underlying device. inputIndex specifies the input to be set and tensor sets information + * such as the input shape, type, and quantization parameters.\n * * * Neural Network Runtime supports models with dynamical shape input. For fixed shape input and dynamic shape input scenarios, @@ -408,25 +440,27 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); * * - Fixed shape input: The attributes of tensor must be the same as those of the tensor added by calling * {@link OH_NNModel_AddTensor} in the composition phase. - * - Dynamic shape input: In the composition phase, because the shape is not fixed, each value in tensor.dimensions must be greater than - * 0 in the method calls to determine the shape input in the calculation phase. When setting the shape, you can modify - * only the dimension whose value is -1. Assume that [-1, 224, 224, 3] is input as the the dimension of A in the composition phase. - * When this method is called, only the size of the first dimension can be modified, for example, to [3, 224, 224, 3]. - * If other dimensions are adjusted, {@link OH_NN_INVALID_PARAMETER} is returned. \n + * - Dynamic shape input: In the composition phase, because the shape is not fixed, each value in tensor.dimensions + * must be greater than 0 in the method calls to determine the shape input in the calculation phase. + * When setting the shape, you can modify only the dimension whose value is -1. Assume that [-1, 224, 224, 3] + * is input as the the dimension of A in the composition phase. + * When this method is called, only the size of the first dimension can be modified, for example, to [3, 224, 224, 3]. + * If other dimensions are adjusted, {@link OH_NN_INVALID_PARAMETER} is returned.\n * * * * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param inputIndex Input index value, which is in the same sequence of the data input when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of inputIndices is {1, 5, 9} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In input settings, the index value for the three inputs is {0, 1, 2}. + * @param inputIndex Input index value, which is in the same sequence of the data input when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that the value of inputIndices is {1, 5, 9} when {@link OH_NNModel_SpecifyInputsAndOutputs} + * is called. In input settings, the index value for the three inputs is {0, 1, 2}. * * @param tensor Sets the tensor corresponding to the input data. * @param dataBuffer Pointer to the input data. * @param length Length of the data buffer, in bytes. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -440,23 +474,24 @@ OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, * @brief Sets the buffer for a single output of a model. * * This method binds the buffer to which dataBuffer points to the output specified by outputIndex. - * The length of the buffer is specified by length. \n + * The length of the buffer is specified by length.\n * * After {@link OH_NNExecutor_Run} is called to complete a single model inference, Neural Network Runtime compares * the length of the buffer to which dataBuffer points with the length of the output data and returns different results - * based on the actual situation. \n + * based on the actual situation.\n * * * - If the buffer length is greater than or equal to the data length, the inference result is copied to the buffer and * {@link OH_NN_SUCCESS} is returned. You can read the inference result from dataBuffer. * - If the buffer length is smaller than the data length, {@link OH_NNExecutor_Run} returns {@link OH_NN_INVALID_PARAMETER} - * and generates a log indicating that the buffer is too small. \n + * and generates a log indicating that the buffer is too small.\n * * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param outputIndex Output Index value, which is in the same sequence of the data output when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} - * is called. In output buffer settings, the index value for the three outputs is {0, 1, 2}. + * @param outputIndex Output Index value, which is in the same sequence of the data output when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that the value of outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} + * is called. In output buffer settings, the index value for the three outputs is {0, 1, 2}. * * @param dataBuffer Pointer to the output data. * @param length Length of the data buffer, in bytes. @@ -474,18 +509,19 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, * @brief Obtains the dimension information about the output tensor. * * After {@link OH_NNExecutor_Run} is called to complete a single inference, call this method to obtain the specified output dimension - * information and number of dimensions. It is commonly used in dynamic shape input and output scenarios. \n + * information and number of dimensions. It is commonly used in dynamic shape input and output scenarios.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param outputIndex Output Index value, which is in the same sequence of the data output when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * When {@link OH_NNExecutor_GetOutputShape} is called to obtain dimension information about the output tensor, - * outputIndices is {0, 1, 2}. + * @param outputIndex Output Index value, which is in the same sequence of the data output when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * When {@link OH_NNExecutor_GetOutputShape} is called to obtain dimension information about the output tensor, + * outputIndices is {0, 1, 2}. * * @param shape Pointer to the int32_t array. The value of each element in the array is the length of the output tensor in each dimension. * @param shapeLength Pointer to the uint32_t type. The number of output dimensions is returned. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -497,11 +533,11 @@ OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, /** * @brief Performs inference. * - * Performs end-to-end inference and computing of the model on the device associated with the executor. \n + * Performs end-to-end inference and computing of the model on the device associated with the executor.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -510,15 +546,17 @@ OH_NN_ReturnCode OH_NNExecutor_Run(OH_NNExecutor *executor); /** * @brief Allocates shared memory to a single input on a device. * - * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the executor and input index value, - * this method allocates shared memory whose size is specified by length on the device associated with a single input and returns the - * operation result through the {@link OH_NN_Memory} instance. \n + * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the executor + * and input index value, this method allocates shared memory whose size is specified by length on the device associated + * with a single input and returns the operation result through the {@link OH_NN_Memory} instance.\n * * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param inputIndex Input index value, which is in the same sequence of the data input when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of inputIndices is {1, 5, 9} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In the memory input application, the index value for the three inputs is {0, 1, 2}. + * @param inputIndex Input index value, which is in the same sequence of the data input when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that the value of inputIndices is {1, 5, 9} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * In the memory input application, the index value for the three inputs is {0, 1, 2}. * * @param length Memory size to be applied for, in bytes. * @return Pointer to a {@link OH_NN_Memory} instance. @@ -532,13 +570,15 @@ OH_NN_Memory *OH_NNExecutor_AllocateInputMemory(OH_NNExecutor *executor, uint32_ * * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the executor and * output index value, this method allocates shared memory whose size is specified by length on the device associated with - * a single output and returns the operation result through the {@link OH_NN_Memory} instance. \n + * a single output and returns the operation result through the {@link OH_NN_Memory} instance.\n * * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param outputIndex Output Index value, which is in the same sequence of the data output when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In output memory application, the index value for the three outputs is {0, 1, 2}. + * @param outputIndex Output Index value, which is in the same sequence of the data output when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that the value of outputIndices is {4, 6, 8} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * In output memory application, the index value for the three outputs is {0, 1, 2}. * * @param length Memory size to be applied for, in bytes. * @return Pointer to a {@link OH_NN_Memory} instance. @@ -552,16 +592,20 @@ OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32 * * This method needs to be called to release the memory instance created by calling {@link OH_NNExecutor_AllocateInputMemory}. * Otherwise, memory leak will occur. - * The mapping between inputIndex and memory must be the same as that in memory instance creation. \n + * The mapping between inputIndex and memory must be the same as that in memory instance creation.\n * - * If memory or *memory is a null pointer, this method only prints warning logs and does not execute the release logic. \n + * If memory or *memory is a null pointer, this method only prints warning logs and does not execute + * the release logic.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param inputIndex Input index value, which is in the same sequence of the data input when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of inputIndices is {1, 5, 9} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In memory input release, the index value for the three inputs is {0, 1, 2}. + * @param inputIndex Input index value, which is in the same sequence of the data input when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that the value of inputIndices is {1, 5, 9} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * In memory input release, the index value for the three inputs is {0, 1, 2}. * - * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, this method sets *memory to a null pointer. + * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, this method sets + * *memory to a null pointer. * @since 9 * @version 1.0 */ @@ -570,38 +614,48 @@ void OH_NNExecutor_DestroyInputMemory(OH_NNExecutor *executor, uint32_t inputInd /** * @brief Releases the output memory to which the {@link OH_NN_Memory} instance points. * - * This method needs to be called to release the memory instance created by calling {@link OH_NNExecutor_AllocateOutputMemory}. Otherwise, memory leak will occur. - * The mapping between outputIndex and memory must be the same as that in memory instance creation. \n + * This method needs to be called to release the memory instance created by calling {@link OH_NNExecutor_AllocateOutputMemory}. + * Otherwise, memory leak will occur. + * The mapping between outputIndex and memory must be the same as that in memory instance creation.\n * - * If memory or *memory is a null pointer, this method only prints warning logs and does not execute the release logic. \n + * If memory or *memory is a null pointer, this method only prints warning logs and does not + * execute the release logic.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param outputIndex Output Index value, which is in the same sequence of the data output when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In output memory release, the index value for the three outputs is {0, 1, 2}. + * @param outputIndex Output index value, which is in the same sequence of the data output when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that the value of outputIndices is {4, 6, 8} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * In output memory release, the index value for the three outputs is {0, 1, 2}. * - * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, this method sets *memory to a null pointer. + * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, + * this method sets *memory to a null pointer. * @since 9 * @version 1.0 */ void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, OH_NN_Memory **memory); /** - * @brief Specifies the hardware shared memory pointed to by the {@link OH_NN_Memory} instance as the shared memory used by a single input. + * @brief Specifies the hardware shared memory pointed to by the {@link OH_NN_Memory} instance as the shared memory + * used by a single input. * - * In scenarios where memory needs to be managed by yourself, this method binds the execution input to the {@link OH_NN_Memory} memory instance. + * In scenarios where memory needs to be managed by yourself, this method binds the execution input to the + * {@link OH_NN_Memory} memory instance. * During computing, the underlying device reads the input data from the shared memory pointed to by the memory instance. - * By using this method, concurrent execution of input setting, computing, and read can be implemented to improve inference efficiency of a data flow. \n + * By using this method, concurrent execution of input setting, computing, and read can be implemented to + * improve inference efficiency of a data flow.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param inputIndex Input index value, which is in the same sequence of the data input when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of inputIndices is {1, 5, 9} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * When the input shared memory is specified, the index value for the three inputs is {0, 1, 2}. + * @param inputIndex Input index value, which is in the same sequence of the data input when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that the value of inputIndices is {1, 5, 9} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * When the input shared memory is specified, the index value for the three inputs is {0, 1, 2}. * * @param tensor Pointer to {@link OH_NN_Tensor}, used to set the tensor corresponding to a single input. * @param memory Pointer to {@link OH_NN_Memory}. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -611,20 +665,26 @@ OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, const OH_NN_Memory *memory); /** - * @brief Specifies the hardware shared memory pointed to by the {@link OH_NN_Memory} instance as the shared memory used by a single output. + * @brief Specifies the hardware shared memory pointed to by the {@link OH_NN_Memory} instance as the shared memory + * used by a single output. * - * In scenarios where memory needs to be managed by yourself, this method binds the execution output to the {@link OH_NN_Memory} memory instance. - * When computing is performed, the underlying hardware directly writes the computing result to the shared memory to which the memory instance points. - * By using this method, concurrent execution of input setting, computing, and read can be implemented to improve inference efficiency of a data flow. \n + * In scenarios where memory needs to be managed by yourself, this method binds the execution output to + * the {@link OH_NN_Memory} memory instance. + * When computing is performed, the underlying hardware directly writes the computing result to the shared memory to which + * the memory instance points. + * By using this method, concurrent execution of input setting, computing, and read can be implemented to improve + * inference efficiency of a data flow.\n * * @param executor Executor. - * @param outputIndex Output Index value, which is in the same sequence of the data output when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * When output shared memory is specified, the index value for the three outputs is {0, 1, 2}. + * @param outputIndex Output Index value, which is in the same sequence of the data output when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that the value of outputIndices is {4, 6, 8} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * When output shared memory is specified, the index value for the three outputs is {0, 1, 2}. * * @param memory Pointer to {@link OH_NN_Memory}. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -635,10 +695,11 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutputWithMemory(OH_NNExecutor *executor, /** * @brief Destroys an executor instance to release the memory occupied by the executor. * - * This method needs to be called to release the executor instance created by calling {@link OH_NNExecutor_Construct}. Otherwise, - * memory leak will occur. \n + * This method needs to be called to release the executor instance created by calling {@link OH_NNExecutor_Construct}. + * Otherwise, memory leak will occur.\n * - * If executor or *executor is a null pointer, this method only prints warning logs and does not execute the release logic. \n + * If executor or *executor is a null pointer, this method only prints warning logs and does not + * execute the release logic.\n * * @param executor Level-2 pointer to the {@link OH_NNExecutor} instance. * @since 9 @@ -650,14 +711,16 @@ void OH_NNExecutor_Destroy(OH_NNExecutor **executor); /** * @brief Obtains the ID of the device connected to Neural Network Runtime. * - * Each device has a unique and fixed ID in Neural Network Runtime. This method returns device IDs on the current device through the uint32_t array. \n + * Each device has a unique and fixed ID in Neural Network Runtime. This method returns device IDs on the current + * device through the uint32_t array.\n * - * Device IDs are returned through the size_t array. Each element of the array is the ID of a single device. - * The array memory is managed by Neural Network Runtime. - * The data pointer is valid before this method is called next time. \n + * Device IDs are returned through the size_t array. Each element of the array is the ID of a single device. + * The array memory is managed by Neural Network Runtime. + * The data pointer is valid before this method is called next time.\n + * + * @param allDevicesID Pointer to the size_t array. The input *allDevicesID must be a null pointer. + * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. * - * @param allDevicesID Pointer to the size_t array. The input *allDevicesID must be a null pointer. Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. - * * @param deviceCount Pointer of the uint32_t type, which is used to return the length of (*allDevicesID). * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. @@ -669,13 +732,15 @@ OH_NN_ReturnCode OH_NNDevice_GetAllDevicesID(const size_t **allDevicesID, uint32 /** * @brief Obtains the name of the specified device. * - * deviceID specifies the device whose name will be obtained. The device ID needs to be obtained by calling {@link OH_NNDevice_GetAllDevicesID}. \n + * deviceID specifies the device whose name will be obtained. The device ID needs to be obtained by calling + * {@link OH_NNDevice_GetAllDevicesID}.\n * * @param deviceID Device ID. - * @param name Pointer to the char array. The passed (*char) must be a null pointer. Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. - * The value of (*name) is a C-style string ended with '\0'. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @param name Pointer to the char array. The passed (*char) must be a null pointer. Otherwise, + * {@link OH_NN_INVALID_PARAMETER} is returned. + * The value of (*name) is a C-style string ended with '\0'. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -684,16 +749,17 @@ OH_NN_ReturnCode OH_NNDevice_GetName(size_t deviceID, const char **name); /** * @brief Obtains the type information of the specified device. * - * deviceID specifies the device whose type will be obtained. Currently, Neural Network Runtime supports the following device types: + * deviceID specifies the device whose type will be obtained. Currently, Neural Network Runtime supports the + * following device types: * - OH_NN_CPU: CPU device. * - OH_NN_GPU: GPU device. * - OH_NN_ACCELERATOR: machine learning dedicated accelerator. - * - OH_NN_OTHERS: other hardware types. \n + * - OH_NN_OTHERS: other hardware types.\n * * @param deviceID Device ID. * @param deviceType Pointer to the {@link OH_NN_DeviceType} instance. The device type information is returned. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index 23be7b1a..9a715044 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -387,7 +387,7 @@ typedef enum { * * input: input tensor. * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. * The value of inChannel must be exactly divided by the value of group. - * + * * * bias: bias of the convolution. It is an array with a length of [outChannel]. * In quantization scenarios, the bias parameter does not require quantization parameters. * The quantization version requires data input of the OH_NN_INT32 type. @@ -419,7 +419,7 @@ typedef enum { * * input: input tensor. * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. * The value of inChannel must be exactly divided by the value of group. - * + * * * bias: bias of the convolution. It is an array with a length of [outChannel]. * In quantization scenarios, the bias parameter does not require quantization parameters. * The quantization version requires data input of the OH_NN_INT32 type. @@ -455,7 +455,7 @@ typedef enum { * * input: input tensor. * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. * The value of inChannel must be exactly divided by the value of group. - * + * * * bias: bias of the convolution. It is an array with a length of [outChannel]. * In quantization scenarios, the bias parameter does not require quantization parameters. * The quantization version requires data input of the OH_NN_INT32 type. @@ -483,11 +483,11 @@ typedef enum { * Inputs: * * * input: input tensor. - * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. - * The value of inChannel must be exactly divided by the value of group. - * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. + * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. + * The value of inChannel must be exactly divided by the value of group. + * * bias: bias of the convolution. It is an array with a length of [outChannel]. + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. * * Parameters: @@ -496,11 +496,11 @@ typedef enum { * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * * padList: padding around input. It is an int array [top, bottom, left, right]. - * * group: number of groups in which the input is divided by in_channel. The value is of the int type. - * If group is 1, it is a conventional convolution. If group is greater than 1 + * * group: number of groups in which the input is divided by in_channel. The value is of the int type. + * If group is 1, it is a conventional convolution. If group is greater than 1 * and less than or equal to in_channel, it is a group convolution. - * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. - * It can be a single integer to specify the same value for all spatial dimensions. The amount of output padding + * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. + * It can be a single integer to specify the same value for all spatial dimensions. The amount of output padding * along a dimension must be less than the stride along this dimension. * * * activationType is an integer constant which is contained in FuseType. @@ -520,11 +520,11 @@ typedef enum { * Inputs: * * * input: input tensor. - * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, 1] format. + * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, 1] format. * outChannel is equal to channelMultiplier multiplied by inChannel. - * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. + * * bias: bias of the convolution. It is an array with a length of [outChannel]. + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. * * @@ -534,11 +534,11 @@ typedef enum { * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or 1 (valid). - * 0 (same): The height and width of the output are the same as those of the input. + * 0 (same): The height and width of the output are the same as those of the input. * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. * - * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. * The excessive pixels will be discarded. * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. @@ -548,11 +548,11 @@ typedef enum { * Inputs: * * * input: input tensor. - * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, 1] format. + * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, 1] format. * outChannel is equal to channelMultiplier multiplied by inChannel. - * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. + * * bias: bias of the convolution. It is an array with a length of [outChannel]. + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. * * @@ -578,8 +578,10 @@ typedef enum { * * * input1: first input, which is a number, a bool, or a tensor whose data type is number or Boolean. * * input2: second input, which must meet the following requirements: - * If the first input is a tensor, the second input can be a real number, a Boolean value, or a tensor whose data type is real number or Boolean value. - * If the first input is a real number or Boolean value, the second input must be a tensor whose data type is real number or Boolean value. + * If the first input is a tensor, the second input can be a real number, a Boolean value, or + * a tensor whose data type is real number or Boolean value. + * If the first input is a real number or Boolean value, the second input must be a tensor whose data type + * is real number or Boolean value. * * Parameters: * @@ -617,7 +619,8 @@ typedef enum { * Inputs: * * * input: input tensor. - * * axis: index of the dimension to be added. The value is of the int32_t type and must be a constant in the range [-dim-1, dim]. + * * axis: index of the dimension to be added. The value is of the int32_t type and must be + * a constant in the range [-dim-1, dim]. * * Outputs: * @@ -635,7 +638,8 @@ typedef enum { * * Outputs: * - * * output: generated tensor, which has the same data type as value. The tensor shape is specified by the shape parameter. + * * output: generated tensor, which has the same data type as value. + * The tensor shape is specified by the shape parameter. */ OH_NN_OPS_FILL = 14, @@ -754,7 +758,8 @@ typedef enum { /** * Calculates the maximum of input1 and input2 element-wise. The inputs of input1 and input2 - * comply with the implicit type conversion rules to make the data types consistent. * The inputs must be two tensors or one tensor and one scalar. + * comply with the implicit type conversion rules to make the data types consistent. + * The inputs must be two tensors or one tensor and one scalar. * When the inputs are two tensors, their data types cannot be both NN_BOOL. Their shapes can be broadcast to the same size. * When the inputs are one tensor and one scalar, the scalar must be a constant. * @@ -788,7 +793,8 @@ typedef enum { * * padMode: padding mode, which is optional. The value is of the int type and can be 0 (same) * or 1 (valid). The nearest neighbor value is used for padding. * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, + * left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. * * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. @@ -1055,12 +1061,14 @@ typedef enum { * * Outputs: * - * * output: square root of the input. It is an n-dimensional tensor with the same data type and shape as input. + * * output: square root of the input. It is an n-dimensional tensor with the same data type + * and shape as input. */ OH_NN_OPS_SQRT = 33, /** - * Calculates the square of the difference between two tensors. The SquaredDifference operator supports tensor and tensor subtraction. + * Calculates the square of the difference between two tensors. The SquaredDifference operator supports + * tensor and tensor subtraction. * If two tensors have different TensorTypes, the Sub operator converts the low-precision tensor to a high-precision one. * If two tensors have different shapes, the two tensors can be extended to tensors with the same shape through broadcast. * @@ -1135,22 +1143,23 @@ typedef enum { * Parameters: * * * beginMask: an integer used to mask begin. beginMask is represented in binary code. - * In case of binary(beginMask)[i]==1, for the ith dimension, elements are sliced from the first element at strides[i] until the end[i]-1 element. - * + * In case of binary(beginMask)[i]==1, for the ith dimension, elements are sliced from the first element + * at strides[i] until the end[i]-1 element. + * * * endMask: an integer used to mask end. endMask is represented in binary code. * In case of binary(endMask)[i]==1, elements are sliced from the element at the begin[i] position * in the ith dimension until the tensor boundary at strides[i]. - * + * * * ellipsisMask: integer used to mask begin and end. ellipsisMask is represented in binary code. * In case of binary(ellipsisMask)[i]==1, elements are sliced from the first element at strides[i] in the ith dimension * until the tensor boundary. Only one bit of binary(ellipsisMask) can be a non-zero value. - * + * * * newAxisMask: new dimension, which is an integer. newAxisMask is represented in binary code. * In case of binary(newAxisMask)[i]==1, a new dimension whose length is 1 is inserted into the ith dimension. * * shrinkAxisMask: shrinking dimension, which is an integer. * shrinkAxisMask is represented in binary code. * In the case of binary(shrinkAxisMask)[i]==1, all elements in the ith dimension will be discarded, * and the length of the ith dimension is shrunk to 1. - * + * * * Outputs: * @@ -1169,7 +1178,7 @@ typedef enum { * Parameters: * * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * @@ -1233,7 +1242,8 @@ typedef enum { * Inputs: * * * input: n-dimensional input tensor, where n is less than 8. - * * axis: dimension used to calculate the average value. The value is a 1D tensor. The value range of each element in axis is [–n, n). + * * axis: dimension used to calculate the average value. The value is a 1D tensor. The value range of + * each element in axis is [–n, n). * * Parameters: * @@ -1251,15 +1261,16 @@ typedef enum { * * Inputs: * - * * input: 4D input tensor. Each element in the input cannot be less than 0. The input layout must be [batchSize, height, width, channels]. + * * input: 4D input tensor. Each element in the input cannot be less than 0. The input layout must be + * [batchSize, height, width, channels]. * * Parameters: * * * newHeight: resized height of the 4D tensor. * * newWidth: resized width of the 4D tensor. * * preserveAspectRatio: indicates whether to maintain the height/width ratio of input after resizing. - * * coordinateTransformMode: coordinate transformation method used by the resize operation. The value is an int32 integer. - * Currently, the following methods are supported: + * * coordinateTransformMode: coordinate transformation method used by the resize operation. + * The value is an int32 integer. Currently, the following methods are supported: * * excludeOutside: an int64 floating point number. When its value is 1, the sampling weight of the part that * exceeds the boundary of input is set to 0, and other weights are normalized. * @@ -1475,7 +1486,8 @@ typedef enum { OH_NN_OPS_UNSQUEEZE = 55, /** - * Gaussian error linear unit activation function. The int quantization input is not supported. output=0.5∗input∗(1+tanh(input/2)) + * Gaussian error linear unit activation function. The int quantization input is not supported. + * output=0.5∗input∗(1+tanh(input/2)) * * Inputs: * * An n-dimensional input tensor. @@ -1489,13 +1501,14 @@ typedef enum { /** * @brief Enumerates the tensor data types. * - * Tensors are usually used to set the input, output, and operator parameters of a model. When a tensor is used - * as the input or output of a model (or operator), set the tensor type to {@link OH_NN_TENSOR}. - * When the tensor is used as an operator parameter, select an enumerated value other than {@link OH_NN_TENSOR} as the tensor type. - * Assume that the pad parameter of the {@link OH_NN_OPS_CONV2D} operator is being set. - * You need to set the type attribute of the {@link OH_NN_Tensor} instance to {@link OH_NN_CONV2D_PAD}. + * Tensors are usually used to set the input, output, and operator parameters of a model. When a tensor is used + * as the input or output of a model (or operator), set the tensor type to {@link OH_NN_TENSOR}. + * When the tensor is used as an operator parameter, select an enumerated value other than {@link OH_NN_TENSOR} + * as the tensor type. + * Assume that the pad parameter of the {@link OH_NN_OPS_CONV2D} operator is being set. + * You need to set the type attribute of the {@link OH_NN_Tensor} instance to {@link OH_NN_CONV2D_PAD}. * The settings of other operator parameters are similar. The enumerated values are named - * in the format OH_NN_{Operator name}_{Attribute name}. + * in the format OH_NN_{Operator name}_{Attribute name}. * * * @since 9 @@ -1709,7 +1722,8 @@ typedef struct OH_NN_UInt32Array { /** * @brief Quantization information. * - * In quantization scenarios, the 32-bit floating-point data type is quantized into the fixed-point data type according to the following formula: + * In quantization scenarios, the 32-bit floating-point data type is quantized into the fixed-point data type + * according to the following formula: \f[ q = clamp(round(\frac{r}{s}+z), q_{min}, q_{max}) \f] diff --git a/en/native_sdk/usb/usb_ddk_api.h b/en/native_sdk/usb/usb_ddk_api.h index cb9bfd64..274172fb 100644 --- a/en/native_sdk/usb/usb_ddk_api.h +++ b/en/native_sdk/usb/usb_ddk_api.h @@ -19,7 +19,8 @@ * @addtogroup UsbDDK * @{ * - * @brief Provides USB DDK APIs to open and close USB interfaces, perform non-isochronous and isochronous data transfer over USB pipes, and implement control transfer and interrupt transfer, etc. + * @brief Provides USB DDK APIs to open and close USB interfaces, perform non-isochronous and + * isochronous data transfer over USB pipes, and implement control transfer and interrupt transfer, etc. * * @syscap SystemCapability.Driver.USB.Extension * @since 10 @@ -77,12 +78,14 @@ void OH_Usb_Release(void); int32_t OH_Usb_GetDeviceDescriptor(uint64_t deviceId, struct UsbDeviceDescriptor *desc); /** - * @brief Obtains the configuration descriptor. To avoid memory leakage, use {@link OH_Usb_FreeConfigDescriptor} to release a descriptor after use. + * @brief Obtains the configuration descriptor. To avoid memory leakage, use {@link OH_Usb_FreeConfigDescriptor} + * to release a descriptor after use. * * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId ID of the device whose configuration descriptor is to be obtained. * @param configIndex Configuration index, which corresponds to {@link bConfigurationValue} in the USB protocol. - * @param config Configuration descriptor, which includes the standard configuration descriptor defined in the USB protocol and the associated interface descriptor and endpoint descriptor. + * @param config Configuration descriptor, which includes the standard configuration descriptor defined in the + * USB protocol and the associated interface descriptor and endpoint descriptor. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -91,7 +94,8 @@ int32_t OH_Usb_GetConfigDescriptor( uint64_t deviceId, uint8_t configIndex, struct UsbDdkConfigDescriptor ** const config); /** - * @brief Releases the configuration descriptor. To avoid memory leakage, use OH_Usb_FreeConfigDescriptor to release a descriptor after use. + * @brief Releases the configuration descriptor. To avoid memory leakage, use OH_Usb_FreeConfigDescriptor to + * release a descriptor after use. * * @permission ohos.permission.ACCESS_DDK_USB * @param config Configuration descriptor obtained by calling {@link OH_Usb_GetConfigDescriptor}. @@ -106,7 +110,8 @@ void OH_Usb_FreeConfigDescriptor(const struct UsbDdkConfigDescriptor * const con * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId ID of the device to be operated. * @param interfaceIndex Interface index, which corresponds to {@link bInterfaceNumber} in the USB protocol. - * @param interfaceHandle Interface operation handle. After the interface is claimed successfully, a value will be assigned to this parameter. + * @param interfaceHandle Interface operation handle. After the interface is claimed successfully, a value will be + * assigned to this parameter. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -129,7 +134,8 @@ int32_t OH_Usb_ReleaseInterface(uint64_t interfaceHandle); * * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle Interface operation handle. - * @param settingIndex Index of the alternate setting, which corresponds to {@link bAlternateSetting} in the USB protocol. + * @param settingIndex Index of the alternate setting, which corresponds to {@link bAlternateSetting} + * in the USB protocol. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -141,7 +147,8 @@ int32_t OH_Usb_SelectInterfaceSetting(uint64_t interfaceHandle, uint8_t settingI * * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle Interface operation handle. - * @param settingIndex Index of the alternate setting, which corresponds to {@link bAlternateSetting} in the USB protocol. + * @param settingIndex Index of the alternate setting, which corresponds to {@link bAlternateSetting} + * in the USB protocol. * @return 0 if the operation is successful; a negative value otherwise. * @since 10 * @version 1.0 @@ -181,7 +188,8 @@ int32_t OH_Usb_SendControlWriteRequest(uint64_t interfaceHandle, const struct Us uint32_t timeout, const uint8_t *data, uint32_t dataLen); /** - * @brief Sends a pipe request. This API works in a synchronous manner. This API applies to interrupt transfer and bulk transfer. + * @brief Sends a pipe request. This API works in a synchronous manner. + * This API applies to interrupt transfer and bulk transfer. * * @permission ohos.permission.ACCESS_DDK_USB * @param pipe Pipe used to transfer data. -- Gitee From 06e15c309fcf976fa44fc6b373e28ae8370316cb Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 20 Oct 2023 13:56:44 +0800 Subject: [PATCH 0043/2135] updte docs Signed-off-by: shawn_he --- .../neural_network_runtime_type.h | 611 +++++++++++------- 1 file changed, 394 insertions(+), 217 deletions(-) diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index 9a715044..020b6bb5 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -117,7 +117,7 @@ typedef enum { OH_NN_FAILED = 1, /** Invalid parameter. */ OH_NN_INVALID_PARAMETER = 2, - /** Memory-related error, for example, insufficient memory, memory data copy failure, or memory application failure. */ + /** Memory-related error, for example, insufficient memory, or memory data copy or memory application failure. */ OH_NN_MEMORY_ERROR = 3, /** Invalid operation. */ OH_NN_OPERATION_FORBIDDEN = 4, @@ -243,7 +243,8 @@ typedef enum { OH_NN_OPS_ADD = 1, /** - * Apply 2D average pooling to the input tensor, which now must be in NHWC format. The int8 quantization input is supported. + * Apply 2D average pooling to the input tensor, which now must be in NHWC format. The int8 quantization input + * is supported. * * If the input contains the padMode parameter: * @@ -253,16 +254,23 @@ typedef enum { * * Parameters: * - * * kernelSize indicates the kernel size used to obtain the average value. It is an int array [kernel_height, kernel_width]. + * * kernelSize indicates the kernel size used to obtain the average value. It is an int array + * [kernel_height, kernel_width]. * The first number indicates the kernel height, and the second number indicates the kernel width. - * * strides indicates the distance of kernel moving. The value is an int array [stride_height, stride_width]. - * The first number indicates the moving step in height, and the second number indicates the moving step in width. - * * padMode: padding mode, which is optional. The value is of the int type and can be 0 (same) or 1 (valid). + * * strides indicates the distance of kernel moving. The value is an int array + * [stride_height, stride_width]. + * The first number indicates the moving step in height, and the second number indicates the moving step + * in width. + * * padMode: padding mode, which is optional. The value is of the int type and can be 0 (same) + * or 1 (valid). * The nearest neighbor value is used for padding. * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, + * bottom, left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. - * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. Excessive pixels will be discarded. + * 1 (valid): The possible maximum height and width of the output will be returned in case of + * no padding. + * Excessive pixels will be discarded. * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. * @@ -274,11 +282,15 @@ typedef enum { * * Parameters: * - * * kernelSize indicates the kernel size used to obtain the average value. It is an int array [kernel_height, kernel_width]. + * * kernelSize indicates the kernel size used to obtain the average value. It is an int array + * [kernel_height, kernel_width]. * The first number indicates the kernel height, and the second number indicates the kernel width. - * * strides indicates the distance of kernel moving. The value is an int array [stride_height, stride_width]. - * The first number indicates the moving step in height, and the second number indicates the moving step in width. - * * padList: padding around input. It is an int array [top, bottom, left, right], and the nearest neighbor values are used for padding. + * * strides indicates the distance of kernel moving. The value is an int array + * [stride_height, stride_width]. + * The first number indicates the moving step in height, and the second number indicates the moving step + * in width. + * * padList: padding around input. It is an int array [top, bottom, left, right], and the nearest + * neighbor values are used for padding. * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. * @@ -289,15 +301,19 @@ typedef enum { OH_NN_OPS_AVG_POOL = 2, /** - * Batch normalization is performed on a tensor to scale and shift tensor elements, relieving potential covariate shift in a batch of data. + * Batch normalization is performed on a tensor to scale and shift tensor elements, relieving potential covariate + * shift in a batch of data. * * Inputs: * - * * input: n-dimensional tensor of shape [N, ..., C]. The nth dimension is the number of channels. + * * input: n-dimensional tensor of shape [N, ..., C]. The nth dimension is the number + * of channels. * * scale: 1D tensor of the scaling factor used to scale the first normalized tensor. * * offset: 1D tensor used to move to the first normalized tensor. - * * mean: 1D tensor of the overall mean value. It is used only for inference. In case of training, this parameter must be left empty. - * * variance: 1D tensor used for the overall variance. It is used only for inference. In case of training, this parameter must be left empty. + * * mean: 1D tensor of the overall mean value. It is used only for inference. In case of training, + * this parameter must be left empty. + * * variance: 1D tensor used for the overall variance. It is used only for inference. In case of training, + * this parameter must be left empty. * * Parameters: * @@ -310,21 +326,26 @@ typedef enum { OH_NN_OPS_BATCH_NORM = 3, /** - * Divides the batch dimension of a 4D tensor into small blocks by block_shape, and interleaves these blocks back into the spatial dimension. + * Divides the batch dimension of a 4D tensor into small blocks by block_shape, and interleaves these blocks + * back into the spatial dimension. * * Parameters: * - * * input: input tensor. The dimension will be divided into small blocks, and these blocks will be interleaved into the spatial dimension. + * * input: input tensor. The dimension will be divided into small blocks, and these blocks will be interleaved + * into the spatial dimension. * * Outputs: * - * * blockSize: size of each block to be interleaved into the spatial dimension. The value is an array [height_block, width_block]. - * * crops: elements truncated from the spatial dimension of the output. The value is a 2D array [[crop0_start, crop0_end], [crop1_start, crop1_end]] with the shape of (2, 2). + * * blockSize: size of each block to be interleaved into the spatial dimension. The value is an array + * [height_block, width_block]. + * * crops: elements truncated from the spatial dimension of the output. The value is a 2D array + * [[crop0_start, crop0_end], [crop1_start, crop1_end]] with the shape of (2, 2). * * * Outputs: * - * * output. Assume that the shape of input is (n,h,w,c) and the shape of output is (n',h',w',c'): + * * output. Assume that the shape of input is (n,h,w,c) and the shape of output + * is (n',h',w',c'): * n' = n / (block_shape[0] * block_shape[1]) * h' = h * block_shape[0] - crops[0][0] - crops[0][1] * w' = w * block_shape[1] - crops[1][0] - crops[1][1] @@ -395,20 +416,27 @@ typedef enum { * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * * stride: movement stride of the convolution kernel in height and width. + * It is an int array [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array + * [dilationHeight, dilationWidth]. * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * - * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or 1 (valid). + * * padMode: padding mode of input. The value is of the int type and can be 0 (same) + * or 1 (valid). * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, + * bottom, left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. * - * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. The excessive pixels will be discarded. - * * group: number of groups in which the input is divided by in_channel. The value is of the int type. - * If group is 1, it is a conventional convolution. If group is greater than 1 and - * less than or equal to in_channel, it is a group convolution. - * * activationType is an integer constant which is contained in FuseType. The specified activation function is called before output. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no + * padding. The excessive pixels will be discarded. + * * group: number of groups in which the input is divided by in_channel. The value is of the int + * type. + * If group is 1, it is a conventional convolution. If group is greater than 1 + * and less than or equal to in_channel, it is a group convolution. + * * activationType is an integer constant which is contained in FuseType. The specified activation + * function is called before output. * * * @@ -428,14 +456,20 @@ typedef enum { * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. - * The value must be greater than or equal to 1 and cannot exceed the height and width of input. + * * stride: movement stride of the convolution kernel in height and width. It is an int array + * [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array + * [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of + * input. * * padList: padding around input. It is an int array [top, bottom, left, right]. - * * group: number of groups in which the input is divided by in_channel. The value is of the int type. + * * group: number of groups in which the input is divided by in_channel. The value is of the + * int type. * If group is 1, it is a conventional convolution. - * If group is in_channel, it is depthwiseConv2d. In this case, group==in_channel==out_channel. - * If group is greater than 1 and less than in_channel, it is a group convolution. In this case, out_channel==group. + * If group is in_channel, it is depthwiseConv2d. In this case, + * group==in_channel==out_channel. + * If group is greater than 1 and less than in_channel, it is a group convolution. + * In this case, out_channel==group. * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. * @@ -461,19 +495,28 @@ typedef enum { * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. * - * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. + * * stride: movement stride of the convolution kernel in height and width. It is an int array + * [strideHeight, strideWidth]. * * Parameters: * - * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array + * [dilationHeight, dilationWidth]. * The value must be greater than or equal to 1 and cannot exceed the height and width of input. - * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or 1 (valid). - * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. - * Otherwise, the last additional padding will be completed from the bottom and right. - * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. The excessive pixels will be discarded. - * * group: number of groups in which the input is divided by in_channel. The value is of the int type. If group is 1, it is a conventional convolution. If group is greater than 1 and less than or equal to in_channel, it is a group convolution. - * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. It can be a single integer to specify the same value for all spatial dimensions. The amount of output padding along a dimension must be less than the stride along this dimension. + * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or + * 1 (valid). + * 0 (same): The height and width of the output are the same as those of the input. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, + * bottom, left, and right if possible. + * Otherwise, the last additional padding will be completed from the bottom and right. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. + * The excessive pixels will be discarded. + * * group: number of groups in which the input is divided by in_channel. The value is of the int type. + * If group is 1, it is a conventional convolution. If group is greater than 1 + * and less than or equal to in_channel, it is a group convolution. + * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. + * It can be a single integer to specify the same value for all spatial dimensions. The amount of output + * padding along a dimension must be less than the stride along this dimension. * * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. @@ -492,16 +535,18 @@ typedef enum { * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * * stride: movement stride of the convolution kernel in height and width. It is an int array + * [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array + * [dilationHeight, dilationWidth]. * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * * padList: padding around input. It is an int array [top, bottom, left, right]. * * group: number of groups in which the input is divided by in_channel. The value is of the int type. * If group is 1, it is a conventional convolution. If group is greater than 1 * and less than or equal to in_channel, it is a group convolution. * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. - * It can be a single integer to specify the same value for all spatial dimensions. The amount of output padding - * along a dimension must be less than the stride along this dimension. + * It can be a single integer to specify the same value for all spatial dimensions. The amount of output + * padding along a dimension must be less than the stride along this dimension. * * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. @@ -530,16 +575,21 @@ typedef enum { * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * * stride: movement stride of the convolution kernel in height and width. It is an int array + * [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array + * [dilationHeight, dilationWidth]. * The value must be greater than or equal to 1 and cannot exceed the height and width of input. - * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or 1 (valid). + * * padMode: padding mode of input. The value is of the int type and can be 0 (same) + * or 1 (valid). * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, + * bottom, left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. * - * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. - * The excessive pixels will be discarded. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no + * padding. + * The excessive pixels will be discarded. * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. * @@ -558,8 +608,10 @@ typedef enum { * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * * stride: movement stride of the convolution kernel in height and width. It is an int array + * [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array + * [dilationHeight, dilationWidth]. * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * * padList: padding around input. It is an int array [top, bottom, left, right]. * * activationType is an integer constant which is contained in FuseType. @@ -595,7 +647,8 @@ typedef enum { OH_NN_OPS_DIV = 11, /** - * Sets parameters to perform product (dot product), sum (addition and subtraction), or max (larger value) on the input. + * Sets parameters to perform product (dot product), sum (addition and subtraction), or max (larger value) + * on the input. * * Inputs: * @@ -650,7 +703,8 @@ typedef enum { * * * input: full-connection input tensor. * * weight: weight tensor for a full connection. - * * bias: full-connection bias. In quantization scenarios, no quantized parameter is required for this parameter. + * * bias: full-connection bias. In quantization scenarios, no quantized parameter is required for + * this parameter. * If quantization is required, the data must be of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. * @@ -670,15 +724,16 @@ typedef enum { * * * input: full-connection input tensor. * * weight: weight tensor for a full connection. - * * bias: full-connection bias. In quantization scenarios, no quantized parameter is required for this parameter. - * If quantization is required, the data must be of the OH_NN_INT32 type. The actual quantization parameters - * are determined by input and weight. + * * bias: full-connection bias. In quantization scenarios, no quantized parameter is required for + * this parameter. + * If quantization is required, the data must be of the OH_NN_INT32 type. The actual quantization + * parameters are determined by input and weight. * * * Parameters: * - * * axis: axis in which the full connection is applied. The specified axis and its following axes are - * converted into a 1D tensor for applying the full connection. + * * axis: axis in which the full connection is applied. The specified axis and its following axes + * are converted into a 1D tensor for applying the full connection. * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. * @@ -696,7 +751,8 @@ typedef enum { * * input: tensor to be sliced. * * inputIndices: indices of the specified input on the axis. The value is an array of the int type * and must be in the range [0,input.shape[axis]). - * * axis: axis on which input is sliced. The value is an array with one element of the int32_t type. + * * axis: axis on which input is sliced. The value is an array with one element of the int32_t + * type. * * Outputs: * @@ -713,7 +769,8 @@ typedef enum { * * Outputs: * - * * n-dimensional Hswish activation value. The data type is the same as that of shape and input. + * * n-dimensional Hswish activation value. The data type is the same as that of shape + * and input. */ OH_NN_OPS_HSWISH = 17, @@ -757,10 +814,11 @@ typedef enum { OH_NN_OPS_MATMUL = 19, /** - * Calculates the maximum of input1 and input2 element-wise. The inputs of input1 and input2 - * comply with the implicit type conversion rules to make the data types consistent. + * Calculates the maximum of input1 and input2 element-wise. The inputs of input1 and + * input2 comply with the implicit type conversion rules to make the data types consistent. * The inputs must be two tensors or one tensor and one scalar. - * When the inputs are two tensors, their data types cannot be both NN_BOOL. Their shapes can be broadcast to the same size. + * When the inputs are two tensors, their data types cannot be both NN_BOOL. Their shapes can be broadcast to the + * same size. * When the inputs are one tensor and one scalar, the scalar must be a constant. * * Inputs: @@ -789,12 +847,13 @@ typedef enum { * * kernelSize: kernel size used to obtain the maximum. It is an int array [kernel_height, kernel_width]. * The first number indicates the kernel height, and the second number indicates the kernel width. * * strides indicates the distance of kernel moving. The value is an int array [stride_height, stride_width]. - * The first number indicates the moving step in height, and the second number indicates the moving step in width. + * The first number indicates the moving step in height, and the second number indicates the moving step + * in width. * * padMode: padding mode, which is optional. The value is of the int type and can be 0 (same) * or 1 (valid). The nearest neighbor value is used for padding. * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, - * left, and right if possible. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, + * bottom, left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. * * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. @@ -810,10 +869,13 @@ typedef enum { * * Parameters: * - * * kernelSize: kernel size used to obtain the maximum. It is an int array [kernel_height, kernel_width]. + * * kernelSize: kernel size used to obtain the maximum. It is an int array + * [kernel_height, kernel_width]. * The first number indicates the kernel height, and the second number indicates the kernel width. - * * strides indicates the distance of kernel moving. The value is an int array [stride_height, stride_width]. - * The first number indicates the moving step in height, and the second number indicates the moving step in width. + * * strides indicates the distance of kernel moving. The value is an int array + * [stride_height, stride_width]. + * The first number indicates the moving step in height, and the second number indicates the moving step + * in width. * * padList: padding around input. It is an int array [top, bottom, left, right], * and the nearest neighbor values are used for padding. * * activationType is an integer constant which is contained in FuseType. @@ -848,8 +910,8 @@ typedef enum { OH_NN_OPS_MUL = 22, /** - * Generates a one-hot tensor based on the positions specified by indices. The positions specified by indices - * are determined by on_value, and other positions are determined by off_value. + * Generates a one-hot tensor based on the positions specified by indices. The positions specified by + * indices are determined by on_value, and other positions are determined by off_value. * * Inputs: * @@ -858,7 +920,8 @@ typedef enum { * * depth: integer scalar that determines the depth of the one-hot vector. The value of depth * must be greater than 0. * * on_value: scalar that specifies a valid value in the one-hot vector. - * * off_value: scalar that specifies the values of other posistions in the one-hot vector except the valid value. + * * off_value: scalar that specifies the values of other posistions in the one-hot vector except the + * valid value. * * Parameters: * @@ -882,24 +945,30 @@ typedef enum { * * * inputX: n-dimensional tensor in [BatchSize, ...] format. * * paddings: 2D tensor that specifies the length to pad in each dimension. The shape is [n, 2]. - * For example, paddings[i][0] indicates the number of paddings to be added preceding inputX in the ith dimension. - * paddings[i][1] indicates the number of paddings to be added following inputX in the ith dimension. + * For example, paddings[i][0] indicates the number of paddings to be added preceding + * inputX in the ith dimension. + * paddings[i][1] indicates the number of paddings to be added following inputX + * in the ith dimension. * * Parameters: * - * * padValues: value to be added to the pad operation. The value is a constant with the same data type as inputX. + * * padValues: value to be added to the pad operation. The value is a constant with the same + * data type as inputX. * * Outputs: * - * * output: n-dimensional tensor after padding, with the same dimensions and data type as inputX. - * The shape is determined by inputX and paddings. - * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1] + * * output: n-dimensional tensor after padding, with the same dimensions and data type + * as inputX. + * The shape is determined by inputX and paddings. + * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1] */ OH_NN_OPS_PAD = 24, /** - * Calculates the y power of each element in input. The inputs must be two tensors or one tensor and one scalar. - * When the inputs are two tensors, their data types cannot be both NN_BOOL, and their shapes must be the same. + * Calculates the y power of each element in input. The inputs must be two tensors or + * one tensor and one scalar. + * When the inputs are two tensors, their data types cannot be both NN_BOOL, and their shapes must be + * the same. * When the inputs are one tensor and one scalar, the scalar must be a constant. * * Inputs: @@ -909,7 +978,8 @@ typedef enum { * * Outputs: * - * * output: tensor, whose shape is determined by the shape of input and y after broadcasting. + * * output: tensor, whose shape is determined by the shape of input and y after + * broadcasting. */ OH_NN_OPS_POW = 25, @@ -930,8 +1000,8 @@ typedef enum { * * Outputs: * - * * output: scaled n-dimensional tensor, whose data type is the same as that of input and - * shape is determined by axis. + * * output: scaled n-dimensional tensor, whose data type is the same as that of input + * and shape is determined by axis. */ OH_NN_OPS_SCALE = 26, @@ -1009,8 +1079,8 @@ typedef enum { * Parameters: * * * blockShape: a pair of integers. Each of them is greater than or equal to 1. - * * paddings: a pair of arrays. Each of them consists of two integers. The four integers that form paddings - * must be greater than or equal to 0. paddings[0][0] and paddings[0][1] + * * paddings: a pair of arrays. Each of them consists of two integers. The four integers that form + * paddings must be greater than or equal to 0. paddings[0][0] and paddings[0][1] * specify the number of paddings in the third dimension, and paddings[1][0] and paddings[1][1] * specify the number of paddings in the fourth dimension. * @@ -1030,7 +1100,8 @@ typedef enum { OH_NN_OPS_SPACE_TO_BATCH_ND = 31, /** - * Splits the input into multiple tensors along the axis dimension. The number of tensors is specified by outputNum. + * Splits the input into multiple tensors along the axis dimension. The number of tensors is specified by + * outputNum. * * Inputs: * @@ -1040,8 +1111,8 @@ typedef enum { * * * outputNum: number of output tensors. The data type is long. * * size_splits: size of each tensor split from the input. The value is a 1D tensor of the int type. - * If size_splits is empty, the input will be evenly split into tensors of the same size. In this case, - * input.shape[axis] can be exactly divisible by outputNum. + * If size_splits is empty, the input will be evenly split into tensors of the same size. + * In this case, input.shape[axis] can be exactly divisible by outputNum. * If size_splits is not empty, the sum of all its elements must be equal to input.shape[axis]. * * axis: splitting dimension of the int type. * @@ -1069,8 +1140,10 @@ typedef enum { /** * Calculates the square of the difference between two tensors. The SquaredDifference operator supports * tensor and tensor subtraction. - * If two tensors have different TensorTypes, the Sub operator converts the low-precision tensor to a high-precision one. - * If two tensors have different shapes, the two tensors can be extended to tensors with the same shape through broadcast. + * If two tensors have different TensorTypes, the Sub operator converts the low-precision tensor to a + * high-precision one. + * If two tensors have different shapes, the two tensors can be extended to tensors with the same shape through + * broadcast. * * Inputs: * @@ -1079,9 +1152,10 @@ typedef enum { * * Outputs: * - * * output: square of the difference between two inputs. The output shape is determined - * byinput1 and input2. If they have the same shape, the output tensor has the same shape as them. - * If they have different shapes, perform the broadcast operation on input1 and input2 and perform subtraction. + * * output: square of the difference between two inputs. The output shape is determined by + * input1 and input2. If they have the same shape, the output tensor has the same shape as them. + * If they have different shapes, perform the broadcast operation on input1 and input2 and perform + * subtraction. * TensorType of the output is the same as that of the input tensor with higher precision. */ OH_NN_OPS_SQUARED_DIFFERENCE = 34, @@ -1098,7 +1172,8 @@ typedef enum { * * Parameters: * - * * axis: dimension to be removed. The value is of int64_t type and can be an integer in the range [-n, n) or an array. + * * axis: dimension to be removed. The value is of int64_t type and can be an integer in the range [-n, n) + * or an array. * * Outputs: * @@ -1122,8 +1197,8 @@ typedef enum { * * Outputs: * - * * output: stacking result of the input along the axis dimension. The value is an n+1-dimensional tensor - * and has the same TensorType as the input. + * * output: stacking result of the input along the axis dimension. The value is an + * n+1-dimensional tensor and has the same TensorType as the input. */ OH_NN_OPS_STACK = 36, @@ -1143,27 +1218,32 @@ typedef enum { * Parameters: * * * beginMask: an integer used to mask begin. beginMask is represented in binary code. - * In case of binary(beginMask)[i]==1, for the ith dimension, elements are sliced from the first element - * at strides[i] until the end[i]-1 element. + * In case of binary(beginMask)[i]==1, for the ith dimension, elements are sliced from the first + * element at strides[i] until the end[i]-1 element. * * * endMask: an integer used to mask end. endMask is represented in binary code. * In case of binary(endMask)[i]==1, elements are sliced from the element at the begin[i] position * in the ith dimension until the tensor boundary at strides[i]. * - * * ellipsisMask: integer used to mask begin and end. ellipsisMask is represented in binary code. - * In case of binary(ellipsisMask)[i]==1, elements are sliced from the first element at strides[i] in the ith dimension - * until the tensor boundary. Only one bit of binary(ellipsisMask) can be a non-zero value. + * * ellipsisMask: integer used to mask begin and end. ellipsisMask is represented + * in binary code. + * In case of binary(ellipsisMask)[i]==1, elements are sliced from the first element at strides[i] + * in the ith dimension until the tensor boundary. Only one bit of binary(ellipsisMask) can be + * a non-zero value. * * * newAxisMask: new dimension, which is an integer. newAxisMask is represented in binary code. - * In case of binary(newAxisMask)[i]==1, a new dimension whose length is 1 is inserted into the ith dimension. - * * shrinkAxisMask: shrinking dimension, which is an integer. * shrinkAxisMask is represented in binary code. + * In case of binary(newAxisMask)[i]==1, a new dimension whose length is 1 is inserted into the + * ith dimension. + * * shrinkAxisMask: shrinking dimension, which is an integer. * shrinkAxisMask is represented + * in binary code. * In the case of binary(shrinkAxisMask)[i]==1, all elements in the ith dimension will be discarded, * and the length of the ith dimension is shrunk to 1. * * * Outputs: * - * * A tensor, with the same data type as input. The number of dimensions of the output tensor is rank(input[0])+1. + * * A tensor, with the same data type as input. The number of dimensions of the output tensor is + * rank(input[0])+1. */ OH_NN_OPS_STRIDED_SLICE = 37, @@ -1182,9 +1262,11 @@ typedef enum { * * Outputs: * - * * output: difference between the two tensors. The output shape is determined byinput1 and input2. + * * output: difference between the two tensors. The output shape is determined byinput1 + * and input2. * If they have the same shape, the output tensor has the same shape as them. - * If they have different shapes, perform the broadcast operation on input1 and input2 and perform subtraction. + * If they have different shapes, perform the broadcast operation on input1 and input2 and perform + * subtraction. * TensorType of the output is the same as that of the input tensor with higher precision. */ OH_NN_OPS_SUB = 38, @@ -1198,7 +1280,8 @@ typedef enum { * * Outputs: * - * * output: hyperbolic tangent of the input. The TensorType and tensor shape are the same as those of the input. + * * output: hyperbolic tangent of the input. The TensorType and tensor shape are the same as those + * of the input. */ OH_NN_OPS_TANH = 39, @@ -1226,18 +1309,20 @@ typedef enum { * Inputs: * * * input: n-dimensional tensor to be transposed. - * * permutation: The value is a 1D tensor whose length is the same as the number of dimensions of input 0. + * * permutation: The value is a 1D tensor whose length is the same as the number of dimensions of + * input 0. * * Outputs: * - * * output: n-dimensional tensor. TensorType of output 0 is the same as that of input 0, - * and the output shape is determined by the shape and permutation of input 0. + * * output: n-dimensional tensor. TensorType of output 0 is the same as that of + * input 0, and the output shape is determined by the shape and permutation of input 0. */ OH_NN_OPS_TRANSPOSE = 41, /** - * Calculates the average value in the specified dimension. If keepDims is set to false, the number of dimensions - * is reduced for the input; if keepDims is set to true, the number of dimensions is retained. + * Calculates the average value in the specified dimension. If keepDims is set to false, the number + * of dimensions is reduced for the input; if keepDims is set to true, the number of dimensions + * is retained. * * Inputs: * @@ -1251,8 +1336,8 @@ typedef enum { * * Outputs: * - * * output: m-dimensional output tensor whose data type is the same as that of the input. If keepDims is - * false, m==n. If keepDims is true, moutput: m-dimensional output tensor whose data type is the same as that of the input. + * If keepDims is false, m==n. If keepDims is true, mnewHeight: resized height of the 4D tensor. * * newWidth: resized width of the 4D tensor. - * * preserveAspectRatio: indicates whether to maintain the height/width ratio of input after resizing. + * * preserveAspectRatio: indicates whether to maintain the height/width ratio of input + * after resizing. * * coordinateTransformMode: coordinate transformation method used by the resize operation. * The value is an int32 integer. Currently, the following methods are supported: - * * excludeOutside: an int64 floating point number. When its value is 1, the sampling weight of the part that - * exceeds the boundary of input is set to 0, and other weights are normalized. + * * excludeOutside: an int64 floating point number. When its value is 1, the sampling weight of the + * part that exceeds the boundary of input is set to 0, and other weights are normalized. * * Outputs: * @@ -1285,7 +1371,8 @@ typedef enum { * * Inputs: * - * * input: n-dimensional tensor, where n is less than 8. Each element of the tensor cannot be less than 0. + * * input: n-dimensional tensor, where n is less than 8. Each element of the tensor cannot be + * less than 0. * * Outputs: * @@ -1304,7 +1391,8 @@ typedef enum { * * Outputs: * - * * output: tensor whose data type is the same as that of input and shape is determined by InputShape. + * * output: tensor whose data type is the same as that of input and shape is determined + * by InputShape. */ OH_NN_OPS_RESHAPE = 45, @@ -1313,9 +1401,11 @@ typedef enum { * * Inputs: * - * * input: n-dimensional tensor. If n is greater than or equal to 2, inputX must be [BatchSize, ..., Channels]. + * * input: n-dimensional tensor. If n is greater than or equal to 2, + * inputX must be [BatchSize, ..., Channels]. * The second dimension is the number of channels. - * * weight: 1D tensor. The length of weight must be 1 or equal to the number of channels. If the length of weight is 1, + * * weight: 1D tensor. The length of weight must be 1 or equal to the number of channels. + * If the length of weight is 1, * all channels share the same weight. * If the length of weight is equal to the number of channels, each channel exclusively has a weight. * If n is less than 2 for inputX, the weight length must be 1. @@ -1340,7 +1430,8 @@ typedef enum { OH_NN_OPS_RELU = 47, /** - * Calculates the Relu6 activation value of the input, that is, calculate min(max(x, 0), 6) for each element x in the input. + * Calculates the Relu6 activation value of the input, that is, calculate min(max(x, 0), 6) for + * each element x in the input. * * Inputs: * @@ -1364,8 +1455,10 @@ typedef enum { * * Parameters: * - * * beginAxis is an NN_INT32 scalar that specifies the axis from which normalization starts. The value range is [1, rank(input)). - * * epsilon is a scalar of NN_FLOAT32. It is a tiny amount in the normalization formula. The common value is 1e-7. + * * beginAxis is an NN_INT32 scalar that specifies the axis from which normalization starts. + * The value range is [1, rank(input)). + * * epsilon is a scalar of NN_FLOAT32. It is a tiny amount in the normalization formula. + * The common value is 1e-7. * * Outputs: * @@ -1379,7 +1472,8 @@ typedef enum { * Inputs: * * * input: n-dimensional input tensor, where n is less than 8. - * * axis: dimension used to calculate the product. The value is a 1D tensor. The value range of each element in axis is [–n, n). + * * axis: dimension used to calculate the product. The value is a 1D tensor. + * The value range of each element in axis is [–n, n). * * Parameters: * @@ -1397,12 +1491,14 @@ typedef enum { /** * Operates the logical OR in the specified dimension. If keepDims is set to false, - * the number of dimensions is reduced for the input; if keepDims is set to true, the number of dimensions is retained. + * the number of dimensions is reduced for the input; if keepDims is set to true, + * the number of dimensions is retained. * * Inputs: * * * A n-dimensional input tensor, where n is less than 8. - * * A 1D tensor specifying the dimension used to operate the logical OR. The value range of each element in axis is [–n, n). + * * A 1D tensor specifying the dimension used to operate the logical OR. + * The value range of each element in axis is [–n, n). * * Parameters: * @@ -1410,7 +1506,7 @@ typedef enum { * * Outputs: * * output: m-dimensional output tensor whose data type is the same as that of the input. - * If keepDims is false, m==n. If keepDims is true, mkeepDims is false, m==n. If keepDims is true, msorted: order of sorting. The value true means descending and false means ascending. + * * sorted: order of sorting. The value true means descending and false means + * ascending. * * Outputs: * @@ -1518,191 +1615,268 @@ typedef enum { /** This enumerated value is used when the tensor is used as the input or output of a model (or operator). */ OH_NN_TENSOR = 0, - /** This enumerated value is used when the tensor is used as the activationType parameter of the Add operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + Add operator. */ OH_NN_ADD_ACTIVATIONTYPE = 1, - /** This enumerated value is used when the tensor is used as the kernel_size parameter of the AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the kernel_size parameter of the + AvgPool operator. */ OH_NN_AVG_POOL_KERNEL_SIZE = 2, - /** This enumerated value is used when the tensor is used as the stride parameter of the AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the stride parameter of the + AvgPool operator. */ OH_NN_AVG_POOL_STRIDE = 3, - /** This enumerated value is used when the tensor is used as the pad_mode parameter of the AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the pad_mode parameter of the + AvgPool operator. */ OH_NN_AVG_POOL_PAD_MODE = 4, - /** This enumerated value is used when the tensor is used as the pad parameter of the AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the + AvgPool operator. */ OH_NN_AVG_POOL_PAD = 5, - /** This enumerated value is used when the tensor is used as the activation_type parameter of the AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the activation_type parameter of the + AvgPool operator. */ OH_NN_AVG_POOL_ACTIVATION_TYPE = 6, - /** This enumerated value is used when the tensor is used as the eosilon parameter of the BatchNorm operator. */ + /** This enumerated value is used when the tensor is used as the eosilon parameter of the + BatchNorm operator. */ OH_NN_BATCH_NORM_EPSILON = 7, - /** This enumerated value is used when the tensor is used as the blockSize parameter of the BatchToSpaceND operator. */ + /** This enumerated value is used when the tensor is used as the blockSize parameter of the + BatchToSpaceND operator. */ OH_NN_BATCH_TO_SPACE_ND_BLOCKSIZE = 8, - /** This enumerated value is used when the tensor is used as the crops parameter of the BatchToSpaceND operator. */ + /** This enumerated value is used when the tensor is used as the crops parameter of the + BatchToSpaceND operator. */ OH_NN_BATCH_TO_SPACE_ND_CROPS = 9, - /** This enumerated value is used when the tensor is used as the axis parameter of the Concat operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the + Concat operator. */ OH_NN_CONCAT_AXIS = 10, - /** This enumerated value is used when the tensor is used as the strides parameter of the Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the strides parameter of the + Conv2D operator. */ OH_NN_CONV2D_STRIDES = 11, - /** This enumerated value is used when the tensor is used as the pad parameter of the Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the + Conv2D operator. */ OH_NN_CONV2D_PAD = 12, - /** This enumerated value is used when the tensor is used as the dilation parameter of the Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the dilation parameter of the + Conv2D operator. */ OH_NN_CONV2D_DILATION = 13, - /** This enumerated value is used when the tensor is used as the padMode parameter of the Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the padMode parameter of the + Conv2D operator. */ OH_NN_CONV2D_PAD_MODE = 14, - /** This enumerated value is used when the tensor is used as the activationType parameter of the Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + Conv2D operator. */ OH_NN_CONV2D_ACTIVATION_TYPE = 15, - /** This enumerated value is used when the tensor is used as the group parameter of the Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the group parameter of the + Conv2D operator. */ OH_NN_CONV2D_GROUP = 16, - /** This enumerated value is used when the tensor is used as the strides parameter of the Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the strides parameter of the + Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_STRIDES = 17, - /** This enumerated value is used when the tensor is used as the pad parameter of the Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the + Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_PAD = 18, - /** This enumerated value is used when the tensor is used as the dilation parameter of the Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the dilation parameter of the + Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_DILATION = 19, - /** This enumerated value is used when the tensor is used as the outputPaddings parameter of the Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the outputPaddings parameter of the + Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_OUTPUT_PADDINGS = 20, - /** This enumerated value is used when the tensor is used as the padMode parameter of the Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the padMode parameter of the + Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_PAD_MODE = 21, - /** This enumerated value is used when the tensor is used as the activationType parameter of the Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_ACTIVATION_TYPE = 22, - /** This enumerated value is used when the tensor is used as the group parameter of the Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the group parameter of the + Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_GROUP = 23, - /** This enumerated value is used when the tensor is used as the strides parameter of the DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the strides parameter of the + DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_STRIDES = 24, - /** This enumerated value is used when the tensor is used as the pad parameter of the DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the + DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_PAD = 25, - /** This enumerated value is used when the tensor is used as the dilation parameter of the DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the dilation parameter of the + DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_DILATION = 26, - /** This enumerated value is used when the tensor is used as the padMode parameter of the DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the padMode parameter of the + DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_PAD_MODE = 27, - /** This enumerated value is used when the tensor is used as the activationType parameter of the DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_ACTIVATION_TYPE = 28, - /** This enumerated value is used when the tensor is used as the activationType parameter of the Div operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + Div operator. */ OH_NN_DIV_ACTIVATIONTYPE = 29, - /** This enumerated value is used when the tensor is used as the mode parameter of the Eltwise operator. */ + /** This enumerated value is used when the tensor is used as the mode parameter of the + Eltwise operator. */ OH_NN_ELTWISE_MODE = 30, - /** This enumerated value is used when the tensor is used as the axis parameter of the FullConnection operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the + FullConnection operator. */ OH_NN_FULL_CONNECTION_AXIS = 31, - /** This enumerated value is used when the tensor is used as the activationType parameter of the FullConnection operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + FullConnection operator. */ OH_NN_FULL_CONNECTION_ACTIVATIONTYPE = 32, - /** This enumerated value is used when the tensor is used as the transposeA parameter of the Matmul operator. */ + /** This enumerated value is used when the tensor is used as the transposeA parameter of the + Matmul operator. */ OH_NN_MATMUL_TRANSPOSE_A = 33, - /** This enumerated value is used when the tensor is used as the transposeB parameter of the Matmul operator. */ + /** This enumerated value is used when the tensor is used as the transposeB parameter of the + Matmul operator. */ OH_NN_MATMUL_TRANSPOSE_B = 34, - /** This enumerated value is used when the tensor is used as the activationType parameter of the Matmul operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + Matmul operator. */ OH_NN_MATMUL_ACTIVATION_TYPE = 35, - /** This enumerated value is used when the tensor is used as the kernel_size parameter of the MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the kernel_size parameter of the + MaxPool operator. */ OH_NN_MAX_POOL_KERNEL_SIZE = 36, - /** This enumerated value is used when the tensor is used as the stride parameter of the MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the stride parameter of the + MaxPool operator. */ OH_NN_MAX_POOL_STRIDE = 37, - /** This enumerated value is used when the tensor is used as the pad_mode parameter of the MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the pad_mode parameter of the + MaxPool operator. */ OH_NN_MAX_POOL_PAD_MODE = 38, - /** This enumerated value is used when the tensor is used as the pad parameter of the MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the + MaxPool operator. */ OH_NN_MAX_POOL_PAD = 39, - /** This enumerated value is used when the tensor is used as the activation_type parameter of the MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the activation_type parameter of the + MaxPool operator. */ OH_NN_MAX_POOL_ACTIVATION_TYPE = 40, - /** This enumerated value is used when the tensor is used as the activationType parameter of the Mul operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + Mul operator. */ OH_NN_MUL_ACTIVATION_TYPE = 41, - /** This enumerated value is used when the tensor is used as the axis parameter of the OneHot operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the + OneHot operator. */ OH_NN_ONE_HOT_AXIS = 42, - /** This enumerated value is used when the tensor is used as the constant_value parameter of the Pad operator. */ + /** This enumerated value is used when the tensor is used as the constant_value parameter of the + Pad operator. */ OH_NN_PAD_CONSTANT_VALUE = 43, - /** This enumerated value is used when the tensor is used as the activationType parameter of the Scale operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the + Scale operator. */ OH_NN_SCALE_ACTIVATIONTYPE = 44, - /** This enumerated value is used when the tensor is used as the axis parameter of the Scale operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the + Scale operator. */ OH_NN_SCALE_AXIS = 45, - /** This enumerated value is used when the tensor is used as the axis parameter of the Softmax operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the + Softmax operator. */ OH_NN_SOFTMAX_AXIS = 46, - /** This enumerated value is used when the tensor is used as the BlockShape parameter of the SpaceToBatchND operator. */ + /** This enumerated value is used when the tensor is used as the BlockShape parameter of the + SpaceToBatchND operator. */ OH_NN_SPACE_TO_BATCH_ND_BLOCK_SHAPE = 47, - /** This enumerated value is used when the tensor is used as the Paddings parameter of the SpaceToBatchND operator. */ + /** This enumerated value is used when the tensor is used as the Paddings parameter of the + SpaceToBatchND operator. */ OH_NN_SPACE_TO_BATCH_ND_PADDINGS = 48, - /** This enumerated value is used when the tensor is used as the Axis parameter of the Split operator. */ + /** This enumerated value is used when the tensor is used as the Axis parameter of the + Split operator. */ OH_NN_SPLIT_AXIS = 49, - /** This enumerated value is used when the tensor is used as the OutputNum parameter of the Split operator. */ + /** This enumerated value is used when the tensor is used as the OutputNum parameter of the + Split operator. */ OH_NN_SPLIT_OUTPUT_NUM = 50, - /** This enumerated value is used when the tensor is used as the SizeSplits parameter of the Split operator. */ + /** This enumerated value is used when the tensor is used as the SizeSplits parameter of the + Split operator. */ OH_NN_SPLIT_SIZE_SPLITS = 51, - /** This enumerated value is used when the tensor is used as the Axis parameter of the Squeeze operator. */ + /** This enumerated value is used when the tensor is used as the Axis parameter of the + Squeeze operator. */ OH_NN_SQUEEZE_AXIS = 52, - /** This enumerated value is used when the tensor is used as the Axis parameter of the Stack operator. */ + /** This enumerated value is used when the tensor is used as the Axis parameter of the + Stack operator. */ OH_NN_STACK_AXIS = 53, - /** This enumerated value is used when the tensor is used as the BeginMask parameter of the StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the BeginMask parameter of the + StridedSlice operator. */ OH_NN_STRIDED_SLICE_BEGIN_MASK = 54, - /** This enumerated value is used when the tensor is used as the EndMask parameter of the StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the EndMask parameter of the + StridedSlice operator. */ OH_NN_STRIDED_SLICE_END_MASK = 55, - /** This enumerated value is used when the tensor is used as the EllipsisMask parameter of the StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the EllipsisMask parameter of the + StridedSlice operator. */ OH_NN_STRIDED_SLICE_ELLIPSIS_MASK = 56, - /** This enumerated value is used when the tensor is used as the NewAxisMask parameter of the StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the NewAxisMask parameter of the + StridedSlice operator. */ OH_NN_STRIDED_SLICE_NEW_AXIS_MASK = 57, - /** This enumerated value is used when the tensor is used as the ShrinkAxisMask parameter of the StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the ShrinkAxisMask parameter of the + StridedSlice operator. */ OH_NN_STRIDED_SLICE_SHRINK_AXIS_MASK = 58, - /** This enumerated value is used when the tensor is used as the ActivationType parameter of the Sub operator. */ + /** This enumerated value is used when the tensor is used as the ActivationType parameter of the + Sub operator. */ OH_NN_SUB_ACTIVATIONTYPE = 59, - /** This enumerated value is used when the tensor is used as the keep_dims parameter of the ReduceMean operator. */ + /** This enumerated value is used when the tensor is used as the keep_dims parameter of the + ReduceMean operator. */ OH_NN_REDUCE_MEAN_KEEP_DIMS = 60, - /** This enumerated value is used when the tensor is used as the new_height parameter of the ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the new_height parameter of the + ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_NEW_HEIGHT = 61, - /** This enumerated value is used when the tensor is used as the new_width parameter of the ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the new_width parameter of the + ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_NEW_WIDTH = 62, - /** This enumerated value is used when the tensor is used as the preserve_aspect_ratio parameter of the ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the preserve_aspect_ratio parameter of the + ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_PRESERVE_ASPECT_RATIO = 63, - /** This enumerated value is used when the tensor is used as the coordinate_transform_mode parameter of the ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the coordinate_transform_mode parameter of the + ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_COORDINATE_TRANSFORM_MODE = 64, - /** This enumerated value is used when the tensor is used as the exclude_outside parameter of the ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the exclude_outside parameter of the + ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_EXCLUDE_OUTSIDE = 65, - /** This enumerated value is used when the tensor is used as the beginNormAxis parameter of the LayerNorm operator. */ + /** This enumerated value is used when the tensor is used as the beginNormAxis parameter of the + LayerNorm operator. */ OH_NN_LAYER_NORM_BEGIN_NORM_AXIS = 66, - /** This enumerated value is used when the tensor is used as the epsilon parameter of the LayerNorm operator. */ + /** This enumerated value is used when the tensor is used as the epsilon parameter of the + LayerNorm operator. */ OH_NN_LAYER_NORM_EPSILON = 67, - /** This enumerated value is used when the tensor is used as the beginParamsAxis parameter of the LayerNorm operator. */ + /** This enumerated value is used when the tensor is used as the beginParamsAxis parameter of the + LayerNorm operator. */ OH_NN_LAYER_NORM_BEGIN_PARAM_AXIS = 68, - /** This enumerated value is used when the tensor is used as the elementwiseAffine parameter of the LayerNorm operator. */ + /** This enumerated value is used when the tensor is used as the elementwiseAffine parameter of the + LayerNorm operator. */ OH_NN_LAYER_NORM_ELEMENTWISE_AFFINE = 69, - /** This enumerated value is used when the tensor is used as the keep_dims parameter of the ReduceProd operator. */ + /** This enumerated value is used when the tensor is used as the keep_dims parameter of the + ReduceProd operator. */ OH_NN_REDUCE_PROD_KEEP_DIMS = 70, - /** This enumerated value is used when the tensor is used as the keep_dims parameter of the ReduceAll operator. */ + /** This enumerated value is used when the tensor is used as the keep_dims parameter of the + ReduceAll operator. */ OH_NN_REDUCE_ALL_KEEP_DIMS = 71, - /** This enumerated value is used when the tensor is used as the src_t parameter of the QuantDTypeCast operator. */ + /** This enumerated value is used when the tensor is used as the src_t parameter of the + QuantDTypeCast operator. */ OH_NN_QUANT_DTYPE_CAST_SRC_T = 72, - /** This enumerated value is used when the tensor is used as the dst_t parameter of the QuantDTypeCast operator. */ + /** This enumerated value is used when the tensor is used as the dst_t parameter of the + QuantDTypeCast operator. */ OH_NN_QUANT_DTYPE_CAST_DST_T = 73, - /** This enumerated value is used when the tensor is used as the Sorted parameter of the Topk operator. */ + /** This enumerated value is used when the tensor is used as the Sorted parameter of the + Topk operator. */ OH_NN_TOP_K_SORTED = 74, - /** This enumerated value is used when the tensor is used as the axis parameter of the ArgMax operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the + ArgMax operator. */ OH_NN_ARG_MAX_AXIS = 75, - /** This enumerated value is used when the tensor is used as the keepDims parameter of the ArgMax operator. */ + /** This enumerated value is used when the tensor is used as the keepDims parameter of the + ArgMax operator. */ OH_NN_ARG_MAX_KEEPDIMS = 76, - /** This enumerated value is used when the tensor is used as the Axis parameter of the Unsqueeze operator. */ + /** This enumerated value is used when the tensor is used as the Axis parameter of the + Unsqueeze operator. */ OH_NN_UNSQUEEZE_AXIS = 77, } OH_NN_TensorType; @@ -1727,9 +1901,10 @@ typedef struct OH_NN_UInt32Array { \f[ q = clamp(round(\frac{r}{s}+z), q_{min}, q_{max}) \f] - * s and z are quantization parameters, which are stored by scale and zeroPoint in {@link OH_NN_QuantParam}. - * r is a floating point number, q is the quantization result, q_min is the lower bound of the quantization result, and - * q_max is an upper bound of a quantization result. The calculation method is as follows: + * s and z are quantization parameters, which are stored by scale and zeroPoint in + * {@link OH_NN_QuantParam}. + * r is a floating point number, q is the quantization result, q_min is the lower bound of the quantization result, + * and q_max is an upper bound of a quantization result. The calculation method is as follows: * \f[ \text{clamp}(x,min,max) = @@ -1753,7 +1928,8 @@ typedef struct OH_NN_UInt32Array { */ typedef struct OH_NN_QuantParam { /** Specifies the length of the numBits, scale, and zeroPoint arrays. In the per-layer quantization scenario, - * quantCount is usually set to 1. That is, all channels of a tensor share a set of quantization parameters. + * quantCount is usually set to 1. That is, all channels of a tensor share a set of quantization + * parameters. * In the per-channel quantization scenario, quantCount is usually the same as the number of tensor channels, * and each channel uses its own quantization parameters. */ @@ -1786,7 +1962,8 @@ typedef struct OH_NN_Tensor { const OH_NN_QuantParam *quantParam; /** Specifies the tensor type. The value of type is related to the tensor usage. * When the tensor is used as the input or output of the model, set type to {@link OH_NN_TENSOR}. - * When a tensor is used as an operator parameter, select any enumerated value except {@link OH_NN_TENSOR} from {@link OH_NN_TensorType}. + * When a tensor is used as an operator parameter, select any enumerated value except {@link OH_NN_TENSOR} + * from {@link OH_NN_TensorType}. */ OH_NN_TensorType type; } OH_NN_Tensor; -- Gitee From 722ef64979cf00c8feb1a41d9a68749f590ee9cd Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 20 Oct 2023 15:33:32 +0800 Subject: [PATCH 0044/2135] update docs Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/context.h | 8 +- en/native_sdk/ai/mindspore/model.h | 6 +- en/native_sdk/ai/mindspore/tensor.h | 11 +- .../neural_network_runtime.h | 236 +++++++++--------- .../neural_network_runtime_type.h | 55 ++-- en/native_sdk/usb/usb_ddk_api.h | 3 +- en/native_sdk/usb/usb_ddk_types.h | 2 +- 7 files changed, 169 insertions(+), 152 deletions(-) diff --git a/en/native_sdk/ai/mindspore/context.h b/en/native_sdk/ai/mindspore/context.h index 298f0614..766a0c6a 100644 --- a/en/native_sdk/ai/mindspore/context.h +++ b/en/native_sdk/ai/mindspore/context.h @@ -69,7 +69,8 @@ OH_AI_API OH_AI_ContextHandle OH_AI_ContextCreate(); /** * @brief Destroys a context object. * - * @param context Level-2 pointer to {@link OH_AI_ContextHandle}. After the context is destroyed, the pointer is set to null. + * @param context Level-2 pointer to {@link OH_AI_ContextHandle}. After the context is destroyed, + * the pointer is set to null. * @since 9 */ OH_AI_API void OH_AI_ContextDestroy(OH_AI_ContextHandle *context); @@ -405,8 +406,9 @@ OH_AI_API OH_AI_Priority OH_AI_DeviceInfoGetPriority(const OH_AI_DeviceInfoHandl * @brief Adds extended configuration in the form of key/value pairs to the device information. * This function is available only for NNRt device information. * - * Note: The key/value pairs currently supported include {"CachePath": "YourCachePath"}, {"CacheVersion": "YourCacheVersion"}, - * and {"QuantParam": "YourQuantConfig". You can replace the values as required. + * Note: The key/value pairs currently supported include {"CachePath": "YourCachePath"}, + * {"CacheVersion": "YourCacheVersion"}, and {"QuantParam": "YourQuantConfig". You can replace + * the values as required. * * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. * @param name Key in an extended key/value pair. The value is a C string. diff --git a/en/native_sdk/ai/mindspore/model.h b/en/native_sdk/ai/mindspore/model.h index f8e83809..19e3986f 100644 --- a/en/native_sdk/ai/mindspore/model.h +++ b/en/native_sdk/ai/mindspore/model.h @@ -126,7 +126,8 @@ OH_AI_API void OH_AI_ModelDestroy(OH_AI_ModelHandle *model); * * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or * {@link OH_AI_ModelBuildFromFile} only once. - * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects accordingly. + * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects + * accordingly. * * @param model Pointer to the model object. * @param model_data Address of the loaded model data in the memory. @@ -145,7 +146,8 @@ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *mod * * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or * {@link OH_AI_ModelBuildFromFile} only once. - * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects accordingly. + * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects + * accordingly. * * @param model Pointer to the model object. * @param model_path Path of the model file. diff --git a/en/native_sdk/ai/mindspore/tensor.h b/en/native_sdk/ai/mindspore/tensor.h index 554fe5dc..bff23591 100644 --- a/en/native_sdk/ai/mindspore/tensor.h +++ b/en/native_sdk/ai/mindspore/tensor.h @@ -230,15 +230,18 @@ OH_AI_API int64_t OH_AI_TensorGetElementNum(const OH_AI_TensorHandle tensor); OH_AI_API size_t OH_AI_TensorGetDataSize(const OH_AI_TensorHandle tensor); /** - * @brief Sets the tensor as the user data. This function allows you to reuse user data as the model input, which helps to reduce data copy by one time. - * Note: The user data is type of external data for the tensor and is not automatically released when the tensor is destroyed. The caller needs to release the data. In addition, the caller must ensure validity of the user data - * during use of the tensor. + * @brief Sets the tensor as the user data. This function allows you to reuse user data as the model input, + * which helps to reduce data copy by one time. + * Note: The user data is type of external data for the tensor and is not automatically released when the tensor + * is destroyed. The caller needs to release the data. In addition, the caller must ensure validity of the user + * data during use of the tensor. * * @param tensor Handle of the tensor object. * @param data Start address of user data. * @param data_size Length of the user data. * - * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_STATUS_SUCCESS** indicates that the operation is successful. If the operation fails, an error code is returned. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_STATUS_SUCCESS** indicates that the + * operation is successful. If the operation fails, an error code is returned. * * @since 10 */ diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index 4cd1822a..0895c1b0 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -29,7 +29,7 @@ * * @brief Defines the Neural Network Runtime APIs. The AI inference framework uses the Native APIs provided by Neural * Network Runtime to construct and compile models and perform inference and computing on acceleration hardware. - * Note: Currently, the APIs of Neural Network Runtime do not support multi-thread calling.\n + * Note: Currently, the APIs of Neural Network Runtime do not support multi-thread calling.\n * * @library libneural_network_runtime.so * @since 9 @@ -46,15 +46,16 @@ extern "C" { #endif /** - * @brief Creates a model instance of the {@link OH_NNModel} type and uses other APIs provided by OH_NNModel to construct - * the model instance. + * @brief Creates a model instance of the {@link OH_NNModel} type and uses other APIs provided by OH_NNModel to + * construct the model instance. * * Before composition, call {@link OH_NNModel_Construct} to create a model instance. Based on the model topology, - * call the {@link OH_NNModel_AddTensor}, {@link OH_NNModel_AddOperation}, and {@link OH_NNModel_SetTensorData} methods - * to fill in the data and operator nodes of the model, and then call {@link OH_NNModel_SpecifyInputsAndOutputs} - * to specify the inputs and outputs of the model. - * After the model topology is constructed, call {@link OH_NNModel_Finish} to build the model.\n - * After a model instance is used, you need to destroy it by calling {@link OH_NNModel_Destroy} to avoid memory leak.\n + * call the {@link OH_NNModel_AddTensor}, {@link OH_NNModel_AddOperation}, and {@link OH_NNModel_SetTensorData} + * methods to fill in the data and operator nodes of the model, and then call + * {@link OH_NNModel_SpecifyInputsAndOutputs} to specify the inputs and outputs of the model. + * After the model topology is constructed, call {@link OH_NNModel_Finish} to build the model.\n + * After a model instance is used, you need to destroy it by calling {@link OH_NNModel_Destroy} to avoid + * memory leak.\n * * @return Returns the pointer to a {@link OH_NNModel} instance. * @since 9 @@ -65,21 +66,21 @@ OH_NNModel *OH_NNModel_Construct(void); /** * @brief Adds a tensor to a model instance. * - * The data node and operator parameters in the Neural Network Runtime model are composed of tensors of the model. + * The data node and operator parameters in the Neural Network Runtime model are composed of tensors of the model. * This method is used to add tensors to a model instance based on the tensor parameter. * The sequence of adding tensors is specified by the index value recorded in the model. The * {@link OH_NNModel_SetTensorData}, {@link OH_NNModel_AddOperation}, and {@link OH_NNModel_SpecifyInputsAndOutputs} - * methods specifies tensors based on the index value.\n + * methods specifies tensors based on the index value.\n * Neural Network Runtime supports inputs and outputs of the dynamic shape. When adding a data node with a dynamic shape, * you need to set the dimensions that support dynamic changes in tensor.dimensions to -1. * For example, if tensor.dimensions of a four-dimensional tensor is set to [1, -1, 2, 2], the second - * dimension supports dynamic changes.\n + * dimension supports dynamic changes.\n * * * @param model Pointer to the {@link OH_NNModel} instance. * @param tensor Pointer to the {@link OH_NN_Tensor} tensor. The tensor specifies the attributes of the tensor added to * the model instance. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, see * {@link OH_NN_ReturnCode}. * @since 9 @@ -91,14 +92,14 @@ OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *ten * \brief Sets the tensor value. * * For tensors with constant values (such as model weights), you need to use this method in the composition phase. - * The index value of a tensor is determined by the sequence in which the tensor is added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n + * The index value of a tensor is determined by the sequence in which the tensor is added to the model. + * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @param index Index value of a tensor. * @param dataBuffer Pointer to real data. * @param length Length of the data buffer. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, * see {@link OH_NN_ReturnCode}. * @since 9 @@ -109,22 +110,22 @@ OH_NN_ReturnCode OH_NNModel_SetTensorData(OH_NNModel *model, uint32_t index, con /** * @brief Adds an operator to a model instance. * - * This method is used to add an operator to a model instance. The operator type is specified by op, and + * This method is used to add an operator to a model instance. The operator type is specified by op, and * the operator parameters, inputs, and outputs are specified by paramIndices, inputIndices, and * outputIndices respectively. - * This method verifies the attributes of operator parameters and the number of input and output parameters. + * This method verifies the attributes of operator parameters and the number of input and output parameters. * These attributes must be correctly set when {@link OH_NNModel_AddTensor} is called to add tensors. * For details about the expected parameters, input attributes, and output attributes of each operator, - * see {@link OH_NN_OperationType}.\n + * see {@link OH_NN_OperationType}.\n * * * paramIndices, inputIndices, and outputIndices store index values of tensors. * Index values are determined by the sequence in which tensors are added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n + * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n * * If unnecessary parameters are added for adding an operator, this method returns {@link OH_NN_INVALID_PARAMETER}. * If no operator parameter is set, the operator uses the default parameter value. - * For details about the default values, see {@link OH_NN_OperationType}.\n + * For details about the default values, see {@link OH_NN_OperationType}.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @param op Specifies the type of an operator to be added. For details, see the enumerated values of @@ -152,14 +153,14 @@ OH_NN_ReturnCode OH_NNModel_AddOperation(OH_NNModel *model, * phase to set the input and output data.\n * * The index value of a tensor is determined by the sequence in which the tensor is added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n + * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n * - * Currently, the model inputs and outputs cannot be set asynchronously.\n + * Currently, the model inputs and outputs cannot be set asynchronously.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @param inputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator input. * @param outputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator output. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, * see {@link OH_NN_ReturnCode}. * @since 9 @@ -174,14 +175,14 @@ OH_NN_ReturnCode OH_NNModel_SpecifyInputsAndOutputs(OH_NNModel *model, * * After the model topology is set up, call this method to indicate that the composition is complete. After this method * additional composition operations cannot be performed. If {@link OH_NNModel_AddTensor}, {@link OH_NNModel_AddOperation}, - * is called, {@link OH_NNModel_SetTensorData}, and {@link OH_NNModel_SpecifyInputsAndOutputs} are called, - * {@link OH_NN_OPERATION_FORBIDDEN} is returned.\n + * is called, {@link OH_NNModel_SetTensorData}, and {@link OH_NNModel_SpecifyInputsAndOutputs} are called, + * {@link OH_NN_OPERATION_FORBIDDEN} is returned.\n * - * Before calling {@link OH_NNModel_GetAvailableOperations} and {@link OH_NNCompilation_Construct}, - * you must call this method to complete composition.\n + * Before calling {@link OH_NNModel_GetAvailableOperations} and {@link OH_NNCompilation_Construct}, + * you must call this method to complete composition.\n * * @param model Pointer to the {@link OH_NNModel} instance. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 @@ -192,10 +193,10 @@ OH_NN_ReturnCode OH_NNModel_Finish(OH_NNModel *model); * @brief Releases a model instance. * * This method needs to be called to release the model instance created by calling {@link OH_NNModel_Construct}. - * Otherwise, memory leak will occur.\n + * Otherwise, memory leak will occur.\n * * If model or *model is a null pointer, this method only prints warning logs and does not execute the - * release logic.\n + * release logic.\n * * @param model Level-2 pointer to the {@link OH_NNModel} instance. After a model instance is destroyed, * this method sets *model to a null pointer. @@ -205,17 +206,18 @@ OH_NN_ReturnCode OH_NNModel_Finish(OH_NNModel *model); void OH_NNModel_Destroy(OH_NNModel **model); /** - * @brief Queries whether the device supports operators in the model. The support status is indicated by the Boolean value. + * @brief Queries whether the device supports operators in the model. The support status is indicated by the + * Boolean value. * - * Queries whether underlying device supports operators in a model instance. The device is specified by deviceID, - * and the result is represented by the array pointed by isSupported. If the ith operator is supported, - * the value of (*isSupported)[i] is true. Otherwise, the value is false.\n + * Queries whether underlying device supports operators in a model instance. The device is specified by deviceID, + * and the result is represented by the array pointed by isSupported. If the ith operator is supported, + * the value of (*isSupported)[i] is true. Otherwise, the value is false.\n * * After this method is successfully executed, (*isSupported) points to the bool array that records the operator - * support status. + * support status. * The operator quantity for the array length is the same as that for the model instance. The memory corresponding to * this array is managed by Neural Network Runtime and is automatically destroyed after the model instance is destroyed - * or this method is called again.\n + * or this method is called again.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @param deviceID Device ID to be queried, which can be obtained by using {@link OH_NNDevice_GetAllDevicesID}. @@ -223,7 +225,7 @@ void OH_NNModel_Destroy(OH_NNModel **model); * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. * * @param opCount Number of operators in a model instance, corresponding to the length of the (*isSupported) array. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, * see {@link OH_NN_ReturnCode}. * @@ -249,9 +251,9 @@ OH_NN_ReturnCode OH_NNModel_GetAvailableOperations(OH_NNModel *model, * - {@link OH_NNCompilation_SetCache} * - {@link OH_NNCompilation_SetPerformanceMode} * - {@link OH_NNCompilation_SetPriority} - * - {@link OH_NNCompilation_EnableFloat16}\n + * - {@link OH_NNCompilation_EnableFloat16}\n * - * After {@link OH_NNCompilation} is created by calling this method, the {@link OH_NNModel} instance can be released.\n + * After {@link OH_NNCompilation} is created by calling this method, the {@link OH_NNModel} instance can be released.\n * * @param model Pointer to the {@link OH_NNModel} instance. * @return Returns the pointer to a {@link OH_NNCompilation} instance. @@ -264,13 +266,15 @@ OH_NNCompilation *OH_NNCompilation_Construct(const OH_NNModel *model); * @brief Specifies the device for model compilation and computing. * * In the compilation phase, you need to specify the device for model compilation and computing. - * Call {@link OH_NNDevice_GetAllDevicesID} to obtain available device IDs. Call {@link OH_NNDevice_GetType} and - * {@link OH_NNDevice_GetName} to obtain device information and pass target device IDs to this method for setting.\n + * Call {@link OH_NNDevice_GetAllDevicesID} to obtain available device IDs. Call {@link OH_NNDevice_GetType} + * and {@link OH_NNDevice_GetName} to obtain device information and pass target device IDs to this method + * for setting.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @param deviceID Device ID. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -281,32 +285,32 @@ OH_NN_ReturnCode OH_NNCompilation_SetDevice(OH_NNCompilation *compilation, size_ * * On the device that supports caching, a model can be saved as a cache file after being compiled at the * device driver layer. - * The model can be directly read from the cache file in the next compilation, saving recompilation time. + * The model can be directly read from the cache file in the next compilation, saving recompilation time. * This method performs different operations based on the passed cache directory and version:\n * * - No file exists in the cache directory: - * Caches the compiled model to the directory and sets the cache version to version.\n + * Caches the compiled model to the directory and sets the cache version to version.\n * * - A complete cache file exists in the cache directory, and its version is version: * Reads the cache file in the path and passes the data to the underlying device for conversion into - * executable model instances.\n + * executable model instances.\n * * - A complete cache file exists in the cache directory, and its version is earlier than version: - * When model compilation is complete on the underlying device, overwrites the cache file and changes the version number - * to version.\n + * When model compilation is complete on the underlying device, overwrites the cache file and changes the version + * number to version.\n * * - A complete cache file exists in the cache directory, and its version is later than version: - * Returns the {@link OH_NN_INVALID_PARAMETER} error code without reading the cache file.\n + * Returns the {@link OH_NN_INVALID_PARAMETER} error code without reading the cache file.\n * * - The cache file in the cache directory is incomplete or you do not have the permission to access the cache file. - * Returns the {@link OH_NN_INVALID_FILE} error code.\n + * Returns the {@link OH_NN_INVALID_FILE} error code.\n * * - The cache directory does not exist or you do not have the access permission. - * Returns the {@link OH_NN_INVALID_PATH} error code.\n + * Returns the {@link OH_NN_INVALID_PATH} error code.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param cachePath Directory for storing model cache files. This method creates directories for different devices in the - * cachePath directory. You are advised to use a separate cache directory for each model. + * @param cachePath Directory for storing model cache files. This method creates directories for different devices in + * the cachePath directory. You are advised to use a separate cache directory for each model. * @param version Cache version. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. @@ -321,16 +325,17 @@ OH_NN_ReturnCode OH_NNCompilation_SetCache(OH_NNCompilation *compilation, const * Neural Network Runtime allows you to set the performance mode for model computing to meet the requirements of low * power consumption and ultimate performance. If this method is not called to set the performance mode in the * compilation phase, the compilation instance assigns the {@link OH_NN_PERFORMANCE_NONE} mode for the model by default. - * In this case, the device performs computing in the default performance mode.\n + * In this case, the device performs computing in the default performance mode.\n * * If this method is called on the device that does not support the setting of the performance mode, - * the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned.\n + * the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @param performanceMode Performance mode. For details about the available performance modes, * see {@link OH_NN_PerformanceMode}. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -342,15 +347,16 @@ OH_NN_ReturnCode OH_NNCompilation_SetPerformanceMode(OH_NNCompilation *compilati * * Neural Network Runtime allows you to set computing priorities for models. * The priorities apply only to models created by the process with the same UID. - * The settings will not affect models created by processes with different UIDs on different devices.\n + * The settings will not affect models created by processes with different UIDs on different devices.\n * - * If this method is called on the device that does not support the priority setting, the {@link OH_NN_UNAVALIDABLE_DEVICE} - * error code is returned.\n + * If this method is called on the device that does not support the priority setting, the + * {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @param priority Priority. For details about the optional priorities, see {@link OH_NN_Priority}. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -359,17 +365,19 @@ OH_NN_ReturnCode OH_NNCompilation_SetPriority(OH_NNCompilation *compilation, OH_ /** * @brief Enables float16 for computing. * - * Currently, Neural Network Runtime supports only float32 and int8. If this method is called on a device that supports - * float16, float16 will be used for computing the float32 model to reduce memory usage and execution time.\n + * Currently, Neural Network Runtime supports only float32 and int8. If this method is called on a device that + * supports float16, float16 will be used for computing the float32 model to reduce memory usage and execution time.\n * * If this method is called on the device that does not support float16, the {@link OH_NN_UNAVALIDABLE_DEVICE} - * error code is returned.\n + * error code is returned.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param enableFloat16 Whether to enable float16. If this parameter is set to true, float16 inference is performed. + * @param enableFloat16 Whether to enable float16. If this parameter is set to true, float16 inference + * is performed. * If this parameter is set to false, float32 inference is performed. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -378,16 +386,17 @@ OH_NN_ReturnCode OH_NNCompilation_EnableFloat16(OH_NNCompilation *compilation, b /** * @brief Compiles a model. * - * After the compilation configuration is complete, call this method to return the compilation result. The compilation instance - * pushes the model and compilation options to the device for compilation. After this method is called, additional compilation - * operations cannot be performed. - * If the {@link OH_NNCompilation_SetDevice}, {@link OH_NNCompilation_SetCache}, {@link OH_NNCompilation_SetPerformanceMode}, - * {@link OH_NNCompilation_SetPriority}, and {@link OH_NNCompilation_EnableFloat16} methods are called, - * {@link OH_NN_OPERATION_FORBIDDEN} is returned.\n + * After the compilation configuration is complete, call this method to return the compilation result. The compilation + * instance pushes the model and compilation options to the device for compilation. After this method is called, + * additional compilation operations cannot be performed. + * If the {@link OH_NNCompilation_SetDevice}, {@link OH_NNCompilation_SetCache}, + * {@link OH_NNCompilation_SetPerformanceMode}, {@link OH_NNCompilation_SetPriority}, and + * {@link OH_NNCompilation_EnableFloat16} methods are called, {@link OH_NN_OPERATION_FORBIDDEN} is returned.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -396,11 +405,11 @@ OH_NN_ReturnCode OH_NNCompilation_Build(OH_NNCompilation *compilation); /** * @brief Releases the Compilation object. * - * This method needs to be called to release the compilation instance created by calling {@link OH_NNCompilation_Construct}. - * Otherwise, memory leak will occur.\n + * This method needs to be called to release the compilation instance created by calling + * {@link OH_NNCompilation_Construct}. Otherwise, memory leak will occur.\n * - * If compilation or *compilation is a null pointer, this method only prints warning logs and does not execute - * the release logic.\n + * If compilation or *compilation is a null pointer, this method only prints warning logs and + * does not execute the release logic.\n * * @param compilation Level-2 pointer to the {@link OH_NNCompilation} instance. After a compilation instance is destroyed, * this method sets *compilation to a null pointer. @@ -415,10 +424,10 @@ void OH_NNCompilation_Destroy(OH_NNCompilation **compilation); * * This method constructs a model inference executor associated with the device based on the passed compiler. * Use {@link OH_NNExecutor_SetInput} to set the model input data. After the input data is set, call {@link OH_NNExecutor_Run} - * to perform inference and then call {@link OH_NNExecutor_SetOutput} to obtain the computing result.\n + * to perform inference and then call {@link OH_NNExecutor_SetOutput} to obtain the computing result.\n * * After calling this method to create the {@link OH_NNExecutor} instance, you can release the {@link OH_NNCompilation} - * instance if you do not need to create any other executors.\n + * instance if you do not need to create any other executors.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @return Pointer to a {@link OH_NNExecutor} instance. @@ -432,7 +441,7 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); * * This method copies the data whose length is specified by length (in bytes) in dataBuffer to the shared memory * of the underlying device. inputIndex specifies the input to be set and tensor sets information - * such as the input shape, type, and quantization parameters.\n + * such as the input shape, type, and quantization parameters.\n * * * Neural Network Runtime supports models with dynamical shape input. For fixed shape input and dynamic shape input scenarios, @@ -445,10 +454,10 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); * When setting the shape, you can modify only the dimension whose value is -1. Assume that [-1, 224, 224, 3] * is input as the the dimension of A in the composition phase. * When this method is called, only the size of the first dimension can be modified, for example, to [3, 224, 224, 3]. - * If other dimensions are adjusted, {@link OH_NN_INVALID_PARAMETER} is returned.\n - * - * - * + * If other dimensions are adjusted, {@link OH_NN_INVALID_PARAMETER} is returned.\n + * + * + * * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param inputIndex Input index value, which is in the same sequence of the data input when @@ -474,17 +483,17 @@ OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, * @brief Sets the buffer for a single output of a model. * * This method binds the buffer to which dataBuffer points to the output specified by outputIndex. - * The length of the buffer is specified by length.\n + * The length of the buffer is specified by length.\n * * After {@link OH_NNExecutor_Run} is called to complete a single model inference, Neural Network Runtime compares * the length of the buffer to which dataBuffer points with the length of the output data and returns different results - * based on the actual situation.\n + * based on the actual situation.\n * * * - If the buffer length is greater than or equal to the data length, the inference result is copied to the buffer and * {@link OH_NN_SUCCESS} is returned. You can read the inference result from dataBuffer. - * - If the buffer length is smaller than the data length, {@link OH_NNExecutor_Run} returns {@link OH_NN_INVALID_PARAMETER} - * and generates a log indicating that the buffer is too small.\n + * - If the buffer length is smaller than the data length, {@link OH_NNExecutor_Run} returns {@link OH_NN_INVALID_PARAMETER} + * and generates a log indicating that the buffer is too small.\n * * * @param executor Pointer to the {@link OH_NNExecutor} instance. @@ -509,7 +518,7 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, * @brief Obtains the dimension information about the output tensor. * * After {@link OH_NNExecutor_Run} is called to complete a single inference, call this method to obtain the specified output dimension - * information and number of dimensions. It is commonly used in dynamic shape input and output scenarios.\n + * information and number of dimensions. It is commonly used in dynamic shape input and output scenarios.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param outputIndex Output Index value, which is in the same sequence of the data output when @@ -533,7 +542,7 @@ OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, /** * @brief Performs inference. * - * Performs end-to-end inference and computing of the model on the device associated with the executor.\n + * Performs end-to-end inference and computing of the model on the device associated with the executor.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. @@ -546,10 +555,10 @@ OH_NN_ReturnCode OH_NNExecutor_Run(OH_NNExecutor *executor); /** * @brief Allocates shared memory to a single input on a device. * - * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the executor - * and input index value, this method allocates shared memory whose size is specified by length on the device associated - * with a single input and returns the operation result through the {@link OH_NN_Memory} instance.\n - * + * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the + * executor and input index value, this method allocates shared memory whose size is specified by length on the + * device associated with a single input and returns the operation result through the {@link OH_NN_Memory} instance.\n + * * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param inputIndex Input index value, which is in the same sequence of the data input when @@ -568,9 +577,10 @@ OH_NN_Memory *OH_NNExecutor_AllocateInputMemory(OH_NNExecutor *executor, uint32_ /** * @brief Allocates shared memory to a single output on a device. * - * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the executor and - * output index value, this method allocates shared memory whose size is specified by length on the device associated with - * a single output and returns the operation result through the {@link OH_NN_Memory} instance.\n + * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the + * executor and output index value, this method allocates shared memory whose size is specified by length on + * the device associated with a single output and returns the operation result through the {@link OH_NN_Memory} + * instance.\n * * * @param executor Pointer to the {@link OH_NNExecutor} instance. @@ -590,12 +600,12 @@ OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32 /** * @brief Releases the input memory to which the {@link OH_NN_Memory} instance points. * - * This method needs to be called to release the memory instance created by calling {@link OH_NNExecutor_AllocateInputMemory}. - * Otherwise, memory leak will occur. - * The mapping between inputIndex and memory must be the same as that in memory instance creation.\n + * This method needs to be called to release the memory instance created by calling + * {@link OH_NNExecutor_AllocateInputMemory}. Otherwise, memory leak will occur. + * The mapping between inputIndex and memory must be the same as that in memory instance creation.\n * * If memory or *memory is a null pointer, this method only prints warning logs and does not execute - * the release logic.\n + * the release logic.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param inputIndex Input index value, which is in the same sequence of the data input when @@ -616,10 +626,10 @@ void OH_NNExecutor_DestroyInputMemory(OH_NNExecutor *executor, uint32_t inputInd * * This method needs to be called to release the memory instance created by calling {@link OH_NNExecutor_AllocateOutputMemory}. * Otherwise, memory leak will occur. - * The mapping between outputIndex and memory must be the same as that in memory instance creation.\n + * The mapping between outputIndex and memory must be the same as that in memory instance creation.\n * * If memory or *memory is a null pointer, this method only prints warning logs and does not - * execute the release logic.\n + * execute the release logic.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param outputIndex Output index value, which is in the same sequence of the data output when @@ -643,7 +653,7 @@ void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputI * {@link OH_NN_Memory} memory instance. * During computing, the underlying device reads the input data from the shared memory pointed to by the memory instance. * By using this method, concurrent execution of input setting, computing, and read can be implemented to - * improve inference efficiency of a data flow.\n + * improve inference efficiency of a data flow.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param inputIndex Input index value, which is in the same sequence of the data input when @@ -651,7 +661,7 @@ void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputI * Assume that the value of inputIndices is {1, 5, 9} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * When the input shared memory is specified, the index value for the three inputs is {0, 1, 2}. - * + * * @param tensor Pointer to {@link OH_NN_Tensor}, used to set the tensor corresponding to a single input. * @param memory Pointer to {@link OH_NN_Memory}. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. @@ -673,7 +683,7 @@ OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, * When computing is performed, the underlying hardware directly writes the computing result to the shared memory to which * the memory instance points. * By using this method, concurrent execution of input setting, computing, and read can be implemented to improve - * inference efficiency of a data flow.\n + * inference efficiency of a data flow.\n * * @param executor Executor. * @param outputIndex Output Index value, which is in the same sequence of the data output when @@ -696,10 +706,10 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutputWithMemory(OH_NNExecutor *executor, * @brief Destroys an executor instance to release the memory occupied by the executor. * * This method needs to be called to release the executor instance created by calling {@link OH_NNExecutor_Construct}. - * Otherwise, memory leak will occur.\n + * Otherwise, memory leak will occur.\n * * If executor or *executor is a null pointer, this method only prints warning logs and does not - * execute the release logic.\n + * execute the release logic.\n * * @param executor Level-2 pointer to the {@link OH_NNExecutor} instance. * @since 9 @@ -712,17 +722,17 @@ void OH_NNExecutor_Destroy(OH_NNExecutor **executor); * @brief Obtains the ID of the device connected to Neural Network Runtime. * * Each device has a unique and fixed ID in Neural Network Runtime. This method returns device IDs on the current - * device through the uint32_t array.\n + * device through the uint32_t array.\n * * Device IDs are returned through the size_t array. Each element of the array is the ID of a single device. * The array memory is managed by Neural Network Runtime. - * The data pointer is valid before this method is called next time.\n + * The data pointer is valid before this method is called next time.\n * * @param allDevicesID Pointer to the size_t array. The input *allDevicesID must be a null pointer. * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. * * @param deviceCount Pointer of the uint32_t type, which is used to return the length of (*allDevicesID). - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 @@ -733,7 +743,7 @@ OH_NN_ReturnCode OH_NNDevice_GetAllDevicesID(const size_t **allDevicesID, uint32 * @brief Obtains the name of the specified device. * * deviceID specifies the device whose name will be obtained. The device ID needs to be obtained by calling - * {@link OH_NNDevice_GetAllDevicesID}.\n + * {@link OH_NNDevice_GetAllDevicesID}.\n * * @param deviceID Device ID. * @param name Pointer to the char array. The passed (*char) must be a null pointer. Otherwise, @@ -754,7 +764,7 @@ OH_NN_ReturnCode OH_NNDevice_GetName(size_t deviceID, const char **name); * - OH_NN_CPU: CPU device. * - OH_NN_GPU: GPU device. * - OH_NN_ACCELERATOR: machine learning dedicated accelerator. - * - OH_NN_OTHERS: other hardware types.\n + * - OH_NN_OTHERS: other hardware types.\n * * @param deviceID Device ID. * @param deviceType Pointer to the {@link OH_NN_DeviceType} instance. The device type information is returned. diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index 020b6bb5..b8d0288d 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -236,7 +236,7 @@ typedef enum { * * Outputs: * - * * output: sum of input1 and input2. + * * output: sum of input1 and input2. * The data shape is the same as that of the input after broadcasting, * and the data type is the same as that of the input with a higher precision. */ @@ -262,7 +262,7 @@ typedef enum { * The first number indicates the moving step in height, and the second number indicates the moving step * in width. * * padMode: padding mode, which is optional. The value is of the int type and can be 0 (same) - * or 1 (valid). + * or 1 (valid). * The nearest neighbor value is used for padding. * 0 (same): The height and width of the output are the same as those of the input. * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, @@ -419,14 +419,14 @@ typedef enum { * * stride: movement stride of the convolution kernel in height and width. * It is an int array [strideHeight, strideWidth]. * * dilation: dilation size of the convolution kernel in height and width. It is an int array - * [dilationHeight, dilationWidth]. + * [dilationHeight, dilationWidth]. * The value must be greater than or equal to 1 and cannot exceed the height and width of input. - * + * * * padMode: padding mode of input. The value is of the int type and can be 0 (same) * or 1 (valid). * 0 (same): The height and width of the output are the same as those of the input. * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, - * bottom, left, and right if possible. + * bottom, left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. * * 1 (valid): The possible maximum height and width of the output will be returned in case of no @@ -437,7 +437,7 @@ typedef enum { * and less than or equal to in_channel, it is a group convolution. * * activationType is an integer constant which is contained in FuseType. The specified activation * function is called before output. - * + * * * * If the input contains the padList parameter: @@ -452,7 +452,7 @@ typedef enum { * In quantization scenarios, the bias parameter does not require quantization parameters. * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. - * + * * * Parameters: * @@ -494,7 +494,7 @@ typedef enum { * In quantization scenarios, the bias parameter does not require quantization parameters. * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. - * + * * * stride: movement stride of the convolution kernel in height and width. It is an int array * [strideHeight, strideWidth]. * @@ -507,7 +507,7 @@ typedef enum { * 1 (valid). * 0 (same): The height and width of the output are the same as those of the input. * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, - * bottom, left, and right if possible. + * bottom, left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. * The excessive pixels will be discarded. @@ -517,7 +517,7 @@ typedef enum { * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. * It can be a single integer to specify the same value for all spatial dimensions. The amount of output * padding along a dimension must be less than the stride along this dimension. - * + * * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. * @@ -532,7 +532,7 @@ typedef enum { * In quantization scenarios, the bias parameter does not require quantization parameters. * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. - * + * * Parameters: * * * stride: movement stride of the convolution kernel in height and width. It is an int array @@ -547,7 +547,7 @@ typedef enum { * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. * It can be a single integer to specify the same value for all spatial dimensions. The amount of output * padding along a dimension must be less than the stride along this dimension. - * + * * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. * @@ -571,7 +571,7 @@ typedef enum { * In quantization scenarios, the bias parameter does not require quantization parameters. * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. - * + * * * Parameters: * @@ -604,7 +604,7 @@ typedef enum { * In quantization scenarios, the bias parameter does not require quantization parameters. * The quantization version requires data input of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. - * + * * * Parameters: * @@ -707,7 +707,7 @@ typedef enum { * this parameter. * If quantization is required, the data must be of the OH_NN_INT32 type. * The actual quantization parameters are determined by input and weight. - * + * * * Parameters: * @@ -856,7 +856,7 @@ typedef enum { * bottom, left, and right if possible. * Otherwise, the last additional padding will be completed from the bottom and right. * - * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. * The excessive pixels will be discarded. * * activationType is an integer constant which is contained in FuseType. * The specified activation function is called before output. @@ -1217,12 +1217,12 @@ typedef enum { * * Parameters: * - * * beginMask: an integer used to mask begin. beginMask is represented in binary code. + * * beginMask: an integer used to mask begin. beginMask is represented in binary code. * In case of binary(beginMask)[i]==1, for the ith dimension, elements are sliced from the first * element at strides[i] until the end[i]-1 element. * - * * endMask: an integer used to mask end. endMask is represented in binary code. - * In case of binary(endMask)[i]==1, elements are sliced from the element at the begin[i] position + * * endMask: an integer used to mask end. endMask is represented in binary code. + * In case of binary(endMask)[i]==1, elements are sliced from the element at the begin[i] position * in the ith dimension until the tensor boundary at strides[i]. * * * ellipsisMask: integer used to mask begin and end. ellipsisMask is represented @@ -1231,12 +1231,12 @@ typedef enum { * in the ith dimension until the tensor boundary. Only one bit of binary(ellipsisMask) can be * a non-zero value. * - * * newAxisMask: new dimension, which is an integer. newAxisMask is represented in binary code. + * * newAxisMask: new dimension, which is an integer. newAxisMask is represented in binary code. * In case of binary(newAxisMask)[i]==1, a new dimension whose length is 1 is inserted into the * ith dimension. * * shrinkAxisMask: shrinking dimension, which is an integer. * shrinkAxisMask is represented * in binary code. - * In the case of binary(shrinkAxisMask)[i]==1, all elements in the ith dimension will be discarded, + * In the case of binary(shrinkAxisMask)[i]==1, all elements in the ith dimension will be discarded, * and the length of the ith dimension is shrunk to 1. * * @@ -1296,7 +1296,7 @@ typedef enum { * Outputs: * * An m-dimensional tensor whose TensorType is the same as that of the input. If input and * multiples have the same length, input and output have the same number of dimensions. - * If the length of multiples is greater than n, 1 is used to fill the input dimension, + * If the length of multiples is greater than n, 1 is used to fill the input dimension, * and then the input is copied in each dimension the specified times to obtain the m-dimensional tensor. * * @@ -1402,12 +1402,11 @@ typedef enum { * Inputs: * * * input: n-dimensional tensor. If n is greater than or equal to 2, - * inputX must be [BatchSize, ..., Channels]. + * inputX must be [BatchSize, ..., Channels]. * The second dimension is the number of channels. * * weight: 1D tensor. The length of weight must be 1 or equal to the number of channels. - * If the length of weight is 1, - * all channels share the same weight. - * If the length of weight is equal to the number of channels, each channel exclusively has a weight. + * If the length of weight is 1, all channels share the same weight. + * If the length of weight is equal to the number of channels, each channel exclusively has a weight. * If n is less than 2 for inputX, the weight length must be 1. * * Outputs: @@ -1584,7 +1583,7 @@ typedef enum { /** * Gaussian error linear unit activation function. The int quantization input is not supported. - * output=0.5∗input∗(1+tanh(input/2)) + * output=0.5∗input∗(1+tanh(input/2)) * * Inputs: * * An n-dimensional input tensor. @@ -1902,7 +1901,7 @@ typedef struct OH_NN_UInt32Array { q = clamp(round(\frac{r}{s}+z), q_{min}, q_{max}) \f] * s and z are quantization parameters, which are stored by scale and zeroPoint in - * {@link OH_NN_QuantParam}. + * {@link OH_NN_QuantParam}. * r is a floating point number, q is the quantization result, q_min is the lower bound of the quantization result, * and q_max is an upper bound of a quantization result. The calculation method is as follows: * diff --git a/en/native_sdk/usb/usb_ddk_api.h b/en/native_sdk/usb/usb_ddk_api.h index 274172fb..f785a144 100644 --- a/en/native_sdk/usb/usb_ddk_api.h +++ b/en/native_sdk/usb/usb_ddk_api.h @@ -201,7 +201,8 @@ int32_t OH_Usb_SendControlWriteRequest(uint64_t interfaceHandle, const struct Us int32_t OH_Usb_SendPipeRequest(const struct UsbRequestPipe *pipe, UsbDeviceMemMap *devMmap); /** - * @brief Creates a buffer. To avoid memory leakage, use {@link OH_Usb_DestroyDeviceMemMap} to destroy a buffer after use. + * @brief Creates a buffer. To avoid memory leakage, use {@link OH_Usb_DestroyDeviceMemMap} to + * destroy a buffer after use. * * @permission ohos.permission.ACCESS_DDK_USB * @param deviceId ID of the device for which the buffer is to be created. diff --git a/en/native_sdk/usb/usb_ddk_types.h b/en/native_sdk/usb/usb_ddk_types.h index 2d8163d4..714ccc52 100644 --- a/en/native_sdk/usb/usb_ddk_types.h +++ b/en/native_sdk/usb/usb_ddk_types.h @@ -32,7 +32,7 @@ * * @brief Provides the enumerated variables, structures, and macros used in USB DDK APIs. * - * File to include: <usb/usb_ddk_types.h> + * File to include: <usb/usb_ddk_types.h> * @library libusb_ndk.z.so * @since 10 * @version 1.0 -- Gitee From 286e9955b8199842f472782eb019b3f7aae9ca39 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 20 Oct 2023 16:05:40 +0800 Subject: [PATCH 0045/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/context.h | 8 +- .../neural_network_runtime.h | 89 +++++++++++-------- .../neural_network_runtime_type.h | 16 ++-- 3 files changed, 62 insertions(+), 51 deletions(-) diff --git a/en/native_sdk/ai/mindspore/context.h b/en/native_sdk/ai/mindspore/context.h index 766a0c6a..7526719a 100644 --- a/en/native_sdk/ai/mindspore/context.h +++ b/en/native_sdk/ai/mindspore/context.h @@ -17,16 +17,16 @@ /** * @addtogroup MindSpore * @{ - * + * * @brief Provides APIs related to MindSpore Lite model inference. - * + * * @Syscap SystemCapability.Ai.MindSpore * @since 9 */ /** * @file context.h - * + * * @brief Provides **Context** APIs for configuring runtime information. * * @library libmindspore_lite_ndk.so @@ -45,7 +45,7 @@ extern "C" { #endif /** - * @brief Defines the pointer to the MindSpore context. + * @brief Defines the pointer to the MindSpore context. * * @since 9 */ diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index 0895c1b0..dea0f616 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -183,7 +183,8 @@ OH_NN_ReturnCode OH_NNModel_SpecifyInputsAndOutputs(OH_NNModel *model, * * @param model Pointer to the {@link OH_NNModel} instance. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -223,7 +224,7 @@ void OH_NNModel_Destroy(OH_NNModel **model); * @param deviceID Device ID to be queried, which can be obtained by using {@link OH_NNDevice_GetAllDevicesID}. * @param isSupported Pointer to the bool array. When this method is called, (*isSupported) must be a null pointer. * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. - * + * * @param opCount Number of operators in a model instance, corresponding to the length of the (*isSupported) array. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, @@ -242,8 +243,8 @@ OH_NN_ReturnCode OH_NNModel_GetAvailableOperations(OH_NNModel *model, * @brief Creates a compilation instance of the {@link OH_NNCompilation} type. * * After the OH_NNModel module completes model construction, APIs provided by the OH_NNCompilation module pass the model - * to underlying device for compilation. This method creates a {@link OH_NNCompilation} instance - * based on the passed {@link OH_NNModel} instance. The {@link OH_NNCompilation_SetDevice} method is called + * to underlying device for compilation. This method creates a {@link OH_NNCompilation} instance + * based on the passed {@link OH_NNModel} instance. The {@link OH_NNCompilation_SetDevice} method is called * to set the device to compile on, and {@link OH_NNCompilation_Build} is then called to complete compilation.\n * * In addition to computing device selection, the OH_NNCompilation module supports features such as model caching, @@ -313,7 +314,8 @@ OH_NN_ReturnCode OH_NNCompilation_SetDevice(OH_NNCompilation *compilation, size_ * the cachePath directory. You are advised to use a separate cache directory for each model. * @param version Cache version. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -411,8 +413,8 @@ OH_NN_ReturnCode OH_NNCompilation_Build(OH_NNCompilation *compilation); * If compilation or *compilation is a null pointer, this method only prints warning logs and * does not execute the release logic.\n * - * @param compilation Level-2 pointer to the {@link OH_NNCompilation} instance. After a compilation instance is destroyed, - * this method sets *compilation to a null pointer. + * @param compilation Level-2 pointer to the {@link OH_NNCompilation} instance. After a compilation instance is + * destroyed, this method sets *compilation to a null pointer. * @since 9 * @version 1.0 */ @@ -423,11 +425,12 @@ void OH_NNCompilation_Destroy(OH_NNCompilation **compilation); * @brief Creates an executor instance of the {@link OH_NNExecutor} type. * * This method constructs a model inference executor associated with the device based on the passed compiler. - * Use {@link OH_NNExecutor_SetInput} to set the model input data. After the input data is set, call {@link OH_NNExecutor_Run} - * to perform inference and then call {@link OH_NNExecutor_SetOutput} to obtain the computing result.\n + * Use {@link OH_NNExecutor_SetInput} to set the model input data. After the input data is set, call + * {@link OH_NNExecutor_Run} to perform inference and then call {@link OH_NNExecutor_SetOutput} to obtain the + * computing result.\n * - * After calling this method to create the {@link OH_NNExecutor} instance, you can release the {@link OH_NNCompilation} - * instance if you do not need to create any other executors.\n + * After calling this method to create the {@link OH_NNExecutor} instance, you can release the + * {@link OH_NNCompilation} instance if you do not need to create any other executors.\n * * @param compilation Pointer to the {@link OH_NNCompilation} instance. * @return Pointer to a {@link OH_NNExecutor} instance. @@ -439,22 +442,23 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); /** * @brief Sets the single input data for a model. * - * This method copies the data whose length is specified by length (in bytes) in dataBuffer to the shared memory + * This method copies the data whose length is specified by length (in bytes) in dataBuffer to the shared memory * of the underlying device. inputIndex specifies the input to be set and tensor sets information * such as the input shape, type, and quantization parameters.\n * * - * Neural Network Runtime supports models with dynamical shape input. For fixed shape input and dynamic shape input scenarios, + * Neural Network Runtime supports models with dynamical shape input. For fixed shape input and dynamic shape input scenarios, * this method uses different processing policies. * * - Fixed shape input: The attributes of tensor must be the same as those of the tensor added by calling * {@link OH_NNModel_AddTensor} in the composition phase. - * - Dynamic shape input: In the composition phase, because the shape is not fixed, each value in tensor.dimensions - * must be greater than 0 in the method calls to determine the shape input in the calculation phase. - * When setting the shape, you can modify only the dimension whose value is -1. Assume that [-1, 224, 224, 3] - * is input as the the dimension of A in the composition phase. - * When this method is called, only the size of the first dimension can be modified, for example, to [3, 224, 224, 3]. - * If other dimensions are adjusted, {@link OH_NN_INVALID_PARAMETER} is returned.\n + * - Dynamic shape input: In the composition phase, because the shape is not fixed, each value in + * tensor.dimensions must be greater than 0 in the method calls to determine the shape input in the + * calculation phase. + * When setting the shape, you can modify only the dimension whose value is -1. Assume that + * [-1, 224, 224, 3] is input as the the dimension of A in the composition phase. + * When this method is called, only the size of the first dimension can be modified, for example, to + * [3, 224, 224, 3]. If other dimensions are adjusted, {@link OH_NN_INVALID_PARAMETER} is returned.\n * * * @@ -462,14 +466,16 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param inputIndex Input index value, which is in the same sequence of the data input when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of inputIndices is {1, 5, 9} when {@link OH_NNModel_SpecifyInputsAndOutputs} - * is called. In input settings, the index value for the three inputs is {0, 1, 2}. + * Assume that the value of inputIndices is {1, 5, 9} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. In input settings, the index value for the + * three inputs is {0, 1, 2}. * * @param tensor Sets the tensor corresponding to the input data. * @param dataBuffer Pointer to the input data. * @param length Length of the data buffer, in bytes. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -499,13 +505,15 @@ OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param outputIndex Output Index value, which is in the same sequence of the data output when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that the value of outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} - * is called. In output buffer settings, the index value for the three outputs is {0, 1, 2}. + * Assume that the value of outputIndices is {4, 6, 8} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. In output buffer settings, the index value for the + * three outputs is {0, 1, 2}. * * @param dataBuffer Pointer to the output data. * @param length Length of the data buffer, in bytes. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, - * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -517,8 +525,9 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, /** * @brief Obtains the dimension information about the output tensor. * - * After {@link OH_NNExecutor_Run} is called to complete a single inference, call this method to obtain the specified output dimension - * information and number of dimensions. It is commonly used in dynamic shape input and output scenarios.\n + * After {@link OH_NNExecutor_Run} is called to complete a single inference, call this method to obtain the specified + * output dimension information and number of dimensions. It is commonly used in dynamic shape input and output + * scenarios.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param outputIndex Output Index value, which is in the same sequence of the data output when @@ -527,7 +536,8 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, * When {@link OH_NNExecutor_GetOutputShape} is called to obtain dimension information about the output tensor, * outputIndices is {0, 1, 2}. * - * @param shape Pointer to the int32_t array. The value of each element in the array is the length of the output tensor in each dimension. + * @param shape Pointer to the int32_t array. The value of each element in the array is the length of the output tensor in + * each dimension. * @param shapeLength Pointer to the uint32_t type. The number of output dimensions is returned. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. @@ -546,7 +556,8 @@ OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ @@ -614,8 +625,8 @@ OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32 * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * In memory input release, the index value for the three inputs is {0, 1, 2}. * - * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, this method sets - * *memory to a null pointer. + * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, + * this method sets *memory to a null pointer. * @since 9 * @version 1.0 */ @@ -624,8 +635,8 @@ void OH_NNExecutor_DestroyInputMemory(OH_NNExecutor *executor, uint32_t inputInd /** * @brief Releases the output memory to which the {@link OH_NN_Memory} instance points. * - * This method needs to be called to release the memory instance created by calling {@link OH_NNExecutor_AllocateOutputMemory}. - * Otherwise, memory leak will occur. + * This method needs to be called to release the memory instance created by calling + * {@link OH_NNExecutor_AllocateOutputMemory}. Otherwise, memory leak will occur. * The mapping between outputIndex and memory must be the same as that in memory instance creation.\n * * If memory or *memory is a null pointer, this method only prints warning logs and does not @@ -680,8 +691,8 @@ OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, * * In scenarios where memory needs to be managed by yourself, this method binds the execution output to * the {@link OH_NN_Memory} memory instance. - * When computing is performed, the underlying hardware directly writes the computing result to the shared memory to which - * the memory instance points. + * When computing is performed, the underlying hardware directly writes the computing result to the shared memory to + * which the memory instance points. * By using this method, concurrent execution of input setting, computing, and read can be implemented to improve * inference efficiency of a data flow.\n * @@ -691,7 +702,7 @@ OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, * Assume that the value of outputIndices is {4, 6, 8} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * When output shared memory is specified, the index value for the three outputs is {0, 1, 2}. - * + * * @param memory Pointer to {@link OH_NN_Memory}. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. @@ -733,7 +744,7 @@ void OH_NNExecutor_Destroy(OH_NNExecutor **executor); * * @param deviceCount Pointer of the uint32_t type, which is used to return the length of (*allDevicesID). * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index b8d0288d..63ba6493 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -331,8 +331,8 @@ typedef enum { * * Parameters: * - * * input: input tensor. The dimension will be divided into small blocks, and these blocks will be interleaved - * into the spatial dimension. + * * input: input tensor. The dimension will be divided into small blocks, and these blocks will be + * interleaved into the spatial dimension. * * Outputs: * @@ -1154,8 +1154,8 @@ typedef enum { * * * output: square of the difference between two inputs. The output shape is determined by * input1 and input2. If they have the same shape, the output tensor has the same shape as them. - * If they have different shapes, perform the broadcast operation on input1 and input2 and perform - * subtraction. + * If they have different shapes, perform the broadcast operation on input1 and input2 and + * perform subtraction. * TensorType of the output is the same as that of the input tensor with higher precision. */ OH_NN_OPS_SQUARED_DIFFERENCE = 34, @@ -1226,7 +1226,7 @@ typedef enum { * in the ith dimension until the tensor boundary at strides[i]. * * * ellipsisMask: integer used to mask begin and end. ellipsisMask is represented - * in binary code. + * in binary code. * In case of binary(ellipsisMask)[i]==1, elements are sliced from the first element at strides[i] * in the ith dimension until the tensor boundary. Only one bit of binary(ellipsisMask) can be * a non-zero value. @@ -1265,8 +1265,8 @@ typedef enum { * * output: difference between the two tensors. The output shape is determined byinput1 * and input2. * If they have the same shape, the output tensor has the same shape as them. - * If they have different shapes, perform the broadcast operation on input1 and input2 and perform - * subtraction. + * If they have different shapes, perform the broadcast operation on input1 and input2 and + * perform subtraction. * TensorType of the output is the same as that of the input tensor with higher precision. */ OH_NN_OPS_SUB = 38, @@ -1489,7 +1489,7 @@ typedef enum { OH_NN_OPS_REDUCE_PROD = 50, /** - * Operates the logical OR in the specified dimension. If keepDims is set to false, + * Operates the logical OR in the specified dimension. If keepDims is set to false, * the number of dimensions is reduced for the input; if keepDims is set to true, * the number of dimensions is retained. * -- Gitee From 8a94d4d4e7cc74f9ce4db64165caea65c986ea42 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 20 Oct 2023 16:32:30 +0800 Subject: [PATCH 0046/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/context.h | 2 +- .../neural_network_runtime.h | 45 ++++++++++--------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/en/native_sdk/ai/mindspore/context.h b/en/native_sdk/ai/mindspore/context.h index 7526719a..cd4f59ca 100644 --- a/en/native_sdk/ai/mindspore/context.h +++ b/en/native_sdk/ai/mindspore/context.h @@ -114,7 +114,7 @@ OH_AI_API int OH_AI_ContextGetThreadAffinityMode(const OH_AI_ContextHandle conte /** * @brief Sets the list of CPU cores bound to a runtime thread. - * + * * For example, if **core_list** is set to **[2,6,8]**, threads run on the 2nd, 6th, and 8th CPU cores. * If {@link OH_AI_ContextSetThreadAffinityMode} and {@link OH_AI_ContextSetThreadAffinityCoreList} are called for * the same context object, the **core_list** parameter of {@link OH_AI_ContextSetThreadAffinityCoreList} diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index dea0f616..894db513 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -242,8 +242,8 @@ OH_NN_ReturnCode OH_NNModel_GetAvailableOperations(OH_NNModel *model, /** * @brief Creates a compilation instance of the {@link OH_NNCompilation} type. * - * After the OH_NNModel module completes model construction, APIs provided by the OH_NNCompilation module pass the model - * to underlying device for compilation. This method creates a {@link OH_NNCompilation} instance + * After the OH_NNModel module completes model construction, APIs provided by the OH_NNCompilation module pass the + * model to underlying device for compilation. This method creates a {@link OH_NNCompilation} instance * based on the passed {@link OH_NNModel} instance. The {@link OH_NNCompilation_SetDevice} method is called * to set the device to compile on, and {@link OH_NNCompilation_Build} is then called to complete compilation.\n * @@ -442,19 +442,19 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); /** * @brief Sets the single input data for a model. * - * This method copies the data whose length is specified by length (in bytes) in dataBuffer to the shared memory - * of the underlying device. inputIndex specifies the input to be set and tensor sets information + * This method copies the data whose length is specified by length (in bytes) in dataBuffer to the shared + * memory of the underlying device. inputIndex specifies the input to be set and tensor sets information * such as the input shape, type, and quantization parameters.\n * * - * Neural Network Runtime supports models with dynamical shape input. For fixed shape input and dynamic shape input scenarios, - * this method uses different processing policies. + * Neural Network Runtime supports models with dynamical shape input. For fixed shape input and dynamic shape input + * scenarios, this method uses different processing policies. * - * - Fixed shape input: The attributes of tensor must be the same as those of the tensor added by calling - * {@link OH_NNModel_AddTensor} in the composition phase. + * - Fixed shape input: The attributes of tensor must be the same as those of the tensor added by + * calling {@link OH_NNModel_AddTensor} in the composition phase. * - Dynamic shape input: In the composition phase, because the shape is not fixed, each value in - * tensor.dimensions must be greater than 0 in the method calls to determine the shape input in the - * calculation phase. + * tensor.dimensions must be greater than 0 in the method calls to determine the shape input + * in the calculation phase. * When setting the shape, you can modify only the dimension whose value is -1. Assume that * [-1, 224, 224, 3] is input as the the dimension of A in the composition phase. * When this method is called, only the size of the first dimension can be modified, for example, to @@ -467,8 +467,8 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); * @param inputIndex Input index value, which is in the same sequence of the data input when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of inputIndices is {1, 5, 9} when - * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. In input settings, the index value for the - * three inputs is {0, 1, 2}. + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. In input settings, the index value + * for the three inputs is {0, 1, 2}. * * @param tensor Sets the tensor corresponding to the input data. * @param dataBuffer Pointer to the input data. @@ -496,7 +496,7 @@ OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, * based on the actual situation.\n * * - * - If the buffer length is greater than or equal to the data length, the inference result is copied to the buffer and + * - If the buffer length is greater than or equal to the data length, the inference result is copied to the buffer and * {@link OH_NN_SUCCESS} is returned. You can read the inference result from dataBuffer. * - If the buffer length is smaller than the data length, {@link OH_NNExecutor_Run} returns {@link OH_NN_INVALID_PARAMETER} * and generates a log indicating that the buffer is too small.\n @@ -506,8 +506,8 @@ OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, * @param outputIndex Output Index value, which is in the same sequence of the data output when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of outputIndices is {4, 6, 8} when - * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. In output buffer settings, the index value for the - * three outputs is {0, 1, 2}. + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. In output buffer settings, the index value + * for the three outputs is {0, 1, 2}. * * @param dataBuffer Pointer to the output data. * @param length Length of the data buffer, in bytes. @@ -536,8 +536,8 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, * When {@link OH_NNExecutor_GetOutputShape} is called to obtain dimension information about the output tensor, * outputIndices is {0, 1, 2}. * - * @param shape Pointer to the int32_t array. The value of each element in the array is the length of the output tensor in - * each dimension. + * @param shape Pointer to the int32_t array. The value of each element in the array is the length of the output tensor + * in each dimension. * @param shapeLength Pointer to the uint32_t type. The number of output dimensions is returned. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. @@ -576,7 +576,8 @@ OH_NN_ReturnCode OH_NNExecutor_Run(OH_NNExecutor *executor); * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of inputIndices is {1, 5, 9} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In the memory input application, the index value for the three inputs is {0, 1, 2}. + * In the memory input application, the index value for the three inputs is + * {0, 1, 2}. * * @param length Memory size to be applied for, in bytes. * @return Pointer to a {@link OH_NN_Memory} instance. @@ -623,7 +624,8 @@ OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32 * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of inputIndices is {1, 5, 9} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In memory input release, the index value for the three inputs is {0, 1, 2}. + * In memory input release, the index value for the three inputs is + * {0, 1, 2}. * * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, * this method sets *memory to a null pointer. @@ -671,7 +673,8 @@ void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputI * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of inputIndices is {1, 5, 9} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * When the input shared memory is specified, the index value for the three inputs is {0, 1, 2}. + * When the input shared memory is specified, the index value for the three inputs is + * {0, 1, 2}. * * @param tensor Pointer to {@link OH_NN_Tensor}, used to set the tensor corresponding to a single input. * @param memory Pointer to {@link OH_NN_Memory}. @@ -771,7 +774,7 @@ OH_NN_ReturnCode OH_NNDevice_GetName(size_t deviceID, const char **name); * @brief Obtains the type information of the specified device. * * deviceID specifies the device whose type will be obtained. Currently, Neural Network Runtime supports the - * following device types: + * following device types:\n * - OH_NN_CPU: CPU device. * - OH_NN_GPU: GPU device. * - OH_NN_ACCELERATOR: machine learning dedicated accelerator. -- Gitee From 6524e127f8f4b196145c992e78b38f2658096f9a Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Mon, 23 Oct 2023 18:03:13 +0800 Subject: [PATCH 0047/2135] update docs Signed-off-by: Annie_wang --- en/native_sdk/database/rdb/oh_cursor.h | 2 +- en/native_sdk/database/rdb/oh_predicates.h | 2 +- en/native_sdk/database/rdb/oh_value_object.h | 12 ++- en/native_sdk/database/rdb/oh_values_bucket.h | 2 +- en/native_sdk/database/rdb/relational_store.h | 4 +- .../rdb/relational_store_error_code.h | 100 +++++++++--------- 6 files changed, 63 insertions(+), 59 deletions(-) diff --git a/en/native_sdk/database/rdb/oh_cursor.h b/en/native_sdk/database/rdb/oh_cursor.h index ead52a92..7eeb8d68 100644 --- a/en/native_sdk/database/rdb/oh_cursor.h +++ b/en/native_sdk/database/rdb/oh_cursor.h @@ -35,7 +35,7 @@ * @brief Provides methods to access the result set obtained by querying an RDB store. * * A result set is a set of results returned by query(). - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/en/native_sdk/database/rdb/oh_predicates.h b/en/native_sdk/database/rdb/oh_predicates.h index 243461ef..ed900b1b 100644 --- a/en/native_sdk/database/rdb/oh_predicates.h +++ b/en/native_sdk/database/rdb/oh_predicates.h @@ -33,7 +33,7 @@ * @file oh_predicates.h * * @brief Represents a predicate for a relational database (RDB). - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/en/native_sdk/database/rdb/oh_value_object.h b/en/native_sdk/database/rdb/oh_value_object.h index 5c9f6e74..621ef04b 100644 --- a/en/native_sdk/database/rdb/oh_value_object.h +++ b/en/native_sdk/database/rdb/oh_value_object.h @@ -56,8 +56,9 @@ typedef struct OH_VObject { * * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. * @param value Indicates the pointer to the value or array to convert. - * @param count Indicates the number or length of the parameters to convert. If value points to a single - * parameter, count is 1. If value points to an array, count specifies the array length. + * @param count Indicates the number or length of the parameters to convert. + * If value points to a single parameter, count is 1. + * If value points to an array, count specifies the length of the array. * @return Returns the operation result. If the operation fails, an error code is returned. * @see OH_VObject. * @since 10 @@ -69,8 +70,9 @@ typedef struct OH_VObject { * * @param valueObject Indicates the pointer to the {@link OH_VObject} instance. * @param value Indicates the pointer to the double value or array to convert. - * @param count Indicates the number or length of the parameters to convert. If value points to a single - * parameter, count is 1. If value points to an array, count specifies the array length. + * @param count Indicates the number or length of the parameters to convert. + * If value points to a single parameter, count is 1. + * If value points to an array, count specifies the length of the array. * @return Returns the operation result. If the operation fails, an error code is returned. * @see OH_VObject. * @since 10 @@ -108,7 +110,7 @@ typedef struct OH_VObject { * @see OH_VObject. * @since 10 */ - int (*destroy)(OH_VObject *valueObject); + int (*destroyValueObject)(OH_VObject *valueObject); } OH_VObject; #ifdef __cplusplus diff --git a/en/native_sdk/database/rdb/oh_values_bucket.h b/en/native_sdk/database/rdb/oh_values_bucket.h index 2b056383..67486b26 100644 --- a/en/native_sdk/database/rdb/oh_values_bucket.h +++ b/en/native_sdk/database/rdb/oh_values_bucket.h @@ -33,7 +33,7 @@ * @file oh_values_bucket.h * * @brief Defines the types of the key and value in a key-value (KV) pair. - * + * @library native_rdb_ndk_header.so * @since 10 */ diff --git a/en/native_sdk/database/rdb/relational_store.h b/en/native_sdk/database/rdb/relational_store.h index f0d22418..bd3873ce 100644 --- a/en/native_sdk/database/rdb/relational_store.h +++ b/en/native_sdk/database/rdb/relational_store.h @@ -34,7 +34,7 @@ * @file relational_store.h * * @brief Provides methods for managing relational database (RDB) stores. - * + * @library native_rdb_ndk_header.so * @since 10 */ @@ -90,6 +90,8 @@ typedef struct { int selfSize; /** Database file path. */ const char *dataBaseDir; + /** RDB store name. */ + const char *storeName; /** Application bundle name. */ const char *bundleName; /** Application module name. */ diff --git a/en/native_sdk/database/rdb/relational_store_error_code.h b/en/native_sdk/database/rdb/relational_store_error_code.h index 71d32aa4..8f26a7b2 100644 --- a/en/native_sdk/database/rdb/relational_store_error_code.h +++ b/en/native_sdk/database/rdb/relational_store_error_code.h @@ -34,7 +34,7 @@ * @file relational_store_error_code.h * * @brief Declares the error code information about a relational database (RDB) store. - * + * @library native_rdb_ndk_header.so * @since 10 */ @@ -59,22 +59,22 @@ typedef enum OH_Rdb_ErrCode { RDB_OK = 0, /** - * Error code base. + * @brief Error code base. */ E_BASE = 14800000, /** - * Capability not supported. + * @brief Capability not supported. */ RDB_E_NOT_SUPPORTED = 801, /** - * Error codes for common exceptions. + * @brief Error codes for common exceptions. */ RDB_E_ERROR = E_BASE, /** - * Invalid parameter. + * @brief Invalid parameter. */ RDB_E_INVALID_ARGS = (E_BASE + 1), @@ -84,227 +84,227 @@ typedef enum OH_Rdb_ErrCode { RDB_E_CANNOT_UPDATE_READONLY = (E_BASE + 2), /** - * Failed to delete the file. + * @brief Failed to delete the file. */ RDB_E_REMOVE_FILE = (E_BASE + 3), /** - * The table name is empty. + * @brief The table name is empty. */ RDB_E_EMPTY_TABLE_NAME = (E_BASE + 5), /** - * The KV pair is empty. + * @brief The KV pair is empty. */ RDB_E_EMPTY_VALUES_BUCKET = (E_BASE + 6), /** - * Failed to execute the SQL statement for query. + * @brief Failed to execute the SQL statement for query. */ RDB_E_EXECUTE_IN_STEP_QUERY = (E_BASE + 7), /** - * Invalid column index. + * @brief Invalid column index. */ RDB_E_INVALID_COLUMN_INDEX = (E_BASE + 8), /** - * Invalid column type. + * @brief Invalid column type. */ RDB_E_INVALID_COLUMN_TYPE = (E_BASE + 9), /** - * The file name is empty. + * @brief The file name is empty. */ RDB_E_EMPTY_FILE_NAME = (E_BASE + 10), /** - * Invalid file path. + * @brief Invalid file path. */ RDB_E_INVALID_FILE_PATH = (E_BASE + 11), /** - * Failed to start the transaction. + * @brief Failed to start the transaction. */ RDB_E_TRANSACTION_IN_EXECUTE = (E_BASE + 12), /** - * Failed to precompile the SQL statement. + * @brief Failed to precompile the SQL statement. */ RDB_E_INVALID_STATEMENT = (E_BASE + 13), /** - * Failed to write data in a read connection. + * @brief Failed to write data in a read connection. */ RDB_E_EXECUTE_WRITE_IN_READ_CONNECTION = (E_BASE + 14), /** - * Failed to start the transaction in a read connection. + * @brief Failed to start the transaction in a read connection. */ RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTION = (E_BASE + 15), /** - * The transaction to start does not exist in the database session. + * @brief The transaction to start does not exist in the database session. */ RDB_E_NO_TRANSACTION_IN_SESSION = (E_BASE + 16), /** - * Failed to execute multiple queries a database session. + * @brief Failed to execute multiple queries a database session. */ RDB_E_MORE_STEP_QUERY_IN_ONE_SESSION = (E_BASE + 17), /** - * The result set does not contain any record. + * @brief The result set does not contain any record. */ RDB_E_NO_ROW_IN_QUERY = (E_BASE + 18), /** - * The number of bound parameters in the SQL statement is invalid. + * @brief The number of bound parameters in the SQL statement is invalid. */ RDB_E_INVALID_BIND_ARGS_COUNT = (E_BASE + 19), /** - * Invalid object type. + * @brief Invalid object type. */ RDB_E_INVALID_OBJECT_TYPE = (E_BASE + 20), /** - * Invalid conflict resolution type. + * @brief Invalid conflict resolution type. */ RDB_E_INVALID_CONFLICT_FLAG = (E_BASE + 21), /** - * The HAVING keyword can be used only after GROUP BY. + * @brief The HAVING keyword can be used only after GROUP BY. */ RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BY = (E_BASE + 22), /** - * The result set in step format is not supported. + * @brief The result set in step format is not supported. */ RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SET = (E_BASE + 23), /** - * Failed to query the result set. + * @brief Failed to query the result set. */ RDB_E_STEP_RESULT_SET_CROSS_THREADS = (E_BASE + 24), /** - * The result set query statement is not executed. + * @brief The result set query statement is not executed. */ RDB_E_STEP_RESULT_QUERY_NOT_EXECUTED = (E_BASE + 25), /** - * The cursor is already in the last row of the result set. + * @brief The cursor is already in the last row of the result set. */ RDB_E_STEP_RESULT_IS_AFTER_LAST = (E_BASE + 26), /** - * The number of result set query times exceeds the limit. + * @brief The number of result set query times exceeds the limit. */ RDB_E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 27), /** - * The SQL statement is not precompiled. + * @brief The SQL statement is not precompiled. */ RDB_E_STATEMENT_NOT_PREPARED = (E_BASE + 28), /** - * Incorrect database execution result. + * @brief Incorrect database execution result. */ RDB_E_EXECUTE_RESULT_INCORRECT = (E_BASE + 29), /** - * The result set is closed. + * @brief The result set is closed. */ RDB_E_STEP_RESULT_CLOSED = (E_BASE + 30), /** - * Relative path. + * @brief Relative path. */ RDB_E_RELATIVE_PATH = (E_BASE + 31), /** - * The new encrypt key file is empty. + * @brief The new encrypt key file is empty. */ RDB_E_EMPTY_NEW_ENCRYPT_KEY = (E_BASE + 32), /** - * The RDB store is non-encrypted, which is cannot be changed. + * @brief The RDB store is non-encrypted, which is cannot be changed. */ RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 33), /** - * The database does not respond when the database key is updated. + * @brief The database does not respond when the database key is updated. */ RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSY = (E_BASE + 34), /** - * The precompiled SQL statement is not initialized. + * @brief The precompiled SQL statement is not initialized. */ RDB_E_STEP_STATEMENT_NOT_INIT = (E_BASE + 35), /** - * The WAL mode does not support the ATTACH operation. + * @brief The WAL mode does not support the ATTACH operation. */ RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE = (E_BASE + 36), /** - * Failed to create the folder. + * @brief Failed to create the folder. */ RDB_E_CREATE_FOLDER_FAIL = (E_BASE + 37), /** - * Failed to build the SQL statements. + * @brief Failed to build the SQL statements. */ RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 38), /** - * The database session does not provide a connection. + * @brief The database session does not provide a connection. */ RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY = (E_BASE + 39), /** - * The transaction does not exist in the database session. + * @brief The transaction does not exist in the database session. */ RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40), /** - * The current operation is not supported. + * @brief The current operation is not supported. */ RDB_E_NOT_SUPPORT = (E_BASE + 41), /** - * Invalid PARCEL. + * @brief Invalid PARCEL. */ RDB_E_INVALID_PARCEL = (E_BASE + 42), /** - * Failed to execute query. + * @brief Failed to execute query. */ RDB_E_QUERY_IN_EXECUTE = (E_BASE + 43), /** - * Failed to set the persistence of the database file in WAL mode. + * @brief Failed to set the persistence of the database file in WAL mode. */ RDB_E_SET_PERSIST_WAL = (E_BASE + 44), /** - * The database does not exist. + * @brief The database does not exist. */ RDB_E_DB_NOT_EXIST = (E_BASE + 45), /** - * The number of read connections to set is greater than the limit. + * @brief The number of read connections to set is greater than the limit. */ RDB_E_ARGS_READ_CON_OVERLOAD = (E_BASE + 46), /** - * The WAL log file size exceeds the default value. + * @brief The WAL log file size exceeds the default value. */ RDB_E_WAL_SIZE_OVER_LIMIT = (E_BASE + 47), /** - * The number of database connections has reached the limit. + * @brief The number of database connections has reached the limit. */ RDB_E_CON_OVER_LIMIT = (E_BASE + 48) } OH_Rdb_ErrCode; -- Gitee From d67e15406ae81c4d48fff6a30039fb1966259e70 Mon Sep 17 00:00:00 2001 From: xujie Date: Tue, 24 Oct 2023 14:07:28 +0800 Subject: [PATCH 0048/2135] update dns api Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 114 ++++++- .../native_sdk/net/dns/native_net_conn_type.h | 284 ++++++++++++++++++ 2 files changed, 397 insertions(+), 1 deletion(-) create mode 100644 zh-cn/native_sdk/net/dns/native_net_conn_type.h diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 14095ef6..f999c930 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -79,9 +79,121 @@ int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, st */ int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); +/** + * @brief 查询是否有默认激活的数据网络 + * + * @param hasDefaultNet 是否有默认网络 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_HasDefaultNet(int32_t *hasDefaultNet); + +/** + * @brief 获取激活的默认的数据网络 + * + * @param netHandle 存放网络ID + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetDefaultNet(OH_NetConn_NetHandle *netHandle); + +/** + * @brief 查询默认数据网络是否记流量 + * + * @param isMetered 是否激活 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_IsDefaultNetMetered(int32_t *isMetered); + +/** + * @brief 查询所有激活的数据网络 + * + * @param netHandleList 网络信息列表 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); + +/** + * @brief 查询某个数据网络的链路信息 + * + * @param netHandle 存放网络ID + * @param info 存放链路信息 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetConnectionProperties(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetLinkInfo *info); + +/** + * @brief 查询某个网络的能力集 + * + * @param netHandle 存放网络ID + * @param netAllCapacities 存放能力集 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetNetCapabilities(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetAllCapabilities *netAllCapacities); + +/** + * @brief 查询默认的网络代理 + * + * @param httpProxy 存放代理配置信息 + * @return 0 - 成功. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetDefaultHttpProxy(OH_NetConn_HttpProxy *httpProxy); + #ifdef __cplusplus } #endif /** @} */ -#endif /* NATIVE_NET_CONN_API_H */ \ No newline at end of file +#endif /* NATIVE_NET_CONN_API_H */ diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h new file mode 100644 index 00000000..1870a8ba --- /dev/null +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -0,0 +1,284 @@ +/* + * 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 NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H + +/** + * @addtogroup NetConn + * @{ + * + * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 + * + * @since 11 + * @version 1.0 + */ + +/** + * @file native_net_conn_type.h + * @brief 定义网络连接模块的C接口需要的数据结构 + * + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + * + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OH_NETCONN_MAX_NET_SIZE 32 +#define OH_NETCONN_MAX_BEAR_TYPE_SIZE 32 +#define OH_NETCONN_MAX_CAP_SIZE 32 +#define OH_NETCONN_MAX_ADDR_SIZE 32 +#define OH_NETCONN_MAX_ROUTE_SIZE 64 +#define OH_NETCONN_MAX_EXCLUSION_SIZE 256 +#define OH_NETCONN_MAX_STR_LEN 256 + +/** + * @brief 网络能力集 + * + * @since 11 + * @version 1.0 + */ + +typedef enum OH_NetConn_NetCap { + /* MMS */ + OH_NETCONN_NET_CAPABILITY_MMS = 0, + /* Not Metered */ + OH_NETCONN_NET_CAPABILITY_NOT_METERED = 11, + /* Internet */ + OH_NETCONN_NET_CAPABILITY_INTERNET = 12, + /* Not VPN */ + OH_NETCONN_NET_CAPABILITY_NOT_VPN = 15, + /* Validated */ + OH_NETCONN_NET_CAPABILITY_VALIDATED = 16, + /* Captive portal */ + OH_NETCONN_NET_CAPABILITY_CAPTIVE_PORTAL = 17, + /* Internal Default */ + OH_NETCONN_NET_CAPABILITY_INTERNAL_DEFAULT +} OH_NetConn_NetCap; + +/** + * @brief 网络载体类型 + * + * @since 11 + * @version 1.0 + */ + +typedef enum OH_NetConn_NetBearType { + /* Cellular */ + OH_NETCONN_BEARER_CELLULAR = 0, + /* WIFI */ + OH_NETCONN_BEARER_WIFI = 1, + /* Bluetooth */ + OH_NETCONN_BEARER_BLUETOOTH = 2, + /* Ethernet */ + OH_NETCONN_BEARER_ETHERNET = 3, + /* VPN */ + OH_NETCONN_BEARER_VPN = 4, + /* WIFI aware */ + OH_NETCONN_BEARER_WIFI_AWARE = 5, + /* Default */ + OH_NETCONN_BEARER_DEFAULT +} OH_NetConn_NetBearType; + +/** + * @brief 路由返回类型 + * + * @since 11 + * @version 1.0 + */ + +typedef enum OH_NetConn_RtnType { + /* Unicast */ + OH_NETCONN_RTN_UNICAST = 1, + /* Unreachable */ + OH_NETCONN_RTN_UNREACHABLE = 7, + /* Throw */ + OH_NETCONN_RTN_THROW = 9 +} OH_NetConn_RtnType; + +/** + * @brief IP类型. + * + * @since 11 + * @version 1.0 + */ + +typedef enum { + /* Unknown */ + OH_NETCONN_UNKNOWN = 0x00, + /* IPV4 */ + OH_NETCONN_IPV4 = 0x01, + /* IPV6 */ + OH_NETCONN_IPV6 = 0x02, +} OH_NetConn_IpType; + +/** + * @brief 存放网络ID. + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetHandle { + /* Network id */ + int32_t netId; +} OH_NetConn_NetHandle; + +/** + * @brief 网络列表 + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetHandleList { + /* List of netHandle */ + OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; + /* Actual size of netHandleList */ + int32_t netHandleListSize; +} OH_NetConn_NetHandleList; + +/** + * @brief 网络能力集 + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetAllCapabilities { + /* LinkUpBandwidthKbps */ + uint32_t linkUpBandwidthKbps; + /* LinkDownBandwidthKbps */ + uint32_t linkDownBandwidthKbps; + /* List of capabilities */ + OH_NetConn_NetCap netCaps[OH_NETCONN_MAX_CAP_SIZE]; + /* Actual size of netCaps */ + int32_t netCapsSize; + /* List of bearer types */ + OH_NetConn_NetBearType bearerTypes[OH_NETCONN_MAX_BEAR_TYPE_SIZE]; + /* Actual size of bearerTypes */ + int32_t bearerTypesSize; +} OH_NetConn_NetAllCapabilities; + +/** + * @brief 网络地址 + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_INetAddr { + /* Ip type */ + OH_NetConn_IpType type; + /* Family */ + uint8_t family; + /* Length of prefix */ + uint8_t prefixlen; + /* Port */ + uint8_t port; + /* Address */ + char address[OH_NETCONN_MAX_STR_LEN]; + /* Host name */ + char hostName[OH_NETCONN_MAX_STR_LEN]; +} OH_NetConn_INetAddr; + +/** + * @brief 路由配置信息 + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_Route { + /* Interface */ + char iface[OH_NETCONN_MAX_STR_LEN]; + /* Destination address */ + OH_NetConn_INetAddr destination; + /* Gateway address*/ + OH_NetConn_INetAddr gateway; + /* Return type */ + OH_NetConn_RtnType rtnType; + /* MTU */ + int32_t mtu; + /* Whether it is host */ + int32_t isHost; + /* Whether a gateway is present*/ + int32_t hasGateway; + /* Whether is default route*/ + int32_t isDefaultRoute; +} OH_NetConn_Route; + +/** + * @brief 代理配置信息 + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_HttpProxy { + /* Host name */ + char host[OH_NETCONN_MAX_STR_LEN]; + /* List of exclusion */ + char exclusionList[OH_NETCONN_MAX_EXCLUSION_SIZE][OH_NETCONN_MAX_STR_LEN]; + /* Actual size of exclusionList */ + int32_t exclusionListSize; + /* Port */ + uint16_t port; +} OH_NetConn_HttpProxy; + +/** + * @brief Network link information + * + * @since 11 + * @version 1.0 + */ + +typedef struct OH_NetConn_NetLinkInfo { + /* Interface name */ + char ifaceName[OH_NETCONN_MAX_STR_LEN]; + /* Domain */ + char domain[OH_NETCONN_MAX_STR_LEN]; + /* TCP butter size */ + char tcpBufferSizes[OH_NETCONN_MAX_STR_LEN]; + /* MTU */ + uint16_t mtu; + /* Address list */ + OH_NetConn_INetAddr netAddrList[OH_NETCONN_MAX_ADDR_SIZE]; + /* Actual size of netAddrList */ + int32_t netAddrListSize; + /* DNS list */ + OH_NetConn_INetAddr dnsList[OH_NETCONN_MAX_ADDR_SIZE]; + /* Actual size od dnsList */ + int32_t dnsListSize; + /* Route list */ + OH_NetConn_Route routeList[OH_NETCONN_MAX_ROUTE_SIZE]; + /* Actual size of routeList */ + int32_t routeListSize; + /* Http proxy */ + OH_NetConn_HttpProxy httpProxy; +} OH_NetConn_NetLinkInfo; + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_TYPE_H */ \ No newline at end of file -- Gitee From f48849c752b924c5f9763ad7d3209479d32cca8b Mon Sep 17 00:00:00 2001 From: xujie Date: Tue, 24 Oct 2023 14:45:48 +0800 Subject: [PATCH 0049/2135] update dns api Signed-off-by: xujie --- zh-cn/native_sdk/net/dns/native_net_conn_type.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h index 1870a8ba..d7792cef 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -212,7 +212,7 @@ typedef struct OH_NetConn_Route { char iface[OH_NETCONN_MAX_STR_LEN]; /* Destination address */ OH_NetConn_INetAddr destination; - /* Gateway address*/ + /* Gateway address */ OH_NetConn_INetAddr gateway; /* Return type */ OH_NetConn_RtnType rtnType; @@ -220,9 +220,9 @@ typedef struct OH_NetConn_Route { int32_t mtu; /* Whether it is host */ int32_t isHost; - /* Whether a gateway is present*/ + /* Whether a gateway is present */ int32_t hasGateway; - /* Whether is default route*/ + /* Whether is default route */ int32_t isDefaultRoute; } OH_NetConn_Route; @@ -281,4 +281,4 @@ typedef struct OH_NetConn_NetLinkInfo { #endif /** @} */ -#endif /* NATIVE_NET_CONN_TYPE_H */ \ No newline at end of file +#endif /* NATIVE_NET_CONN_TYPE_H */ -- Gitee From 05ba2ab8dade56d2cf02a32bf0708a9634df4558 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Tue, 24 Oct 2023 17:14:21 +0800 Subject: [PATCH 0050/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/native_sdk/ai/mindspore/context.h b/en/native_sdk/ai/mindspore/context.h index cd4f59ca..2c39756b 100644 --- a/en/native_sdk/ai/mindspore/context.h +++ b/en/native_sdk/ai/mindspore/context.h @@ -188,7 +188,7 @@ OH_AI_API OH_AI_DeviceInfoHandle OH_AI_DeviceInfoCreate(OH_AI_DeviceType device_ OH_AI_API void OH_AI_DeviceInfoDestroy(OH_AI_DeviceInfoHandle *device_info); /** - * @brief Sets the name of a provider. + * @brief Sets the provider name. * * @param device_info {@link OH_AI_DeviceInfoHandle} that points to a device information instance. * @param provider Provider name. -- Gitee From 4d4b4348cc7431443da9b74d54df1d0b938edd4c Mon Sep 17 00:00:00 2001 From: xujie Date: Tue, 24 Oct 2023 19:46:37 +0800 Subject: [PATCH 0051/2135] fix Signed-off-by: xujie --- .../native_sdk/net/dns/native_net_conn_api.h | 1 + .../native_sdk/net/dns/native_net_conn_type.h | 119 +++++++++--------- 2 files changed, 61 insertions(+), 59 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index f999c930..4baab2a6 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -31,6 +31,7 @@ * * @brief Provide C interface for the data network connection module of network management. * + * @library libnetconn_ndk.z.so * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h index d7792cef..843f7379 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -29,7 +29,8 @@ /** * @file native_net_conn_type.h * @brief 定义网络连接模块的C接口需要的数据结构 - * + * + * @library libnetconn_ndk.z.so * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 @@ -58,19 +59,19 @@ extern "C" { */ typedef enum OH_NetConn_NetCap { - /* MMS */ + /** MMS */ OH_NETCONN_NET_CAPABILITY_MMS = 0, - /* Not Metered */ + /** 非计量网络 */ OH_NETCONN_NET_CAPABILITY_NOT_METERED = 11, - /* Internet */ + /** Internet */ OH_NETCONN_NET_CAPABILITY_INTERNET = 12, - /* Not VPN */ + /** 非VPN */ OH_NETCONN_NET_CAPABILITY_NOT_VPN = 15, - /* Validated */ + /** 已验证 */ OH_NETCONN_NET_CAPABILITY_VALIDATED = 16, - /* Captive portal */ + /** 被捕获的门户 */ OH_NETCONN_NET_CAPABILITY_CAPTIVE_PORTAL = 17, - /* Internal Default */ + /** 内部默认能力 */ OH_NETCONN_NET_CAPABILITY_INTERNAL_DEFAULT } OH_NetConn_NetCap; @@ -82,19 +83,19 @@ typedef enum OH_NetConn_NetCap { */ typedef enum OH_NetConn_NetBearType { - /* Cellular */ + /** 蜂窝网络 */ OH_NETCONN_BEARER_CELLULAR = 0, - /* WIFI */ + /** WIFI */ OH_NETCONN_BEARER_WIFI = 1, - /* Bluetooth */ + /** Bluetooth */ OH_NETCONN_BEARER_BLUETOOTH = 2, - /* Ethernet */ + /** Ethernet */ OH_NETCONN_BEARER_ETHERNET = 3, - /* VPN */ + /** VPN */ OH_NETCONN_BEARER_VPN = 4, - /* WIFI aware */ + /** WIFI aware */ OH_NETCONN_BEARER_WIFI_AWARE = 5, - /* Default */ + /** 默认的承载类型 */ OH_NETCONN_BEARER_DEFAULT } OH_NetConn_NetBearType; @@ -106,11 +107,11 @@ typedef enum OH_NetConn_NetBearType { */ typedef enum OH_NetConn_RtnType { - /* Unicast */ + /** 单播 */ OH_NETCONN_RTN_UNICAST = 1, - /* Unreachable */ + /** 不可达 */ OH_NETCONN_RTN_UNREACHABLE = 7, - /* Throw */ + /** 抛出 */ OH_NETCONN_RTN_THROW = 9 } OH_NetConn_RtnType; @@ -122,11 +123,11 @@ typedef enum OH_NetConn_RtnType { */ typedef enum { - /* Unknown */ + /** 未知 */ OH_NETCONN_UNKNOWN = 0x00, - /* IPV4 */ + /** IPV4 */ OH_NETCONN_IPV4 = 0x01, - /* IPV6 */ + /** IPV6 */ OH_NETCONN_IPV6 = 0x02, } OH_NetConn_IpType; @@ -138,7 +139,7 @@ typedef enum { */ typedef struct OH_NetConn_NetHandle { - /* Network id */ + /** 网络标识符 */ int32_t netId; } OH_NetConn_NetHandle; @@ -150,9 +151,9 @@ typedef struct OH_NetConn_NetHandle { */ typedef struct OH_NetConn_NetHandleList { - /* List of netHandle */ + /** netHandle列表 */ OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; - /* Actual size of netHandleList */ + /** netHandleList的实际大小 */ int32_t netHandleListSize; } OH_NetConn_NetHandleList; @@ -164,17 +165,17 @@ typedef struct OH_NetConn_NetHandleList { */ typedef struct OH_NetConn_NetAllCapabilities { - /* LinkUpBandwidthKbps */ + /** 上行带宽 */ uint32_t linkUpBandwidthKbps; - /* LinkDownBandwidthKbps */ + /** 下行带宽 */ uint32_t linkDownBandwidthKbps; - /* List of capabilities */ + /** 网络能力列表 */ OH_NetConn_NetCap netCaps[OH_NETCONN_MAX_CAP_SIZE]; - /* Actual size of netCaps */ + /** 网络能力列表的实际size */ int32_t netCapsSize; - /* List of bearer types */ + /** 承载类型列表 */ OH_NetConn_NetBearType bearerTypes[OH_NETCONN_MAX_BEAR_TYPE_SIZE]; - /* Actual size of bearerTypes */ + /** 承载类型列表的实际size */ int32_t bearerTypesSize; } OH_NetConn_NetAllCapabilities; @@ -186,17 +187,17 @@ typedef struct OH_NetConn_NetAllCapabilities { */ typedef struct OH_NetConn_INetAddr { - /* Ip type */ + /** Ip 类型 */ OH_NetConn_IpType type; - /* Family */ + /** 网络地址族 */ uint8_t family; - /* Length of prefix */ + /** 前缀长度 */ uint8_t prefixlen; - /* Port */ + /** 端口号 */ uint8_t port; - /* Address */ + /** 地址 */ char address[OH_NETCONN_MAX_STR_LEN]; - /* Host name */ + /** 主机名 */ char hostName[OH_NETCONN_MAX_STR_LEN]; } OH_NetConn_INetAddr; @@ -208,21 +209,21 @@ typedef struct OH_NetConn_INetAddr { */ typedef struct OH_NetConn_Route { - /* Interface */ + /** 网络接口 */ char iface[OH_NETCONN_MAX_STR_LEN]; - /* Destination address */ + /** 目标地址 */ OH_NetConn_INetAddr destination; - /* Gateway address */ + /** 网关地址 */ OH_NetConn_INetAddr gateway; - /* Return type */ + /** 路由的类型 */ OH_NetConn_RtnType rtnType; - /* MTU */ + /** MTU */ int32_t mtu; - /* Whether it is host */ + /** 是否是主机 */ int32_t isHost; - /* Whether a gateway is present */ + /** 是否存在网关 */ int32_t hasGateway; - /* Whether is default route */ + /** 是否是默认路由 */ int32_t isDefaultRoute; } OH_NetConn_Route; @@ -234,13 +235,13 @@ typedef struct OH_NetConn_Route { */ typedef struct OH_NetConn_HttpProxy { - /* Host name */ + /** 主机名 */ char host[OH_NETCONN_MAX_STR_LEN]; - /* List of exclusion */ + /** 代理服务器的排除列表 */ char exclusionList[OH_NETCONN_MAX_EXCLUSION_SIZE][OH_NETCONN_MAX_STR_LEN]; - /* Actual size of exclusionList */ + /** 排除列表的实际大小 */ int32_t exclusionListSize; - /* Port */ + /** 端口号 */ uint16_t port; } OH_NetConn_HttpProxy; @@ -252,27 +253,27 @@ typedef struct OH_NetConn_HttpProxy { */ typedef struct OH_NetConn_NetLinkInfo { - /* Interface name */ + /** 网络接口的名称 */ char ifaceName[OH_NETCONN_MAX_STR_LEN]; - /* Domain */ + /** 网络连接的域名信息 */ char domain[OH_NETCONN_MAX_STR_LEN]; - /* TCP butter size */ + /** TCP 缓冲区大小 */ char tcpBufferSizes[OH_NETCONN_MAX_STR_LEN]; - /* MTU */ + /** MTU */ uint16_t mtu; - /* Address list */ + /** 地址列表 */ OH_NetConn_INetAddr netAddrList[OH_NETCONN_MAX_ADDR_SIZE]; - /* Actual size of netAddrList */ + /** 地址列表的实际size */ int32_t netAddrListSize; - /* DNS list */ + /** DNS 列表 */ OH_NetConn_INetAddr dnsList[OH_NETCONN_MAX_ADDR_SIZE]; - /* Actual size od dnsList */ + /** DNS 列表的实际size */ int32_t dnsListSize; - /* Route list */ + /** 路由列表 */ OH_NetConn_Route routeList[OH_NETCONN_MAX_ROUTE_SIZE]; - /* Actual size of routeList */ + /** 路由列表的实际大小 */ int32_t routeListSize; - /* Http proxy */ + /** HTTP 代理信息 */ OH_NetConn_HttpProxy httpProxy; } OH_NetConn_NetLinkInfo; -- Gitee From f93f99cf6363d182354290249589259b0767bde9 Mon Sep 17 00:00:00 2001 From: xujie Date: Tue, 24 Oct 2023 19:48:19 +0800 Subject: [PATCH 0052/2135] fix Signed-off-by: xujie --- zh-cn/native_sdk/net/dns/native_net_conn_type.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/native_net_conn_type.h index 843f7379..77b79d27 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_type.h @@ -57,7 +57,6 @@ extern "C" { * @since 11 * @version 1.0 */ - typedef enum OH_NetConn_NetCap { /** MMS */ OH_NETCONN_NET_CAPABILITY_MMS = 0, @@ -81,7 +80,6 @@ typedef enum OH_NetConn_NetCap { * @since 11 * @version 1.0 */ - typedef enum OH_NetConn_NetBearType { /** 蜂窝网络 */ OH_NETCONN_BEARER_CELLULAR = 0, @@ -105,7 +103,6 @@ typedef enum OH_NetConn_NetBearType { * @since 11 * @version 1.0 */ - typedef enum OH_NetConn_RtnType { /** 单播 */ OH_NETCONN_RTN_UNICAST = 1, @@ -121,7 +118,6 @@ typedef enum OH_NetConn_RtnType { * @since 11 * @version 1.0 */ - typedef enum { /** 未知 */ OH_NETCONN_UNKNOWN = 0x00, @@ -137,7 +133,6 @@ typedef enum { * @since 11 * @version 1.0 */ - typedef struct OH_NetConn_NetHandle { /** 网络标识符 */ int32_t netId; @@ -149,7 +144,6 @@ typedef struct OH_NetConn_NetHandle { * @since 11 * @version 1.0 */ - typedef struct OH_NetConn_NetHandleList { /** netHandle列表 */ OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; @@ -163,7 +157,6 @@ typedef struct OH_NetConn_NetHandleList { * @since 11 * @version 1.0 */ - typedef struct OH_NetConn_NetAllCapabilities { /** 上行带宽 */ uint32_t linkUpBandwidthKbps; @@ -185,7 +178,6 @@ typedef struct OH_NetConn_NetAllCapabilities { * @since 11 * @version 1.0 */ - typedef struct OH_NetConn_INetAddr { /** Ip 类型 */ OH_NetConn_IpType type; @@ -207,7 +199,6 @@ typedef struct OH_NetConn_INetAddr { * @since 11 * @version 1.0 */ - typedef struct OH_NetConn_Route { /** 网络接口 */ char iface[OH_NETCONN_MAX_STR_LEN]; @@ -233,7 +224,6 @@ typedef struct OH_NetConn_Route { * @since 11 * @version 1.0 */ - typedef struct OH_NetConn_HttpProxy { /** 主机名 */ char host[OH_NETCONN_MAX_STR_LEN]; @@ -251,7 +241,6 @@ typedef struct OH_NetConn_HttpProxy { * @since 11 * @version 1.0 */ - typedef struct OH_NetConn_NetLinkInfo { /** 网络接口的名称 */ char ifaceName[OH_NETCONN_MAX_STR_LEN]; -- Gitee From c3f5d653b28b7a7bc53dfc566896922736314e4c Mon Sep 17 00:00:00 2001 From: shawn_he Date: Wed, 25 Oct 2023 17:53:37 +0800 Subject: [PATCH 0053/2135] update docs Signed-off-by: shawn_he --- en/native_sdk/net/dns/native_net_conn_api.h | 200 ++++++++++++++ en/native_sdk/net/dns/native_net_conn_type.h | 274 +++++++++++++++++++ 2 files changed, 474 insertions(+) create mode 100644 en/native_sdk/net/dns/native_net_conn_api.h create mode 100644 en/native_sdk/net/dns/native_net_conn_type.h diff --git a/en/native_sdk/net/dns/native_net_conn_api.h b/en/native_sdk/net/dns/native_net_conn_api.h new file mode 100644 index 00000000..971739af --- /dev/null +++ b/en/native_sdk/net/dns/native_net_conn_api.h @@ -0,0 +1,200 @@ +/* + * 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 NATIVE_NET_CONN_API_H +#define NATIVE_NET_CONN_API_H + +/** + * @addtogroup NetConn + * @{ + * + * @brief Provide C interface for the data network connection module of network management. + * + * @since 11 + * @version 1.0 + */ + +/** + * @file native_net_conn_api.h + * + * @brief Provide C interface for the data network connection module of network management. + * + * @library libnetconn_ndk.z.so + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ + +#include "native_net_conn_type.h" +#include "netdb.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Obtains the DNS result based on netId. + * + * @param host Host name. + * @param serv Service name. + * @param hint Pointer to the addrinfo structure. + * @param res DNS query result, which is in the format of linked lists. + * @param netId Network ID. If netId is 0, the default network ID is used for DNS query. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 +*/ +int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); + +/** + * @brief Releases the DNS query result. + * + * @param res DNS query result, which is in the format of linked lists. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 +*/ +int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); + +/** + * @brief Checks whether a default activated data network is available. + * + * @param hasDefaultNet Whether a default activated data network is available. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_HasDefaultNet(int32_t *hasDefaultNet); + +/** + * @brief Obtains the default activated data network. + * + * @param netHandle Network handle that stores the network ID. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetDefaultNet(OH_NetConn_NetHandle *netHandle); + +/** + * @brief Checks whether metering is enabled for the default data network. + * + * @param isMetered Whether metering is enabled. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_IsDefaultNetMetered(int32_t *isMetered); + +/** + * @brief Queries all activated data networks. + * + * @param netHandleList Network handle that stores the network ID list. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); + +/** + * @brief Queries the link information of a data network. + * + * @param netHandle Network handle that stores the network ID. + * @param info Link information. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetConnectionProperties(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetLinkInfo *info); + +/** + * @brief Queries the capabilities of a data network. + * + * @param netHandle Network handle that stores the network ID. + * @param netAllCapacities Network capabilities. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetNetCapabilities(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetAllCapabilities *netAllCapacities); + +/** + * @brief Queries the default network proxy. + * + * @param httpProxy HTTP proxy. + * @return 0: success. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetDefaultHttpProxy(OH_NetConn_HttpProxy *httpProxy); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_API_H */ diff --git a/en/native_sdk/net/dns/native_net_conn_type.h b/en/native_sdk/net/dns/native_net_conn_type.h new file mode 100644 index 00000000..9b2dd751 --- /dev/null +++ b/en/native_sdk/net/dns/native_net_conn_type.h @@ -0,0 +1,274 @@ +/* + * 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 NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H + +/** + * @addtogroup NetConn + * @{ + * + * @brief Provides the data structures for the C APIs of the network connection module for network management. + * + * @since 11 + * @version 1.0 + */ + +/** + * @file native_net_conn_type.h + * @brief Defines the data structures for the C APIs of the network connection module. + * + * @library libnetconn_ndk.z.so + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + * + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OH_NETCONN_MAX_NET_SIZE 32 +#define OH_NETCONN_MAX_BEAR_TYPE_SIZE 32 +#define OH_NETCONN_MAX_CAP_SIZE 32 +#define OH_NETCONN_MAX_ADDR_SIZE 32 +#define OH_NETCONN_MAX_ROUTE_SIZE 64 +#define OH_NETCONN_MAX_EXCLUSION_SIZE 256 +#define OH_NETCONN_MAX_STR_LEN 256 + +/** + * @brief Defines network capabilities. + * + * @since 11 + * @version 1.0 + */ +typedef enum OH_NetConn_NetCap { + /** MMS */ + OH_NETCONN_NET_CAPABILITY_MMS = 0, + /** Non-metered network */ + OH_NETCONN_NET_CAPABILITY_NOT_METERED = 11, + /** Internet */ + OH_NETCONN_NET_CAPABILITY_INTERNET = 12, + /** Non-VPN */ + OH_NETCONN_NET_CAPABILITY_NOT_VPN = 15, + /** Validated */ + OH_NETCONN_NET_CAPABILITY_VALIDATED = 16, + /** Captive portal */ + OH_NETCONN_NET_CAPABILITY_CAPTIVE_PORTAL = 17, + /** Internal default capability */ + OH_NETCONN_NET_CAPABILITY_INTERNAL_DEFAULT +} OH_NetConn_NetCap; + +/** + * @brief Defines network bearer types. + * + * @since 11 + * @version 1.0 + */ +typedef enum OH_NetConn_NetBearType { + /** Cellular network */ + OH_NETCONN_BEARER_CELLULAR = 0, + /** WIFI */ + OH_NETCONN_BEARER_WIFI = 1, + /** Bluetooth */ + OH_NETCONN_BEARER_BLUETOOTH = 2, + /** Ethernet */ + OH_NETCONN_BEARER_ETHERNET = 3, + /** VPN */ + OH_NETCONN_BEARER_VPN = 4, + /** WIFI aware */ + OH_NETCONN_BEARER_WIFI_AWARE = 5, + /** Default bearer type */ + OH_NETCONN_BEARER_DEFAULT +} OH_NetConn_NetBearType; + +/** + * @brief Defines route return types. + * + * @since 11 + * @version 1.0 + */ +typedef enum OH_NetConn_RtnType { + /** Unicast */ + OH_NETCONN_RTN_UNICAST = 1, + /** Unreachable */ + OH_NETCONN_RTN_UNREACHABLE = 7, + /** Throw */ + OH_NETCONN_RTN_THROW = 9 +} OH_NetConn_RtnType; + +/** + * @brief Defines IP address types. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Unknown */ + OH_NETCONN_UNKNOWN = 0x00, + /** IPV4 */ + OH_NETCONN_IPV4 = 0x01, + /** IPV6 */ + OH_NETCONN_IPV6 = 0x02, +} OH_NetConn_IpType; + +/** + * @brief Defines the network handle. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_NetConn_NetHandle { + /** Network ID */ + int32_t netId; +} OH_NetConn_NetHandle; + +/** + * @brief Defines the network handle list. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_NetConn_NetHandleList { + /** Network handle list */ + OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; + /** Actual size of the network handle list */ + int32_t netHandleListSize; +} OH_NetConn_NetHandleList; + +/** + * @brief Defines all network capabilities. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_NetConn_NetAllCapabilities { + /** Uplink bandwidth */ + uint32_t linkUpBandwidthKbps; + /** Downlink bandwidth */ + uint32_t linkDownBandwidthKbps; + /** Network capability list */ + OH_NetConn_NetCap netCaps[OH_NETCONN_MAX_CAP_SIZE]; + /** Actual size of the network capability list */ + int32_t netCapsSize; + /** Bearer type list */ + OH_NetConn_NetBearType bearerTypes[OH_NETCONN_MAX_BEAR_TYPE_SIZE]; + /** Actual size of the bearer type list */ + int32_t bearerTypesSize; +} OH_NetConn_NetAllCapabilities; + +/** + * @brief Defines the network address. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_NetConn_INetAddr { + /** IP address type */ + OH_NetConn_IpType type; + /** Network address family */ + uint8_t family; + /** Prefix length */ + uint8_t prefixlen; + /** Port number */ + uint8_t port; + /** Address */ + char address[OH_NETCONN_MAX_STR_LEN]; + /** Host name */ + char hostName[OH_NETCONN_MAX_STR_LEN]; +} OH_NetConn_INetAddr; + +/** + * @brief Defines the route configuration information. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_NetConn_Route { + /** Network interface */ + char iface[OH_NETCONN_MAX_STR_LEN]; + /** Destination address */ + OH_NetConn_INetAddr destination; + /** Gateway address */ + OH_NetConn_INetAddr gateway; + /** Route type */ + OH_NetConn_RtnType rtnType; + /** MTU */ + int32_t mtu; + /** Host or not */ + int32_t isHost; + /** Gateway exists or not */ + int32_t hasGateway; + /** Default route or not */ + int32_t isDefaultRoute; +} OH_NetConn_Route; + +/** + * @brief Defines the proxy configuration information. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_NetConn_HttpProxy { + /** Host name */ + char host[OH_NETCONN_MAX_STR_LEN]; + /** Exclusion list of proxy servers */ + char exclusionList[OH_NETCONN_MAX_EXCLUSION_SIZE][OH_NETCONN_MAX_STR_LEN]; + /** Actual size of the exclusion list */ + int32_t exclusionListSize; + /** Port number */ + uint16_t port; +} OH_NetConn_HttpProxy; + +/** + * @brief Defines the network link information. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_NetConn_NetLinkInfo { + /** Network interface name */ + char ifaceName[OH_NETCONN_MAX_STR_LEN]; + /** Domain name of the network connection */ + char domain[OH_NETCONN_MAX_STR_LEN]; + /** TCP buffer size */ + char tcpBufferSizes[OH_NETCONN_MAX_STR_LEN]; + /** MTU */ + uint16_t mtu; + /** Address list */ + OH_NetConn_INetAddr netAddrList[OH_NETCONN_MAX_ADDR_SIZE]; + /** Actual size of the address list */ + int32_t netAddrListSize; + /** DNS list */ + OH_NetConn_INetAddr dnsList[OH_NETCONN_MAX_ADDR_SIZE]; + /** Actual size of the DNS list */ + int32_t dnsListSize; + /** Route list */ + OH_NetConn_Route routeList[OH_NETCONN_MAX_ROUTE_SIZE]; + /** Actual size of the route list */ + int32_t routeListSize; + /** HTTP proxy information */ + OH_NetConn_HttpProxy httpProxy; +} OH_NetConn_NetLinkInfo; + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_TYPE_H */ -- Gitee From b5e7446ea290896c850ec5d8ba3fd86cb6d8e25f Mon Sep 17 00:00:00 2001 From: shawn_he Date: Thu, 26 Oct 2023 09:03:05 +0800 Subject: [PATCH 0054/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/net/dns/native_net_conn_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/native_sdk/net/dns/native_net_conn_type.h b/en/native_sdk/net/dns/native_net_conn_type.h index 9b2dd751..a29b0512 100644 --- a/en/native_sdk/net/dns/native_net_conn_type.h +++ b/en/native_sdk/net/dns/native_net_conn_type.h @@ -29,7 +29,7 @@ /** * @file native_net_conn_type.h * @brief Defines the data structures for the C APIs of the network connection module. - * + * * @library libnetconn_ndk.z.so * @syscap SystemCapability.Communication.NetManager.Core * @since 11 -- Gitee From 6b7aab95f4c76d36d6046f34aeee03504700ff24 Mon Sep 17 00:00:00 2001 From: renjiecui Date: Mon, 30 Oct 2023 14:30:51 +0800 Subject: [PATCH 0055/2135] add ndk Signed-off-by: renjiecui --- zh-cn/native_sdk/database/rdb/data_asset.h | 270 ++++++++++++++++ zh-cn/native_sdk/database/rdb/oh_cursor.h | 40 ++- zh-cn/native_sdk/database/rdb/oh_predicates.h | 2 +- .../native_sdk/database/rdb/oh_value_object.h | 2 +- .../database/rdb/oh_values_bucket.h | 28 +- .../database/rdb/relational_store.h | 305 +++++++++++++++++- .../rdb/relational_store_error_code.h | 2 +- 7 files changed, 643 insertions(+), 6 deletions(-) create mode 100644 zh-cn/native_sdk/database/rdb/data_asset.h diff --git a/zh-cn/native_sdk/database/rdb/data_asset.h b/zh-cn/native_sdk/database/rdb/data_asset.h new file mode 100644 index 00000000..7c88758a --- /dev/null +++ b/zh-cn/native_sdk/database/rdb/data_asset.h @@ -0,0 +1,270 @@ +/* + * 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 DATA_ASSET_H +#define DATA_ASSET_H + +/** + * @addtogroup Data + * @{ + * + * @brief 分布式数据管理(Distributed data manager,data)支持单设备的各种结构化数据的持久化,以及端云间的同步、共享功能。 + * 分布式数据管理定义了一系列数据类型,可以对数据进行增删改查。 + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + +/** + * @file data_asset.h + * + * @brief 提供资产类型数据结构。 + * + * 资产是指可以一种可以在数据管理中使用的数据结构,可以存储及查询一个文件的名称、绝对路径、相对路径、创建时间、修改时间、 状态、 + * 占用空间等属性。 + * @library libnative_rdb_ndk.z.so + * @since 10 + */ + +#include +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum Data_AssetStatus { + /** 表示资产为空。 */ + ASSET_NULL = 0, + /** 表示资产状态正常。 */ + ASSET_NORMAL, + /** 表示资产需要插入到云端。 */ + ASSET_INSERT, + /** 表示资产需要更新到云端。 */ + ASSET_UPDATE, + /** 表示资产需要在云端删除。 */ + ASSET_DELETE, + /** 表示资产状态异常。 */ + ASSET_ABNORMAL, + /** 表示资产正在下载到本地设备。 */ + ASSET_DOWNLOADING +} Data_AssetStatus; + +/** + * @brief 表示资产附件类型的数据。 + * + * 提供资产附件的信息。 + * + * @since 11 + */ +typedef struct Data_Asset Data_Asset; + +/** + * @brief 设置资产类型数据的名称。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param name 表示要设置的名称。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_SetName(Data_Asset *asset, const char *name); + +/** + * @brief 设置资产类型数据在系统里的绝对路径,即URI。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param name 表示要设置的URI。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_SetUri(Data_Asset *asset, const char *uri); + +/** + * @brief 设置资产类型数据在应用沙箱里的相对路径。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param path 表示要设置的相对路径。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_SetPath(Data_Asset *asset, const char *path); + +/** + * @brief 设置资产类型数据创建的时间。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param createTime 表示要设置的创建时间。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_SetCreateTime(Data_Asset *asset, int64_t createTime); + +/** + * @brief 设置资产类型数据最后修改的时间。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param modifyTime 表示要设置的最后修改的时间。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_SetModifyTime(Data_Asset *asset, int64_t modifyTime); + +/** + * @brief 设置资产类型数据占用空间的大小。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param size 表示要设置的占用空间的大小。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_SetSize(Data_Asset *asset, size_t size); + +/** + * @brief 设置资产类型数据的状态码。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param status 表示需要设置的状态码。详细信息可以查看{@link Data_AssetStatus}。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset, Data_AssetStatus + * @since 11 + */ +int OH_Data_Asset_SetStatus(Data_Asset *asset, Data_AssetStatus status); + +/** + * @brief 获取资产类型数据的名称。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param name 该参数是输出参数,资产类型数据的名称会以字符串形式写入该变量。 + * @param length 表示name的长度。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_GetName(Data_Asset *asset, char *name, size_t *length); + +/** + * @brief 获取资产类型数据的绝对路径。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param uri 参数是输出参数,资产类型数据的绝对路径会以字符串形式写入该变量。 + * @param length 表示uri的长度。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_GetUri(Data_Asset *asset, char *uri, size_t *length); + +/** + * @brief 获取资产类型数据的相对路径。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param path 参数是输出参数,资产类型数据的相对路径会以字符串形式写入该变量。 + * @param length 表示path的长度。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_GetPath(Data_Asset *asset, char *path, size_t *length); + +/** + * @brief 获取资产类型数据的创建时间。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param createTime 参数是输出参数,资产类型数据的创建时间会以int64_t形式写入该变量。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_GetCreateTime(Data_Asset *asset, int64_t *createTime); + +/** + * @brief 获取资产类型数据的最后修改的时间。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param modifyTime 参数是输出参数,资产类型数据的最后修改时间会以int64_t形式写入该变量。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_GetModifyTime(Data_Asset *asset, int64_t *modifyTime); + +/** + * @brief 获取资产类型数据占用空间的大小。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param size 参数是输出参数,资产类型数据的占用空间大小会以size_t形式写入该变量。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_GetSize(Data_Asset *asset, size_t *size); + +/** + * @brief 获取资产类型数据的状态码。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @param status 参数是输出参数,资产类型数据的状态码会以{@link Data_AssetStatus}形式写入该变量。 + * @return 返回特定的错误码值。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset + * @since 11 + */ +int OH_Data_Asset_GetStatus(Data_Asset *asset, Data_AssetStatus *status); + +/** + * @brief 创造一个{@link Data_Asset} 类型实例 + * + * @return 创建成功则返回一个指向{@link Data_Asset}结构体实例的指针,否则返回NULL。 + * @see Data_Asset. + * @since 11 + */ +Data_Asset *OH_Data_Asset_CreateOne(); + +/** + * @brief 销毁{@link Data_Asset} 对象并回收该对象占用的内存。 + * + * @param asset 表示指向{@link Data_Asset}实例的指针。 + * @return 返回操作是否成功,成功时返回RDB_OK,出错时返回对应的错误码。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset, OH_Rdb_ErrCode. + * @since 11 + */ +int OH_Data_Asset_DestroyOne(Data_Asset *asset); + +/** + * @brief 创造指定数量的{@link Data_Asset} 类型实例 + * + * @param count 代表创建的资产类型数据的数量。 + * @return 创建成功则返回一个指向{@link Data_Asset}结构体实例的指针,否则返回NULL。 + * @see Data_Asset. + * @since 11 + */ +Data_Asset **OH_Data_Asset_CreateMultiple(uint32_t count); + +/** + * @brief 销毁多个{@link Data_Asset} 对象并回收该对象占用的内存。 + * + * @param assets 表示指向{@link Data_Asset}实例的指针。 + * @param count 代表需要销毁的{@link Data_Asset}类型对象的数量。 + * @return 返回操作是否成功,成功时返回RDB_OK,出错时返回对应的错误码。详细信息可以查看{@link OH_Rdb_ErrCode}。 + * @see Data_Asset, OH_Rdb_ErrCode. + * @since 11 + */ +int OH_Data_Asset_DestroyMultiple(Data_Asset **assets, uint32_t count); +#ifdef __cplusplus +}; +#endif // DATA_ASSET_H diff --git a/zh-cn/native_sdk/database/rdb/oh_cursor.h b/zh-cn/native_sdk/database/rdb/oh_cursor.h index 73a49e21..a9ea78a5 100644 --- a/zh-cn/native_sdk/database/rdb/oh_cursor.h +++ b/zh-cn/native_sdk/database/rdb/oh_cursor.h @@ -33,13 +33,14 @@ * @brief 提供通过查询数据库生成的数据库结果集的访问方法。 * * 结果集是指用户调用关系型数据库查询接口之后返回的结果集合,提供了多种灵活的数据访问方式,以便用户获取各项数据。 - * @library native_rdb_ndk_header.so + * @library libnative_rdb_ndk.z.so * @since 10 */ #include #include #include +#include "database/rdb/data_asset.h" #ifdef __cplusplus extern "C" { #endif @@ -60,6 +61,18 @@ typedef enum OH_ColumnType { TYPE_TEXT, /** 表示BLOB数据类型 */ TYPE_BLOB, + /** + * @brief 表示ASSET(资产附件)数据类型 + * + * @since 11 + */ + TYPE_ASSET, + /** + * @brief ASSETS(多个资产附件)数据类型 + * + * @since 11 + */ + TYPE_ASSETS, } OH_ColumnType; /** @@ -225,6 +238,31 @@ typedef struct OH_Cursor { * @since 10 */ int (*destroy)(OH_Cursor *cursor); + + /** + * @brief 函数指针,以资产的形式获取当前行中指定列的值。 + * + * @param cursor 表示指向{@link OH_Cursor}实例的指针。 + * @param columnIndex 表示结果集中指定列的索引。 + * @param value 该参数是输出参数,结果集中指定列的值会以资产形式写入该变量。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_Cursor. + * @since 11 + */ + int (*getAsset)(OH_Cursor *cursor, int32_t columnIndex, Data_Asset *value); + + /** + * @brief 函数指针,以资产数组的形式获取当前行中指定列的值。 + * + * @param cursor 表示指向{@link OH_Cursor}实例的指针。 + * @param columnIndex 表示结果集中指定列的索引。 + * @param value 该参数是输出参数,结果集中指定列的值会以资产数组形式写入该变量。 + * @param length 表示资产数组的长度。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_Cursor. + * @since 11 + */ + int (*getAssets)(OH_Cursor *cursor, int32_t columnIndex, Data_Asset **value, uint32_t length); } OH_Cursor; #ifdef __cplusplus diff --git a/zh-cn/native_sdk/database/rdb/oh_predicates.h b/zh-cn/native_sdk/database/rdb/oh_predicates.h index ce8188b0..590a3ff3 100644 --- a/zh-cn/native_sdk/database/rdb/oh_predicates.h +++ b/zh-cn/native_sdk/database/rdb/oh_predicates.h @@ -31,7 +31,7 @@ * @file oh_predicates.h * * @brief 表示关系型数据库(RDB)的谓词。 - * @library native_rdb_ndk_header.so + * @library libnative_rdb_ndk.z.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/oh_value_object.h b/zh-cn/native_sdk/database/rdb/oh_value_object.h index 8647b11f..6e6a4b77 100644 --- a/zh-cn/native_sdk/database/rdb/oh_value_object.h +++ b/zh-cn/native_sdk/database/rdb/oh_value_object.h @@ -31,7 +31,7 @@ * @file oh_value_object.h * * @brief 提供类型转换方法。 - * @library native_rdb_ndk_header.so + * @library libnative_rdb_ndk,z.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/oh_values_bucket.h b/zh-cn/native_sdk/database/rdb/oh_values_bucket.h index f28e7102..084654f9 100644 --- a/zh-cn/native_sdk/database/rdb/oh_values_bucket.h +++ b/zh-cn/native_sdk/database/rdb/oh_values_bucket.h @@ -31,11 +31,12 @@ * @file oh_values_bucket.h * * @brief 用于存储键值对的类型。 - * @library native_rdb_ndk_header.so + * @library libnative_rdb_ndk.z.so * @since 10 */ #include +#include "database/data/data_asset" #ifdef __cplusplus extern "C" { #endif @@ -133,6 +134,31 @@ typedef struct OH_VBucket { int (*destroy)(OH_VBucket *bucket); } OH_VBucket; +/** + * @brief 将{@link OH_Asset} 类型的对象放入给定列名的{@link OH_VBucket}对象中. + * + * @param bucket 表示指向{@link OH_VBucket}实例的指针。 + * @param field 数据库表中的列名。 + * @param value 数据库表中指定列名对应的值。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_VBucket. + * @since 11 + */ +int OH_VBucket_PutAsset(OH_VBucket *bucket, const char *field, OH_Asset *value); + +/** + * @brief 将{@link OH_Asset} 类型的对象数组放入给定列名的{@link OH_VBucket}对象中. + * + * @param bucket 表示指向{@link OH_VBucket}实例的指针。 + * @param field 数据库表中的列名。 + * @param value 数据库表中指定列名对应的值。 + * @param count 表示传入的{@link OH_Asset}对象数组元素的个数. + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_VBucket. + * @since 11 + */ +int OH_VBucket_PutAssets(OH_VBucket *bucket, const char *field, OH_Asset **value, int count); + #ifdef __cplusplus }; #endif diff --git a/zh-cn/native_sdk/database/rdb/relational_store.h b/zh-cn/native_sdk/database/rdb/relational_store.h index ffd9de6a..9de0e6e8 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store.h +++ b/zh-cn/native_sdk/database/rdb/relational_store.h @@ -32,7 +32,7 @@ * @file relational_store.h * * @brief 提供管理关系数据库(RDB)方法的接口。 - * @library native_rdb_ndk_header.so + * @library libnative_rdb_ndk.z.so * @since 10 */ @@ -77,6 +77,30 @@ typedef enum OH_Rdb_SecurityLevel { S4 } OH_Rdb_SecurityLevel; +/** + * @brief 描述数据库的安全区域等级。 + * + * @since 11 + */ +typedef enum Rdb_SecurityArea { + /** + * @brief 安全区域等级为1。 + */ + RDB_SECURITY_AREA_EL1 = 1, + /** + * @brief 安全区域等级为2。 + */ + RDB_SECURITY_AREA_EL2, + /** + * @brief 安全区域等级为3。 + */ + RDB_SECURITY_AREA_EL3, + /** + * @brief 安全区域等级为4。 + */ + RDB_SECURITY_AREA_EL4, +} Rdb_SecurityArea; + /** * @brief 管理关系数据库配置。 * @@ -98,6 +122,12 @@ typedef struct { bool isEncrypt; /** 设置数据库安全级别{@link OH_Rdb_SecurityLevel}。 */ int securityLevel; + /** + * 设置数据库安全区域等级{@link Rdb_SecurityArea}。 + * + * @since 11 + */ + int area; } OH_Rdb_Config; #pragma pack() @@ -313,6 +343,279 @@ int OH_Rdb_GetVersion(OH_Rdb_Store *store, int *version); */ int OH_Rdb_SetVersion(OH_Rdb_Store *store, int version); +/** + * @brief 描述表的分布式类型的枚举。 + * + * @since 11 + */ +typedef enum Rdb_DistributedType { + /** 表示在设备和云端之间分布式的数据库表。 */ + RDB_DISTRIBUTED_CLOUD +} Rdb_DistributedType; + +/** + * @brief 描述{@link Rdb_DistributedConfig}的版本。 + * + * @since 11 + */ +#define DISTRIBUTED_CONFIG_VERSION 1 + +/** + * @brief 记录表的分布式配置信息。 + * + * @since 11 + */ +typedef struct Rdb_DistributedConfig { + /** 用于唯一标识Rdb_DistributedConfig结构的版本。 */ + int version; + /** 表示该表是否支持自动同步。 */ + bool isAutoSync; +} Rdb_DistributedConfig; + +/** + * @brief 设置分布式数据库表。 + * + * @param store 表示指向{@link OH_Rdb_Store}实例的指针。 + * @param tables 要设置的分布式数据库表表名。 + * @param count 要设置的分布式数据库表的数量。 + * @param type 表的分布式类型 {@link Rdb_DistributedType}。 + * @param config 表的分布式配置信息。{@link Rdb_DistributedConfig}。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_Rdb_Store. + * @since 11 + */ +int OH_Rdb_SetDistributedTables(OH_Rdb_Store *store, const char *tables[], uint32_t count, Rdb_DistributedType type, + const Rdb_DistributedConfig *config); + +/** + * @brief 获取数据库表中数据的最后修改时间。 + * + * @param store 表示指向{@link OH_Rdb_Store}实例的指针。 + * @param tableName 要查找的分布式数据库表表名。 + * @param columnName 指定要查询的数据库表的列名。 + * @param values 指定要查询的行的主键。如果数据库表无主键,参数columnName需传入"rowid",此时values为要查询的数据库表的行号。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_Rdb_Store. + * @since 11 + */ +OH_Cursor *OH_Rdb_FindModifyTime(OH_Rdb_Store *store, const char *tableName, const char *columnName, + OH_VObject *values); + +/** + * @brief 描述数据变更类型。 + * + * @since 11 + */ +typedef enum Rdb_ChangeType { + /** 表示是数据发生变更。 */ + RDB_DATA_CHANGE, + /** 表示是资产附件发生了变更。 */ + RDB_ASSET_CHANGE +} Rdb_ChangeType; + +/** + * @brief 描述发生变化的行的主键或者行号。 + * + * @since 11 + */ +typedef struct Rdb_KeyInfo { + /** 表示发生变化的主键或者行号的数量。 */ + int count; + /** 表示主键的类型{@link OH_ColumnType}。 */ + int type; + /** + * @brief 存放变化的具体数据 + * + * @since 11 + */ + union Rdb_KeyData { + /** 存放uint64_t类型的数据。 */ + uint64_t integer; + /** 存放double类型的数据。 */ + double real; + /** 存放char *类型的数据。 */ + const char *text; + } *data; +} Rdb_KeyInfo; + +/** + * @brief 描述{@link Rdb_ChangeInfo}的版本。 + * + * @since 11 + */ +#define DISTRIBUTED_CHANGE_INFO_VERSION 1 + +/** + * @brief 记录端云同步过程详情。 + * + * @since 11 + */ +typedef struct Rdb_ChangeInfo { + /** 用于唯一标识Rdb_DistributedConfig结构的版本。 */ + int version; + /** 表示发生变化的表的名称。 */ + const char *tableName; + /** 表示发生变化的数据的类型,数据或者资产附件发生变化。 */ + int ChangeType; + /** 记录插入数据的位置,如果该表的主键是string类型,该值是主键的值,否则该值表示插入数据的行号。 */ + Rdb_KeyInfo inserted; + /** 记录更新数据的位置,如果该表的主键是string类型,该值是主键的值,否则该值表示插入数据的行号。 */ + Rdb_KeyInfo updated; + /** 记录删除数据的位置,如果该表的主键是string类型,该值是主键的值,否则该值表示插入数据的行号。 */ + Rdb_KeyInfo deleted; +} Rdb_ChangeInfo; + +/** + * @brief 描述订阅类型。 + * + * @since 11 + */ +typedef enum Rdb_SubscribeType { + /** 订阅云端数据更改。 */ + RDB_SUBSCRIBE_TYPE_CLOUD, + /** 订阅云端数据更改详情。 */ + RDB_SUBSCRIBE_TYPE_CLOUD_DETAILS, +} Rdb_SubscribeType; + +/** + * @brief 表示数据库的同步模式 + * + * @since 11 + */ +typedef enum Rdb_SyncMode { + /** 表示数据从修改时间较近的一端同步到修改时间较远的一端。 */ + RDB_SYNC_MODE_TIME_FIRST, + /** 表示数据从本地设备同步到云端。 */ + RDB_SYNC_MODE_NATIVE_FIRST, + /** 表示数据从云端同步到本地设备。 */ + RDB_SYNC_MODE_CLOUD_FIRST +} Rdb_SyncMode; + +/** + * @brief 描述数据库表的端云同步过程的统计信息。 + * + * @since 11 + */ +typedef struct Rdb_Statistic { + /** 表示数据库表中需要端云同步的总行数。 */ + int total; + /** 表示数据库表中端云同步成功的行数。 */ + int successful; + /** 表示数据库表中端云同步失败的行数。 */ + int failed; + /** 表示数据库表中端云同步剩余未执行的行数。 */ + int remained; +} Rdb_Statistic; + +/** + * @brief 描述数据库表执行端云同步任务上传和下载的统计信息。 + * + * @since 11 + */ +typedef struct Rdb_TableDetails { + /** 数据库表名 */ + const char *table; + /** 表示数据库表中端云同步上传过程的统计信息。 */ + Rdb_Statistic upload; + /** 表示数据库表中端云同步下载过程的统计信息。 */ + Rdb_Statistic download; +} Rdb_TableDetails; + +/** + * 描述端云同步过程。 + * + * @since 11 + */ +typedef enum Rdb_Progress { + /** 表示端云同步过程开始。 */ + RDB_SYNC_BEGIN, + /** 表示正在端云同步过程中。 */ + RDB_SYNC_IN_PROGRESS, + /** 表示端云同步过程已完成。 */ + RDB_SYNC_FINISH +} Rdb_Progress; + + +/** + * 表示端云同步过程的状态。 + * + * @since 11 + */ +typedef enum Rdb_ProgressCode { + /** 表示端云同步过程成功。 */ + RDB_SUCCESS, + /** 表示端云同步过程遇到未知错误。 */ + RDB_UNKNOWN_ERROR, + /** 表示端云同步过程遇到网络错误。 */ + RDB_NETWORK_ERROR, + /** 表示云端不可用。 */ + RDB_CLOUD_DISABLED, + /** 表示有其他设备正在端云同步,本设备无法进行端云同步。 */ + RDB_LOCKED_BY_OTHERS, + /** 表示本次端云同步需要同步的条目或大小超出最大值。由云端配置最大值。 */ + RDB_RECORD_LIMIT_EXCEEDED, + /** 表示云空间剩余空间小于待同步的资产大小。 */ + RDB_NO_SPACE_FOR_ASSET +} Rdb_ProgressCode; + +/** + * @brief 描述{@link OH_ProgressDetails}的版本。 + * + * @since 11 + */ +#define DISTRIBUTED_PROGRESS_DETAIL_VERSION 1 + +/** + * @brief 描述数据库整体执行端云同步任务上传和下载的统计信息。 + * + * @since 11 + */ +typedef struct Rdb_ProgressDetails { + /** 用于唯一标识OH_TableDetails结构的版本。 */ + int version; + /** 表示端云同步过程。 */ + int schedule; + /** 表示端云同步过程的状态。 */ + int code; + /** 表示端云同步的表的数量 */ + int32_t tableLength; +} Rdb_ProgressDetails; + +/** + * @brief 从端云同步任务的统计信息中获取数据库表的统计信息。 + * + * @param progress 表示指向{@link OH_ProgressDetails}实例的指针。 + * @param version 表示当前{@link Rdb_ProgressDetails}的版本。 + * @return 如果操作成功,会返回一个{@link Rdb_TableDetails}结构体的指针,否则返回NULL。 + * @see Rdb_ProgressDetails + * @see Rdb_TableDetails + * @since 11 + */ +Rdb_TableDetails *OH_Rdb_GetTableDetails(Rdb_ProgressDetails *progress, int32_t version); + +/** + * @brief 数据库端云同步的回调函数。 + * + * @param progressDetails 数据库端云同步的统计信息。 + * @see OH_Rdb_Store. + * @since 11 + */ +typedef void (*Rdb_SyncCallback)(Rdb_ProgressDetails *progressDetails); + +/** + * @brief 进行端云同步。 + * + * @param store 表示指向{@link OH_Rdb_Store}实例的指针。 + * @param mode 表示同步过程的类型{@link Rdb_SyncMode}. + * @param tables 表示需要同步的表名。 + * @param count 同步的表的数量,如果传入的值为0,同步数据库的所有表。 + * @param progress 数据库端云同步的回调函数。 + * @see OH_Rdb_Store. + * @since 11 + */ +int OH_Rdb_CloudSync(OH_Rdb_Store *store, Rdb_SyncMode mode, const char *tables, int count, + Rdb_SyncCallback *progress); + #ifdef __cplusplus }; #endif diff --git a/zh-cn/native_sdk/database/rdb/relational_store_error_code.h b/zh-cn/native_sdk/database/rdb/relational_store_error_code.h index 31ab3a86..674bfbed 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store_error_code.h +++ b/zh-cn/native_sdk/database/rdb/relational_store_error_code.h @@ -32,7 +32,7 @@ * @file relational_store_error_code.h * * @brief 声明关系型数据库(RDB)的错误码信息。 - * @library native_rdb_ndk_header.so + * @library libnative_rdb_ndk.z.so * @since 10 */ -- Gitee From 0dc6b4fb8e96db25370a5978f598a1882c45ac35 Mon Sep 17 00:00:00 2001 From: renjiecui Date: Fri, 3 Nov 2023 09:09:18 +0800 Subject: [PATCH 0056/2135] move data Signed-off-by: renjiecui --- zh-cn/native_sdk/database/{rdb => data}/data_asset.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename zh-cn/native_sdk/database/{rdb => data}/data_asset.h (100%) diff --git a/zh-cn/native_sdk/database/rdb/data_asset.h b/zh-cn/native_sdk/database/data/data_asset.h similarity index 100% rename from zh-cn/native_sdk/database/rdb/data_asset.h rename to zh-cn/native_sdk/database/data/data_asset.h -- Gitee From a2ffbe8b0bcf2dcd1491724e871f32978f840adf Mon Sep 17 00:00:00 2001 From: renjiecui Date: Fri, 3 Nov 2023 09:21:21 +0800 Subject: [PATCH 0057/2135] modify Signed-off-by: renjiecui --- zh-cn/native_sdk/database/data/data_asset.h | 6 ++++++ zh-cn/native_sdk/database/rdb/oh_value_object.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/database/data/data_asset.h b/zh-cn/native_sdk/database/data/data_asset.h index 7c88758a..6a1bbf3c 100644 --- a/zh-cn/native_sdk/database/data/data_asset.h +++ b/zh-cn/native_sdk/database/data/data_asset.h @@ -34,6 +34,7 @@ * * 资产是指可以一种可以在数据管理中使用的数据结构,可以存储及查询一个文件的名称、绝对路径、相对路径、创建时间、修改时间、 状态、 * 占用空间等属性。 + * 引用文件 * @library libnative_rdb_ndk.z.so * @since 10 */ @@ -43,6 +44,11 @@ extern "C" { #endif +/** + * @brief 资产状态值类型。 + * + * @since 11 + */ typedef enum Data_AssetStatus { /** 表示资产为空。 */ ASSET_NULL = 0, diff --git a/zh-cn/native_sdk/database/rdb/oh_value_object.h b/zh-cn/native_sdk/database/rdb/oh_value_object.h index 6e6a4b77..47836a8e 100644 --- a/zh-cn/native_sdk/database/rdb/oh_value_object.h +++ b/zh-cn/native_sdk/database/rdb/oh_value_object.h @@ -31,7 +31,7 @@ * @file oh_value_object.h * * @brief 提供类型转换方法。 - * @library libnative_rdb_ndk,z.so + * @library libnative_rdb_ndk.z.so * @since 10 */ -- Gitee From 1be0b59b42649873f6ceb5d240effb231e19edab Mon Sep 17 00:00:00 2001 From: renjiecui Date: Mon, 6 Nov 2023 09:48:06 +0800 Subject: [PATCH 0058/2135] modify Signed-off-by: renjiecui --- zh-cn/native_sdk/database/data/data_asset.h | 2 +- zh-cn/native_sdk/database/rdb/relational_store.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/database/data/data_asset.h b/zh-cn/native_sdk/database/data/data_asset.h index 6a1bbf3c..1c209f00 100644 --- a/zh-cn/native_sdk/database/data/data_asset.h +++ b/zh-cn/native_sdk/database/data/data_asset.h @@ -36,7 +36,7 @@ * 占用空间等属性。 * 引用文件 * @library libnative_rdb_ndk.z.so - * @since 10 + * @since 11 */ #include diff --git a/zh-cn/native_sdk/database/rdb/relational_store.h b/zh-cn/native_sdk/database/rdb/relational_store.h index 9de0e6e8..eaf5590f 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store.h +++ b/zh-cn/native_sdk/database/rdb/relational_store.h @@ -459,9 +459,9 @@ typedef struct Rdb_ChangeInfo { int ChangeType; /** 记录插入数据的位置,如果该表的主键是string类型,该值是主键的值,否则该值表示插入数据的行号。 */ Rdb_KeyInfo inserted; - /** 记录更新数据的位置,如果该表的主键是string类型,该值是主键的值,否则该值表示插入数据的行号。 */ + /** 记录更新数据的位置,如果该表的主键是string类型,该值是主键的值,否则该值表示更新数据的行号。 */ Rdb_KeyInfo updated; - /** 记录删除数据的位置,如果该表的主键是string类型,该值是主键的值,否则该值表示插入数据的行号。 */ + /** 记录删除数据的位置,如果该表的主键是string类型,该值是主键的值,否则该值表示删除数据的行号。 */ Rdb_KeyInfo deleted; } Rdb_ChangeInfo; -- Gitee From 4253fa31098209c69382d4f761a28ea0d6a5a9bd Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Thu, 9 Nov 2023 17:08:53 +0800 Subject: [PATCH 0059/2135] add NDK api for net ssl Signed-off-by: liuxiyao223 --- .../netssl/native_net_ssl_adapter.h | 70 +++++++++++++++++ zh-cn/native_sdk/netssl/native_net_ssl_api.h | 60 +++++++++++++++ zh-cn/native_sdk/netssl/native_net_ssl_type.h | 76 +++++++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 zh-cn/native_sdk/netssl/native_net_ssl_adapter.h create mode 100644 zh-cn/native_sdk/netssl/native_net_ssl_api.h create mode 100644 zh-cn/native_sdk/netssl/native_net_ssl_type.h diff --git a/zh-cn/native_sdk/netssl/native_net_ssl_adapter.h b/zh-cn/native_sdk/netssl/native_net_ssl_adapter.h new file mode 100644 index 00000000..687a685a --- /dev/null +++ b/zh-cn/native_sdk/netssl/native_net_ssl_adapter.h @@ -0,0 +1,70 @@ +/* + * 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 NATIVE_NET_SSL_ADAPTER_H +#define NATIVE_NET_SSL_ADAPTER_H + +#include + +/** + * @addtogroup netstack + * @{ + * + * @brief 为SSL/TLS证书链校验模块提供内部实现 + * + * @since 11 + * @version 1.0 + */ + +/** + * @file native_net_ssl_adapter.h + * + * @brief 为websocket客户端模块定义C接口 + * + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#include "native_net_ssl_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 以预制证书校验用户传入证书 + * @param cert 用户传入的待校验证书 + * @return 返回0表示校验成功,否则,表示校验失败 + * @since 11 + * @version 1.0 + */ +int32_t VerifyCert_With_RootCa(const struct OH_NetStack_CertBlob *cert); + +/** + * @brief 以用户指定证书校验用户传入证书 + * @param cert 用户传入的待校验证书 + * @param caCert 用户指定证书 + * @return 返回0表示校验成功,否则,表示校验失败 + * @since 11 + * @version 1.0 + */ +int32_t VerifyCert_With_DesignatedCa(const struct OH_NetStack_CertBlob *cert, + const struct OH_NetStack_CertBlob *caCert); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_NET_SSL_ADAPTER_H diff --git a/zh-cn/native_sdk/netssl/native_net_ssl_api.h b/zh-cn/native_sdk/netssl/native_net_ssl_api.h new file mode 100644 index 00000000..5570f61f --- /dev/null +++ b/zh-cn/native_sdk/netssl/native_net_ssl_api.h @@ -0,0 +1,60 @@ +/* + * 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 NATIVE_NET_SSL_API_H +#define NATIVE_NET_SSL_API_H + +/** + * @addtogroup netstack + * @{ + * + * @brief 为SSL/TLS证书链校验模块提供C接口 + * + * @since 11 + * @version 1.0 + */ + +/** + * @file native_net_ssl_api.h + * + * @brief 为SSL/TLS证书链校验模块定义C接口 + * + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#include "native_net_ssl_adapter.h" +#include "native_net_ssl_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 对外暴露的证书链校验接口 + * @param cert 用户传入的待校验证书 + * @param caCert 用户指定的证书,若为空则以系统预置证书进行校验 + * @return 返回0表示校验成功,否则,表示校验失败 + * @since 11 + * @version 1.0 + */ +int32_t OH_NetStack_VerifyCertification(const struct OH_NetStack_CertBlob *cert, + const struct OH_NetStack_CertBlob *caCert); +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_NET_SSL_API_H diff --git a/zh-cn/native_sdk/netssl/native_net_ssl_type.h b/zh-cn/native_sdk/netssl/native_net_ssl_type.h new file mode 100644 index 00000000..0c43014b --- /dev/null +++ b/zh-cn/native_sdk/netssl/native_net_ssl_type.h @@ -0,0 +1,76 @@ +/* + * 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 NATIVE_NET_SSL_TYPE_H +#define NATIVE_NET_SSL_TYPE_H + +/** + * @addtogroup netstack + * @{ + * + * @brief 为SSL/TLS证书链校验模块的C接口提供数据结构 + * + * @since 11 + * @version 1.0 + */ + +/** + * @file native_net_ssl_type.h + * @brief 定义SSL/TLS证书链校验模块的C接口需要的数据结构 + * + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 证书类型枚举 + * @since 11 + * @version 1.0 + */ +enum OH_NetStack_CertType { + /** PEM证书类型 */ + OH_NetStack_CERT_TYPE_PEM = 0, + /** DER证书类型 */ + OH_NetStack_CERT_TYPE_DER = 1, + /** 错误证书类型 */ + OH_NetStack_CERT_TYPE_MAX +}; + +/** + * @brief 证书数据结构体 + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_CertBlob { + /** 证书类型 */ + enum OH_NetStack_CertType type; + /** 证书内容长度 */ + uint32_t size; + /** 证书内容 */ + uint8_t *data; +}; + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_NET_SSL_TYPE_H -- Gitee From 76b4ba68e682f413bcc9bb4521b80de4aa4449cf Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Thu, 9 Nov 2023 17:42:05 +0800 Subject: [PATCH 0060/2135] delete native_net_ssl_adapter.cpp,modify return type from int32_t to uint32_t Signed-off-by: liuxiyao223 --- .../netssl/native_net_ssl_adapter.h | 70 ------------------- zh-cn/native_sdk/netssl/native_net_ssl_api.h | 3 +- 2 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 zh-cn/native_sdk/netssl/native_net_ssl_adapter.h diff --git a/zh-cn/native_sdk/netssl/native_net_ssl_adapter.h b/zh-cn/native_sdk/netssl/native_net_ssl_adapter.h deleted file mode 100644 index 687a685a..00000000 --- a/zh-cn/native_sdk/netssl/native_net_ssl_adapter.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 NATIVE_NET_SSL_ADAPTER_H -#define NATIVE_NET_SSL_ADAPTER_H - -#include - -/** - * @addtogroup netstack - * @{ - * - * @brief 为SSL/TLS证书链校验模块提供内部实现 - * - * @since 11 - * @version 1.0 - */ - -/** - * @file native_net_ssl_adapter.h - * - * @brief 为websocket客户端模块定义C接口 - * - * @syscap SystemCapability.Communication.Netstack - * @since 11 - * @version 1.0 - */ - -#include "native_net_ssl_type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief 以预制证书校验用户传入证书 - * @param cert 用户传入的待校验证书 - * @return 返回0表示校验成功,否则,表示校验失败 - * @since 11 - * @version 1.0 - */ -int32_t VerifyCert_With_RootCa(const struct OH_NetStack_CertBlob *cert); - -/** - * @brief 以用户指定证书校验用户传入证书 - * @param cert 用户传入的待校验证书 - * @param caCert 用户指定证书 - * @return 返回0表示校验成功,否则,表示校验失败 - * @since 11 - * @version 1.0 - */ -int32_t VerifyCert_With_DesignatedCa(const struct OH_NetStack_CertBlob *cert, - const struct OH_NetStack_CertBlob *caCert); - -#ifdef __cplusplus -} -#endif - -#endif // NATIVE_NET_SSL_ADAPTER_H diff --git a/zh-cn/native_sdk/netssl/native_net_ssl_api.h b/zh-cn/native_sdk/netssl/native_net_ssl_api.h index 5570f61f..529e7f94 100644 --- a/zh-cn/native_sdk/netssl/native_net_ssl_api.h +++ b/zh-cn/native_sdk/netssl/native_net_ssl_api.h @@ -36,7 +36,6 @@ * @version 1.0 */ -#include "native_net_ssl_adapter.h" #include "native_net_ssl_type.h" #ifdef __cplusplus @@ -51,7 +50,7 @@ extern "C" { * @since 11 * @version 1.0 */ -int32_t OH_NetStack_VerifyCertification(const struct OH_NetStack_CertBlob *cert, +uint32_t OH_NetStack_VerifyCertification(const struct OH_NetStack_CertBlob *cert, const struct OH_NetStack_CertBlob *caCert); #ifdef __cplusplus } -- Gitee From c0d1f3645f8eeeb72d9e88b24bc8294c68197e15 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 10 Nov 2023 09:01:48 +0800 Subject: [PATCH 0061/2135] update docs Signed-off-by: shawn_he --- en/native_sdk/net/dns/native_net_conn_api.h | 117 +------------------- 1 file changed, 2 insertions(+), 115 deletions(-) diff --git a/en/native_sdk/net/dns/native_net_conn_api.h b/en/native_sdk/net/dns/native_net_conn_api.h index 971739af..8e00d1ee 100644 --- a/en/native_sdk/net/dns/native_net_conn_api.h +++ b/en/native_sdk/net/dns/native_net_conn_api.h @@ -20,7 +20,7 @@ * @addtogroup NetConn * @{ * - * @brief Provide C interface for the data network connection module of network management. + * @brief Provides C APIs for the data network connection module of network management. * * @since 11 * @version 1.0 @@ -29,9 +29,8 @@ /** * @file native_net_conn_api.h * - * @brief Provide C interface for the data network connection module of network management. + * @brief Provides C APIs for the data network connection module of network management. * - * @library libnetconn_ndk.z.so * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 @@ -80,118 +79,6 @@ int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, st */ int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); -/** - * @brief Checks whether a default activated data network is available. - * - * @param hasDefaultNet Whether a default activated data network is available. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.GET_NETWORK_INFO - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ -int32_t OH_NetConn_HasDefaultNet(int32_t *hasDefaultNet); - -/** - * @brief Obtains the default activated data network. - * - * @param netHandle Network handle that stores the network ID. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.GET_NETWORK_INFO - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ -int32_t OH_NetConn_GetDefaultNet(OH_NetConn_NetHandle *netHandle); - -/** - * @brief Checks whether metering is enabled for the default data network. - * - * @param isMetered Whether metering is enabled. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.GET_NETWORK_INFO - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ -int32_t OH_NetConn_IsDefaultNetMetered(int32_t *isMetered); - -/** - * @brief Queries all activated data networks. - * - * @param netHandleList Network handle that stores the network ID list. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.GET_NETWORK_INFO - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ -int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); - -/** - * @brief Queries the link information of a data network. - * - * @param netHandle Network handle that stores the network ID. - * @param info Link information. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.GET_NETWORK_INFO - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ -int32_t OH_NetConn_GetConnectionProperties(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetLinkInfo *info); - -/** - * @brief Queries the capabilities of a data network. - * - * @param netHandle Network handle that stores the network ID. - * @param netAllCapacities Network capabilities. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.GET_NETWORK_INFO - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ -int32_t OH_NetConn_GetNetCapabilities(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetAllCapabilities *netAllCapacities); - -/** - * @brief Queries the default network proxy. - * - * @param httpProxy HTTP proxy. - * @return 0: success. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ -int32_t OH_NetConn_GetDefaultHttpProxy(OH_NetConn_HttpProxy *httpProxy); - #ifdef __cplusplus } #endif -- Gitee From 297d3ae1dcf482cd636ecbfb859a92b7311334c6 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 10 Nov 2023 11:07:45 +0800 Subject: [PATCH 0062/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/net/dns/native_net_conn_api.h | 73 +++++++++++++++------ 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/en/native_sdk/net/dns/native_net_conn_api.h b/en/native_sdk/net/dns/native_net_conn_api.h index 8e00d1ee..de4c7e8e 100644 --- a/en/native_sdk/net/dns/native_net_conn_api.h +++ b/en/native_sdk/net/dns/native_net_conn_api.h @@ -20,7 +20,7 @@ * @addtogroup NetConn * @{ * - * @brief Provides C APIs for the data network connection module of network management. + * @brief Provide C interface for the data network connection module of network management. * * @since 11 * @version 1.0 @@ -29,7 +29,7 @@ /** * @file native_net_conn_api.h * - * @brief Provides C APIs for the data network connection module of network management. + * @brief Provide C interface for the data network connection module of network management. * * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -44,18 +44,18 @@ extern "C" { #endif /** - * @brief Obtains the DNS result based on netId. + * @brief 通过netId获取DNS结果. * - * @param host Host name. - * @param serv Service name. - * @param hint Pointer to the addrinfo structure. - * @param res DNS query result, which is in the format of linked lists. - * @param netId Network ID. If netId is 0, the default network ID is used for DNS query. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. + * @param host 所需查询的host名. + * @param serv 服务名. + * @param hint 指向addrinfo结构体的指针. + * @param res 存放DNS查询结果,以链表形式返回. + * @param netId DNS查询netId 为0是使用默认netid查询. + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -64,14 +64,14 @@ extern "C" { int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); /** - * @brief Releases the DNS query result. + * @brief 释放DNS结果. * - * @param res DNS query result, which is in the format of linked lists. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. + * @param res DNS查询结果链表头. + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -79,9 +79,40 @@ int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, st */ int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); +/** + * @brief 注册自定义DNS解析器 + * + * @param resolve 自定义DNS解析函数的函数指针 + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 +*/ +int32_t OHOS_NetConn_RegisterDnsHook(customdnsresolve resolve); + +/** + * @brief 解注册自定义DNS解析器 + * + * @return 0 - 成功. + * @return 201 - 缺少权限. + * @return 401 - 参数错误. + * @return 2100002 - 无法连接到服务. + * @return 2100003 - 内部错误. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 +*/ +int32_t OHOS_NetConn_UnRegisterDnsHook(); + #ifdef __cplusplus } #endif /** @} */ -#endif /* NATIVE_NET_CONN_API_H */ +#endif /* NATIVE_NET_CONN_API_H */ \ No newline at end of file -- Gitee From 286c5b0940e962d9ebb3ff427ee0f77ec2889a95 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 10 Nov 2023 11:09:30 +0800 Subject: [PATCH 0063/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/net/dns/native_net_conn_api.h | 68 ++++++++++----------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/en/native_sdk/net/dns/native_net_conn_api.h b/en/native_sdk/net/dns/native_net_conn_api.h index de4c7e8e..52e64a2b 100644 --- a/en/native_sdk/net/dns/native_net_conn_api.h +++ b/en/native_sdk/net/dns/native_net_conn_api.h @@ -20,7 +20,7 @@ * @addtogroup NetConn * @{ * - * @brief Provide C interface for the data network connection module of network management. + * @brief Provides C APIs for the data network connection module of network management. * * @since 11 * @version 1.0 @@ -29,7 +29,7 @@ /** * @file native_net_conn_api.h * - * @brief Provide C interface for the data network connection module of network management. + * @brief Provides C APIs for the data network connection module of network management. * * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -44,18 +44,18 @@ extern "C" { #endif /** - * @brief 通过netId获取DNS结果. + * @brief Obtains the DNS result based on netId. * - * @param host 所需查询的host名. - * @param serv 服务名. - * @param hint 指向addrinfo结构体的指针. - * @param res 存放DNS查询结果,以链表形式返回. - * @param netId DNS查询netId 为0是使用默认netid查询. - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @param host Host name. + * @param serv Service name. + * @param hint Pointer to the addrinfo structure. + * @param res DNS query result, which is in the format of linked lists. + * @param netId Network ID. If netId is 0, the default network ID is used for DNS query. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -64,14 +64,14 @@ extern "C" { int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); /** - * @brief 释放DNS结果. + * @brief Releases the DNS query result. * - * @param res DNS查询结果链表头. - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @param res DNS query result, which is in the format of linked lists. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -80,14 +80,14 @@ int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, st int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); /** - * @brief 注册自定义DNS解析器 + * @brief Registers a custom DNS resolver. * - * @param resolve 自定义DNS解析函数的函数指针 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @param resolve Pointer to the custom DNS resolver. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -96,13 +96,13 @@ int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); int32_t OHOS_NetConn_RegisterDnsHook(customdnsresolve resolve); /** - * @brief 解注册自定义DNS解析器 + * @brief Unregisters a custom DNS resolver. * - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @return 0: success. + * @return 201: insufficient permission. + * @return 401: parameter error. + * @return 2100002: service connection failure. + * @return 2100003: internal error. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 @@ -115,4 +115,4 @@ int32_t OHOS_NetConn_UnRegisterDnsHook(); #endif /** @} */ -#endif /* NATIVE_NET_CONN_API_H */ \ No newline at end of file +#endif /* NATIVE_NET_CONN_API_H */ -- Gitee From a241a90d9fe1b5c130a32e474e720bf084c6957d Mon Sep 17 00:00:00 2001 From: zhangkai269 Date: Fri, 10 Nov 2023 11:16:25 +0800 Subject: [PATCH 0064/2135] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ohaudio=20ndk?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangkai269 --- .../media/ohaudio/native_audiocapturer.h | 232 ++++++++++ .../media/ohaudio/native_audiorenderer.h | 228 ++++++++++ .../media/ohaudio/native_audiostream_base.h | 417 ++++++++++++++++++ .../media/ohaudio/native_audiostreambuilder.h | 209 +++++++++ 4 files changed, 1086 insertions(+) create mode 100644 zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h create mode 100644 zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h create mode 100644 zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h create mode 100644 zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h b/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h new file mode 100644 index 00000000..e469ca43 --- /dev/null +++ b/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OHAudio + * @{ + * + * @brief 提供音频模块C接口定义。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * + * @since 10 + * @version 1.0 + */ + +/** + * @file native_audiocapturer.h + * + * @brief 声明输入类型的音频流相关接口, + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + * @version 1.0 + */ + +#ifndef NATIVE_AUDIOCAPTURER_H +#define NATIVE_AUDIOCAPTURER_H + +#include +#include "native_audiostream_base.h" +#ifdef __cplusplus +extern "C" { +#endif +/* + * @brief 释放音频流。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @permission ohos.permission.MICROPHONE + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_Release(OH_AudioCapturer* capturer); + +/* + * @brief 开始获取音频数据。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @permission ohos.permission.MICROPHONE + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_Start(OH_AudioCapturer* capturer); + +/* + * @brief 暂停音频流。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @permission ohos.permission.MICROPHONE + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_Pause(OH_AudioCapturer* capturer); + +/* + * @brief 停止音频流 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @permission ohos.permission.MICROPHONE + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_Stop(OH_AudioCapturer* capturer); + +/* + * @brief 丢弃获取的音频数据。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_Flush(OH_AudioCapturer* capturer); + +/* + * @brief 查询当前音频流状态。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param state 指向一个用来接收音频流状态的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetCurrentState(OH_AudioCapturer* capturer, OH_AudioStream_State* state); + +/* + * @brief 查询当前音频流时延模式。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param latencyMode 指向一个用来接收音频流时延模式的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetLatencyMode(OH_AudioCapturer* capturer, + OH_AudioStream_LatencyMode* latencyMode); + +/* + * @brief 查询当前音频流ID。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param streamId 指向一个用来接收音频流ID的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetStreamId(OH_AudioCapturer* capturer, uint32_t* streamId); + +/* + * @brief 查询当前音频流采样率。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param rate 指向一个用来接收音频流采样率的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetSamplingRate(OH_AudioCapturer* capturer, int32_t* rate); + +/* + * @brief 查询当前音频流通道数。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param channelCount 指向一个用来接收音频流通道数的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetChannelCount(OH_AudioCapturer* capturer, int32_t* channelCount); + +/* + * @brief 查询当前音频流采样格式。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param sampleFormat 指向一个用来接收音频流采样格式的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetSampleFormat(OH_AudioCapturer* capturer, + OH_AudioStream_SampleFormat* sampleFormat); + +/* + * @brief 查询当前音频流编码类型。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param encodingType 指向一个用来接收音频流编码类型的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetEncodingType(OH_AudioCapturer* capturer, + OH_AudioStream_EncodingType* encodingType); + +/* + * @brief 查询当前音频流工作场景类型。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param sourceType 指向一个用来接收输入类型音频流的工作场景的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetCapturerInfo(OH_AudioCapturer* capturer, + OH_AudioStream_SourceType* sourceType); + +/* + * @brief 在回调中查询帧大小,它是每次回调返回的缓冲区的固定长度。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param frameSize 指向将为帧大小设置的变量的指针(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetFrameSizeInCallback(OH_AudioCapturer *capturer, + int32_t *frameSize); + +/* + * @brief 获取输入音频流时间戳和位置信息。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param clockId CLOCK_MONOTONIC。 + * @param framePosition 指向要接收位置的变量的指针(作为返回值使用)。 + * @param timestamp 指向接收时间戳的变量的指针(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetTimestamp(OH_AudioCapturer *capturer, clockid_t clockId, + int64_t *framePosition, int64_t *timestamp); + +/* + * @brief 查询自创建流以来已读取的帧数。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param capturer 指向{@link OH_AudioStreamBuilder_GenerateCapturer}创建的音频流实例。 + * @param frames 指向将为帧计数设置的变量的指针(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioCapturer_GetFramesRead(OH_AudioCapturer *capturer, int64_t *frames) +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AUDIOCAPTURER_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h b/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h new file mode 100644 index 00000000..9b9f0c21 --- /dev/null +++ b/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OHAudio + * @{ + * + * @brief 提供音频模块C接口定义。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * + * @since 10 + * @version 1.0 + */ + +/** + * @file native_audiorenderer.h + * + * @brief 声明输出类型的音频流相关接口, + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + * @version 1.0 + */ + +#ifndef NATIVE_AUDIORENDERER_H +#define NATIVE_AUDIORENDERER_H + +#include +#include "native_audiostream_base.h" +#ifdef __cplusplus +extern "C" { +#endif +/* + * @brief 释放音频流。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_Release(OH_AudioRenderer* renderer); + +/* + * @brief 开始输出音频数据。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_Start(OH_AudioRenderer* renderer); + +/* + * @brief 暂停音频流。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_Pause(OH_AudioRenderer* renderer); + +/* + * @brief 停止音频流 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_Stop(OH_AudioRenderer* renderer); + +/* + * @brief 丢弃已经写入的音频数据。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_Flush(OH_AudioRenderer* renderer); + +/* + * @brief 查询当前音频流状态。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param state 指向一个用来接收音频流状态的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetCurrentState(OH_AudioRenderer* renderer, + OH_AudioStream_State* state); + +/* + * @brief 查询当前音频流采样率。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param rate 指向一个用来接收音频流采样率的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetSamplingRate(OH_AudioRenderer* renderer, int32_t* rate); + +/* + * @brief 查询当前音频流ID。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param streamId 指向一个用来接收音频流ID的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetStreamId(OH_AudioRenderer* renderer, uint32_t* streamId); + +/* + * @brief 查询当前音频流通道数。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param channelCount 指向一个用来接收音频流通道数的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetChannelCount(OH_AudioRenderer* renderer, int32_t* channelCount); + +/* + * @brief 查询当前音频流采样格式。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param sampleFormat 指向一个用来接收音频流采样格式的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetSampleFormat(OH_AudioRenderer* renderer, + OH_AudioStream_SampleFormat* sampleFormat); + +/* + * @brief 查询当前音频流时延模式。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param latencyMode 指向一个用来接收音频流时延模式的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetLatencyMode(OH_AudioRenderer* renderer, + OH_AudioStream_LatencyMode* latencyMode); +/* + * @brief 查询当前音频流工作场景类型。 + * + * The rendere info includes {@link OH_AudioStream_Usage} value and {@link OH_AudioStream_Content} value. + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param usage 指向一个用来接收输出类型音频流的工作场景的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetRendererInfo(OH_AudioRenderer* renderer, + OH_AudioStream_Usage* usage); + +/* + * @brief 查询当前音频流编码类型。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param encodingType 指向一个用来接收音频流编码类型的变量(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetEncodingType(OH_AudioRenderer* renderer, + OH_AudioStream_EncodingType* encodingType); + +/* + * @brief 查询自创建流以来已写入的帧数。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param frames 指向将为帧计数设置的变量的指针(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetFramesWritten(OH_AudioRenderer *renderer, int64_t *frames); + +/* + * @brief 获取输出音频流时间戳和位置信息。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param clockId CLOCK_MONOTONIC + * @param framePosition 指向要接收位置的变量的指针(作为返回值使用)。 + * @param timestamp 指向接收时间戳的变量的指针(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetTimestamp(OH_AudioRenderer *renderer, clockid_t clockId, + int64_t *framePosition, int64_t *timestamp); + +/* + * @brief 在回调中查询帧大小,它是一个固定的长度,每次回调都要填充流。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param frameSize 指向将为帧大小设置的变量的指针(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetFrameSizeInCallback(OH_AudioRenderer *renderer, int32_t *frameSize); +#ifdef __cplusplus +} +#endif +#endif // NATIVE_AUDIORENDERER_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h b/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h new file mode 100644 index 00000000..d7e20cba --- /dev/null +++ b/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h @@ -0,0 +1,417 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OHAudio + * @{ + * + * @brief 提供音频模块C接口定义。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * + * @since 10 + * @version 1.0 + */ + +/** + * @file native_audiostream_base.h + * + * @brief 声明OHAudio基础的数据结构。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + * @version 1.0 + */ + +#ifndef NATIVE_AUDIOSTREAM_BASE_H +#define NATIVE_AUDIOSTREAM_BASE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 音频错误码。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 操作成功 + */ + AUDIOSTREAM_SUCCESS, + + /** + * 入参错误。 + */ + AUDIOSTREAM_ERROR_INVALID_PARAM, + + /** + * 非法状态。 + */ + AUDIOSTREAM_ERROR_ILLEGAL_STATE, + + /** + * 系统通用错误。 + */ + AUDIOSTREAM_ERROR_SYSTEM +} OH_AudioStream_Result; + +/** + * @brief 音频流类型。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 该类型代表音频流是输出流。 + */ + AUDIOSTREAM_TYPE_RERNDERER = 1, + + /** + * 该类型代表音频流是输入流。 + */ + AUDIOSTREAM_TYPE_CAPTURER = 2 +} OH_AudioStream_Type; + +/** + * @brief 定义音频流采样格式。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * Unsigned 8位。 + */ + AUDIOSTREAM_SAMPLE_U8 = 0, + /** + * Short 16位小端。 + */ + AUDIOSTREAM_SAMPLE_S16LE = 1, + /** + * Short 24位小端。 + */ + AUDIOSTREAM_SAMPLE_S24LE = 2, + /** + * Short 32位小端。 + */ + AUDIOSTREAM_SAMPLE_S32LE = 3, +} OH_AudioStream_SampleFormat; + +/** + * @brief 定义音频流编码类型。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * PCM编码。 + */ + AUDIOSTREAM_ENCODING_TYPE_RAW = 0, +} OH_AudioStream_EncodingType; + +/** + * @brief 定义音频流使用场景。 + * + * 通常用来描述音频输出流的使用场景。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 未定义。 + */ + AUDIOSTREAM_USAGE_UNKNOWN = 0, + /** + * 音乐。 + */ + AUDIOSTREAM_USAGE_MUSIC = 1, + /** + * 通话。 + */ + AUDIOSTREAM_USAGE_COMMUNICATION = 2, + /** + * 游戏。 + */ + AUDIOSTREAM_USAGE_GAME = 11, +} OH_AudioStream_Usage; + +/** + * @brief 定义音频时延模式。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 该模式代表一个普通时延的音频流。 + */ + AUDIOSTREAM_LATENCY_MODE_NORMAL, +} OH_AudioStream_LatencyMode; + +/** + * @brief 定义音频流的状态。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 不合法的状态。 + */ + AUDIOSTREAM_STATE_INVALID = -1, + /** + * 准备状态。 + */ + AUDIOSTREAM_STATE_PREPARED = 1, + /** + * 工作状态。 + */ + AUDIOSTREAM_STATE_RUNNING = 2, + /** + * 停止状态。 + */ + AUDIOSTREAM_STATE_STOPPED = 3, + /** + * 释放状态。 + */ + AUDIOSTREAM_STATE_RELEASED = 4, + /** + * 暂停状态。 + */ + AUDIOSTREAM_STATE_PAUSED = 5, +} OH_AudioStream_State; + +/** + * @brief 定义音频流使用场景。 + * + * 通常用来描述音频输入流的使用场景。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 不合法状态。 + */ + AUDIOSTREAM_SOURCE_TYPE_INVALID = -1, + /** + * 录音。 + */ + AUDIOSTREAM_SOURCE_TYPE_MIC, + /** + * 语音识别。 + */ + AUDIOSTREAM_SOURCE_TYPE_VOICE_RECOGNITION = 1, + /** + * 通话。 + */ + AUDIOSTREAM_SOURCE_TYPE_VOICE_COMMUNICATION = 7 +} OH_AudioStream_SourceType; + +/** + * @brief 定义音频事件。 + * + * 通常用来描述音频事件。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 音频的路由已更改。 + */ + AUDIOSTREAM_EVENT_ROUTING_CHANGED +} OH_AudioStream_Event; + +/** + * @brief 定义音频中断类型。 + * + * 通常用来描述音频中断事件。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 强制类型,系统更改音频状态。 + */ + AUDIOSTREAM_INTERRUPT_FORCE, + /** + * 共享类型,应用程序更改音频状态。 + */ + AUDIOSTREAM_INTERRUPT_SHAR +} OH_AudioInterrupt_ForceType; + +/** + * @brief 定义音频中断类型。 + * + * 通常用来描述音频中断事件。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef enum { + /** + * 不提示。 + */ + AUDIOSTREAM_INTERRUPT_HINT_NONE, + /** + * 恢复流提示。 + */ + AUDIOSTREAM_INTERRUPT_HINT_RESUME, + /** + * 暂停流提示。 + */ + AUDIOSTREAM_INTERRUPT_HINT_PAUSE, + /** + * 停止流提示。 + */ + AUDIOSTREAM_INTERRUPT_HINT_STOP, + /** + * 短暂降低音量。 + */ + AUDIOSTREAM_INTERRUPT_HINT_DUCK, + /** + * 恢复音量。 + */ + AUDIOSTREAM_INTERRUPT_HINT_UNDUCK +} OH_AudioInterrupt_Hint; + +/** + * @brief 声明音频流的构造器。 + * + * 构造器实例通常被用来设置音频流属性和创建音频流。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef struct OH_AudioStreamBuilderStruct OH_AudioStreamBuilder; + +/** + * @brief 声明输出音频流。 + * + * 输出音频流的实例被用来播放音频数据。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef struct OH_AudioRendererStruct OH_AudioRenderer; + +/** + * @brief 声明输入音频流。 + * + * 输入音频流的实例被用来获取音频数据。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef struct OH_AudioCapturerStruct OH_AudioCapturer; + +/** + * @brief 声明输出音频流的回调函数指针。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef struct OH_AudioRenderer_Callbacks_Struct { + /** + * 这个函数指针将指向用于写入音频数据的回调函数。 + */ + int32_t (*OH_AudioRenderer_OnWriteData)( + OH_AudioRenderer* renderer, + void* userData, + void* buffer, + int32_t lenth); + + /** + * 这个函数指针将指向用于处理音频播放流事件的回调函数。 + */ + int32_t (*OH_AudioRenderer_Callbacks_Struct::OH_AudioRenderer_OnStreamEvent)( + OH_AudioRenderer *renderer, + void *userData, + OH_AudioStream_Event event); + + /** + * 这个函数指针将指向用于处理音频播放中断事件的回调函数。 + */ + int32_t (*OH_AudioRenderer_Callbacks_Struct::OH_AudioRenderer_OnInterruptEvent)( + OH_AudioRenderer *renderer, + void *userData, + OH_AudioInterrupt_ForceType type, + OH_AudioInterrupt_Hint hint); + + /** + * 这个函数指针将指向用于处理音频播放错误结果的回调函数。 + */ + int32_t (*OH_AudioRenderer_Callbacks_Struct::OH_AudioRenderer_OnError)( + OH_AudioRenderer *renderer, + void *userData, + OH_AudioStream_Result error); +} OH_AudioRenderer_Callbacks; + +/** + * @brief 声明输入音频流的回调函数指针。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ +typedef struct OH_AudioCapturer_Callbacks_Struct { + /** + * 这个函数指针将指向用于读取音频数据的回调函数。 + */ + int32_t (*OH_AudioCapturer_OnReadData)( + OH_AudioCapturer* capturer, + void* userData, + void* buffer, + int32_t lenth); + + /** + * 这个函数指针将指向用于处理音频录制流事件的回调函数。 + */ + int32_t (*OH_AudioCapturer_Callbacks_Struct::OH_AudioCapturer_OnStreamEvent)( + OH_AudioCapturer *capturer, + void *userData, + OH_AudioStream_Event event); + + /** + * 这个函数指针将指向用于处理音频录制中断事件的回调函数。 + */ + int32_t (*OH_AudioCapturer_Callbacks_Struct::OH_AudioCapturer_OnInterruptEvent)( + OH_AudioCapturer *capturer, + void *userData, + OH_AudioInterrupt_ForceType type, + OH_AudioInterrupt_Hint hint); + + /** + * 这个函数指针将指向用于处理音频录制错误结果的回调函数。 + */ + int32_t (*OH_AudioCapturer_Callbacks_Struct::OH_AudioCapturer_OnError)( + OH_AudioCapturer *capturer, + void *userData, + OH_AudioStream_Result error); +} OH_AudioCapturer_Callbacks; +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AUDIOSTREAM_BASE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h b/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h new file mode 100644 index 00000000..15136d8d --- /dev/null +++ b/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h @@ -0,0 +1,209 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OHAudio + * @{ + * + * @brief 提供音频模块C接口定义。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * + * @since 10 + * @version 1.0 + */ + +/** + * @file native_audiostreambuilder.h + * + * @brief 声明音频流构造器相关接口。 + * + * 包含构造和销毁构造器,设置音频流属性,回调等相关接口。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + * @version 1.0 + */ + +#ifndef NATIVE_AUDIOSTREAMBUILDER_H +#define NATIVE_AUDIOSTREAMBUILDER_H + +#include "native_audiostream_base.h" +#include "native_audiorenderer.h" +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 创建一个输入或者输出类型的音频流构造器。 + * + * 当构造器不再使用时,需要调用OH_AudioStreamBuilder_Destroy()销毁它。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 该引用指向创建的构造器的结果。 + * @param type 构造器的流类型。{@link AUDIOSTREAM_TYPE_RERNDERER} or {@link AUDIOSTREAM_TYPE_CAPTURER} + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_Create(OH_AudioStreamBuilder** builder, OH_AudioStream_Type type); + +/** + * @brief 销毁一个音频流构造器。 + * + * 当构造器不再使用时,需要调用该函数销毁它。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_Destroy(OH_AudioStreamBuilder* builder); + +/** + * @brief 设置音频流的采样率属性。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param channelCount 音频流采样率。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetSamplingRate(OH_AudioStreamBuilder* builder, int32_t rate); + +/** + * @brief 设置音频流的通道数属性。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param channelCount 音频流通道数。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetChannelCount(OH_AudioStreamBuilder* builder, int32_t channelCount); + +/** + * @brief 设置音频流的采样格式属性。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param format 音频流采样格式。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetSampleFormat(OH_AudioStreamBuilder* builder, + OH_AudioStream_SampleFormat format); + +/** + * @brief 设置音频流的编码类型属性。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param encodingType 音频流编码类型, {@link AUDIOSTREAM_ENCODING_PCM} + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetEncodingType(OH_AudioStreamBuilder* builder, + OH_AudioStream_EncodingType encodingType); + +/** + * @brief 设置音频流的时延模式。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param latencyMode 音频流时延模式。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetLatencyMode(OH_AudioStreamBuilder* builder, + OH_AudioStream_LatencyMode latencyMode); + +/** + * @brief 设置输出音频流的工作场景。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param usage 输出音频流属性,使用的工作场景。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererInfo(OH_AudioStreamBuilder* builder, + OH_AudioStream_Usage usage); + +/** + * @brief 设置输入音频流的工作场景。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param sourceType 输入音频流属性,使用的工作场景。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInfo(OH_AudioStreamBuilder* builder, + OH_AudioStream_SourceType sourceType); + +/** + * @brief 设置输出音频流的回调。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param callbacks 将被用来处理输出音频流相关事件的回调函数。 + * @param userData 指向通过回调函数传递的应用数据指针。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererCallback(OH_AudioStreamBuilder* builder, + OH_AudioRenderer_Callbacks callbacks, void* userData); + +/** + * @brief 设置输入音频流的回调。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param callbacks 将被用来处理输入音频流相关事件的回调函数。 + * @param userData 指向通过回调函数传递的应用数据指针。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerCallback(OH_AudioStreamBuilder* builder, + OH_AudioCapturer_Callbacks callbacks, void* userData); + +/** + * @brief 创建输出音频流实例。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param audioRenderer 指向输出音频流实例的指针,将被用来接收函数创建的结果。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_GenerateRenderer(OH_AudioStreamBuilder* builder, + OH_AudioRenderer** audioRenderer); + +/** + * @brief 创建输入音频流实例。 + * + * @since 10 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param audioCapturer 指向输入音频流实例的指针,将被用来接收函数创建的结果。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_GenerateCapturer(OH_AudioStreamBuilder* builder, + OH_AudioCapturer** audioCapturer); +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AUDIOSTREAMBUILDER_H \ No newline at end of file -- Gitee From d490f4ca540663acd662e8679f63d73c381cf2a1 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 10 Nov 2023 15:47:24 +0800 Subject: [PATCH 0065/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/net/dns/native_net_conn_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/native_sdk/net/dns/native_net_conn_api.h b/en/native_sdk/net/dns/native_net_conn_api.h index 52e64a2b..1d332a27 100644 --- a/en/native_sdk/net/dns/native_net_conn_api.h +++ b/en/native_sdk/net/dns/native_net_conn_api.h @@ -108,7 +108,7 @@ int32_t OHOS_NetConn_RegisterDnsHook(customdnsresolve resolve); * @since 11 * @version 1.0 */ -int32_t OHOS_NetConn_UnRegisterDnsHook(); +int32_t OHOS_NetConn_UnRegisterDnsHook(void); #ifdef __cplusplus } -- Gitee From f95ffd5b7af2a28966d2d77138ca313b78a5ab8b Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Fri, 10 Nov 2023 16:04:36 +0800 Subject: [PATCH 0066/2135] format modify Signed-off-by: liuxiyao223 --- zh-cn/native_sdk/{netssl => net_ssl}/native_net_ssl_api.h | 3 +++ zh-cn/native_sdk/{netssl => net_ssl}/native_net_ssl_type.h | 3 +++ 2 files changed, 6 insertions(+) rename zh-cn/native_sdk/{netssl => net_ssl}/native_net_ssl_api.h (91%) rename zh-cn/native_sdk/{netssl => net_ssl}/native_net_ssl_type.h (93%) diff --git a/zh-cn/native_sdk/netssl/native_net_ssl_api.h b/zh-cn/native_sdk/net_ssl/native_net_ssl_api.h similarity index 91% rename from zh-cn/native_sdk/netssl/native_net_ssl_api.h rename to zh-cn/native_sdk/net_ssl/native_net_ssl_api.h index 529e7f94..c54d1dac 100644 --- a/zh-cn/native_sdk/netssl/native_net_ssl_api.h +++ b/zh-cn/native_sdk/net_ssl/native_net_ssl_api.h @@ -31,6 +31,7 @@ * * @brief 为SSL/TLS证书链校验模块定义C接口 * + * @library libnet_ssl_ndk.z.so * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 @@ -44,9 +45,11 @@ extern "C" { /** * @brief 对外暴露的证书链校验接口 + * * @param cert 用户传入的待校验证书 * @param caCert 用户指定的证书,若为空则以系统预置证书进行校验 * @return 返回0表示校验成功,否则,表示校验失败 + * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/netssl/native_net_ssl_type.h b/zh-cn/native_sdk/net_ssl/native_net_ssl_type.h similarity index 93% rename from zh-cn/native_sdk/netssl/native_net_ssl_type.h rename to zh-cn/native_sdk/net_ssl/native_net_ssl_type.h index 0c43014b..da3e8838 100644 --- a/zh-cn/native_sdk/netssl/native_net_ssl_type.h +++ b/zh-cn/native_sdk/net_ssl/native_net_ssl_type.h @@ -30,6 +30,7 @@ * @file native_net_ssl_type.h * @brief 定义SSL/TLS证书链校验模块的C接口需要的数据结构 * + * @library libnet_ssl_ndk.z.so * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 @@ -43,6 +44,7 @@ extern "C" { /** * @brief 证书类型枚举 + * * @since 11 * @version 1.0 */ @@ -57,6 +59,7 @@ enum OH_NetStack_CertType { /** * @brief 证书数据结构体 + * * @since 11 * @version 1.0 */ -- Gitee From 6d718b32e1b0ee7a489e614acff4459f346ca930 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Mon, 13 Nov 2023 10:54:15 +0800 Subject: [PATCH 0067/2135] add native interface comment Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/external_window.h | 23 ++++++ zh-cn/native_sdk/graphic/native_buffer.h | 86 ++++++++++++++++++++++ zh-cn/native_sdk/graphic/native_image.h | 60 +++++++++++++++ 3 files changed, 169 insertions(+) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index fa6b4b7b..043b1ff4 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -295,6 +295,17 @@ void OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window); */ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(void* pSurfaceBuffer); +/** + * @brief 创建OHNativeWindowBuffer实例,每次调用都会产生一个新的OHNativeWindowBuffer实例 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param nativeBuffer 一个指向OH_NativeBuffer的指针, + * @return 返回一个指针,指向OHNativeWindowBuffer的结构体实例 + * @since 11 + * @version 1.0 + */ +OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(OH_NativeBuffer* nativeBuffer); + /** * @brief 将OHNativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该OHNativeWindowBuffer对象会被析构掉 * @@ -334,6 +345,18 @@ int32_t OH_NativeWindow_NativeWindowRequestBuffer(OHNativeWindow *window, int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer, int fenceFd, Region region); +/** + * @brief 从OHNativeWindow获取上次送回到buffer队列中的OHNativeWindowBuffer + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window 一个OHNativeWindow的结构体实例的指针 + * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针 + * @return 返回值为0表示执行成功 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); + /** * @brief 通过OHNativeWindow将之前申请出来的OHNativeWindowBuffer返还到Buffer队列中,供下次再申请 * diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index f93f3b39..4c1d80d2 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -164,6 +164,80 @@ enum OH_NativeBuffer_Format { NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF }; +/** + * @brief Indicates the color space of a native buffer. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 11 + * @version 1.0 + */ +enum OH_NativeBuffer_ColorSpace { + /** 无颜色空间 */ + OH_COLORSPACE_NONE, + /** 色域范围为BT601_P, 传递函数为BT709, 转换矩阵为BT601_P, 数据范围为RANGE_FULL */ + OH_COLORSPACE_BT601_EBU_FULL, + /** 色域范围为BT601_N, 传递函数为BT709, 转换矩阵为BT601_N, 数据范围为RANGE_FULL */ + OH_COLORSPACE_BT601_SMPLE_C_FULL, + /** 色域范围为BT709, 传递函数为BT709, 转换矩阵为BT709, 数据范围为RANGE_FULL */ + OH_COLORSPACE_BT709_FULL, + /** 色域范围为BT2020, 传递函数为HLG, 转换矩阵为BT2020, 数据范围为RANGE_FULL */ + OH_COLORSPACE_BT2020_HLG_FULL, + /** 色域范围为BT2020, 传递函数为PQ, 转换矩阵为BT2020, 数据范围为RANGE_FULL */ + OH_COLORSPACE_BT2020_PQ_FULL, + /** 色域范围为BT601_P, 传递函数为BT709, 转换矩阵为BT601_P, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_BT601_EBU_LIMIT, + /** 色域范围为BT601_N, 传递函数为BT709, 转换矩阵为BT601_N, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_BT601_SMPLE_C_LIMIT, + /** 色域范围为BT709, 传递函数为BT709, 转换矩阵为BT709, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_BT709_LIMIT, + /** 色域范围为BT2020, 传递函数为HLG, 转换矩阵为BT2020, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_BT2020_HLG_LIMIT, + /** 色域范围为BT2020, 传递函数为PQ, 转换矩阵为BT2020, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_BT2020_PQ_LIMIT, + /** 色域范围为SRGB, 传递函数为SRGB, 转换矩阵为BT601_N, 数据范围为RANGE_FULL */ + OH_COLORSPACE_SRGB_FULL, + /** 色域范围为P3_D65, 传递函数为SRGB, 转换矩阵为P3, 数据范围为RANGE_FULL */ + OH_COLORSPACE_P3_FULL, + /** 色域范围为P3_D65, 传递函数为HLG, 转换矩阵为P3, 数据范围为RANGE_FULL */ + OH_COLORSPACE_P3_HLG_FULL, + /** 色域范围为P3_D65, 传递函数为PQ, 转换矩阵为P3, 数据范围为RANGE_FULL */ + OH_COLORSPACE_P3_PQ_FULL, + /** 色域范围为ADOBERGB, 传递函数为ADOBERGB, 转换矩阵为ADOBERGB, 数据范围为RANGE_FULL */ + OH_COLORSPACE_ADOBERGB_FULL, + /** 色域范围为SRGB, 传递函数为SRGB, 转换矩阵为BT601_N, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_SRGB_LIMIT, + /** 色域范围为P3_D65, 传递函数为SRGB, 转换矩阵为P3, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_P3_LIMIT, + /** 色域范围为P3_D65, 传递函数为HLG, 转换矩阵为P3, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_P3_HLG_LIMIT, + /** 色域范围为P3_D65, 传递函数为PQ, 转换矩阵为P3, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_P3_PQ_LIMIT, + /** 色域范围为ADOBERGB, 传递函数为ADOBERGB, 转换矩阵为ADOBERGB, 数据范围为RANGE_LIMITED */ + OH_COLORSPACE_ADOBERGB_LIMIT, + /** 色域范围为SRGB, 传递函数为LINEAR */ + OH_COLORSPACE_LINEAR_SRGB, + /** 等同于 OH_COLORSPACE_LINEAR_SRGB */ + OH_COLORSPACE_LINEAR_BT709, + /** 色域范围为P3_D65, 传递函数为LINEAR */ + OH_COLORSPACE_LINEAR_P3, + /** 色域范围为BT2020, 传递函数为LINEAR */ + OH_COLORSPACE_LINEAR_BT2020, + /** 等同于 OH_COLORSPACE_SRGB_FULL */ + OH_COLORSPACE_DISPLAY_SRGB, + /** 等同于 OH_COLORSPACE_P3_FULL */ + OH_COLORSPACE_DISPLAY_P3_SRGB, + /** 等同于 OH_COLORSPACE_P3_HLG_FULL */ + OH_COLORSPACE_DISPLAY_P3_HLG, + /** 等同于 OH_COLORSPACE_P3_PQ_FULL */ + OH_COLORSPACE_DISPLAY_P3_PQ, + /** 色域范围为BT2020, 传递函数为SRGB, 转换矩阵为BT2020, 数据范围为RANGE_FULL */ + OH_COLORSPACE_DISPLAY_BT2020_SRGB, + /** 等同于 OH_COLORSPACE_BT2020_HLG_FULL */ + OH_COLORSPACE_DISPLAY_BT2020_HLG, + /** 等同于 OH_COLORSPACE_BT2020_PQ_FULL */ + OH_COLORSPACE_DISPLAY_BT2020_PQ, +}; + /** * @brief OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性 * @@ -274,6 +348,18 @@ int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); */ uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); +/** + * @brief 为OH_NativeBuffer设置颜色空间属性 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @param buffer 一个指向OH_NativeBuffer实例的指针 + * @param colorSpace 为OH_NativeBuffer设置的颜色空间,其值从OH_NativeBuffer_ColorSpace获取 + * @return 返回值为0表示执行成功 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeBuffer_SetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index b36b4b71..78ffaa13 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -61,6 +61,31 @@ typedef struct OH_NativeImage OH_NativeImage; */ typedef struct NativeWindow OHNativeWindow; +/** + * @brief 新帧可用的回调函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param context User defined context, returned to the user in the callback function + * @since 11 + * @version 1.0 + */ +typedef void (*OH_OnFrameAvailable)(void *context); + +/** + * @brief 一个OH_NativeImage的监听者,通过OH_NativeImage_SetOnFrameAvailableListener接口注册, + * 该监听结构体当有帧可用时,将触发回调 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_OnFrameAvailableListener +{ + /** 用户自定义的上下文信息,会在回调触发时返回给用户 */ + void *context; + /** 新帧可用的回调函数 */ + OH_OnFrameAvailable onFrameAvailable; +} OH_OnFrameAvailableListener; + /** * @brief 创建一个OH_NativeImage实例,该实例与OpenGL ES的纹理ID和纹理目标相关联 * @@ -145,6 +170,41 @@ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); */ int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]); +/** + * @brief 获取OH_NativeImage的surface编号 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param image 是指向OH_NativeImage实例的指针 + * @param surfaceId 是指向surface编号的指针 + * @return 返回值为0表示执行成功 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId); + +/** + * @brief 设置帧可用回调 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param image 是指向OH_NativeImage实例的指针 + * @param listener 表示回调监听者 + * @return 返回值为0表示执行成功 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeImage_SetOnFrameAvailableListener(OH_NativeImage* image, OH_OnFrameAvailableListener listener); + +/** + * @brief 取消设置帧可用回调 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param image 是指向OH_NativeImage实例的指针 + * @return 返回值为0表示执行成功 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeImage_UnsetOnFrameAvailableListener(OH_NativeImage* image); + /** * @brief 销毁通过OH_NativeImage_Create创建的OH_NativeImage实例, 销毁后该\n * OH_NativeImage指针会被赋值为空 -- Gitee From a58e5271f7007be62fbcf8cafeb49293ee2786a9 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Mon, 13 Nov 2023 19:26:14 +0800 Subject: [PATCH 0068/2135] add native interface comment Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/external_window.h | 2 +- zh-cn/native_sdk/graphic/native_buffer.h | 2 +- zh-cn/native_sdk/graphic/native_image.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index 043b1ff4..f7ada6da 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -299,7 +299,7 @@ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer( * @brief 创建OHNativeWindowBuffer实例,每次调用都会产生一个新的OHNativeWindowBuffer实例 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param nativeBuffer 一个指向OH_NativeBuffer的指针, + * @param nativeBuffer 一个指向OH_NativeBuffer的指针 * @return 返回一个指针,指向OHNativeWindowBuffer的结构体实例 * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index 4c1d80d2..0dee3506 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -165,7 +165,7 @@ enum OH_NativeBuffer_Format { }; /** - * @brief Indicates the color space of a native buffer. + * @brief OH_NativeBuffer的颜色空间 * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 11 diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index 78ffaa13..9a293dac 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -62,18 +62,18 @@ typedef struct OH_NativeImage OH_NativeImage; typedef struct NativeWindow OHNativeWindow; /** - * @brief 新帧可用的回调函数 + * @brief 有buffer可获取时触发的回调函数 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param context User defined context, returned to the user in the callback function + * @param context 用户自定义的上下文信息,会在回调触发时返回给用户 * @since 11 * @version 1.0 */ typedef void (*OH_OnFrameAvailable)(void *context); /** - * @brief 一个OH_NativeImage的监听者,通过OH_NativeImage_SetOnFrameAvailableListener接口注册, - * 该监听结构体当有帧可用时,将触发回调 + * @brief 一个OH_NativeImage的监听者,通过{@Link OH_NativeImage_SetOnFrameAvailableListener}接口注册 + * 该监听结构体,当有buffer可获取时,将触发回调给用户 * * @since 11 * @version 1.0 -- Gitee From 7d668fea10b69341b3a4f26a70b060f2e9114410 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Mon, 13 Nov 2023 20:09:14 +0800 Subject: [PATCH 0069/2135] add native interface comment Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/external_window.h | 1 + zh-cn/native_sdk/graphic/native_buffer.h | 1 + zh-cn/native_sdk/graphic/native_image.h | 1 + 3 files changed, 3 insertions(+) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index f7ada6da..3f3b59b0 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -32,6 +32,7 @@ * * @brief 定义获取和使用NativeWindow的相关函数 * + * 引用文件 * @library libnative_window.so * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index 0dee3506..50a52dd0 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -32,6 +32,7 @@ * * @brief 定义获取和使用NativeBuffer的相关函数 * + * 引用文件 * @library libnative_buffer.so * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer * @since 9 diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index 9a293dac..cedfa472 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -32,6 +32,7 @@ * * @brief 定义获取和使用NativeImage的相关函数 * + * 引用文件 * @library libnative_image.so * @since 9 * @version 1.0 -- Gitee From 95084b3446e44904d8452d4b722be1f34832f937 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Mon, 13 Nov 2023 21:09:41 +0800 Subject: [PATCH 0070/2135] add websocket ndk header Signed-off-by: liuxiyao223 --- .../native_sdk/net_websocket/net_websocket.h | 142 +++++++++ .../net_websocket/net_websocket_type.h | 288 ++++++++++++++++++ 2 files changed, 430 insertions(+) create mode 100755 zh-cn/native_sdk/net_websocket/net_websocket.h create mode 100755 zh-cn/native_sdk/net_websocket/net_websocket_type.h diff --git a/zh-cn/native_sdk/net_websocket/net_websocket.h b/zh-cn/native_sdk/net_websocket/net_websocket.h new file mode 100755 index 00000000..cf517447 --- /dev/null +++ b/zh-cn/native_sdk/net_websocket/net_websocket.h @@ -0,0 +1,142 @@ +/* + * 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 NET_WEBSOCKET_H +#define NET_WEBSOCKET_H + +#include +#include +#include + +/** + * @addtogroup netstack + * @{ + * + * @brief 为websocket客户端模块提供C接口 + + * @since 11 + * @version 1.0 + */ + +/** + * @file net_websocket.h + * + * @brief 为websocket客户端模块定义C接口 + * + * @library libnet_websocket.so + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#include "net_websocket_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief OH_NetStack_WebsocketClient客户端的构造函数 + * + * @param onMessage 客户端定义的接收消息的回调函数 + * @param onClose 客户端定义的关闭消息的回调函数 + * @param onError 客户端定义的错误消息的回调函数 + * @param onOpen 客户端定义的建立连接消息的回调函数 + * @return 成功返回客户端指针,失败返回为NULL + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient *OH_NetStack_WebsocketClient_Construct( + OH_NetStack_WebsocketClient_OnOpenCallback OnOpen, OH_NetStack_WebsocketClient_OnMessageCallback onMessage, + OH_NetStack_WebsocketClient_OnErrorCallback OnError, OH_NetStack_WebsocketClient_OnCloseCallback onclose); + +/** + * @brief 将header头信息添加到client客户端request中 + * + * @param client 客户端指针 + * @param header header头信息 + * @return 返回值为0表示执行成功。返回错细信息可以查看{@link OH_Websocket_ErrCode}。 + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebSocketClient_AddHeader(struct OH_NetStack_WebsocketClient *client, + struct OH_NetStack_WebsocketClient_Slist header); + +/** + * @brief 客户端连接服务端 + * + * @param client 客户端指针 + * @param url 客户端要连接到服务端的地址 + * @param options 发起连接的可选参数 + * @return 返回值为0表示执行成功。返回错细信息可以查看{@link OH_Websocket_ErrCode}。 + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebSocketClient_Connet(struct OH_NetStack_WebsocketClient *client, const char *url, + struct OH_NetStack_WebsocketClient_RequestOptions options); + +/** + * @brief 客户端向服务端发送数据 + * + * @param client 客户端 + * @param data 客户端发送的数据 + * @param length 客户端发送的数据长度 + * @return 0 - 成功. + * @return 返回值为0表示执行成功。返回错细信息可以查看{@link OH_Websocket_ErrCode}。 + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebSocketClient_Send(struct OH_NetStack_WebsocketClient *client, char *data, size_t length); + +/** + * @brief 客户端主动关闭websocket连接 + * + * @param client 客户端 + * @param url 客户端要连接到服务端的地址 + * @param options 发起关闭连接的可选参数 + * @return 返回值为0表示执行成功。返回错细信息可以查看{@link OH_Websocket_ErrCode}。 + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebSocketClient_Close(struct OH_NetStack_WebsocketClient *client, + struct OH_NetStack_WebsocketClient_CloseOption options); + +/** + * @brief 释放websocket连接上下文和资源 + * + * @param client 客户端 + * @return 返回值为0表示执行成功。返回错细信息可以查看{@link OH_Websocket_ErrCode}。 + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebsocketClient_Destroy(struct OH_NetStack_WebsocketClient *client); + +#ifdef __cplusplus +} +#endif + +#endif // NET_WEBSOCKET_H diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h new file mode 100755 index 00000000..9768a054 --- /dev/null +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -0,0 +1,288 @@ +/* + * 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 NET_WEBSOCKET_TYPE_H +#define NET_WEBSOCKET_TYPE_H + +/** + * @addtogroup netstack + * @{ + * + * @brief 为websocket客户端模块提供C接口 + * + * @since 11 + * @version 1.0 + */ + +/** + * @file net_websocket_type.h + * + * @brief 定义websocket客户端模块的C接口需要的数据结构 + * + * @library libnet_websocket.so + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief websocket客户端来自服务端关闭的参数 + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_CloseResult { + /** 关闭的错误码 */ + uint32_t code; + /** 关闭的错误原因 */ + const char *reason; +}; + +/** + * @brief websocket客户端主动关闭的参数 + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_CloseOption { + /** 关闭的错误码 */ + uint32_t code; + /** 关闭的错误原因 */ + const char *reason; +}; + +/** + * @brief websocket客户端来自服务端连接错误的参数 + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_ErrorResult { + /** 错误码 */ + uint32_t errorCode; + /** 错误的消息 */ + const char *errorMessage; +}; + +/** + * @brief websocket客户端来自服务端连接成功的参数 + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_OpenResult { + /** websocket客户端连接成功码 */ + uint32_t code; + /** websocket客户端连接原因 */ + const char *reason; +}; + +/** + * @brief websocket客户端接收open消息的回调函数定义 + * + * @param client websocket客户端 + * @param openResult websocket客户端接收建立连接消息的内容 + * @since 11 + * @version 1.0 + */ +typedef void (*OH_NetStack_WebsocketClient_OnOpenCallback)(struct OH_NetStack_WebsocketClient *client, + OH_NetStack_WebsocketClient_OpenResult openResult); + +/** + * @brief websocket客户端接收数据的回调函数定义 + * + * @param client websocket客户端 + * @param data websocket客户端接收的数据 + * @param length websocket客户端接收的数据长度 + * @since 11 + * @version 1.0 + */ +typedef void (*OH_NetStack_WebsocketClient_OnMessageCallback)(struct OH_NetStack_WebsocketClient *client, char *data, + uint32_t length); + +/** + * @brief websocket客户端接收error错误消息的回调函数定义 + * + * @param client websocket客户端 + * @param errorResult websocket客户端接收连接错误消息的内容 + * @since 11 + * @version 1.0 + */ +typedef void (*OH_NetStack_WebsocketClient_OnErrorCallback)(struct OH_NetStack_WebsocketClient *client, + OH_NetStack_WebsocketClient_ErrorResult errorResult); + +/** + * @brief websocket客户端接收close消息的回调函数定义 + * + * @param client websocket客户端 + * @param closeResult websocket客户端接收关闭消息的内容 + * @since 11 + * @version 1.0 + */ +typedef void (*OH_NetStack_WebsocketClient_OnCloseCallback)(struct OH_NetStack_WebsocketClient *client, + OH_NetStack_WebsocketClient_CloseResult closeResult); + +/** + * @brief websocket客户端增加header头的链表节点 + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_Slist { + /** header头的字段名 */ + const char *FieldName; + /**header头的字段内容 */ + const char *FieldValue; + /** header头链表的next指针 */ + struct OH_NetStack_WebsocketClient_Slist *next; +}; + +/** + * @brief websocket客户端和服务端建立连接的参数 + * + * @param headers header头信息 + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_RequestOptions { + struct OH_NetStack_WebsocketClient_Slist *headers; +}; + +/** + * @brief websocket客户端结构体 + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient { + /** 客户端接收连接消息的回调指针 */ + OH_NetStack_WebsocketClient_OnOpenCallback onOpen; + /**客户端接收消息的回调指针 */ + OH_NetStack_WebsocketClient_OnMessageCallback onMessage; + /** 客户端接收错误消息的回调指针 */ + OH_NetStack_WebsocketClient_OnErrorCallback onError; + /** 客户端接收关闭消息的回调指针 */ + OH_NetStack_WebsocketClient_OnCloseCallback onClose; + /** 客户端建立连接请求内容 */ + OH_NetStack_WebsocketClient_RequestOptions RequestOptions; +}; + +typedef enum OH_Websocket_ErrCode { + /** + * 执行成功 + */ + Websocket_OK = 0, + + /** + * @brief 异常错误代码的基础 + */ + E_BASE = 1000, + + /** + * @brief websocket为空 + */ + WEBSOCKET_CLIENT_IS_NULL = (E_BASE + 1), + + /** + * @brief websocket未创建 + */ + WEBSOCKET_CLIENT_IS_NOT_CREAT = (E_BASE + 2), + + /** + * @brief websocket客户端连接错误 + */ + WEBSOCKET_CONNECTION_ERROR = (E_BASE + 3), + + /** + * @brief websocket客户端连接参数解析错误 + */ + WEBSOCKET_CONNECTION_PARSEURL_ERROR = (E_BASE + 5), + + /** + * @brief websocket客户端连接时创建上下文无内存 + */ + WEBSOCKET_CONNECTION_NO_MEMOERY = (E_BASE + 6), + + /** + * @brief 初始化时候关闭 + */ + WEBSOCKET_PEER_INITIATED_CLOSE = (E_BASE + 7), + + /** + * @brief websocket连接被销毁 + */ + WEBSOCKET_DESTROY = (E_BASE + 8), + + /** + * @brief websocket客户端连接时候协议错误 + */ + WEBSOCKET_PROTOCOL_ERROR = (E_BASE + 9), + + /** + * @brief websocket客户端发送数据时候没有足够内存 + */ + WEBSOCKET_SEND_NO_MEMOERY_ERROR = (E_BASE + 10), + + /** + * @brief websocket客户端发送数据为空 + */ + WEBSOCKET_SEND_DATA_NULL = (E_BASE + 11), + + /** + * @brief websocket客户端发送数据长度超限制 + */ + WEBSOCKET_DATA_LENGTH_EXCEEDS = (E_BASE + 12), + + /** + * @brief websocket客户端发送数据队列长度超限制 + */ + WEBSOCKET_QUEUE_LENGTH_EXCEEDS = (E_BASE + 13), + + /** + * @brief websocket客户端上下文为空 + */ + WEBSOCKET_ERROR_NO_CLIENTCONTEX = (E_BASE + 14), + + /** + * @brief websocket客户端header头异常 + */ + WEBSOCKET_ERROR_NO_HEADR_CONTEXT = (E_BASE + 15), + + /** + * @brief websocket客户端header头超过限制 + */ + WEBSOCKET_ERROR_NO_HEADR_EXCEEDS = (E_BASE + 16), + + /** + * @brief websocket客户端没有连接 + */ + WEBSOCKET_ERROR_HAVE_NO_CONNECT = (E_BASE + 17), + + /** + * @brief websocket客户端没有连接上下文 + */ + WEBSOCKET_ERROR_HAVE_NO_CONNECT_CONTEXT = (E_BASE + 18), + +} OH_Websocket_ErrCode; + +#ifdef __cplusplus +} +#endif + +#endif // NET_WEBSOCKET_TYPE_H -- Gitee From 455c1d70af49ae640292dc04181a793f04069ed2 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Mon, 13 Nov 2023 21:14:10 +0800 Subject: [PATCH 0071/2135] add native interface comment Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/external_window.h | 2 +- zh-cn/native_sdk/graphic/native_buffer.h | 2 +- zh-cn/native_sdk/graphic/native_image.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index 3f3b59b0..2ce58b8c 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -32,7 +32,7 @@ * * @brief 定义获取和使用NativeWindow的相关函数 * - * 引用文件 + * 引用文件 * @library libnative_window.so * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index 50a52dd0..90952266 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -32,7 +32,7 @@ * * @brief 定义获取和使用NativeBuffer的相关函数 * - * 引用文件 + * 引用文件 * @library libnative_buffer.so * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer * @since 9 diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index cedfa472..db51baae 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -32,7 +32,7 @@ * * @brief 定义获取和使用NativeImage的相关函数 * - * 引用文件 + * 引用文件 * @library libnative_image.so * @since 9 * @version 1.0 -- Gitee From 9314855d30d82f91350defb6b87610afc0b7c362 Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 14 Nov 2023 01:33:45 +0000 Subject: [PATCH 0072/2135] update zh-cn/native_sdk/net_websocket/net_websocket_type.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net_websocket/net_websocket_type.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h index 9768a054..2a5409a5 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket_type.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -28,7 +28,6 @@ /** * @file net_websocket_type.h - * * @brief 定义websocket客户端模块的C接口需要的数据结构 * * @library libnet_websocket.so @@ -278,7 +277,6 @@ typedef enum OH_Websocket_ErrCode { * @brief websocket客户端没有连接上下文 */ WEBSOCKET_ERROR_HAVE_NO_CONNECT_CONTEXT = (E_BASE + 18), - } OH_Websocket_ErrCode; #ifdef __cplusplus -- Gitee From c4f7d948c98ad203c6ec5b39f2264977440f4c06 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Tue, 14 Nov 2023 11:44:01 +0800 Subject: [PATCH 0073/2135] modify file name and lib name Signed-off-by: liuxiyao223 --- .../net_ssl/{native_net_ssl_api.h => net_ssl_c.h} | 14 +++++++------- .../{native_net_ssl_type.h => net_ssl_c_type.h} | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) rename zh-cn/native_sdk/net_ssl/{native_net_ssl_api.h => net_ssl_c.h} (80%) rename zh-cn/native_sdk/net_ssl/{native_net_ssl_type.h => net_ssl_c_type.h} (86%) diff --git a/zh-cn/native_sdk/net_ssl/native_net_ssl_api.h b/zh-cn/native_sdk/net_ssl/net_ssl_c.h similarity index 80% rename from zh-cn/native_sdk/net_ssl/native_net_ssl_api.h rename to zh-cn/native_sdk/net_ssl/net_ssl_c.h index c54d1dac..ea34796d 100644 --- a/zh-cn/native_sdk/net_ssl/native_net_ssl_api.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef NATIVE_NET_SSL_API_H -#define NATIVE_NET_SSL_API_H +#ifndef NET_SSL_C_H +#define NET_SSL_C_H /** * @addtogroup netstack @@ -27,17 +27,17 @@ */ /** - * @file native_net_ssl_api.h + * @file net_ssl_c.h * * @brief 为SSL/TLS证书链校验模块定义C接口 * - * @library libnet_ssl_ndk.z.so + * @library libnet_ssl_c.z.so * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 */ -#include "native_net_ssl_type.h" +#include "net_ssl_c_type.h" #ifdef __cplusplus extern "C" { @@ -54,9 +54,9 @@ extern "C" { * @version 1.0 */ uint32_t OH_NetStack_VerifyCertification(const struct OH_NetStack_CertBlob *cert, - const struct OH_NetStack_CertBlob *caCert); + const struct OH_NetStack_CertBlob *caCert); #ifdef __cplusplus } #endif -#endif // NATIVE_NET_SSL_API_H +#endif // NET_SSL_C_H diff --git a/zh-cn/native_sdk/net_ssl/native_net_ssl_type.h b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h similarity index 86% rename from zh-cn/native_sdk/net_ssl/native_net_ssl_type.h rename to zh-cn/native_sdk/net_ssl/net_ssl_c_type.h index da3e8838..cf91816f 100644 --- a/zh-cn/native_sdk/net_ssl/native_net_ssl_type.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef NATIVE_NET_SSL_TYPE_H -#define NATIVE_NET_SSL_TYPE_H +#ifndef NET_SSL_C_TYPE_H +#define NET_SSL_C_TYPE_H /** * @addtogroup netstack @@ -27,10 +27,10 @@ */ /** - * @file native_net_ssl_type.h + * @file net_ssl_c_type.h * @brief 定义SSL/TLS证书链校验模块的C接口需要的数据结构 * - * @library libnet_ssl_ndk.z.so + * @library libnet_ssl_c.z.so * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 @@ -76,4 +76,4 @@ struct OH_NetStack_CertBlob { } #endif -#endif // NATIVE_NET_SSL_TYPE_H +#endif // NET_SSL_C_TYPE_H -- Gitee From 4c5692019750b5c3b47656d15829ac64d90ba6ec Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 14 Nov 2023 03:58:58 +0000 Subject: [PATCH 0074/2135] update zh-cn/native_sdk/net_websocket/net_websocket.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net_websocket/net_websocket.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket.h b/zh-cn/native_sdk/net_websocket/net_websocket.h index cf517447..959f80ef 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) Huawei Technologies Co., Ltd. 2012-2018. 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 -- Gitee From b0ab62117e572004152328e6d1c8d1dd4a529e6d Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 14 Nov 2023 04:00:48 +0000 Subject: [PATCH 0075/2135] update zh-cn/native_sdk/net_websocket/net_websocket_type.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net_websocket/net_websocket_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h index 2a5409a5..b8c3fab5 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket_type.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) Huawei Technologies Co., Ltd. 2012-2018. 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 -- Gitee From cb441fbb90984d4ca7ef16ab1336fc651e378757 Mon Sep 17 00:00:00 2001 From: lixinsheng2 Date: Mon, 13 Nov 2023 20:38:04 +0800 Subject: [PATCH 0076/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9Ehid=20ddk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lixinsheng2 --- zh-cn/native_sdk/hid/hid_ddk_api.h | 87 ++++ zh-cn/native_sdk/hid/hid_ddk_types.h | 590 +++++++++++++++++++++++++++ 2 files changed, 677 insertions(+) create mode 100644 zh-cn/native_sdk/hid/hid_ddk_api.h create mode 100644 zh-cn/native_sdk/hid/hid_ddk_types.h diff --git a/zh-cn/native_sdk/hid/hid_ddk_api.h b/zh-cn/native_sdk/hid/hid_ddk_api.h new file mode 100644 index 00000000..11654163 --- /dev/null +++ b/zh-cn/native_sdk/hid/hid_ddk_api.h @@ -0,0 +1,87 @@ +/* + * 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 HID_DDK_API_H +#define HID_DDK_API_H + +/** + * @addtogroup HidDdk + * @{ + * + * @brief 提供HID DDK接口,包括创建设备、发送事件、销毁设备。 + * + * @syscap SystemCapability.Driver.HID.Extension + * @since 11 + * @version 1.0 + */ + +/** + * @file hid_ddk_api.h + * + * @brief 声明主机侧访问输入设备的HID DDK接口。 + * + * 引用文件: + * @since 11 + * @version 1.0 + */ + +#include +#include "hid_ddk_types.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief 创建设备。 + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param hidDevice 创建设备需要的基本信息,包括设备名、厂商ID、产品ID等。 + * @param hidEventProperties 创建的设备关注的事件,包括事件类型、按键事件属性、绝对坐标事件属性、相对坐标事件属性等。 + * @return 成功返回设备ID,非负数;否则返回负数。 + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_CreateDevice(HidDevice *hidDevice, HidEventProperties *hidEventProperties); + +/** + * @brief 向指定设备发送事件列表。 + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId 设备ID。 + * @param items 发送的事件列表,事件包括类型(取值来源事件类型HidEventType)、编码(取值来源同步事件编码HidSynEvent、键值编码HidKeyCode、按钮编码HidBtnCode、 + * 绝对坐标编码HidAbsAxes、相对坐标编码HidRelAxes、其它类型的输入事件编码HidMscEvent)、值(根据实际设备输入决定)。 + * @param length 发送事件列表长度(一次发送事件个数)。 + * @return 成功返回0,否则返回负数。 + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_EmitEvent(int32_t deviceId, const EmitItem items[], uint16_t length); + +/** + * @brief 销毁设备。 + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId 设备ID。 + * @return 成功返回0,否则返回负数。 + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_DestroyDevice(int32_t deviceId); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // HID_DDK_API_H \ No newline at end of file diff --git a/zh-cn/native_sdk/hid/hid_ddk_types.h b/zh-cn/native_sdk/hid/hid_ddk_types.h new file mode 100644 index 00000000..64a350a5 --- /dev/null +++ b/zh-cn/native_sdk/hid/hid_ddk_types.h @@ -0,0 +1,590 @@ +/* + * 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 HID_DDK_TYPES_H +#define HID_DDK_TYPES_H +/** + * @addtogroup HidDdk + * @{ + * + * @brief 提供HID DDK接口,包括创建设备、发送事件、销毁设备。 + * + * @syscap SystemCapability.Driver.HID.Extension + * @since 11 + * @version 1.0 + */ + +/** + * @file hid_ddk_types.h + * + * @brief 提供HID DDK中的枚举变量与结构体定义。 + * + * 引用文件: + * @since 11 + * @version 1.0 + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief 事件信息。 + * + * @since 11 + * @version 1.0 + */ +typedef struct EmitItem { + /** 事件类型 */ + uint16_t type; + /** 事件编码 */ + uint16_t code; + /** 事件值 */ + uint32_t value; +} EmitItem; + +/** + * @brief 输入设备特性定义。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 指针设备 */ + HID_PROP_POINTER = 0x00, + /** 直接输入设备 */ + HID_PROP_DIRECT = 0x01, + /** 底部按键触摸设备 */ + HID_PROP_BUTTONPAD = 0x02, + /** 全多点触控设备 */ + HID_PROP_SEMI_MT = 0x03, + /** 顶部软按键触摸设备 */ + HID_PROP_TOPBUTTONPAD = 0x04, + /** 指点杆设备 */ + HID_PROP_POINTING_STICK = 0x05, + /** 加速度传感器设备 */ + HID_PROP_ACCELEROMETER = 0x06 +} HidDeviceProp; + +/** + * @brief 设备基本信息。 + * + * @since 11 + * @version 1.0 + */ +typedef struct HidDevice { + /** 设备名称 */ + const char *deviceName; + /** 厂商ID */ + uint16_t vendorId; + /** 产品ID */ + uint16_t productId; + /** 版本号 */ + uint16_t version; + /** 总线类型 */ + uint16_t bustype; + /** 设备特性 */ + HidDeviceProp *properties; + /** 设备特性数量 */ + uint16_t propLength; +} HidDevice; + +/** + * @brief 事件类型。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 同步事件 */ + HID_EV_SYN = 0x00, + /** 按键事件 */ + HID_EV_KEY = 0x01, + /** 相对坐标事件 */ + HID_EV_REL = 0x02, + /** 绝对坐标事件 */ + HID_EV_ABS = 0x03, + /** 特殊事件 */ + HID_EV_MSC = 0x04 +} HidEventType; + +/** + * @brief 同步事件编码。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 表示一个事件的结束 */ + HID_SYN_REPORT = 0, + /** 表示配置同步 */ + HID_SYN_CONFIG = 1, + /** 表示多点触摸的ABS数据包结束 */ + HID_SYN_MT_REPORT = 2, + /** 表示该事件被丢弃 */ + HID_SYN_DROPPED = 3 +} HidSynEvent; + +/** + * @brief 键值编码。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 键A */ + HID_KEY_A = 30, + /** 键B */ + HID_KEY_B = 48, + /** 键C */ + HID_KEY_C = 46, + /** 键D */ + HID_KEY_D = 32, + /** 键E */ + HID_KEY_E = 18, + /** 键F */ + HID_KEY_F = 33, + /** 键G */ + HID_KEY_G = 34, + /** 键H */ + HID_KEY_H = 35, + /** 键I */ + HID_KEY_I = 23, + /** 键J */ + HID_KEY_J = 36, + /** 键K */ + HID_KEY_K = 37, + /** 键L */ + HID_KEY_L = 38, + /** 键M */ + HID_KEY_M = 50, + /** 键N */ + HID_KEY_N = 49, + /** 键O */ + HID_KEY_O = 24, + /** 键P */ + HID_KEY_P = 25, + /** 键Q */ + HID_KEY_Q = 16, + /** 键R */ + HID_KEY_R = 19, + /** 键S */ + HID_KEY_S = 31, + /** 键T */ + HID_KEY_T = 20, + /** 键U */ + HID_KEY_U = 22, + /** 键V */ + HID_KEY_V = 47, + /** 键W */ + HID_KEY_W = 17, + /** 键X */ + HID_KEY_X = 45, + /** 键Y */ + HID_KEY_Y = 21, + /** 键Z */ + HID_KEY_Z = 44, + /** 键0 */ + HID_KEY_0 = 11, + /** 键1 */ + HID_KEY_1 = 2, + /** 键2 */ + HID_KEY_2 = 3, + /** 键3 */ + HID_KEY_3 = 4, + /** 键4 */ + HID_KEY_4 = 5, + /** 键5 */ + HID_KEY_5 = 6, + /** 键6 */ + HID_KEY_6 = 7, + /** 键7 */ + HID_KEY_7 = 8, + /** 键8 */ + HID_KEY_8 = 9, + /** 键9 */ + HID_KEY_9 = 10, + /** 键` */ + HID_KEY_GRAVE = 41, + /** 键- */ + HID_KEY_MINUS = 12, + /** 键= */ + HID_KEY_EQUALS = 13, + /** 键[ */ + HID_KEY_LEFT_BRACKET = 26, + /** 键] */ + HID_KEY_RIGHT_BRACKET = 27, + /** 键\ */ + HID_KEY_BACKSLASH = 43, + /** 键; */ + HID_KEY_SEMICOLON = 39, + /** 键' */ + HID_KEY_APOSTROPHE = 40, + /** 键/ */ + HID_KEY_SLASH = 53, + /** 键, */ + HID_KEY_COMMA = 51, + /** 键. */ + HID_KEY_PERIOD = 52, + /** 数字键0 */ + HID_KEY_NUMPAD_0 = 82, + /** 数字键1 */ + HID_KEY_NUMPAD_1 = 79, + /** 数字键2 */ + HID_KEY_NUMPAD_2 = 80, + /** 数字键3 */ + HID_KEY_NUMPAD_3 = 81, + /** 数字键4 */ + HID_KEY_NUMPAD_4 = 75, + /** 数字键5 */ + HID_KEY_NUMPAD_5 = 76, + /** 数字键6 */ + HID_KEY_NUMPAD_6 = 77, + /** 数字键7 */ + HID_KEY_NUMPAD_7 = 71, + /** 数字键8 */ + HID_KEY_NUMPAD_8 = 72, + /** 数字键9 */ + HID_KEY_NUMPAD_9 = 73, + /** 数字键/ */ + HID_KEY_NUMPAD_DIVIDE = 70, + /** 数字键* */ + HID_KEY_NUMPAD_MULTIPLY = 55, + /** 数字键- */ + HID_KEY_NUMPAD_SUBTRACT = 74, + /** 数字键+ */ + HID_KEY_NUMPAD_ADD = 78, + /** 数字键. */ + HID_KEY_NUMPAD_DOT = 83 +} HidKeyCode; + +/** + * @brief 按钮编码。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 按钮0 */ + HID_BTN_0 = 0x100, + /** 按键1 */ + HID_BTN_1 = 0x101, + /** 按键2 */ + HID_BTN_2 = 0x102, + /** 按键3 */ + HID_BTN_3 = 0x103, + /** 按键4 */ + HID_BTN_4 = 0x104, + /** 按键5 */ + HID_BTN_5 = 0x105, + /** 按键6 */ + HID_BTN_6 = 0x106, + /** 按键7 */ + HID_BTN_7 = 0x107, + /** 按键8 */ + HID_BTN_8 = 0x108, + /** 按键9 */ + HID_BTN_9 = 0x109, + /** 鼠标按键左键 */ + HID_BTN_LEFT = 0x110, + /** 鼠标按键右键 */ + HID_BTN_RIGHT = 0x111, + /** 鼠标按键中键 */ + HID_BTN_MIDDLE = 0x112, + /** 鼠标侧面按键 */ + HID_BTN_SIDE = 0x113, + /** 鼠标附加按键 */ + HID_BTN_EXTRA = 0x114, + /** 鼠标向前按键 */ + HID_BTN_FORWARD = 0x115, + /** 鼠标向后按键 */ + HID_BTN_BACK = 0x116, + /** 鼠标任务按键 */ + HID_BTN_TASK = 0x117, + /** 画笔 */ + HID_BTN_TOOL_PEN = 0x140 + /** 橡皮擦 */ + HID_BTN_TOOL_RUBBER = 0x141 + /** 笔刷 */ + HID_BTN_TOOL_BRUSH = 0x142 + /** 钢笔 */ + HID_BTN_TOOL_PENCIL = 0x143 + /** 喷枪 */ + HID_BTN_TOOL_AIRBRUSH = 0x144 + /** 手指 */ + HID_BTN_TOOL_FINGER = 0x145 + /** 鼠标 */ + HID_BTN_TOOL_MOUSE = 0x146 + /** 镜头 */ + HID_BTN_TOOL_LENS = 0x147 + /** 五指触控 */ + HID_BTN_TOOL_QUINTTAP = 0x148 + /** 手写笔3 */ + HID_BTN_STYLUS3 = 0x149 + /** 触摸 */ + HID_BTN_TOUCH = 0x14a + /** 手写笔 */ + HID_BTN_STYLUS = 0x14b + /** 手写笔2 */ + HID_BTN_STYLUS2 = 0x14c + /** 二指触控 */ + HID_BTN_TOOL_DOUBLETAP = 0x14d + /** 三指触控 */ + HID_BTN_TOOL_TRIPLETAP = 0x14e + /** 四指触控 */ + HID_BTN_TOOL_QUADTAP = 0x14f + /** 滚轮 */ + HID_BTN_WHEEL = 0x150 +} HidBtnCode; + +/** + * @brief 绝对坐标编码。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** X轴 */ + HID_ABS_X = 0x00, + /** Y轴 */ + HID_ABS_Y = 0x01, + /** Z轴 */ + HID_ABS_Z = 0x02, + /** 右模拟摇杆的 X 轴 */ + HID_ABS_RX = 0x03, + /** 右模拟摇杆的 Y 轴 */ + HID_ABS_RY = 0x04, + /** 右模拟摇杆的 Z 轴 */ + HID_ABS_RZ = 0x05, + /** 油门 */ + HID_ABS_THROTTLE = 0x06, + /** 舵 */ + HID_ABS_RUDDER = 0x07, + /** 滚轮 */ + HID_ABS_WHEEL = 0x08, + /** 气 */ + HID_ABS_GAS = 0x09, + /** 制动 */ + HID_ABS_BRAKE = 0x0a, + /** HAT0X */ + HID_ABS_HAT0X = 0x10, + /** HAT0Y */ + HID_ABS_HAT0Y = 0x11, + /** HAT1X */ + HID_ABS_HAT1X = 0x12, + /** HAT1Y */ + HID_ABS_HAT1Y = 0x13, + /** HAT2X */ + HID_ABS_HAT2X = 0x14, + /** HAT2Y */ + HID_ABS_HAT2Y = 0x15, + /** HAT3X */ + HID_ABS_HAT3X = 0x16, + /** HAT3Y */ + HID_ABS_HAT3Y = 0x17, + /** 压力 */ + HID_ABS_PRESSURE = 0x18, + /** 距离 */ + HID_ABS_DISTANCE = 0x19, + /** X轴倾斜度 */ + HID_ABS_TILT_X = 0x1a, + /** Y轴倾斜度 */ + HID_ABS_TILT_Y = 0x1b, + /** 触摸工具的宽度 */ + HID_ABS_TOOL_WIDTH = 0x1c, + /** 音量 */ + HID_ABS_VOLUME = 0x20, + /** 其它 */ + HID_ABS_MISC = 0x28 +} HidAbsAxes; + +/** + * @brief 相对坐标编码。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** X轴 */ + HID_REL_X = 0x00, + /** Y轴 */ + HID_REL_Y = 0x01, + /** Z轴 */ + HID_REL_Z = 0x02, + /** 右模拟摇杆的 X 轴 */ + HID_REL_RX = 0x03, + /** 右模拟摇杆的 Y 轴 */ + HID_REL_RY = 0x04, + /** 右模拟摇杆的 Z 轴 */ + HID_REL_RZ = 0x05, + /** 水平滚轮 */ + HID_REL_HWHEEL = 0x06, + /** 刻度 */ + HID_REL_DIAL = 0x07, + /** 滚轮 */ + HID_REL_WHEEL = 0x08, + /** 其它 */ + HID_REL_MISC = 0x09, + /** 预留 */ + HID_REL_RESERVED = 0x0a, + /** 高分辨率滚轮 */ + HID_REL_WHEEL_HI_RES = 0x0b, + /** 高分辨率水平滚轮 */ + HID_REL_HWHEEL_HI_RES = 0x0c +} HidRelAxes; + +/** + * @brief 不适合其它类型的输入事件编码。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 序列号 */ + HID_MSC_SERIAL = 0x00, + /** 脉冲 */ + HID_MSC_PULSELED = 0x01, + /** 手势 */ + HID_MSC_GESTURE = 0x02, + /** 开始事件 */ + HID_MSC_RAW = 0x03, + /** 扫描 */ + HID_MSC_SCAN = 0x04, + /** 时间戳 */ + HID_MSC_TIMESTAMP = 0x05 +} HidMscEvent; + +/** + * @brief 事件类型编码数组。 + * + * @since 11 + * @version 1.0 + */ +typedef struct HidEventTypeArray { + /** 事件类型编码 */ + HidEventType *hidEventType; + /** 数组长度 */ + uint16_t length; +} HidEventTypeArray; + +/** + * @brief 键值属性数组。 + * + * @since 11 + * @version 1.0 + */ +typedef struct HidKeyCodeArray { + /** 键值编码 */ + HidKeyCode *hidKeyCode; + /** 数组长度 */ + uint16_t length; +} HidKeyCodeArray; + +/** + * @brief 绝对坐标属性数组。 + * + * @since 11 + * @version 1.0 + */ +typedef struct HidAbsAxesArray { + /** 绝对坐标属性编码 */ + HidAbsAxes *hidAbsAxes; + /** 数组长度 */ + uint16_t length; +} HidAbsAxesArray; + +/** + * @brief 相对坐标属性数组。 + * + * @since 11 + * @version 1.0 + */ +typedef struct HidRelAxesArray { + /** 相对坐标属性编码 */ + HidRelAxes *hidRelAxes; + /** 数组长度 */ + uint16_t length; +} HidRelAxesArray; + +/** + * @brief 其它特殊事件属性数组。 + * + * @since 11 + * @version 1.0 + */ +typedef struct HidMscEventArray { + /** 其它特殊事件属性编码 */ + HidMscEvent *hidMscEvent; + /** 数组长度 */ + uint16_t length; +} HidMscEventArray; + +/** + * @brief 设备关注事件属性。 + * + * @since 11 + * @version 1.0 + */ +typedef struct HidEventProperties { + /** 事件类型属性编码数组 */ + struct HidEventTypeArray hidEventTypes; + /** 键值属性编码数组 */ + struct HidKeyCodeArray hidKeys; + /** 绝对坐标属性编码数组 */ + struct HidAbsAxesArray hidAbs; + /** 相对坐标属性编码数组 */ + struct HidRelAxesArray hidRelBits; + /** 其它特殊事件属性编码数组 */ + struct HidMscEventArray hidMiscellaneous; + + /** 绝对坐标属性最大值 */ + int32_t hidAbsMax[64]; + /** 绝对坐标属性最小值 */ + int32_t hidAbsMin[64]; + /** 绝对坐标属性模糊值 */ + int32_t hidAbsFuzz[64]; + /** 绝对坐标属性固定值 */ + int32_t hidAbsFlat[64]; +} HidEventProperties; + +/** + * @brief HID DDK错误码定义。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 操作成功 */ + HID_DDK_SUCCESS = 0, + /** 操作失败 */ + HID_DDK_FAILED = -1, + /** 非法参数 */ + HID_DDK_INVALID_PARAMETER = -2, + /** 非法操作 */ + HID_DDK_INVALID_OPERATION = -3, + /** 空指针异常 */ + HID_DDK_NULL_PTR = -4, + /** 超时 */ + HID_DDK_TIMEOUT = -5, + /** 没有权限 */ + HID_DDK_NO_PERM = -6 +} HidDdkErrCode; +#ifdef __cplusplus +} +/** @} */ +#endif /* __cplusplus */ +#endif // HID_DDK_TYPES_H \ No newline at end of file -- Gitee From 70601a78dd6697841633ca05b05481543c926041 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Tue, 14 Nov 2023 14:43:06 +0800 Subject: [PATCH 0077/2135] add native interface comment Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/native_image.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index db51baae..e0439cff 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -79,8 +79,7 @@ typedef void (*OH_OnFrameAvailable)(void *context); * @since 11 * @version 1.0 */ -typedef struct OH_OnFrameAvailableListener -{ +typedef struct OH_OnFrameAvailableListener { /** 用户自定义的上下文信息,会在回调触发时返回给用户 */ void *context; /** 新帧可用的回调函数 */ -- Gitee From 0a28d55a4ae9e041b0bf9e5b633c161d7ed29dc0 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Tue, 14 Nov 2023 15:17:00 +0800 Subject: [PATCH 0078/2135] add native interface comment Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/native_image.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index e0439cff..853c8091 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -82,7 +82,7 @@ typedef void (*OH_OnFrameAvailable)(void *context); typedef struct OH_OnFrameAvailableListener { /** 用户自定义的上下文信息,会在回调触发时返回给用户 */ void *context; - /** 新帧可用的回调函数 */ + /** 有buffer可获取时触发的回调函数 */ OH_OnFrameAvailable onFrameAvailable; } OH_OnFrameAvailableListener; -- Gitee From a70b50e5662d4463d440e1c74807b7ac588c4192 Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 14 Nov 2023 09:42:13 +0000 Subject: [PATCH 0079/2135] update zh-cn/native_sdk/net_websocket/net_websocket.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net_websocket/net_websocket.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket.h b/zh-cn/native_sdk/net_websocket/net_websocket.h index 959f80ef..68f4d874 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2012-2018. All rights reserved. + * Copyright (C) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From 1cfedfe68dbb61f7e59d9fb4f82c331682e51dfc Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 14 Nov 2023 09:42:38 +0000 Subject: [PATCH 0080/2135] update zh-cn/native_sdk/net_websocket/net_websocket_type.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net_websocket/net_websocket_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h index b8c3fab5..3c91da3e 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket_type.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2012-2018. All rights reserved. + * Copyright (C) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From f166c22b94f5a92f960bde39a0a82e9ba52058ce Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Tue, 14 Nov 2023 20:22:24 +0800 Subject: [PATCH 0081/2135] add native interface comment Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/native_buffer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index 90952266..6871cfcf 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -178,7 +178,7 @@ enum OH_NativeBuffer_ColorSpace { /** 色域范围为BT601_P, 传递函数为BT709, 转换矩阵为BT601_P, 数据范围为RANGE_FULL */ OH_COLORSPACE_BT601_EBU_FULL, /** 色域范围为BT601_N, 传递函数为BT709, 转换矩阵为BT601_N, 数据范围为RANGE_FULL */ - OH_COLORSPACE_BT601_SMPLE_C_FULL, + OH_COLORSPACE_BT601_SMPTE_C_FULL, /** 色域范围为BT709, 传递函数为BT709, 转换矩阵为BT709, 数据范围为RANGE_FULL */ OH_COLORSPACE_BT709_FULL, /** 色域范围为BT2020, 传递函数为HLG, 转换矩阵为BT2020, 数据范围为RANGE_FULL */ @@ -188,7 +188,7 @@ enum OH_NativeBuffer_ColorSpace { /** 色域范围为BT601_P, 传递函数为BT709, 转换矩阵为BT601_P, 数据范围为RANGE_LIMITED */ OH_COLORSPACE_BT601_EBU_LIMIT, /** 色域范围为BT601_N, 传递函数为BT709, 转换矩阵为BT601_N, 数据范围为RANGE_LIMITED */ - OH_COLORSPACE_BT601_SMPLE_C_LIMIT, + OH_COLORSPACE_BT601_SMPTE_C_LIMIT, /** 色域范围为BT709, 传递函数为BT709, 转换矩阵为BT709, 数据范围为RANGE_LIMITED */ OH_COLORSPACE_BT709_LIMIT, /** 色域范围为BT2020, 传递函数为HLG, 转换矩阵为BT2020, 数据范围为RANGE_LIMITED */ -- Gitee From b605cf844e339a8ab76899c4878795d16e57434f Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Wed, 15 Nov 2023 09:55:35 +0800 Subject: [PATCH 0082/2135] modify library name Signed-off-by: liuxiyao223 --- zh-cn/native_sdk/net_ssl/net_ssl_c.h | 2 +- zh-cn/native_sdk/net_ssl/net_ssl_c_type.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/net_ssl/net_ssl_c.h b/zh-cn/native_sdk/net_ssl/net_ssl_c.h index ea34796d..86630668 100644 --- a/zh-cn/native_sdk/net_ssl/net_ssl_c.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c.h @@ -31,7 +31,7 @@ * * @brief 为SSL/TLS证书链校验模块定义C接口 * - * @library libnet_ssl_c.z.so + * @library libnet_ssl.so * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h index cf91816f..be731f3b 100644 --- a/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h @@ -30,7 +30,7 @@ * @file net_ssl_c_type.h * @brief 定义SSL/TLS证书链校验模块的C接口需要的数据结构 * - * @library libnet_ssl_c.z.so + * @library libnet_ssl.so * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 -- Gitee From b82381bfeb782dbcbd8606b4a9bca0281dbb3541 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Wed, 15 Nov 2023 11:58:54 +0800 Subject: [PATCH 0083/2135] modify brief of type file Signed-off-by: liuxiyao223 --- zh-cn/native_sdk/net_ssl/net_ssl_c_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h index be731f3b..72db1996 100644 --- a/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h @@ -20,7 +20,7 @@ * @addtogroup netstack * @{ * - * @brief 为SSL/TLS证书链校验模块的C接口提供数据结构 + * @brief 为SSL/TLS证书链校验模块提供C接口 * * @since 11 * @version 1.0 -- Gitee From cf86e5fceea2b318e276d1c38e8e5547e9fdcffe Mon Sep 17 00:00:00 2001 From: lixinsheng2 Date: Wed, 15 Nov 2023 17:25:13 +0800 Subject: [PATCH 0084/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9Ehid=20ddk=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lixinsheng2 --- en/native_sdk/hid/hid_ddk_api.h | 92 +++++ en/native_sdk/hid/hid_ddk_types.h | 587 ++++++++++++++++++++++++++++++ 2 files changed, 679 insertions(+) create mode 100644 en/native_sdk/hid/hid_ddk_api.h create mode 100644 en/native_sdk/hid/hid_ddk_types.h diff --git a/en/native_sdk/hid/hid_ddk_api.h b/en/native_sdk/hid/hid_ddk_api.h new file mode 100644 index 00000000..83e830b5 --- /dev/null +++ b/en/native_sdk/hid/hid_ddk_api.h @@ -0,0 +1,92 @@ +/* + * 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 HID_DDK_API_H +#define HID_DDK_API_H + +/** + * @addtogroup HidDdk + * @{ + * + * @brief Provides HID DDK interfaces, including creating a device, sending an event, and destroying a device. + * + * @syscap SystemCapability.Driver.HID.Extension + * @since 11 + * @version 1.0 + */ + +/** + * @file hid_ddk_api.h + * + * @brief Declares the HID DDK interfaces for the host to access an input device. + * + * File to include: + * @since 11 + * @version 1.0 + */ + +#include +#include "hid_ddk_types.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief Creates a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param hidDevice Pointer to the basic information required for creating a device, including the device name, + * vendor ID, and product ID. + * @param hidEventProperties Pointer to the events of the device to be observed, including the event type and + * properties of the key event, absolute coordinate event, and relative coordinate event. + * @return Returns the device ID (a non-negative number) if the operation is successful; + * returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_CreateDevice(HidDevice *hidDevice, HidEventProperties *hidEventProperties); + +/** + * @brief Sends an event list to a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId ID of the device, to which the event list is sent. + * @param items List of events to sent. The event information includes the event type (HidEventType), + * event code (HidSynEvent for a synchronization event code, HidKeyCode for a key code, HidBtnCode + * for a button code, HidAbsAxes for an absolute coordinate code, HidRelAxes + * for a relative coordinate event, and HidMscEvent for other input event code), and value input by the device. + * @param length Length of the event list (number of events sent at a time). + * @return Returns 0 if the operation is successful; returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_EmitEvent(int32_t deviceId, const EmitItem items[], uint16_t length); + +/** + * @brief Destroys a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId ID of the device to destroy. + * @return Returns 0 if the operation is successful; returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_DestroyDevice(int32_t deviceId); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // HID_DDK_API_H diff --git a/en/native_sdk/hid/hid_ddk_types.h b/en/native_sdk/hid/hid_ddk_types.h new file mode 100644 index 00000000..2dc3d8ad --- /dev/null +++ b/en/native_sdk/hid/hid_ddk_types.h @@ -0,0 +1,587 @@ +/* + * 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 HID_DDK_TYPES_H +#define HID_DDK_TYPES_H +/** + * @addtogroup HidDdk + * @{ + * + * @brief Provides HID DDK interfaces, including creating a device, sending an event, and destroying a device. + * + * @syscap SystemCapability.Driver.HID.Extension + * @since 11 + * @version 1.0 + */ + +/** + * @file hid_ddk_types.h + * + * @brief Provides definitions of enum variables and structs in the HID DDK. + * + * File to include: + * @since 11 + * @version 1.0 + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief Defines event information. + * + * @since 11 + * @version 1.0 + */ +typedef struct EmitItem { + /** Event type */ + uint16_t type; + /** Event code */ + uint16_t code; + /** Event value */ + uint32_t value; +} EmitItem; + +/** + * @brief Enumerates the input devices. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Pointer device */ + HID_PROP_POINTER = 0x00, + /** Direct input device */ + HID_PROP_DIRECT = 0x01, + /** Touch device with bottom keys */ + HID_PROP_BUTTONPAD = 0x02, + /** Full multi-touch device */ + HID_PROP_SEMI_MT = 0x03, + /** Touch device with top soft keys */ + HID_PROP_TOPBUTTONPAD = 0x04, + /** Pointing stick */ + HID_PROP_POINTING_STICK = 0x05, + /** Accelerometer */ + HID_PROP_ACCELEROMETER = 0x06 +} HidDeviceProp; + +/** + * @brief Defines the basic device information. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidDevice { + /** Device name */ + const char *deviceName; + /** Vendor ID */ + uint16_t vendorId; + /** Product ID */ + uint16_t productId; + /** Version */ + uint16_t version; + /** Bus type */ + uint16_t bustype; + /** Device properties */ + HidDeviceProp *properties; + /** Number of device properties */ + uint16_t propLength; +} HidDevice; + +/** + * @brief Enumerates the event types. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Synchronization event */ + HID_EV_SYN = 0x00, + /** Key event */ + HID_EV_KEY = 0x01, + /** Relative coordinate event */ + HID_EV_REL = 0x02, + /** Absolute coordinate event */ + HID_EV_ABS = 0x03, + /** Other special event */ + HID_EV_MSC = 0x04 +} HidEventType; + +/** + * @brief Enumerates the synchronization event codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Indicates the end of an event. */ + HID_SYN_REPORT = 0, + /** Indicates configuration synchronization. */ + HID_SYN_CONFIG = 1, + /** Indicates the end of a multi-touch ABS data packet. */ + HID_SYN_MT_REPORT = 2, + /** Indicates that the event is discarded. */ + HID_SYN_DROPPED = 3 +} HidSynEvent; + +/** + * @brief Enumerates the key value codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Key A */ + HID_KEY_A = 30, + /** Key B */ + HID_KEY_B = 48, + /** Key C */ + HID_KEY_C = 46, + /** Key D */ + HID_KEY_D = 32, + /** Key E */ + HID_KEY_E = 18, + /** Key F */ + HID_KEY_F = 33, + /** Key G */ + HID_KEY_G = 34, + /** Key H */ + HID_KEY_H = 35, + /** Key I */ + HID_KEY_I = 23, + /** Key J */ + HID_KEY_J = 36, + /** Key K */ + HID_KEY_K = 37, + /** Key L */ + HID_KEY_L = 38, + /** Key M */ + HID_KEY_M = 50, + /** Key N */ + HID_KEY_N = 49, + /** Key O */ + HID_KEY_O = 24, + /** Key P */ + HID_KEY_P = 25, + /** Key Q */ + HID_KEY_Q = 16, + /** Key R */ + HID_KEY_R = 19, + /** Key S */ + HID_KEY_S = 31, + /** Key T */ + HID_KEY_T = 20, + /** Key U */ + HID_KEY_U = 22, + /** Key V */ + HID_KEY_V = 47, + /** Key W */ + HID_KEY_W = 17, + /** Key X */ + HID_KEY_X = 45, + /** Key Y */ + HID_KEY_Y = 21, + /** Key Z */ + HID_KEY_Z = 44, + /** Key 0 */ + HID_KEY_0 = 11, + /** Key 1 */ + HID_KEY_1 = 2, + /** Key 2 */ + HID_KEY_2 = 3, + /** Key 3 */ + HID_KEY_3 = 4, + /** Key 4 */ + HID_KEY_4 = 5, + /** Key 5 */ + HID_KEY_5 = 6, + /** Key 6 */ + HID_KEY_6 = 7, + /** Key 7 */ + HID_KEY_7 = 8, + /** Key 8 */ + HID_KEY_8 = 9, + /** Key 9 */ + HID_KEY_9 = 10, + /** Key grave (`) */ + HID_KEY_GRAVE = 41, + /** Key minum (-) */ + HID_KEY_MINUS = 12, + /** Key equals (=) */ + HID_KEY_EQUALS = 13, + /** Key backspace */ + HID_KEY_BACKSPACE = 14, + /** Key left bracket ([) */ + HID_KEY_LEFT_BRACKET = 26, + /** Key right bracket (]) */ + HID_KEY_RIGHT_BRACKET = 27, + /** Key enter */ + HID_KEY_ENTER = 28, + /** Key backslash (\) */ + HID_KEY_BACKSLASH = 43, + /** Key semicolon (;) */ + HID_KEY_SEMICOLON = 39, + /** Key apostrophe (') */ + HID_KEY_APOSTROPHE = 40, + /** Key space */ + HID_KEY_SPACE = 57, + /** Key slash (/) */ + HID_KEY_SLASH = 53, + /** Key comma (,) */ + HID_KEY_COMMA = 51, + /** Key period (.) */ + HID_KEY_PERIOD = 52, + /** Numeral 0 on the numeric keypad */ + HID_KEY_NUMPAD_0 = 82, + /** Numeral 1 on the numeric keypad */ + HID_KEY_NUMPAD_1 = 79, + /** Numeral 2 on the numeric keypad */ + HID_KEY_NUMPAD_2 = 80, + /** Numeral 3 on the numeric keypad */ + HID_KEY_NUMPAD_3 = 81, + /** Numeral 4 on the numeric keypad */ + HID_KEY_NUMPAD_4 = 75, + /** Numeral 5 on the numeric keypad */ + HID_KEY_NUMPAD_5 = 76, + /** Numeral 6 on the numeric keypad*/ + HID_KEY_NUMPAD_6 = 77, + /** Numeral 7 on the numeric keypad */ + HID_KEY_NUMPAD_7 = 71, + /** Numeral 8 on the numeric keypad */ + HID_KEY_NUMPAD_8 = 72, + /** Numeral 9 on the numeric keypad */ + HID_KEY_NUMPAD_9 = 73, + /** Arithmetic operator / (division) on the numeric keypad */ + HID_KEY_NUMPAD_DIVIDE = 70, + /** Arithmetic operator * (multiplication) on the numeric keypad */ + HID_KEY_NUMPAD_MULTIPLY = 55, + /** Arithmetic operator - (subtraction) on the numeric keypad */ + HID_KEY_NUMPAD_SUBTRACT = 74, + /** Arithmetic operator + (addition) on the numeric keypad */ + HID_KEY_NUMPAD_ADD = 78, + /** Decimal point (.) on the numeric keypad */ + HID_KEY_NUMPAD_DOT = 83, + /** Button 0 */ + HID_BTN_0 = 0x100, + /** Button 1 */ + HID_BTN_1 = 0x101, + /** Button 2 */ + HID_BTN_2 = 0x102, + /** Button 3 */ + HID_BTN_3 = 0x103, + /** Button 4 */ + HID_BTN_4 = 0x104, + /** Button 5 */ + HID_BTN_5 = 0x105, + /** Button 6 */ + HID_BTN_6 = 0x106, + /** Button 7 */ + HID_BTN_7 = 0x107, + /** Button 8 */ + HID_BTN_8 = 0x108, + /** Button 9 */ + HID_BTN_9 = 0x109, + /** Left mouse button */ + HID_BTN_LEFT = 0x110, + /** Right mouse button */ + HID_BTN_RIGHT = 0x111, + /** Middle mouse button */ + HID_BTN_MIDDLE = 0x112, + /** Side mouse button */ + HID_BTN_SIDE = 0x113, + /** Extra mouse button */ + HID_BTN_EXTRA = 0x114, + /** Mouse forward button */ + HID_BTN_FORWARD = 0x115, + /** Mouse backward button */ + HID_BTN_BACK = 0x116, + /** Mouse task button */ + HID_BTN_TASK = 0x117, + /** Pen */ + HID_BTN_TOOL_PEN = 0x140 + /** Rubber */ + HID_BTN_TOOL_RUBBER = 0x141 + /** Brush */ + HID_BTN_TOOL_BRUSH = 0x142 + /** Pencil */ + HID_BTN_TOOL_PENCIL = 0x143 + /** Air brush */ + HID_BTN_TOOL_AIRBRUSH = 0x144 + /** Finger */ + HID_BTN_TOOL_FINGER = 0x145 + /** Mouse */ + HID_BTN_TOOL_MOUSE = 0x146 + /** Lens */ + HID_BTN_TOOL_LENS = 0x147 + /** Five-finger touch */ + HID_BTN_TOOL_QUINTTAP = 0x148 + /** Stylus 3 */ + HID_BTN_STYLUS3 = 0x149 + /** Touch */ + HID_BTN_TOUCH = 0x14a + /** Stylus */ + HID_BTN_STYLUS = 0x14b + /** Stylus 2 */ + HID_BTN_STYLUS2 = 0x14c + /** Two-finger touch */ + HID_BTN_TOOL_DOUBLETAP = 0x14d + /** Three-finger touch */ + HID_BTN_TOOL_TRIPLETAP = 0x14e + /** Four-finger touch */ + HID_BTN_TOOL_QUADTAP = 0x14f + /** Scroll wheel */ + HID_BTN_WHEEL = 0x150 +} HidKeyCode; + +/** + * @brief Enumerates the absolute coordinate codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** X axis */ + HID_ABS_X = 0x00, + /** Y axis */ + HID_ABS_Y = 0x01, + /** Z axis */ + HID_ABS_Z = 0x02, + /** X axis of the right analog stick */ + HID_ABS_RX = 0x03, + /** Y axis of the right analog stick */ + HID_ABS_RY = 0x04, + /** Z axis of the right analog stick */ + HID_ABS_RZ = 0x05, + /** Throttle */ + HID_ABS_THROTTLE = 0x06, + /** Rudder */ + HID_ABS_RUDDER = 0x07, + /** Scroll wheel */ + HID_ABS_WHEEL = 0x08, + /** Gas */ + HID_ABS_GAS = 0x09, + /** Brake */ + HID_ABS_BRAKE = 0x0a, + /** HAT0X */ + HID_ABS_HAT0X = 0x10, + /** HAT0Y */ + HID_ABS_HAT0Y = 0x11, + /** HAT1X */ + HID_ABS_HAT1X = 0x12, + /** HAT1Y */ + HID_ABS_HAT1Y = 0x13, + /** HAT2X */ + HID_ABS_HAT2X = 0x14, + /** HAT2Y */ + HID_ABS_HAT2Y = 0x15, + /** HAT3X */ + HID_ABS_HAT3X = 0x16, + /** HAT3Y */ + HID_ABS_HAT3Y = 0x17, + /** Pressure */ + HID_ABS_PRESSURE = 0x18, + /** Distance */ + HID_ABS_DISTANCE = 0x19, + /** Inclination of X axis */ + HID_ABS_TILT_X = 0x1a, + /** Inclination of Y axis */ + HID_ABS_TILT_Y = 0x1b, + /** Width of the touch tool */ + HID_ABS_TOOL_WIDTH = 0x1c, + /** Volume */ + HID_ABS_VOLUME = 0x20, + /** Others */ + HID_ABS_MISC = 0x28 +} HidAbsAxes; + +/** + * @brief Enumerates the relative coordinate codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** X axis */ + HID_REL_X = 0x00, + /** Y axis */ + HID_REL_Y = 0x01, + /** Z axis */ + HID_REL_Z = 0x02, + /** X axis of the right analog stick */ + HID_REL_RX = 0x03, + /** Y axis of the right analog stick */ + HID_REL_RY = 0x04, + /** Z axis of the right analog stick */ + HID_REL_RZ = 0x05, + /** Horizontal scroll wheel */ + HID_REL_HWHEEL = 0x06, + /** Scale */ + HID_REL_DIAL = 0x07, + /** Scroll wheel */ + HID_REL_WHEEL = 0x08, + /** Others */ + HID_REL_MISC = 0x09, + /* Reserved */ + HID_REL_RESERVED = 0x0a, + /** High-resolution scroll wheel */ + HID_REL_WHEEL_HI_RES = 0x0b, + /** High-resolution horizontal scroll wheel */ + HID_REL_HWHEEL_HI_RES = 0x0c +} HidRelAxes; + +/** + * @brief Enumerates the codes of other input events. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Serial number */ + HID_MSC_SERIAL = 0x00, + /** Pulse */ + HID_MSC_PULSELED = 0x01, + /** Gesture */ + HID_MSC_GESTURE = 0x02, + /** Start event */ + HID_MSC_RAW = 0x03, + /** Scan */ + HID_MSC_SCAN = 0x04, + /** Timestamp */ + HID_MSC_TIMESTAMP = 0x05 +} HidMscEvent; + +/** + * @brief Defines an array of the event type codes. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidEventTypeArray { + /** Event type code */ + HidEventType *hidEventType; + /** Length of the array */ + uint16_t length; +} HidEventTypeArray; + +/** + * @brief Defines an array of key value properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidKeyCodeArray { + /** Key value code */ + HidKeyCode *hidKeyCode; + /** Length of the array */ + uint16_t length; +} HidKeyCodeArray; + +/** + * @brief Defines an array of absolute coordinate properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidAbsAxesArray { + /** Absolute coordinate property code */ + HidAbsAxes *hidAbsAxes; + /** Length of the array */ + uint16_t length; +} HidAbsAxesArray; + +/** + * @brief Defines an array of relative coordinate properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidRelAxesArray { + /** Relative coordinate property code */ + HidRelAxes *hidRelAxes; + /** Length of the array */ + uint16_t length; +} HidRelAxesArray; + +/** + * @brief Defines an array of other special event properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidMscEventArray { + /** Code of the event property */ + HidMscEvent *hidMscEvent; + /** Length of the array */ + uint16_t length; +} HidMscEventArray; + +/** + * @brief Defines the event properties of a device to be observed. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidEventProperties { + /** Array of event type codes */ + struct HidEventTypeArray hidEventTypes; + /** Array of key value codes */ + struct HidKeyCodeArray hidKeys; + /** Array of absolute coordinate property codes */ + struct HidAbsAxesArray hidAbs; + /** Array of relative coordinate property codes */ + struct HidRelAxesArray hidRelBits; + /** Array of other event property codes */ + struct HidMscEventArray hidMiscellaneous; + + /** Maximum values of the absolute coordinates */ + int32_t hidAbsMax[64]; + /** Minimum values of the absolute coordinates */ + int32_t hidAbsMin[64]; + /** Fuzzy values of the absolute coordinates */ + int32_t hidAbsFuzz[64]; + /** Fixed values of the absolute coordinates */ + int32_t hidAbsFlat[64]; +} HidEventProperties; + +/** + * @brief Defines the error codes used in the HID DDK. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Operation successful */ + HID_DDK_SUCCESS = 0, + /** Operation failed */ + HID_DDK_FAILED = -1, + /** Invalid parameter */ + HID_DDK_INVALID_PARAMETER = -2, + /** Invalid operation */ + HID_DDK_INVALID_OPERATION = -3, + /** Null pointer exception */ + HID_DDK_NULL_PTR = -4, + /** Timeout */ + HID_DDK_TIMEOUT = -5, + /** Permission denied */ + HID_DDK_NO_PERM = -6 +} HidDdkErrCode; +#ifdef __cplusplus +} +/** @} */ +#endif /* __cplusplus */ +#endif // HID_DDK_TYPES_H -- Gitee From 11ebebd0670b2719528c6eb2925481a27b94cf12 Mon Sep 17 00:00:00 2001 From: lengye Date: Wed, 15 Nov 2023 13:35:28 +0000 Subject: [PATCH 0085/2135] add camera native api Signed-off-by: lengye --- zh-cn/native_sdk/media/oh_camera/camera.h | 806 ++++++++++++++++++ .../native_sdk/media/oh_camera/camera_input.h | 150 ++++ .../media/oh_camera/camera_manager.h | 270 ++++++ .../media/oh_camera/capture_session.h | 604 +++++++++++++ .../media/oh_camera/metadata_output.h | 164 ++++ .../native_sdk/media/oh_camera/photo_output.h | 202 +++++ .../media/oh_camera/preview_output.h | 175 ++++ .../native_sdk/media/oh_camera/video_output.h | 173 ++++ 8 files changed, 2544 insertions(+) create mode 100644 zh-cn/native_sdk/media/oh_camera/camera.h create mode 100644 zh-cn/native_sdk/media/oh_camera/camera_input.h create mode 100644 zh-cn/native_sdk/media/oh_camera/camera_manager.h create mode 100644 zh-cn/native_sdk/media/oh_camera/capture_session.h create mode 100644 zh-cn/native_sdk/media/oh_camera/metadata_output.h create mode 100644 zh-cn/native_sdk/media/oh_camera/photo_output.h create mode 100644 zh-cn/native_sdk/media/oh_camera/preview_output.h create mode 100644 zh-cn/native_sdk/media/oh_camera/video_output.h diff --git a/zh-cn/native_sdk/media/oh_camera/camera.h b/zh-cn/native_sdk/media/oh_camera/camera.h new file mode 100644 index 00000000..c1c7d090 --- /dev/null +++ b/zh-cn/native_sdk/media/oh_camera/camera.h @@ -0,0 +1,806 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief 为相机模块提供C接口的定义。 + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file camera.h + * + * @brief 声明相机的基本概念。 + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_CAMERA_H +#define NATIVE_INCLUDE_CAMERA_CAMERA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 相机管理器对象。 + * + * 可以使用{@link OH_Camera_GetCameraManager}方法创建指针。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Manager Camera_Manager; + +/** + * @brief 相机错误代码的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_ErrorCode { + /** + * 相机结果正常。 + */ + CAMERA_OK = 0, + + /** + * 参数丢失或参数类型不正确。 + */ + CAMERA_INVALID_ARGUMENT = 7400101, + + /** + * 不允许操作。 + */ + CAMERA_OPERATION_NOT_ALLOWED = 7400102, + + /** + * 会话未配置。 + */ + CAMERA_SESSION_NOT_CONFIG = 7400103, + + /** + * 会话未运行。 + */ + CAMERA_SESSION_NOT_RUNNING = 7400104, + + /** + * 会话配置已锁定。 + */ + CAMERA_SESSION_CONFIG_LOCKED = 7400105, + + /** + * 设备设置已锁定。 + */ + CAMERA_DEVICE_SETTING_LOCKED = 7400106, + + /** + * 因冲突而无法使用相机。 + */ + CAMERA_CONFLICT_CAMERA = 7400107, + + /** + * 由于安全原因,相机已禁用。 + */ + CAMERA_DEVICE_DISABLED = 7400108, + + /** + * 因被抢占而无法使用相机。 + */ + CAMERA_DEVICE_PREEMPTED = 7400109, + + /** + * 相机服务致命错误。 + */ + CAMERA_SERVICE_FATAL_ERROR = 7400201 +} Camera_ErrorCode; + +/** + * @brief 相机状态的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Status { + /** + * 显示状态。 + */ + CAMERA_STATUS_APPEAR = 0, + + /** + * 消失状态。 + */ + CAMERA_STATUS_DISAPPEAR = 1, + + /** + * 可用状态。 + */ + CAMERA_STATUS_AVAILABLE = 2, + + /** + * 不可用状态。 + */ + CAMERA_STATUS_UNAVAILABLE = 3 +} Camera_Status; + +/** + * @brief 相机位置的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Position { + /** + * 未指定位置。 + */ + CAMERA_POSITION_UNSPECIFIED = 0, + + /** + * 后置。 + */ + CAMERA_POSITION_BACK = 1, + + /** + * 前置。 + */ + CAMERA_POSITION_FRONT = 2 +} Camera_Position; + +/** + * @brief 相机类型的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Type { + /** + * 默认相机类型。 + */ + CAMERA_TYPE_DEFAULT = 0, + + /** + * 广角相机。 + */ + CAMERA_TYPE_WIDE_ANGLE = 1, + + /** + * 超广角相机。 + */ + CAMERA_TYPE_ULTRA_WIDE = 2, + + /** + * 电话相机。 + */ + CAMERA_TYPE_TELEPHOTO = 3, + + /** + * 景深相机。 + */ + CAMERA_TYPE_TRUE_DEPTH = 4 +} Camera_Type; + +/** + * @brief 相机连接类型的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Connection { + /** + * 内置摄像头。 + */ + CAMERA_CONNECTION_BUILT_IN = 0, + + /** + * 使用USB连接的摄像头。 + */ + CAMERA_CONNECTION_USB_PLUGIN = 1, + + /** + * 远程摄像头。 + */ + CAMERA_CONNECTION_REMOTE = 2 +} Camera_Connection; + +/** + * @brief 相机格式类型的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Format { + /** + * RGBA 8888格式。 + */ + CAMERA_FORMAT_RGBA_8888 = 3, + + /** + * YUV 420格式。 + */ + CAMERA_FORMAT_YUV_420_SP = 1003, + + /** + * JPEG格式。 + */ + CAMERA_FORMAT_JPEG = 2000 +} Camera_Format; + +/** + * @brief 闪光模式的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_FlashMode { + /** + * 关闭模式。 + */ + FLASH_MODE_CLOSE = 0, + + /** + * 打开模式。 + */ + FLASH_MODE_OPEN = 1, + + /** + * 自动模式。 + */ + FLASH_MODE_AUTO = 2, + + /** + * 始终打开模式。 + */ + FLASH_MODE_ALWAYS_OPEN = 3 +} Camera_FlashMode; + +/** + * @brief 曝光模式的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_ExposureMode { + /** + * 锁定曝光模式。 + */ + EXPOSURE_MODE_LOCKED = 0, + + /** + * 自动曝光模式。 + */ + EXPOSURE_MODE_AUTO = 1, + + /** + * 连续自动曝光。 + */ + EXPOSURE_MODE_CONTINUOUS_AUTO = 2 +} Camera_ExposureMode; + +/** + * @brief 聚焦模式的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_FocusMode { + /** + * 手动模式。 + */ + FOCUS_MODE_MANUAL = 0, + + /** + * 连续自动模式。 + */ + FOCUS_MODE_CONTINUOUS_AUTO = 1, + + /** + * 自动模式。 + */ + FOCUS_MODE_AUTO = 2, + + /** + * 锁定模式。 + */ + FOCUS_MODE_LOCKED = 3 +} Camera_FocusMode; + +/** + * @brief 焦点状态的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_FocusState { + /** + * 扫描状态。 + */ + FOCUS_STATE_SCAN = 0, + + /** + * 专聚焦状态。 + */ + FOCUS_STATE_FOCUSED = 1, + + /** + * 非聚焦的状态。 + */ + FOCUS_STATE_UNFOCUSED = 2 +} Camera_FocusState; + +/** + * @brief 录像防抖模式的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_VideoStabilizationMode { + /** + * 关闭录像防抖。 + */ + STABILIZATION_MODE_OFF = 0, + + /** + * LOW模式提供基本的防抖效果。 + */ + STABILIZATION_MODE_LOW = 1, + + /** + * MIDDLE模式意味着通过算法可以获得比LOW模式更好的效果。 + */ + STABILIZATION_MODE_MIDDLE = 2, + + /** + * HIGH模式意味着通过算法可以获得比MIDDLE模式更好的效果。 + */ + STABILIZATION_MODE_HIGH = 3, + + /** + * HDF相机可以自动选择模式。 + */ + STABILIZATION_MODE_AUTO = 4 +} Camera_VideoStabilizationMode; + +/** + * @brief 图像旋转角度的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_ImageRotation { + /** + * 捕获图像旋转0度。 + */ + IAMGE_ROTATION_0 = 0, + + /** + * 捕获图像旋转90度。 + */ + IAMGE_ROTATION_90 = 90, + + /** + * 捕获图像旋转180度。 + */ + IAMGE_ROTATION_180 = 180, + + /** + * 捕获图像旋转270度。 + */ + IAMGE_ROTATION_270 = 270 +} Camera_ImageRotation; + +/** + * @brief 图像质量等级的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_QualityLevel { + /** + * 高图像质量。 + */ + QUALITY_LEVEL_HIGH = 0, + + /** + * 中等图像质量。 + */ + QUALITY_LEVEL_MEDIUM = 1, + + /** + * 低图像质量。 + */ + QUALITY_LEVEL_LOW = 2 +} Camera_QualityLevel; + +/** + * @brief 元数据对象类型的枚举。 + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_MetadataObjectType { + /** + * 人脸检测。 + */ + FACE_DETECTION = 0 +} Camera_MetadataObjectType; + +/** + * @brief 大小参数。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Size { + /** + * 宽度。 + */ + uint32_t width; + + /** + * 高度。 + */ + uint32_t height; +} Camera_Size; + +/** + * @brief 相机流的配置文件。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Profile { + /** + * 相机格式。 + */ + Camera_Format format; + + /** + * 图片大小。 + */ + Camera_Size size; +} Camera_Profile; + +/** + * @brief 帧速率范围。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_FrameRateRange { + /** + * 最小帧速率。 + */ + uint32_t min; + + /** + * 最大帧速率。 + */ + uint32_t max; +} Camera_FrameRateRange; + +/** + * @brief 录像配置文件。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_VideoProfile { + /** + * 相机格式。 + */ + Camera_Format format; + + /** + * 图片大小。 + */ + Camera_Size size; + + /** + * 帧速率,单位为fps(每秒帧数)。 + */ + Camera_FrameRateRange range; +} Camera_VideoProfile; + +/** + * @brief 相机输出能力。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_OutputCapability { + /** + * 预览配置文件列表。 + */ + Camera_Profile** previewProfiles; + + /** + * 预览配置文件列表的大小。 + */ + uint32_t previewProfilesSize; + + /** + * 拍照配置文件列表。 + */ + Camera_Profile** photoProfiles; + + /** + * 拍照配置文件列表的大小。 + */ + uint32_t photoProfilesSize; + + /** + * 录像配置文件列表。 + */ + Camera_VideoProfile** videoProfiles; + + /** + * 录像配置文件列表的大小。 + */ + uint32_t videoProfilesSize; + + /** + * 元数据对象类型列表。 + */ + Camera_MetadataObjectType** supportedMetadataObjectTypes; + + /** + * 元数据对象类型列表的大小。 + */ + uint32_t metadataProfilesSize; +} Camera_OutputCapability; + +/** + * @brief 相机设备对象。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Device { + /** + * 相机id属性。 + */ + char* cameraId; + + /** + * 相机位置属性。 + */ + Camera_Position cameraPosition; + + /** + * 相机类型属性。 + */ + Camera_Type cameraType; + + /** + * 相机连接类型属性。 + */ + Camera_Connection connectionType; +} Camera_Device; + +/** + * @brief 相机状态信息。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_StatusInfo { + /** + * 相机实例。 + */ + Camera_Device* camera; + + /** + * 当前相机状态。 + */ + Camera_Status status; +} Camera_StatusInfo; + +/** + * @brief 点参数。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Point { + /** + * X坐标。 + */ + double x; + + /** + * Y坐标。 + */ + double y; +} Camera_Point; + +/** + * @brief 拍照位置。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Location { + /** + * 纬度。 + */ + double latitude; + + /** + * 经度。 + */ + double longitude; + + /** + * 海拔高度。 + */ + double altitude; +} Camera_Location; + +/** + * @brief 要设置的拍照捕获选项。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_PhotoCaptureSetting { + /** + * 拍照图像质量。 + */ + Camera_QualityLevel quality; + + /** + * 拍照旋转角度。 + */ + Camera_ImageRotation rotation; + + /** + * 拍照位置。 + */ + Camera_Location* location; + + /** + * 设置镜像拍照功能开关,默认为false。 + */ + bool mirror; +} Camera_PhotoCaptureSetting; + +/** + * @brief 帧快门回调信息。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_FrameShutterInfo { + /** + * 捕获id。 + */ + int32_t captureId; + + /** + * 帧的时间戳。 + */ + uint64_t timestamp; +} Camera_FrameShutterInfo; + +/** + * @brief 捕获结束信息。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_CaptureEndInfo { + /** + * 捕获id。 + */ + int32_t captureId; + + /** + * 帧数。 + */ + int64_t frameCount; +} Camera_CaptureEndInfo; + +/** + * @brief 矩形定义。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Rect { + /** + * 左上角的X坐标。 + */ + int32_t topLeftX; + + /** + * 左上角的Y坐标。 + */ + int32_t topLeftY; + + /** + * 矩形宽度。 + */ + int32_t width; + + /** + * 矩形高度。 + */ + int32_t height; +} Camera_Rect; + +/** + * @brief 元数据对象基础。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_MetadataObject { + /** + * 元数据对象类型。 + */ + Camera_MetadataObjectType type; + + /** + * 元数据对象时间戳(以毫秒为单位)。 + */ + int64_t timestamp; + + /** + * 检测到的元数据对象的轴对齐边界框。 + */ + Camera_Rect* boundingBox; +} Camera_MetadataObject; + +/** + * @brief 创建CameraManager实例。 + * + * @param cameraManager 如果方法调用成功,将创建输出{@linkCamera_Manager}cameraManager。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_Camera_GetCameraManager(Camera_Manager** cameraManager); + +/** + * @brief 删除CameraManager实例。 + * + * @param cameraManager 要删除的{@link Camera_Manager}cameraManager实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_Camera_DeleteCameraManager(Camera_Manager* cameraManager); + + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/oh_camera/camera_input.h b/zh-cn/native_sdk/media/oh_camera/camera_input.h new file mode 100644 index 00000000..a6dcf9e8 --- /dev/null +++ b/zh-cn/native_sdk/media/oh_camera/camera_input.h @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief 为相机模块提供C接口的定义。 + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file camera_input.h + * + * @brief 声明相机输入概念。 + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_CAMERA_INPUT_H +#define NATIVE_INCLUDE_CAMERA_CAMERA_INPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 相机输入对象。 + * + * 可以使用{@link OH_CameraManager_CreateCameraInput}方法创建指针。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Input Camera_Input; + +/** + * @brief 在{@link CameraInput_Callbacks}中被调用的相机输入错误回调。 + * + * @param cameraInput 传递回调的{@link Camera_Input}。 + * @param errorCode 相机输入的{@link Camera_ErrorCode}。 + * + * @see CAMERA_CONFLICT_CAMERA + * @see CAMERA_DEVICE_DISABLED + * @see CAMERA_DEVICE_PREEMPTED + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ +typedef void (*OH_CameraInput_OnError)(const Camera_Input* cameraInput, Camera_ErrorCode errorCode); + +/** + * @brief 相机输入错误事件的回调。 + * + * @see OH_CameraInput_RegisterCallback + * @since 11 + * @version 1.0 + */ +typedef struct CameraInput_Callbacks { + /** + * 相机输入错误事件。 + */ + OH_CameraInput_OnError onError; +} CameraInput_Callbacks; + +/** + * @brief 注册相机输入更改事件回调。 + * + * @param cameraInput {@link Camera_Input}实例。 + * @param callback 要注册的{@link CameraInput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraInput_RegisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback); + +/** + * @brief 注销相机输入更改事件回调。 + * + * @param cameraInput {@link Camera_Input}实例。 + * @param callback 要注销的{@link CameraInput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraInput_UnregisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback); + +/** + * @brief 打开相机。 + * + * @param cameraInput 要打开的{@link Camera_Input}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_CONFLICT_CAMERA}如果不能使用相机会导致冲突。 + * {@link#CAMERA_DEVICE_DISABLED}如果由于安全原因禁用了摄像头。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CameraInput_Open(Camera_Input* cameraInput); + +/** + * @brief 关闭相机。 + * + * @param cameraInput 要关闭的{@link Camera_Input}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CameraInput_Close(Camera_Input* cameraInput); + +/** + * @brief 释放相机输入实例。 + * + * @param cameraInput 要释放的{@link Camera_Input}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CameraInput_Release(Camera_Input* cameraInput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_INPUT_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/oh_camera/camera_manager.h b/zh-cn/native_sdk/media/oh_camera/camera_manager.h new file mode 100644 index 00000000..445a6e9a --- /dev/null +++ b/zh-cn/native_sdk/media/oh_camera/camera_manager.h @@ -0,0 +1,270 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief 为相机模块提供C接口的定义。 + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file camera_manager.h + * + * @brief 声明相机管理器的概念。 + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_CAMERA_MANAGER_H +#define NATIVE_INCLUDE_CAMERA_CAMERA_MANAGER_H + +#include +#include +#include "camera.h" +#include "camera_input.h" +#include "capture_session.h" +#include "preview_output.h" +#include "video_output.h" +#include "photo_output.h" +#include "metadata_output.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 在{@link CameraManager_Callbacks}中被调用的相机管理器状态回调。 + * + * @param cameraManager 传递回调的{@link Camera_Manager}。 + * @param status 每个相机设备的{@link Camera_StatusInfo}。 + * @since 11 + */ +typedef void (*OH_CameraManager_StatusCallback)(Camera_Manager* cameraManager, Camera_StatusInfo* status); + +/** + * @brief 相机设备状态的回调。 + * + * @see OH_CameraManager_RegisterCallback + * @since 11 + * @version 1.0 + */ +typedef struct CameraManager_Callbacks { + /** + * 相机状态更改事件。 + */ + OH_CameraManager_StatusCallback onCameraStatus; +} CameraManager_Callbacks; + +/** + * @brief 注册相机状态更改事件回调。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param callback 要注册的{@link CameraManager_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_RegisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback); + +/** + * @brief 注销摄像机状态更改事件回调。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param callback 要注销的{@link CameraManager_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_UnregisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback); + +/** + * @brief 获取支持相机的描述。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param cameras 如果方法调用成功,则将记录支持的{@link Camera_Device}列表。 + * @param size 如果方法调用成功,则将记录支持的{@link Camera_Device}列表的大小。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_GetSupportedCameras(Camera_Manager* cameraManager, + Camera_Device** cameras, uint32_t* size); + +/** + * @brief 删除支持的相机。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param cameras 要删除的{@link Camera_Device}列表。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_DeleteSupportedCameras(Camera_Manager* cameraManager, + Camera_Device* cameras, uint32_t size); + +/** + * @brief 获取特定相机和特定模式支持的输出功能。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param cameras 要查询的{@link Camera_Device}。 + * @param cameraOutputCapability 如果方法调用成功,则将记录支持的{@link Camera_OutputCapability}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapability(Camera_Manager* cameraManager, + const Camera_Device* camera, Camera_OutputCapability** cameraOutputCapability); + +/** + * @brief 删除支持的输出功能。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param cameraOutputCapability 要删除的{@link Camera_OutputCapability}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_DeleteSupportedCameraOutputCapability(Camera_Manager* cameraManager, + Camera_OutputCapability* cameraOutputCapability); + +/** + * @brief 确定相机是否静音。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param isCameraMuted 如果方法调用成功,将判断相机是否静音。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_IsCameraMuted(Camera_Manager* cameraManager, bool* isCameraMuted); + +/** + * @brief 创建捕获会话实例。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param captureSession 如果方法调用成功,则将创建{@link Camera_CaptureSession}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_CreateCaptureSession(Camera_Manager* cameraManager, + Camera_CaptureSession** captureSession); + +/** + * @brief 创建相机输入实例。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param camera 用于创建{@link Camera_Input}的{@link Camera_Device}。 + * @param cameraInput 如果方法调用成功,将创建{@link Camera_Input}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @permission ohos.permission.CAMERA + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_CreateCameraInput(Camera_Manager* cameraManager, + const Camera_Device* camera, Camera_Input** cameraInput); + +/** + * @brief 创建具有位置和类型的相机输入实例 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param position 用于创建{@link Camera_Input}的{@link Camera_Position}。 + * @param type 用于创建{@link Camera_Input}的{@linkCamera_Type}。 + * @param cameraInput 如果方法调用成功,将创建{@link Camera_Input}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @permission ohos.permission.CAMERA + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_CreateCameraInput_WithPositionAndType(Camera_Manager* cameraManager, + Camera_Position position, Camera_Type type, Camera_Input** cameraInput); + +/** + * @brief 创建预览输出实例。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param profile 用于创建{@link Camera_PreviewOutput}的{@link Camera_Profile}。 + * @param surfaceId 用于创建{@link Camera_PreviewOutput}。 + * @param previewOutput 如果方法调用成功,将创建{@link Camera_PreviewOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_CreatePreviewOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, + const char* surfaceId, Camera_PreviewOutput** previewOutput); + +/** + * @brief 创建一个拍照输出实例。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param profile 用于创建{@link Camera_PhotoOutput}的{@link Camera_Profile}。 + * @param surfaceId 用于创建{@link Camera_PhotoOutput}。 + * @param photoOutput 如果方法调用成功,将创建{@link Camera_PhotoOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, + const char* surfaceId, Camera_PhotoOutput** photoOutput); + +/** + * @brief 创建一个录像输出实例。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param profile 用于创建{@link Camera_VideoOutput}的{@link Camera_VideoProfile}。 + * @param surfaceId 用于创建{@link Camera_VideoOutput}。 + * @param videoOutput 如果方法调用成功,将创建{@link Camera_VideoOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_CreateVideoOutput(Camera_Manager* cameraManager, const Camera_VideoProfile* profile, + const char* surfaceId, Camera_VideoOutput** videoOutput); + +/** + * @brief 创建元数据输出实例。 + * + * @param cameraManager {@link Camera_Manager}实例。 + * @param profile 用于创建{@link Camera_MetadataOutput}的{@link Camera_MetadataObjectType}. + * @param metadataOutput 如果方法调用成功,将创建{@link Camera_MetadataOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CameraManager_CreateMetadataOutput(Camera_Manager* cameraManager, + const Camera_MetadataObjectType* profile, Camera_MetadataOutput** metadataOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_MANAGER_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/oh_camera/capture_session.h b/zh-cn/native_sdk/media/oh_camera/capture_session.h new file mode 100644 index 00000000..0498e01c --- /dev/null +++ b/zh-cn/native_sdk/media/oh_camera/capture_session.h @@ -0,0 +1,604 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief 为相机模块提供C接口的定义。 + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file capture_session.h + * + * @brief 声明捕获会话概念。 + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H +#define NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H + +#include +#include +#include "camera.h" +#include "camera_input.h" +#include "preview_output.h" +#include "photo_output.h" +#include "video_output.h" +#include "metadata_output.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 捕获会话对象 + * + * 可以使用{@link Camera_CaptureSession}方法创建指针。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_CaptureSession Camera_CaptureSession; + +/** + * @brief 在{@link CaptureSession_Callbacks}中被调用的捕获会话焦点状态回调。 + * + * @param session 传递回调的{@link Camera_CaptureSession}。 + * @param focusState 回调传递的{@link Camera_FocusState}。 + * @since 11 + */ +typedef void (*OH_CaptureSession_OnFocusStateChange)(Camera_CaptureSession* session, Camera_FocusState focusState); + +/** + * @brief 在{@link CaptureSession_Callbacks}中被调用的捕获会话错误回调。 + * + * @param session 传递回调的{@link Camera_CaptureSession}。 + * @param errorCode 捕获会话的{@link Camera_ErrorCode}。 + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ +typedef void (*OH_CaptureSession_OnError)(Camera_CaptureSession* session, Camera_ErrorCode errorCode); + +/** + * @brief 捕获会话的回调。 + * + * @see OH_CaptureSession_RegisterCallback + * @since 11 + * @version 1.0 + */ +typedef struct CaptureSession_Callbacks { + /** + * 捕获会话焦点状态更改事件。 + */ + OH_CaptureSession_OnFocusStateChange onFocusStateChange; + + /** + * 捕获会话错误事件。 + */ + OH_CaptureSession_OnError onError; +} CaptureSession_Callbacks; + +/** + * @brief 注册捕获会话事件回调。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param callback 要注册的{@link CaptureSession_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_RegisterCallback(Camera_CaptureSession* session, + CaptureSession_Callbacks* callback); + +/** + * @brief 注销捕获会话事件回调。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param callback 要注销的{@link CaptureSession_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_UnregisterCallback(Camera_CaptureSession* session, + CaptureSession_Callbacks* callback); + +/** + * @brief 开始捕获会话配置。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_CONFIG_LOCKED}如果会话配置已锁定。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_BeginConfig(Camera_CaptureSession* session); + +/** + * @brief 提交捕获会话配置。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_CommitConfig(Camera_CaptureSession* session); + +/** + * @brief 添加相机输入。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param cameraInput 要添加的目标{@link Camera_Input}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_AddInput(Camera_CaptureSession* session, Camera_Input* cameraInput); + +/** + * @brief 删除相机输入。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param cameraInput 要删除的目标{@link Camera_Input}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_RemoveInput(Camera_CaptureSession* session, Camera_Input* cameraInput); + +/** + * @brief 添加预览输出。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param previewOutput 要添加的目标{@link Camera_PreviewOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession* session, + Camera_PreviewOutput* previewOutput); + +/** + * @brief 删除预览输出。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param previewOutput 要删除的目标{@link Camera_PreviewOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession* session, + Camera_PreviewOutput* previewOutput); + +/** + * @brief 添加拍照输出。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param photoOutput 要添加的目标{@link Camera_PhotoOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput); + +/** + * @brief 删除拍照输出。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param photoOutput 要删除的目标{@link Camera_PhotoOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput); + +/** + * @brief 添加录像输出。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param videoOutput 要添加的目标{@link Camera_VideoOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_AddVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput); + +/** + * @brief 删除录像输出。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param videoOutput 要删除的目标{@link Camera_VideoOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput); + +/** + * @brief 添加元数据输出。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param metadataOutput 要添加的目标{@link Camera_MetadataOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession* session, + Camera_MetadataOutput* metadataOutput); + +/** + * @brief 删除元数据输出。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param metadataOutput 要删除的目标{@link Camera_MetadataOutput}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_OPERATION_NOT_ALLOWED}如果不允许操作。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession* session, + Camera_MetadataOutput* metadataOutput); + +/** + * @brief 启动捕获会话。 + * + * @param session 要启动的{@link Camera_CaptureSession}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_Start(Camera_CaptureSession* session); + +/** + * @brief 停止捕获会话。 + * + * @param session 要停止的{@link Camera_CaptureSession}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_Stop(Camera_CaptureSession* session); + +/** + * @brief 释放捕获会话。 + * + * @param session 要释放的{@link Camera_CaptureSession}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_Release(Camera_CaptureSession* session); + +/** + * @brief 检查设备是否有闪光灯。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param hasFlash 是否支持闪光灯的结果。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_HasFlash(Camera_CaptureSession* session, bool* hasFlash); + +/** + * @brief 检查是否支持指定的闪光灯模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param flashMode 要检查的{@link Camera_FlashMode}。 + * @param isSupported 是否支持闪光灯模式的结果。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession* session, + Camera_FlashMode flashMode, bool* isSupported); + +/** + * @brief 获取当前闪光灯模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param flashMode 当前{@link Camera_FlashMode}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetFlashMode(Camera_CaptureSession* session, Camera_FlashMode* flashMode); + +/** + * @brief 设置闪光灯模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param flashMode 要设置的目标{@link Camera_FlashMode}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_SetFlashMode(Camera_CaptureSession* session, Camera_FlashMode flashMode); + +/** + * @brief 检查是否支持指定的曝光模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param exposureMode 要检查的{@link Camera_ExposureMode}。 + * @param isSupported 是否支持曝光模式的结果。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession* session, + Camera_ExposureMode exposureMode, bool* isSupported); + +/** + * @brief 获取当前曝光模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param exposureMode 当前的{@link Camera_ExposureMode}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode); + +/** + * @brief 设置曝光模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param exposureMode 要设置的目标{@link Camera_ExposureMode}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode); + +/** + * @brief 获取当前测量点。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param point 当前{@link Camera_Point}测量点。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point); + +/** + * @brief 设置计量区域的中心点。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param point 要设置的目标{@link Camera_Point}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point); + +/** + * @brief 查询曝光补偿范围。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param minExposureBias 曝光补偿的最小值。 + * @param maxExposureBias 曝光补偿的最大值。 + * @param step 每个级别之间的曝光补偿阶梯。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session, float* minExposureBias, + float* maxExposureBias, float* step); + +/** + * @brief 设置曝光补偿。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param exposureBias 要设置的目标曝光补偿。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias); + +/** + * @brief 获取当前曝光补偿。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param exposureBias 当前的曝光补偿。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias); + +/** + * @brief 检查是否支持指定的聚焦模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param focusMode 要检查的{@link Camera_FocusMode}。 + * @param isSupported 是否支持聚焦模式的结果。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* session, + Camera_FocusMode focusMode, bool* isSupported); + +/** + * @brief 获取当前聚焦模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param exposureBias 当前{@link Camera_FocusMode}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetFocusMode(Camera_CaptureSession* session, Camera_FocusMode* focusMode); + +/** + * @brief 设置聚焦模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param focusMode 要设置的目标{@link Camera_FocusMode}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_SetFocusMode(Camera_CaptureSession* session, Camera_FocusMode focusMode); + +/** + * @brief 获取当前焦点。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param focusPoint 当前{@link Camera_Point}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetFocusPoint(Camera_CaptureSession* session, Camera_Point* focusPoint); + +/** + * @brief 设置焦点。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param focusPoint 要设置的目标{@link Camera_Point}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_SetFocusPoint(Camera_CaptureSession* session, Camera_Point focusPoint); + +/** + * @brief 获取所有支持的缩放比例范围。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param minZoom 缩放比范围的最小值。 + * @param maxZoom 缩放比例范围的最大值。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession* session, float* minZoom, float* maxZoom); + +/** + * @brief 获取当前缩放比例。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param zoom 当前缩放比例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetZoomRatio(Camera_CaptureSession* session, float* zoom); + +/** + * @brief 设置缩放比例。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param zoom 要设置的目标缩放比。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_SetZoomRatio(Camera_CaptureSession* session, float zoom); + +/** + * @brief 检查是否支持指定的录像防抖模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param mode 要检查的{@link Camera_VideoStatizationMode}。 + * @param isSupported 是否支持录像防抖模式的结果。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession* session, + Camera_VideoStabilizationMode mode, bool* isSupported); + +/** + * @brief 获取当前录像防抖模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param mode 当前{@link Camera_VideoStatizationMode}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession* session, + Camera_VideoStabilizationMode* mode); + +/** + * @brief 设置录像防抖模式。 + * + * @param session {@link Camera_CaptureSession}实例。 + * @param mode 要设置的目标{@link Camera_VideoStatizationMode}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * @since 11 + */ +Camera_ErrorCode OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession* session, + Camera_VideoStabilizationMode mode); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/oh_camera/metadata_output.h b/zh-cn/native_sdk/media/oh_camera/metadata_output.h new file mode 100644 index 00000000..46a0df3e --- /dev/null +++ b/zh-cn/native_sdk/media/oh_camera/metadata_output.h @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief 为相机模块提供C接口的定义。 + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file metadata_output.h + * + * @brief 声明元数据输出概念。 + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 元数据输出对象 + * + * 可以使用{@link Camera_MetadataOutput}方法创建指针。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_MetadataOutput Camera_MetadataOutput; + +/** + * @brief 在{@link MetadataOutput_Callbacks}中被调用的元数据输出元数据对象可用回调。 + * + * @param metadataOutput 传递回调的{@link Camera_MetadataOutput}。 + * @param metadataObject {@link Camera_MetadataObject}将由回调传递。 + * @param size 元数据对象的大小。 + * @since 11 + */ +typedef void (*OH_MetadataOutput_OnMetadataObjectAvailable)(Camera_MetadataOutput* metadataOutput, + Camera_MetadataObject* metadataObject, uint32_t size); + +/** + * @brief 在{@link MetadataOutput_Callbacks}中被调用的元数据输出错误回调。 + * + * @param metadataOutput 传递回调的{@link Camera_MetadataOutput}。 + * @param errorCode 元数据输出的{@link Camera_ErrorCode}。 + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ +typedef void (*OH_MetadataOutput_OnError)(Camera_MetadataOutput* metadataOutput, Camera_ErrorCode errorCode); + +/** + * @brief 元数据输出的回调。 + * + * @see OH_MetadataOutput_RegisterCallback + * @since 11 + * @version 1.0 + */ +typedef struct MetadataOutput_Callbacks { + /** + * 此回调将调用元数据输出结果数据。 + */ + OH_MetadataOutput_OnMetadataObjectAvailable onMetadataObjectAvailable; + + /** + * 元数据输出错误事件。 + */ + OH_MetadataOutput_OnError onError; +} MetadataOutput_Callbacks; + +/** + * @brief 注册元数据输出更改事件回调。 + * + * @param metadataOutput {@link Camera_MetadataOutput}实例。 + * @param callback 要注册的{@link MetadataOutput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_MetadataOutput_RegisterCallback(Camera_MetadataOutput* metadataOutput, + MetadataOutput_Callbacks* callback); + +/** + * @brief 注销元数据输出更改事件回调。 + * + * @param metadataOutput {@link Camera_MetadataOutput}实例。 + * @param callback 要注销的{@link MetadataOutput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_MetadataOutput_UnregisterCallback(Camera_MetadataOutput* metadataOutput, + MetadataOutput_Callbacks* callback); + +/** + * @brief 启动元数据输出。 + * + * @param metadataOutput 要启动的{@link Camera_MetadataOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_MetadataOutput_Start(Camera_MetadataOutput* metadataOutput); + +/** + * @brief 停止元数据输出。 + * + * @param metadataOutput 要停止的{@link Camera_MetadataOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_MetadataOutput_Stop(Camera_MetadataOutput* metadataOutput); + +/** + * @brief 释放元数据输出。 + * + * @param metadataOutput 要释放的{@link Camera_MetadataOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_MetadataOutput_Release(Camera_MetadataOutput* metadataOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/oh_camera/photo_output.h b/zh-cn/native_sdk/media/oh_camera/photo_output.h new file mode 100644 index 00000000..2bace0f5 --- /dev/null +++ b/zh-cn/native_sdk/media/oh_camera/photo_output.h @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief 为相机模块提供C接口的定义。 + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file photo_output.h + * + * @brief 声明拍照输出概念。 + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 拍照输出对象 + * + * 可以使用{@link Camera_PhotoOutput}方法创建指针。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_PhotoOutput Camera_PhotoOutput; + +/** + * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧启动回调。 + * + * @param photoOutput 传递回调的{@link Camera_PhotoOutput}。 + * @since 11 + */ +typedef void (*OH_PhotoOutput_OnFrameStart)(Camera_PhotoOutput* photoOutput); + +/** + * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧快门回调。 + * + * @param photoOutput 传递回调的{@link Camera_PhotoOutput}。 + * @param info 回调传递的{@link Camera_FrameShutterInfo}。 + * @since 11 + */ +typedef void (*OH_PhotoOutput_OnFrameShutter)(Camera_PhotoOutput* photoOutput, Camera_FrameShutterInfo* info); + +/** + * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧结束回调。 + * + * @param photoOutput 传递回调的{@link Camera_PhotoOutput}。 + * @param frameCount 回调传递的帧计数。 + * @since 11 + */ +typedef void (*OH_PhotoOutput_OnFrameEnd)(Camera_PhotoOutput* photoOutput, int32_t frameCount); + +/** + * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出错误回调。 + * + * @param photoOutput 传递回调的{@link Camera_PhotoOutput}。 + * @param errorCode 拍照输出的{@link Camera_ErrorCode}。 + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ +typedef void (*OH_PhotoOutput_OnError)(Camera_PhotoOutput* photoOutput, Camera_ErrorCode errorCode); + +/** + * @brief 拍照输出的回调。 + * + * @see OH_PhotoOutput_RegisterCallback + * @since 11 + * @version 1.0 + */ +typedef struct PhotoOutput_Callbacks { + /** + * 拍照输出帧启动事件。 + */ + OH_PhotoOutput_OnFrameStart onFrameStart; + + /** + * 拍照输出框快门事件。 + */ + OH_PhotoOutput_OnFrameShutter onFrameShutter; + + /** + * 拍照输出帧结束事件。 + */ + OH_PhotoOutput_OnFrameEnd onFrameEnd; + + /** + * 拍照输出错误事件。 + */ + OH_PhotoOutput_OnError onError; +} PhotoOutput_Callbacks; + +/** + * @brief 注册拍照输出更改事件回调。 + * + * @param photoOutput {@link Camera_PhotoOutput}实例。 + * @param callback 要注册的{@link PhotoOutput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_PhotoOutput_RegisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback); + +/** + * @brief 注销拍照输出更改事件回调。 + * + * @param photoOutput {@link Camera_PhotoOutput}实例。 + * @param callback 要注销的{@link PhotoOutput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_PhotoOutput_UnregisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback); + +/** + * @brief 拍摄照片。 + * + * @param photoOutput 用于捕获拍照的{@link Camera_PhotoOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_RUNNING}如果捕获会话未运行。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_PhotoOutput_Capture(Camera_PhotoOutput* photoOutput); + +/** + * @brief 使用捕获设置捕获拍照。 + * + * @param photoOutput 用于捕获拍照的{@link Camera_PhotoOutput}实例。 + * @param setting 用于捕获拍照的{@link Camera_PhotoCaptureSetting}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_RUNNING}如果捕获会话未运行。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_PhotoOutput_Capture_WithCaptureSetting(Camera_PhotoOutput* photoOutput, + Camera_PhotoCaptureSetting setting); + +/** + * @brief 释放拍照输出。 + * + * @param photoOutput 要释放的{@link Camera_PhotoOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_PhotoOutput_Release(Camera_PhotoOutput* photoOutput); + +/** + * @brief 检查是否支持镜像拍照。 + * + * @param photoOutput {@link Camera_PhotoOutput}实例,用于检查是否支持镜像。 + * @param isSupported 是否支持镜像的结果。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_PhotoOutput_IsMirrorSupported(Camera_PhotoOutput* photoOutput, bool* isSupported); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/oh_camera/preview_output.h b/zh-cn/native_sdk/media/oh_camera/preview_output.h new file mode 100644 index 00000000..794771c5 --- /dev/null +++ b/zh-cn/native_sdk/media/oh_camera/preview_output.h @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief 为相机模块提供C接口的定义。 + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file preview_output.h + * + * @brief 声明预览输出概念。 + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 预览输出对象 + * + * 可以使用{@link Camera_PreviewOutput}方法创建指针。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_PreviewOutput Camera_PreviewOutput; + +/** + * @brief 在{@link PreviewOutput_Callbacks}中被调用的预览输出帧开始回调。 + * + * @param previewOutput 传递回调的{@link Camera_PreviewOutput}。 + * @since 11 + */ +typedef void (*OH_PreviewOutput_OnFrameStart)(Camera_PreviewOutput* previewOutput); + +/** + * @brief 在{@link PreviewOutput_Callbacks}中被调用的预览输出帧结束回调。 + * + * @param previewOutput 传递回调的{@link Camera_PreviewOutput}。 + * @param frameCount 回调传递的帧计数。 + * @since 11 + */ +typedef void (*OH_PreviewOutput_OnFrameEnd)(Camera_PreviewOutput* previewOutput, int32_t frameCount); + +/** + * @brief 在{@link PreviewOutput_Callbacks}中被调用的预览输出帧错误回调。 + * + * @param previewOutput 传递回调的{@link Camera_PreviewOutput}。 + * @param errorCode 预览输出的{@link Camera_ErrorCode}。 + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ +typedef void (*OH_PreviewOutput_OnError)(Camera_PreviewOutput* previewOutput, Camera_ErrorCode errorCode); + +/** + * @brief 用于预览输出的回调。 + * + * @see OH_PreviewOutput_RegisterCallback + * @since 11 + * @version 1.0 + */ +typedef struct PreviewOutput_Callbacks { + /** + * 预览输出帧开始事件。 + */ + OH_PreviewOutput_OnFrameStart onFrameStart; + + /** + * 预览输出帧结束事件。 + */ + OH_PreviewOutput_OnFrameEnd onFrameEnd; + + /** + * 预览输出错误事件。 + */ + OH_PreviewOutput_OnError onError; +} PreviewOutput_Callbacks; + +/** + * @brief 注册预览输出更改事件回调。 + * + * @param previewOutput {@link Camera_PreviewOutput}实例。 + * @param callback 要注册的{@link PreviewOutput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_PreviewOutput_RegisterCallback(Camera_PreviewOutput* previewOutput, + PreviewOutput_Callbacks* callback); + +/** + * @brief 注销预览输出更改事件回调。 + * + * @param previewOutput {@link Camera_PreviewOutput}实例。 + * @param callback 要注销的{@link PreviewOutput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_PreviewOutput_UnregisterCallback(Camera_PreviewOutput* previewOutput, + PreviewOutput_Callbacks* callback); + +/** + * @brief 开始预览输出。 + * + * @param previewOutput 要启动的{@link Camera_PreviewOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_PreviewOutput_Start(Camera_PreviewOutput* previewOutput); + +/** + * @brief 停止预览输出。 + * + * @param previewOutput 要停止的{@link Camera_PreviewOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_PreviewOutput_Stop(Camera_PreviewOutput* previewOutput); + +/** + * @brief 释放预览输出。 + * + * @param previewOutput 要释放的{@link Camera_PreviewOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_PreviewOutput_Release(Camera_PreviewOutput* previewOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/oh_camera/video_output.h b/zh-cn/native_sdk/media/oh_camera/video_output.h new file mode 100644 index 00000000..05badd48 --- /dev/null +++ b/zh-cn/native_sdk/media/oh_camera/video_output.h @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief 为相机模块提供C接口的定义。 + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file video_output.h + * + * @brief 声明录像输出概念。 + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 录像输出对象 + * + * 可以使用{@link Camera_VideoOutput}方法创建指针。 + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_VideoOutput Camera_VideoOutput; + +/** + * @brief 在{@link VideoOutput_Callbacks}中被调用的录像输出帧开始回调。 + * + * @param videoOutput 传递回调的{@link Camera_VideoOutput}。 + * @since 11 + */ +typedef void (*OH_VideoOutput_OnFrameStart)(Camera_VideoOutput* videoOutput); + +/** + * @brief 在{@link VideoOutput_Callbacks}中被调用的录像输出帧结束回调。 + * + * @param videoOutput 传递回调的{@link Camera_VideoOutput}。 + * @param frameCount 回调传递的帧计数。 + * @since 11 + */ +typedef void (*OH_VideoOutput_OnFrameEnd)(Camera_VideoOutput* videoOutput, int32_t frameCount); + +/** + * @brief 在{@link VideoOutput_Callbacks}中被调用的录像输出错误回调。 + * + * @param videoOutput 传递回调的{@link Camera_VideoOutput}。 + * @param errorCode 录像输出的{@link Camera_ErrorCode}。 + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ +typedef void (*OH_VideoOutput_OnError)(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode); + +/** + * @brief 用于录像输出的回调。 + * + * @see OH_VideoOutput_RegisterCallback + * @since 11 + * @version 1.0 + */ +typedef struct VideoOutput_Callbacks { + /** + * 录像输出帧启动事件。 + */ + OH_VideoOutput_OnFrameStart onFrameStart; + + /** + * 录像输出帧结束事件。 + */ + OH_VideoOutput_OnFrameEnd onFrameEnd; + + /** + * 录像输出错误事件。 + */ + OH_VideoOutput_OnError onError; +} VideoOutput_Callbacks; + +/** + * @brief 注册录像输出更改事件回调。 + * + * @param videoOutput {@link Camera_VideoOutput}实例。 + * @param callback 要注册的{@link VideoOutput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback); + +/** + * @brief 注销录像输出更改事件回调。 + * + * @param videoOutput {@link Camera_VideoOutput}实例。 + * @param callback 要注销的{@link VideoOutput_Callbacks}。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @since 11 + */ +Camera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback); + +/** + * @brief 开始录像输出。 + * + * @param videoOutput 要启动的{@link Camera_VideoOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_CONFIG}如果捕获会话未配置。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput); + +/** + * @brief 停止录像输出。 + * + * @param videoOutput 要停止的{@link Camera_VideoOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput); + +/** + * @brief 释放录像输出。 + * + * @param videoOutput 要释放的{@link Camera_VideoOutput}实例。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @since 11 + */ +Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H +/** @} */ \ No newline at end of file -- Gitee From f0a131a0fed78e7ff41e621d60f08a20a7e05d12 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Wed, 15 Nov 2023 16:39:48 +0800 Subject: [PATCH 0086/2135] update docs Signed-off-by: Annie_wang --- en/native_sdk/hid/hid_ddk_api.h | 92 +++++ en/native_sdk/hid/hid_ddk_types.h | 590 ++++++++++++++++++++++++++++++ 2 files changed, 682 insertions(+) create mode 100644 en/native_sdk/hid/hid_ddk_api.h create mode 100644 en/native_sdk/hid/hid_ddk_types.h diff --git a/en/native_sdk/hid/hid_ddk_api.h b/en/native_sdk/hid/hid_ddk_api.h new file mode 100644 index 00000000..83e830b5 --- /dev/null +++ b/en/native_sdk/hid/hid_ddk_api.h @@ -0,0 +1,92 @@ +/* + * 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 HID_DDK_API_H +#define HID_DDK_API_H + +/** + * @addtogroup HidDdk + * @{ + * + * @brief Provides HID DDK interfaces, including creating a device, sending an event, and destroying a device. + * + * @syscap SystemCapability.Driver.HID.Extension + * @since 11 + * @version 1.0 + */ + +/** + * @file hid_ddk_api.h + * + * @brief Declares the HID DDK interfaces for the host to access an input device. + * + * File to include: + * @since 11 + * @version 1.0 + */ + +#include +#include "hid_ddk_types.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief Creates a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param hidDevice Pointer to the basic information required for creating a device, including the device name, + * vendor ID, and product ID. + * @param hidEventProperties Pointer to the events of the device to be observed, including the event type and + * properties of the key event, absolute coordinate event, and relative coordinate event. + * @return Returns the device ID (a non-negative number) if the operation is successful; + * returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_CreateDevice(HidDevice *hidDevice, HidEventProperties *hidEventProperties); + +/** + * @brief Sends an event list to a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId ID of the device, to which the event list is sent. + * @param items List of events to sent. The event information includes the event type (HidEventType), + * event code (HidSynEvent for a synchronization event code, HidKeyCode for a key code, HidBtnCode + * for a button code, HidAbsAxes for an absolute coordinate code, HidRelAxes + * for a relative coordinate event, and HidMscEvent for other input event code), and value input by the device. + * @param length Length of the event list (number of events sent at a time). + * @return Returns 0 if the operation is successful; returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_EmitEvent(int32_t deviceId, const EmitItem items[], uint16_t length); + +/** + * @brief Destroys a device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId ID of the device to destroy. + * @return Returns 0 if the operation is successful; returns a negative number otherwise. + * @since 11 + * @version 1.0 + */ +int32_t OH_Hid_DestroyDevice(int32_t deviceId); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif // HID_DDK_API_H diff --git a/en/native_sdk/hid/hid_ddk_types.h b/en/native_sdk/hid/hid_ddk_types.h new file mode 100644 index 00000000..766b3721 --- /dev/null +++ b/en/native_sdk/hid/hid_ddk_types.h @@ -0,0 +1,590 @@ +/* + * 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 HID_DDK_TYPES_H +#define HID_DDK_TYPES_H +/** + * @addtogroup HidDdk + * @{ + * + * @brief Provides HID DDK interfaces, including creating a device, sending an event, and destroying a device. + * + * @syscap SystemCapability.Driver.HID.Extension + * @since 11 + * @version 1.0 + */ + +/** + * @file hid_ddk_types.h + * + * @brief Provides definitions of enum variables and structs in the HID DDK. + * + * File to include: + * @since 11 + * @version 1.0 + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief Defines event information. + * + * @since 11 + * @version 1.0 + */ +typedef struct EmitItem { + /** Event type */ + uint16_t type; + /** Event code */ + uint16_t code; + /** Event value */ + uint32_t value; +} EmitItem; + +/** + * @brief Enumerates the input devices. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Pointer device */ + HID_PROP_POINTER = 0x00, + /** Direct input device */ + HID_PROP_DIRECT = 0x01, + /** Touch device with bottom keys */ + HID_PROP_BUTTONPAD = 0x02, + /** Full multi-touch device */ + HID_PROP_SEMI_MT = 0x03, + /** Touch device with top soft keys */ + HID_PROP_TOPBUTTONPAD = 0x04, + /** Pointing stick */ + HID_PROP_POINTING_STICK = 0x05, + /** Accelerometer */ + HID_PROP_ACCELEROMETER = 0x06 +} HidDeviceProp; + +/** + * @brief Defines the basic device information. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidDevice { + /** Device name */ + const char *deviceName; + /** Vendor ID */ + uint16_t vendorId; + /** Product ID */ + uint16_t productId; + /** Version */ + uint16_t version; + /** Bus type */ + uint16_t bustype; + /** Device properties */ + HidDeviceProp *properties; + /** Number of device properties */ + uint16_t propLength; +} HidDevice; + +/** + * @brief Enumerates the event types. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Synchronization event */ + HID_EV_SYN = 0x00, + /** Key event */ + HID_EV_KEY = 0x01, + /** Relative coordinate event */ + HID_EV_REL = 0x02, + /** Absolute coordinate event */ + HID_EV_ABS = 0x03, + /** Other special event */ + HID_EV_MSC = 0x04 +} HidEventType; + +/** + * @brief Enumerates the synchronization event codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Indicates the end of an event. */ + HID_SYN_REPORT = 0, + /** Indicates configuration synchronization. */ + HID_SYN_CONFIG = 1, + /** Indicates the end of a multi-touch ABS data packet. */ + HID_SYN_MT_REPORT = 2, + /** Indicates that the event is discarded. */ + HID_SYN_DROPPED = 3 +} HidSynEvent; + +/** + * @brief Enumerates the key value codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Key A */ + HID_KEY_A = 30, + /** Key B */ + HID_KEY_B = 48, + /** Key C */ + HID_KEY_C = 46, + /** Key D */ + HID_KEY_D = 32, + /** Key E */ + HID_KEY_E = 18, + /** Key F */ + HID_KEY_F = 33, + /** Key G */ + HID_KEY_G = 34, + /** Key H */ + HID_KEY_H = 35, + /** Key I */ + HID_KEY_I = 23, + /** Key J */ + HID_KEY_J = 36, + /** Key K */ + HID_KEY_K = 37, + /** Key L */ + HID_KEY_L = 38, + /** Key M */ + HID_KEY_M = 50, + /** Key N */ + HID_KEY_N = 49, + /** Key O */ + HID_KEY_O = 24, + /** Key P */ + HID_KEY_P = 25, + /** Key Q */ + HID_KEY_Q = 16, + /** Key R */ + HID_KEY_R = 19, + /** Key S */ + HID_KEY_S = 31, + /** Key T */ + HID_KEY_T = 20, + /** Key U */ + HID_KEY_U = 22, + /** Key V */ + HID_KEY_V = 47, + /** Key W */ + HID_KEY_W = 17, + /** Key X */ + HID_KEY_X = 45, + /** Key Y */ + HID_KEY_Y = 21, + /** Key Z */ + HID_KEY_Z = 44, + /** Key 0 */ + HID_KEY_0 = 11, + /** Key 1 */ + HID_KEY_1 = 2, + /** Key 2 */ + HID_KEY_2 = 3, + /** Key 3 */ + HID_KEY_3 = 4, + /** Key 4 */ + HID_KEY_4 = 5, + /** Key 5 */ + HID_KEY_5 = 6, + /** Key 6 */ + HID_KEY_6 = 7, + /** Key 7 */ + HID_KEY_7 = 8, + /** Key 8 */ + HID_KEY_8 = 9, + /** Key 9 */ + HID_KEY_9 = 10, + /** Key grave (`) */ + HID_KEY_GRAVE = 41, + /** Key minum (-) */ + HID_KEY_MINUS = 12, + /** Key equals (=) */ + HID_KEY_EQUALS = 13, + /** Key left bracket ([) */ + HID_KEY_LEFT_BRACKET = 26, + /** Key right bracket (]) */ + HID_KEY_RIGHT_BRACKET = 27, + /** Key backslash (\) */ + HID_KEY_BACKSLASH = 43, + /** Key semicolon (;) */ + HID_KEY_SEMICOLON = 39, + /** Key apostrophe (') */ + HID_KEY_APOSTROPHE = 40, + /** Key slash (/) */ + HID_KEY_SLASH = 53, + /** Key comma (,) */ + HID_KEY_COMMA = 51, + /** Key period (.) */ + HID_KEY_PERIOD = 52, + /** Numeral 0 on the numeric keypad */ + HID_KEY_NUMPAD_0 = 82, + /** Numeral 1 on the numeric keypad */ + HID_KEY_NUMPAD_1 = 79, + /** Numeral 2 on the numeric keypad */ + HID_KEY_NUMPAD_2 = 80, + /** Numeral 3 on the numeric keypad */ + HID_KEY_NUMPAD_3 = 81, + /** Numeral 4 on the numeric keypad */ + HID_KEY_NUMPAD_4 = 75, + /** Numeral 5 on the numeric keypad */ + HID_KEY_NUMPAD_5 = 76, + /** Numeral 6 on the numeric keypad*/ + HID_KEY_NUMPAD_6 = 77, + /** Numeral 7 on the numeric keypad */ + HID_KEY_NUMPAD_7 = 71, + /** Numeral 8 on the numeric keypad */ + HID_KEY_NUMPAD_8 = 72, + /** Numeral 9 on the numeric keypad */ + HID_KEY_NUMPAD_9 = 73, + /** Arithmetic operator / (division) on the numeric keypad */ + HID_KEY_NUMPAD_DIVIDE = 70, + /** Arithmetic operator * (multiplication) on the numeric keypad */ + HID_KEY_NUMPAD_MULTIPLY = 55, + /** Arithmetic operator - (subtraction) on the numeric keypad */ + HID_KEY_NUMPAD_SUBTRACT = 74, + /** Arithmetic operator + (addition) on the numeric keypad */ + HID_KEY_NUMPAD_ADD = 78, + /** Decimal point (.) on the numeric keypad */ + HID_KEY_NUMPAD_DOT = 83 +} HidKeyCode; + +/** + * @brief Enumerates the button codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Button 0 */ + HID_BTN_0 = 0x100, + /** Button 1 */ + HID_BTN_1 = 0x101, + /** Button 2 */ + HID_BTN_2 = 0x102, + /** Button 3 */ + HID_BTN_3 = 0x103, + /** Button 4 */ + HID_BTN_4 = 0x104, + /** Button 5 */ + HID_BTN_5 = 0x105, + /** Button 6 */ + HID_BTN_6 = 0x106, + /** Button 7 */ + HID_BTN_7 = 0x107, + /** Button 8 */ + HID_BTN_8 = 0x108, + /** Button 9 */ + HID_BTN_9 = 0x109, + /** Left mouse button */ + HID_BTN_LEFT = 0x110, + /** Right mouse button */ + HID_BTN_RIGHT = 0x111, + /** Middle mouse button */ + HID_BTN_MIDDLE = 0x112, + /** Side mouse button */ + HID_BTN_SIDE = 0x113, + /** Extra mouse button */ + HID_BTN_EXTRA = 0x114, + /** Mouse forward button */ + HID_BTN_FORWARD = 0x115, + /** Mouse backward button */ + HID_BTN_BACK = 0x116, + /** Mouse task button */ + HID_BTN_TASK = 0x117, + /** Pen */ + HID_BTN_TOOL_PEN = 0x140 + /** Rubber */ + HID_BTN_TOOL_RUBBER = 0x141 + /** Brush */ + HID_BTN_TOOL_BRUSH = 0x142 + /** Pencil */ + HID_BTN_TOOL_PENCIL = 0x143 + /** Air brush */ + HID_BTN_TOOL_AIRBRUSH = 0x144 + /** Finger */ + HID_BTN_TOOL_FINGER = 0x145 + /** Mouse */ + HID_BTN_TOOL_MOUSE = 0x146 + /** Lens */ + HID_BTN_TOOL_LENS = 0x147 + /** Five-finger touch */ + HID_BTN_TOOL_QUINTTAP = 0x148 + /** Stylus 3 */ + HID_BTN_STYLUS3 = 0x149 + /** Touch */ + HID_BTN_TOUCH = 0x14a + /** Stylus */ + HID_BTN_STYLUS = 0x14b + /** Stylus 2 */ + HID_BTN_STYLUS2 = 0x14c + /** Two-finger touch */ + HID_BTN_TOOL_DOUBLETAP = 0x14d + /** Three-finger touch */ + HID_BTN_TOOL_TRIPLETAP = 0x14e + /** Four-finger touch */ + HID_BTN_TOOL_QUADTAP = 0x14f + /** Scroll wheel */ + HID_BTN_WHEEL = 0x150 +} HidBtnCode; + +/** + * @brief Enumerates the absolute coordinate codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** X axis */ + HID_ABS_X = 0x00, + /** Y axis */ + HID_ABS_Y = 0x01, + /** Z axis */ + HID_ABS_Z = 0x02, + /** X axis of the right analog stick */ + HID_ABS_RX = 0x03, + /** Y axis of the right analog stick */ + HID_ABS_RY = 0x04, + /** Z axis of the right analog stick */ + HID_ABS_RZ = 0x05, + /** Throttle */ + HID_ABS_THROTTLE = 0x06, + /** Rudder */ + HID_ABS_RUDDER = 0x07, + /** Scroll wheel */ + HID_ABS_WHEEL = 0x08, + /** Gas */ + HID_ABS_GAS = 0x09, + /** Brake */ + HID_ABS_BRAKE = 0x0a, + /** HAT0X */ + HID_ABS_HAT0X = 0x10, + /** HAT0Y */ + HID_ABS_HAT0Y = 0x11, + /** HAT1X */ + HID_ABS_HAT1X = 0x12, + /** HAT1Y */ + HID_ABS_HAT1Y = 0x13, + /** HAT2X */ + HID_ABS_HAT2X = 0x14, + /** HAT2Y */ + HID_ABS_HAT2Y = 0x15, + /** HAT3X */ + HID_ABS_HAT3X = 0x16, + /** HAT3Y */ + HID_ABS_HAT3Y = 0x17, + /** Pressure */ + HID_ABS_PRESSURE = 0x18, + /** Distance */ + HID_ABS_DISTANCE = 0x19, + /** Inclination of X axis */ + HID_ABS_TILT_X = 0x1a, + /** Inclination of Y axis */ + HID_ABS_TILT_Y = 0x1b, + /** Width of the touch tool */ + HID_ABS_TOOL_WIDTH = 0x1c, + /** Volume */ + HID_ABS_VOLUME = 0x20, + /** Others */ + HID_ABS_MISC = 0x28 +} HidAbsAxes; + +/** + * @brief Enumerates the relative coordinate codes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** X axis */ + HID_REL_X = 0x00, + /** Y axis */ + HID_REL_Y = 0x01, + /** Z axis */ + HID_REL_Z = 0x02, + /** X axis of the right analog stick */ + HID_REL_RX = 0x03, + /** Y axis of the right analog stick */ + HID_REL_RY = 0x04, + /** Z axis of the right analog stick */ + HID_REL_RZ = 0x05, + /** Horizontal scroll wheel */ + HID_REL_HWHEEL = 0x06, + /** Scale */ + HID_REL_DIAL = 0x07, + /** Scroll wheel */ + HID_REL_WHEEL = 0x08, + /** Others */ + HID_REL_MISC = 0x09, + /* Reserved */ + HID_REL_RESERVED = 0x0a, + /** High-resolution scroll wheel */ + HID_REL_WHEEL_HI_RES = 0x0b, + /** High-resolution horizontal scroll wheel */ + HID_REL_HWHEEL_HI_RES = 0x0c +} HidRelAxes; + +/** + * @brief Enumerates the codes of other input events. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Serial number */ + HID_MSC_SERIAL = 0x00, + /** Pulse */ + HID_MSC_PULSELED = 0x01, + /** Gesture */ + HID_MSC_GESTURE = 0x02, + /** Start event */ + HID_MSC_RAW = 0x03, + /** Scan */ + HID_MSC_SCAN = 0x04, + /** Timestamp */ + HID_MSC_TIMESTAMP = 0x05 +} HidMscEvent; + +/** + * @brief Defines an array of the event type codes. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidEventTypeArray { + /** Event type code */ + HidEventType *hidEventType; + /** Length of the array */ + uint16_t length; +} HidEventTypeArray; + +/** + * @brief Defines an array of key value properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidKeyCodeArray { + /** Key value code */ + HidKeyCode *hidKeyCode; + /** Length of the array */ + uint16_t length; +} HidKeyCodeArray; + +/** + * @brief Defines an array of absolute coordinate properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidAbsAxesArray { + /** Absolute coordinate property code */ + HidAbsAxes *hidAbsAxes; + /** Length of the array */ + uint16_t length; +} HidAbsAxesArray; + +/** + * @brief Defines an array of relative coordinate properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidRelAxesArray { + /** Relative coordinate property code */ + HidRelAxes *hidRelAxes; + /** Length of the array */ + uint16_t length; +} HidRelAxesArray; + +/** + * @brief Defines an array of other special event properties. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidMscEventArray { + /** Code of the event property */ + HidMscEvent *hidMscEvent; + /** Length of the array */ + uint16_t length; +} HidMscEventArray; + +/** + * @brief Defines the event properties of a device to be observed. + * + * @since 11 + * @version 1.0 + */ +typedef struct HidEventProperties { + /** Array of event type codes */ + struct HidEventTypeArray hidEventTypes; + /** Array of key value codes */ + struct HidKeyCodeArray hidKeys; + /** Array of absolute coordinate property codes */ + struct HidAbsAxesArray hidAbs; + /** Array of relative coordinate property codes */ + struct HidRelAxesArray hidRelBits; + /** Array of other event property codes */ + struct HidMscEventArray hidMiscellaneous; + + /** Maximum values of the absolute coordinates */ + int32_t hidAbsMax[64]; + /** Minimum values of the absolute coordinates */ + int32_t hidAbsMin[64]; + /** Fuzzy values of the absolute coordinates */ + int32_t hidAbsFuzz[64]; + /** Fixed values of the absolute coordinates */ + int32_t hidAbsFlat[64]; +} HidEventProperties; + +/** + * @brief Defines the error codes used in the HID DDK. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Operation successful */ + HID_DDK_SUCCESS = 0, + /** Operation failed */ + HID_DDK_FAILED = -1, + /** Invalid parameter */ + HID_DDK_INVALID_PARAMETER = -2, + /** Invalid operation */ + HID_DDK_INVALID_OPERATION = -3, + /** Null pointer exception */ + HID_DDK_NULL_PTR = -4, + /** Timeout */ + HID_DDK_TIMEOUT = -5, + /** Permission denied */ + HID_DDK_NO_PERM = -6 +} HidDdkErrCode; +#ifdef __cplusplus +} +/** @} */ +#endif /* __cplusplus */ +#endif // HID_DDK_TYPES_H -- Gitee From 137dbfc850b900d381965c670a9a09b2e004a196 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 17 Nov 2023 09:07:22 +0800 Subject: [PATCH 0087/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/net_ssl/net_ssl_c.h | 62 ++++ en/native_sdk/net_ssl/net_ssl_c_type.h | 79 +++++ en/native_sdk/net_websocket/net_websocket.h | 141 +++++++++ .../net_websocket/net_websocket_type.h | 286 ++++++++++++++++++ 4 files changed, 568 insertions(+) create mode 100644 en/native_sdk/net_ssl/net_ssl_c.h create mode 100644 en/native_sdk/net_ssl/net_ssl_c_type.h create mode 100644 en/native_sdk/net_websocket/net_websocket.h create mode 100644 en/native_sdk/net_websocket/net_websocket_type.h diff --git a/en/native_sdk/net_ssl/net_ssl_c.h b/en/native_sdk/net_ssl/net_ssl_c.h new file mode 100644 index 00000000..1ffc4c2d --- /dev/null +++ b/en/native_sdk/net_ssl/net_ssl_c.h @@ -0,0 +1,62 @@ +/* + * 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 NET_SSL_C_H +#define NET_SSL_C_H + +/** + * @addtogroup netstack + * @{ + * + * @brief Provides C APIs for the SSL/TLS certificate chain verification module. + * + * @since 11 + * @version 1.0 + */ + +/** + * @file net_ssl_c.h + * + * @brief Defines C APIs for the SSL/TLS certificate chain verification module. + * + * @library libnet_ssl.so + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#include "net_ssl_c_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Provides certificate chain verification APIs for external systems. + * + * @param cert Certificate to be verified. + * @param caCert CA certificate specified by the user. If this parameter is left blank, the preset certificate is used. + * @return 0 if success; non-0 otherwise. + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ +uint32_t OH_NetStack_VerifyCertification(const struct OH_NetStack_CertBlob *cert, + const struct OH_NetStack_CertBlob *caCert); +#ifdef __cplusplus +} +#endif + +#endif // NET_SSL_C_H diff --git a/en/native_sdk/net_ssl/net_ssl_c_type.h b/en/native_sdk/net_ssl/net_ssl_c_type.h new file mode 100644 index 00000000..25029f06 --- /dev/null +++ b/en/native_sdk/net_ssl/net_ssl_c_type.h @@ -0,0 +1,79 @@ +/* + * 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 NET_SSL_C_TYPE_H +#define NET_SSL_C_TYPE_H + +/** + * @addtogroup netstack + * @{ + * + * @brief Provides C APIs for the SSL/TLS certificate chain verification module. + * + * @since 11 + * @version 1.0 + */ + +/** + * @file net_ssl_c_type.h + * @brief Defines data structures for the C APIs of the SSL/TLS certificate chain verification module. + * + * @library libnet_ssl.so + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates certificate types. + * + * @since 11 + * @version 1.0 + */ +enum OH_NetStack_CertType { + /** PEM certificate */ + OH_NetStack_CERT_TYPE_PEM = 0, + /** DER certificate */ + OH_NetStack_CERT_TYPE_DER = 1, + /** Invalid certificate */ + OH_NetStack_CERT_TYPE_MAX +}; + +/** + * @brief Defines the certificate data structure. + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_CertBlob { + /** Certificate type */ + enum OH_NetStack_CertType type; + /** Certificate content length */ + uint32_t size; + /** Certificate content */ + uint8_t *data; +}; + +#ifdef __cplusplus +} +#endif + +#endif // NET_SSL_C_TYPE_H diff --git a/en/native_sdk/net_websocket/net_websocket.h b/en/native_sdk/net_websocket/net_websocket.h new file mode 100644 index 00000000..85c67cc2 --- /dev/null +++ b/en/native_sdk/net_websocket/net_websocket.h @@ -0,0 +1,141 @@ +/* + * 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 NET_WEBSOCKET_H +#define NET_WEBSOCKET_H + +#include +#include +#include + +/** + * @addtogroup netstack + * @{ + * + * @brief Provides C APIs for the WebSocket client module. + + * @since 11 + * @version 1.0 + */ + +/** + * @file net_websocket.h + * + * @brief Defines the APIs for the WebSocket client module. + * + * @library libnet_websocket.so + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#include "net_websocket_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Constructor of OH_NetStack_WebsocketClient. + * + * @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. + * @return Client pointer if success; NULL otherwise. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient *OH_NetStack_WebsocketClient_Construct( + OH_NetStack_WebsocketClient_OnOpenCallback OnOpen, OH_NetStack_WebsocketClient_OnMessageCallback onMessage, + OH_NetStack_WebsocketClient_OnErrorCallback OnError, OH_NetStack_WebsocketClient_OnCloseCallback onclose); + +/** + * @brief Adds the header information to the client request. + * + * @param client Client pointer. + * @param header Header information + * @return 0 if success; non-0 otherwise. For details about error codes, see {@link OH_Websocket_ErrCode}. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebSocketClient_AddHeader(struct OH_NetStack_WebsocketClient *client, + struct OH_NetStack_WebsocketClient_Slist header); + +/** + * @brief Connects the client to the server. + * + * @param client Client pointer. + * @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 + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebSocketClient_Connet(struct OH_NetStack_WebsocketClient *client, const char *url, + struct OH_NetStack_WebsocketClient_RequestOptions options); + +/** + * @brief Sends data from the client to the server. + * + * @param client Client pointer. + * @param data Data sent by the client. + * @param length Length of the data sent by the client. + * @return 0 if success; non-0 otherwise. For details about error codes, see {@link OH_Websocket_ErrCode}. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebSocketClient_Send(struct OH_NetStack_WebsocketClient *client, char *data, size_t length); + +/** + * @brief Closes a WebSocket connection. + * + * @param client Client pointer. + * @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 + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebSocketClient_Close(struct OH_NetStack_WebsocketClient *client, + struct OH_NetStack_WebsocketClient_CloseOption options); + +/** + * @brief Releases the context and resources of the WebSocket connection. + * + * @param client Client pointer. + * @return 0 if success; non-0 otherwise. For details about error codes, see {@link OH_Websocket_ErrCode}. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetStack + * @since 11 + * @version 1.0 + */ +int OH_NetStack_WebsocketClient_Destroy(struct OH_NetStack_WebsocketClient *client); + +#ifdef __cplusplus +} +#endif + +#endif // NET_WEBSOCKET_H diff --git a/en/native_sdk/net_websocket/net_websocket_type.h b/en/native_sdk/net_websocket/net_websocket_type.h new file mode 100644 index 00000000..254f593d --- /dev/null +++ b/en/native_sdk/net_websocket/net_websocket_type.h @@ -0,0 +1,286 @@ +/* + * 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 NET_WEBSOCKET_TYPE_H +#define NET_WEBSOCKET_TYPE_H + +/** + * @addtogroup netstack + * @{ + * + * @brief Provides C APIs for the WebSocket client module. + * + * @since 11 + * @version 1.0 + */ + +/** + * @file net_websocket_type.h + * @brief Defines the data structure for the C APIs of the WebSocket client module. + * + * @library libnet_websocket.so + * @syscap SystemCapability.Communication.Netstack + * @since 11 + * @version 1.0 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines the parameters for connection closing by the server. + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_CloseResult { + /** Error code */ + uint32_t code; + /** Error cause */ + const char *reason; +}; + +/** + * @brief Defines the parameters for proactive connection closing by the client. + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_CloseOption { + /** Error code */ + uint32_t code; + /** Error cause */ + const char *reason; +}; + +/** + * @brief Defines the parameters for the connection error reported by the server. + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_ErrorResult { + /** Error code */ + uint32_t errorCode; + /** Error message */ + const char *errorMessage; +}; + +/** + * @brief Defines the parameters for the connection success reported by the server. + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_OpenResult { + /** Connection success code */ + uint32_t code; + /** Connection success reason */ + const char *reason; +}; + +/** + * @brief Defines the callback function invoked when an open message is received. + * + * @param client WebSocket client. + * @param openResult Content of the open message received by the WebSocket client. + * @since 11 + * @version 1.0 + */ +typedef void (*OH_NetStack_WebsocketClient_OnOpenCallback)(struct OH_NetStack_WebsocketClient *client, + OH_NetStack_WebsocketClient_OpenResult openResult); + +/** + * @brief Defines the callback function invoked when data is received. + * + * @param client WebSocket client. + * @param data Data received by the WebSocket client. + * @param length Length of the data received by the WebSocket client. + * @since 11 + * @version 1.0 + */ +typedef void (*OH_NetStack_WebsocketClient_OnMessageCallback)(struct OH_NetStack_WebsocketClient *client, char *data, + uint32_t length); + +/** + * @brief Defines the callback function invoked when an error message is received. + * + * @param client WebSocket client. + * @param errorResult Content of the connection error message received by the WebSocket client. + * @since 11 + * @version 1.0 + */ +typedef void (*OH_NetStack_WebsocketClient_OnErrorCallback)(struct OH_NetStack_WebsocketClient *client, + OH_NetStack_WebsocketClient_ErrorResult errorResult); + +/** + * @brief Defines the callback function invoked when a close message is received. + * + * @param client WebSocket client. + * @param closeResult Content of the close message received by the WebSocket client. + * @since 11 + * @version 1.0 + */ +typedef void (*OH_NetStack_WebsocketClient_OnCloseCallback)(struct OH_NetStack_WebsocketClient *client, + OH_NetStack_WebsocketClient_CloseResult closeResult); + +/** + * @brief Adds the header linked list to the WebSocket client. + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_Slist { + /** Header field name */ + const char *FieldName; + /** Header field content */ + const char *FieldValue; + /** Next pointer of the header linked list */ + struct OH_NetStack_WebsocketClient_Slist *next; +}; + +/** + * @brief Defines the parameters for the connection between the WebSocket client and server. + * + * @param headers Header information. + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient_RequestOptions { + struct OH_NetStack_WebsocketClient_Slist *headers; +}; + +/** + * @brief Defines the WebSocket client structure. + * + * @since 11 + * @version 1.0 + */ +struct OH_NetStack_WebsocketClient { + /** Pointer to the callback invoked when a connection message is received */ + OH_NetStack_WebsocketClient_OnOpenCallback onOpen; + /** Pointer to the callback invoked when a message is received */ + OH_NetStack_WebsocketClient_OnMessageCallback onMessage; + /** Pointer to the callback invoked when an error message is received */ + OH_NetStack_WebsocketClient_OnErrorCallback onError; + /** Pointer to the callback invoked when a close message is received */ + OH_NetStack_WebsocketClient_OnCloseCallback onClose; + /** Content of the request for establishing a connection on the client */ + OH_NetStack_WebsocketClient_RequestOptions RequestOptions; +}; + +typedef enum OH_Websocket_ErrCode { + /** + * Operation success. + */ + Websocket_OK = 0, + + /** + * @brief Error code base. + */ + E_BASE = 1000, + + /** + * @brief The WebSocket client is null. + */ + WEBSOCKET_CLIENT_IS_NULL = (E_BASE + 1), + + /** + * @brief A WebSocket client is not created. + */ + WEBSOCKET_CLIENT_IS_NOT_CREAT = (E_BASE + 2), + + /** + * @brief An error occurs while setting up a WebSocket connection. + */ + WEBSOCKET_CONNECTION_ERROR = (E_BASE + 3), + + /** + * @brief An error occurs while parsing WebSocket connection parameters. + */ + WEBSOCKET_CONNECTION_PARSEURL_ERROR = (E_BASE + 5), + + /** + * @brief The memory is insufficient for creating a context during WebSocket connection setup. + */ + WEBSOCKET_CONNECTION_NO_MEMOERY = (E_BASE + 6), + + /** + * @brief The WebSocket connection is closed by the peer. + */ + WEBSOCKET_PEER_INITIATED_CLOSE = (E_BASE + 7), + + /** + * @brief The WebSocket connection is destroyed. + */ + WEBSOCKET_DESTROY = (E_BASE + 8), + + /** + * @brief An incorrect protocol is used for WebSocket connection. + */ + WEBSOCKET_PROTOCOL_ERROR = (E_BASE + 9), + + /** + * @brief The memory for the WebSocket client to send data is insufficient. + */ + WEBSOCKET_SEND_NO_MEMOERY_ERROR = (E_BASE + 10), + + /** + * @brief The data sent by the WebSocket client is null. + */ + WEBSOCKET_SEND_DATA_NULL = (E_BASE + 11), + + /** + * @brief The length of the data sent by the WebSocket client exceeds the limit. + */ + WEBSOCKET_DATA_LENGTH_EXCEEDS = (E_BASE + 12), + + /** + * @brief The queue length of the data sent by the WebSocket client exceeds the limit. + */ + WEBSOCKET_QUEUE_LENGTH_EXCEEDS = (E_BASE + 13), + + /** + * @brief The context of the WebSocket client is null. + */ + WEBSOCKET_ERROR_NO_CLIENTCONTEX = (E_BASE + 14), + + /** + * @brief The header of the WebSocket client is null. + */ + WEBSOCKET_ERROR_NO_HEADR_CONTEXT = (E_BASE + 15), + + /** + * @brief The header of the WebSocket client exceeds the limit. + */ + WEBSOCKET_ERROR_NO_HEADR_EXCEEDS = (E_BASE + 16), + + /** + * @brief The WebSocket client is not connected. + */ + WEBSOCKET_ERROR_HAVE_NO_CONNECT = (E_BASE + 17), + + /** + * @brief The WebSocket client does not have the connection context. + */ + WEBSOCKET_ERROR_HAVE_NO_CONNECT_CONTEXT = (E_BASE + 18), +} OH_Websocket_ErrCode; + +#ifdef __cplusplus +} +#endif + +#endif // NET_WEBSOCKET_TYPE_H -- Gitee From d27b743f09c80164e1965e0fc75da7cfa3dc70ff Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 17 Nov 2023 09:17:33 +0800 Subject: [PATCH 0088/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/net_ssl/net_ssl_c_type.h | 2 +- en/native_sdk/net_websocket/net_websocket.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/en/native_sdk/net_ssl/net_ssl_c_type.h b/en/native_sdk/net_ssl/net_ssl_c_type.h index 25029f06..35712e65 100644 --- a/en/native_sdk/net_ssl/net_ssl_c_type.h +++ b/en/native_sdk/net_ssl/net_ssl_c_type.h @@ -28,7 +28,7 @@ /** * @file net_ssl_c_type.h - * @brief Defines data structures for the C APIs of the SSL/TLS certificate chain verification module. + * @brief Defines the data structures for the C APIs of the SSL/TLS certificate chain verification module. * * @library libnet_ssl.so * @syscap SystemCapability.Communication.Netstack diff --git a/en/native_sdk/net_websocket/net_websocket.h b/en/native_sdk/net_websocket/net_websocket.h index 85c67cc2..04daa5a5 100644 --- a/en/native_sdk/net_websocket/net_websocket.h +++ b/en/native_sdk/net_websocket/net_websocket.h @@ -54,7 +54,7 @@ extern "C" { * @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. - * @return Client pointer if success; NULL otherwise. + * @return Pointer to the WebSocket client if success; NULL otherwise. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetStack * @since 11 @@ -67,7 +67,7 @@ struct OH_NetStack_WebsocketClient *OH_NetStack_WebsocketClient_Construct( /** * @brief Adds the header information to the client request. * - * @param client Client pointer. + * @param client Pointer to the WebSocket client. * @param header Header information * @return 0 if success; non-0 otherwise. For details about error codes, see {@link OH_Websocket_ErrCode}. * @permission ohos.permission.INTERNET @@ -81,7 +81,7 @@ int OH_NetStack_WebSocketClient_AddHeader(struct OH_NetStack_WebsocketClient *cl /** * @brief Connects the client to the server. * - * @param client Client pointer. + * @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}. @@ -96,7 +96,7 @@ int OH_NetStack_WebSocketClient_Connet(struct OH_NetStack_WebsocketClient *clien /** * @brief Sends data from the client to the server. * - * @param client Client pointer. + * @param client Pointer to the WebSocket client. * @param data Data sent by the client. * @param length Length of the data sent by the client. * @return 0 if success; non-0 otherwise. For details about error codes, see {@link OH_Websocket_ErrCode}. @@ -110,7 +110,7 @@ int OH_NetStack_WebSocketClient_Send(struct OH_NetStack_WebsocketClient *client, /** * @brief Closes a WebSocket connection. * - * @param client Client pointer. + * @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}. @@ -125,7 +125,7 @@ int OH_NetStack_WebSocketClient_Close(struct OH_NetStack_WebsocketClient *client /** * @brief Releases the context and resources of the WebSocket connection. * - * @param client Client pointer. + * @param client Pointer to the WebSocket client. * @return 0 if success; non-0 otherwise. For details about error codes, see {@link OH_Websocket_ErrCode}. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetStack -- Gitee From 3cb870ef4f09038bb74db203c364a8e666f14a46 Mon Sep 17 00:00:00 2001 From: lixinsheng2 Date: Fri, 17 Nov 2023 13:20:53 +0800 Subject: [PATCH 0089/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9Ehid=20ddk=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lixinsheng2 --- zh-cn/native_sdk/hid/hid_ddk_types.h | 87 ++++++++++++++++------------ 1 file changed, 51 insertions(+), 36 deletions(-) diff --git a/zh-cn/native_sdk/hid/hid_ddk_types.h b/zh-cn/native_sdk/hid/hid_ddk_types.h index 64a350a5..2406fc03 100644 --- a/zh-cn/native_sdk/hid/hid_ddk_types.h +++ b/zh-cn/native_sdk/hid/hid_ddk_types.h @@ -198,6 +198,8 @@ typedef enum { HID_KEY_Y = 21, /** 键Z */ HID_KEY_Z = 44, + /** 键ESC */ + HID_KEY_ESC = 1, /** 键0 */ HID_KEY_0 = 11, /** 键1 */ @@ -224,22 +226,32 @@ typedef enum { HID_KEY_MINUS = 12, /** 键= */ HID_KEY_EQUALS = 13, + /** 键退格 */ + HID_KEY_BACKSPACE = 14, /** 键[ */ HID_KEY_LEFT_BRACKET = 26, /** 键] */ HID_KEY_RIGHT_BRACKET = 27, + /** 键回车 */ + HID_KEY_ENTER = 28, + /** 键左shift */ + HID_KEY_LEFTSHIFT = 42, /** 键\ */ HID_KEY_BACKSLASH = 43, /** 键; */ HID_KEY_SEMICOLON = 39, /** 键' */ HID_KEY_APOSTROPHE = 40, + /** 键空格 */ + HID_KEY_SPACE = 57, /** 键/ */ HID_KEY_SLASH = 53, /** 键, */ HID_KEY_COMMA = 51, /** 键. */ HID_KEY_PERIOD = 52, + /** 键右shift */ + HID_KEY_RIGHTSHIFT = 54, /** 数字键0 */ HID_KEY_NUMPAD_0 = 82, /** 数字键1 */ @@ -269,35 +281,38 @@ typedef enum { /** 数字键+ */ HID_KEY_NUMPAD_ADD = 78, /** 数字键. */ - HID_KEY_NUMPAD_DOT = 83 -} HidKeyCode; - -/** - * @brief 按钮编码。 - * - * @since 11 - * @version 1.0 - */ -typedef enum { + HID_KEY_NUMPAD_DOT = 83, + /** 键ESC */ + HID_KEY_SYSRQ = 99, + /** 键静音 */ + HID_KEY_MUTE = 113, + /** 键音量+ */ + HID_KEY_VOLUMEDOWN = 114, + /** 键音量- */ + HID_KEY_VOLUMEUP = 115, + /** 键亮度+ */ + HID_KEY_BRIGHTNESSDOWN = 224, + /** 键亮度- */ + HID_KEY_BRIGHTNESSUP = 225, /** 按钮0 */ HID_BTN_0 = 0x100, - /** 按键1 */ + /** 按钮1 */ HID_BTN_1 = 0x101, - /** 按键2 */ + /** 按钮2 */ HID_BTN_2 = 0x102, - /** 按键3 */ + /** 按钮3 */ HID_BTN_3 = 0x103, - /** 按键4 */ + /** 按钮4 */ HID_BTN_4 = 0x104, - /** 按键5 */ + /** 按钮5 */ HID_BTN_5 = 0x105, - /** 按键6 */ + /** 按钮6 */ HID_BTN_6 = 0x106, - /** 按键7 */ + /** 按钮7 */ HID_BTN_7 = 0x107, - /** 按键8 */ + /** 按钮8 */ HID_BTN_8 = 0x108, - /** 按键9 */ + /** 按钮9 */ HID_BTN_9 = 0x109, /** 鼠标按键左键 */ HID_BTN_LEFT = 0x110, @@ -316,40 +331,40 @@ typedef enum { /** 鼠标任务按键 */ HID_BTN_TASK = 0x117, /** 画笔 */ - HID_BTN_TOOL_PEN = 0x140 + HID_BTN_TOOL_PEN = 0x140, /** 橡皮擦 */ - HID_BTN_TOOL_RUBBER = 0x141 + HID_BTN_TOOL_RUBBER = 0x141, /** 笔刷 */ - HID_BTN_TOOL_BRUSH = 0x142 + HID_BTN_TOOL_BRUSH = 0x142, /** 钢笔 */ - HID_BTN_TOOL_PENCIL = 0x143 + HID_BTN_TOOL_PENCIL = 0x143, /** 喷枪 */ - HID_BTN_TOOL_AIRBRUSH = 0x144 + HID_BTN_TOOL_AIRBRUSH = 0x144, /** 手指 */ - HID_BTN_TOOL_FINGER = 0x145 + HID_BTN_TOOL_FINGER = 0x145, /** 鼠标 */ - HID_BTN_TOOL_MOUSE = 0x146 + HID_BTN_TOOL_MOUSE = 0x146, /** 镜头 */ - HID_BTN_TOOL_LENS = 0x147 + HID_BTN_TOOL_LENS = 0x147, /** 五指触控 */ - HID_BTN_TOOL_QUINTTAP = 0x148 + HID_BTN_TOOL_QUINTTAP = 0x148, /** 手写笔3 */ - HID_BTN_STYLUS3 = 0x149 + HID_BTN_STYLUS3 = 0x149, /** 触摸 */ - HID_BTN_TOUCH = 0x14a + HID_BTN_TOUCH = 0x14a, /** 手写笔 */ - HID_BTN_STYLUS = 0x14b + HID_BTN_STYLUS = 0x14b, /** 手写笔2 */ - HID_BTN_STYLUS2 = 0x14c + HID_BTN_STYLUS2 = 0x14c, /** 二指触控 */ - HID_BTN_TOOL_DOUBLETAP = 0x14d + HID_BTN_TOOL_DOUBLETAP = 0x14d, /** 三指触控 */ - HID_BTN_TOOL_TRIPLETAP = 0x14e + HID_BTN_TOOL_TRIPLETAP = 0x14e, /** 四指触控 */ - HID_BTN_TOOL_QUADTAP = 0x14f + HID_BTN_TOOL_QUADTAP = 0x14f, /** 滚轮 */ HID_BTN_WHEEL = 0x150 -} HidBtnCode; +} HidKeyCode; /** * @brief 绝对坐标编码。 -- Gitee From 8ab07e9b7817651e0e0141954914b601e93e0a6d Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 20 Nov 2023 15:15:29 +0800 Subject: [PATCH 0090/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luzhiye --- zh-cn/device_api/hdi/camera/v1_0/IStreamOperator.idl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/device_api/hdi/camera/v1_0/IStreamOperator.idl b/zh-cn/device_api/hdi/camera/v1_0/IStreamOperator.idl index 536f9509..643568a6 100644 --- a/zh-cn/device_api/hdi/camera/v1_0/IStreamOperator.idl +++ b/zh-cn/device_api/hdi/camera/v1_0/IStreamOperator.idl @@ -116,7 +116,7 @@ interface IStreamOperator { * 本接口需在调用{@link CreateStreams}创建流之后调用。 * * @param mode 流运行的模式,支持的模式定义在{@link OperationMode}。 - * @param modeSetting 流的配置参数,包括帧率,ZOOM等信息。ZOOM:变焦 + * @param modeSetting 流的配置参数,包括帧率,ZOOM等信息。ZOOM:变焦,目前可以忽略 * * @return NO_ERROR 表示执行成功。 * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 @@ -181,7 +181,7 @@ interface IStreamOperator { * * 本接口必须在调用{@link CommitStreams}配置流之后调用。 * 图像捕获有两种模式,分别是连续捕获和单次捕获。 - * - 连续捕获即触发之后模块内部进行连续的捕获,消费者可以连续收到图像数据,不需要多次调用本接口,若再次调用了本接口, + * - 连续捕获即触发之后模块内部进行连续的捕获,消费者只需调用此函数一次即可连续接收捕获的图像数据。若再次调用了本接口, * 则停止当前捕获,更新捕获信息,再进行一次新的捕获,多用于预览、录像或者连拍场景。 * - 单次捕获即触发之后只捕获一帧图像数据,用于单次拍照场景。捕获启动时,会调用{@link OnCaptureStarted}来通知调用者捕获已经启动。 * - 连续捕获需调用{@link CancelCapture}来停止捕获。捕获结束时,会调用{@link OnCaptureEnded}来通知调用者捕获的帧计数等信息。 @@ -237,4 +237,4 @@ interface IStreamOperator { ChangeToOfflineStream([in] int[] streamIds, [in] IStreamOperatorCallback callbackObj, [out] IOfflineStreamOperator offlineOperator); } -/** @} */ \ No newline at end of file +/** @} */ -- Gitee From cb560dcbb0d155920c0e44f4d906aadbd50cfc11 Mon Sep 17 00:00:00 2001 From: lengye Date: Mon, 20 Nov 2023 08:27:44 +0000 Subject: [PATCH 0091/2135] modify some descriptions Signed-off-by: lengye --- zh-cn/native_sdk/media/oh_camera/camera.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/zh-cn/native_sdk/media/oh_camera/camera.h b/zh-cn/native_sdk/media/oh_camera/camera.h index c1c7d090..2ff93aeb 100644 --- a/zh-cn/native_sdk/media/oh_camera/camera.h +++ b/zh-cn/native_sdk/media/oh_camera/camera.h @@ -341,12 +341,12 @@ typedef enum Camera_FocusState { FOCUS_STATE_SCAN = 0, /** - * 专聚焦状态。 + * 聚焦状态。 */ FOCUS_STATE_FOCUSED = 1, /** - * 非聚焦的状态。 + * 非聚焦状态。 */ FOCUS_STATE_UNFOCUSED = 2 } Camera_FocusState; @@ -379,7 +379,7 @@ typedef enum Camera_VideoStabilizationMode { STABILIZATION_MODE_HIGH = 3, /** - * HDF相机可以自动选择模式。 + * 自动选择模式,HDF相机可用。 */ STABILIZATION_MODE_AUTO = 4 } Camera_VideoStabilizationMode; @@ -456,12 +456,12 @@ typedef enum Camera_MetadataObjectType { */ typedef struct Camera_Size { /** - * 宽度。 + * 宽度,单位为像素。 */ uint32_t width; /** - * 高度。 + * 高度,单位为像素。 */ uint32_t height; } Camera_Size; @@ -655,7 +655,7 @@ typedef struct Camera_Location { double longitude; /** - * 海拔高度。 + * 海拔高度,单位为像素。 */ double altitude; } Camera_Location; @@ -742,12 +742,12 @@ typedef struct Camera_Rect { int32_t topLeftY; /** - * 矩形宽度。 + * 矩形宽度,单位为像素。 */ int32_t width; /** - * 矩形高度。 + * 矩形高度,单位为像素。 */ int32_t height; } Camera_Rect; -- Gitee From 5d81de5769dd1ed9ab167c4e666b12c7ad1b1e09 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Mon, 20 Nov 2023 19:04:55 +0800 Subject: [PATCH 0092/2135] change capi interface Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/external_window.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index 2ce58b8c..59036fdd 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -351,12 +351,12 @@ int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNative * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param window 一个OHNativeWindow的结构体实例的指针 - * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针 + * @param buffer 一个OHNativeWindowBuffer结构体指针的指针 * @return 返回值为0表示执行成功 * @since 11 * @version 1.0 */ -int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); +int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer); /** * @brief 通过OHNativeWindow将之前申请出来的OHNativeWindowBuffer返还到Buffer队列中,供下次再申请 -- Gitee From 760d340941f60c0d7831cc42d98e392e73ed11e3 Mon Sep 17 00:00:00 2001 From: chengfeng27 Date: Tue, 21 Nov 2023 15:40:44 +0800 Subject: [PATCH 0093/2135] add train c api Signed-off-by: chengfeng27 --- zh-cn/native_sdk/ai/mindspore/context.h | 3 +- zh-cn/native_sdk/ai/mindspore/data_type.h | 1 + zh-cn/native_sdk/ai/mindspore/format.h | 1 + zh-cn/native_sdk/ai/mindspore/model.h | 250 +++++++++++++++++++++- zh-cn/native_sdk/ai/mindspore/status.h | 1 + zh-cn/native_sdk/ai/mindspore/tensor.h | 1 + zh-cn/native_sdk/ai/mindspore/types.h | 62 ++++++ 7 files changed, 309 insertions(+), 10 deletions(-) diff --git a/zh-cn/native_sdk/ai/mindspore/context.h b/zh-cn/native_sdk/ai/mindspore/context.h index 09e76a61..cd236641 100644 --- a/zh-cn/native_sdk/ai/mindspore/context.h +++ b/zh-cn/native_sdk/ai/mindspore/context.h @@ -17,7 +17,7 @@ /** * @addtogroup MindSpore * @{ - * + * * @brief 提供MindSpore Lite的模型推理相关接口。 * * @Syscap SystemCapability.Ai.MindSpore @@ -29,6 +29,7 @@ * * @brief 提供了Context相关的接口,可以配置运行时信息。 * + * 引用文件 * @library libmindspore_lite_ndk.so * @since 9 */ diff --git a/zh-cn/native_sdk/ai/mindspore/data_type.h b/zh-cn/native_sdk/ai/mindspore/data_type.h index 7ac218b0..60433d21 100644 --- a/zh-cn/native_sdk/ai/mindspore/data_type.h +++ b/zh-cn/native_sdk/ai/mindspore/data_type.h @@ -29,6 +29,7 @@ * * @brief 声明了张量的数据的类型。 * + * 引用文件 * @library libmindspore_lite_ndk.so * @since 9 */ diff --git a/zh-cn/native_sdk/ai/mindspore/format.h b/zh-cn/native_sdk/ai/mindspore/format.h index b7505b79..74685ab9 100644 --- a/zh-cn/native_sdk/ai/mindspore/format.h +++ b/zh-cn/native_sdk/ai/mindspore/format.h @@ -29,6 +29,7 @@ * * @brief 提供张量数据的排列格式。 * + * 引用文件 * @library libmindspore_lite_ndk.so * @since 9 */ diff --git a/zh-cn/native_sdk/ai/mindspore/model.h b/zh-cn/native_sdk/ai/mindspore/model.h index bf5ac350..8ef069be 100644 --- a/zh-cn/native_sdk/ai/mindspore/model.h +++ b/zh-cn/native_sdk/ai/mindspore/model.h @@ -29,6 +29,7 @@ * * @brief 提供了模型相关接口,可以用于模型创建、模型推理等。 * + * 引用文件 * @library libmindspore_lite_ndk.so * @since 9 */ @@ -51,6 +52,13 @@ extern "C" */ typedef void *OH_AI_ModelHandle; +/** + * @brief 指向训练配置对象的指针。 + * + * @since 11 + */ +typedef void *OH_AI_TrainCfgHandle; + /** * @brief 张量数组结构体,用于存储张量数组指针和张量数组长度 * @@ -65,11 +73,17 @@ typedef struct OH_AI_TensorHandleArray } OH_AI_TensorHandleArray; /** - * @brief 维度信息,最大的维度为{@link MS_MAX_SHAPE_NUM}。 + * @brief 张量维度最大值 * * @since 9 */ #define OH_AI_MAX_SHAPE_NUM 32 + +/** + * @brief 维度信息,最大的维度为{@link MS_MAX_SHAPE_NUM}。 + * + * @since 9 + */ typedef struct OH_AI_ShapeInfo { /** 维度数组长度 */ @@ -104,7 +118,7 @@ typedef bool (*OH_AI_KernelCallBack)(const OH_AI_TensorHandleArray inputs, const const OH_AI_CallBackParam kernel_Info); /** - * @brief 创建一个模型对象。 + * @brief 创建一个模型对象。 * * @return 模型对象指针。 * @since 9 @@ -112,7 +126,7 @@ typedef bool (*OH_AI_KernelCallBack)(const OH_AI_TensorHandleArray inputs, const OH_AI_API OH_AI_ModelHandle OH_AI_ModelCreate(); /** - * @brief 释放一个模型对象。 + * @brief 释放一个模型对象。 * * @param model 模型对象指针。 * @since 9 @@ -120,7 +134,7 @@ OH_AI_API OH_AI_ModelHandle OH_AI_ModelCreate(); OH_AI_API void OH_AI_ModelDestroy(OH_AI_ModelHandle *model); /** - * @brief 从内存缓冲区加载并编译MindSpore模型。 + * @brief 从内存缓冲区加载并编译MindSpore模型。 * * 注意,同一个{@link OH_AI_ContextHandle}对象仅能传递给{@link OH_AI_ModelBuild}或者{@link OH_AI_ModelBuildFromFile}一次, * 如果多次调用该函数需要创建多个不同的{@link OH_AI_ContextHandle}。 @@ -137,7 +151,7 @@ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *mod OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context); /** - * @brief 通过模型文件加载并编译MindSpore模型。 + * @brief 通过模型文件加载并编译MindSpore模型。 * * 注意,同一个{@link OH_AI_ContextHandle}对象仅能传递给{@link OH_AI_ModelBuild}或者{@link OH_AI_ModelBuildFromFile}一次, * 如果多次调用该函数需要创建多个不同的{@link OH_AI_ContextHandle}。 @@ -153,7 +167,7 @@ OH_AI_API OH_AI_Status OH_AI_ModelBuildFromFile(OH_AI_ModelHandle model, const c OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context); /** - * @brief 调整已编译模型的输入形状。 + * @brief 调整已编译模型的输入形状。 * * @param model 模型对象指针。 * @param inputs 模型输入对应的张量数组结构体。 @@ -190,7 +204,7 @@ OH_AI_API OH_AI_Status OH_AI_ModelPredict(OH_AI_ModelHandle model, const OH_AI_T OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetInputs(const OH_AI_ModelHandle model); /** - * @brief 获取模型的输出张量数组结构体。 + * @brief 获取模型的输出张量数组结构体。 * * @param model 模型对象指针。 * @return 模型输出对应的张量数组结构体。 @@ -199,7 +213,7 @@ OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetInputs(const OH_AI_ModelHandle m OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetOutputs(const OH_AI_ModelHandle model); /** - * @brief 通过张量名获取模型的输入张量。 + * @brief 通过张量名获取模型的输入张量。 * * @param model 模型对象指针。 * @param tensor_name 张量名称。 @@ -209,7 +223,7 @@ OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetOutputs(const OH_AI_ModelHandle OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); /** - * @brief 通过张量名获取模型的输出张量。 + * @brief 通过张量名获取模型的输出张量。 * * @param model 模型对象指针。 * @param tensor_name 张量名称。 @@ -218,6 +232,224 @@ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHa */ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetOutputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); +/** + * @brief 创建训练配置对象指针,仅用于端侧训练。 + * @return 训练配置对象指针。 + * @since 11 + */ +OH_AI_API OH_AI_TrainCfgHandle OH_AI_TrainCfgCreate(); + +/** + * @brief 销毁训练配置对象指针,仅用于端侧训练。 + * + * @param train_cfg 训练配置对象指针。 + * @since 11 + */ +OH_AI_API void OH_AI_TrainCfgDestroy(OH_AI_TrainCfgHandle *train_cfg); + +/** + * @brief 获取损失函数的名称列表,仅用于端侧训练。 + * + * @param train_cfg 训练配置对象指针。 + * @param num 损失函数数量。 + * @return 损失函数的名称列表。 + * @since 11 + */ +OH_AI_API char **OH_AI_TrainCfgGetLossName(OH_AI_TrainCfgHandle train_cfg, size_t *num); + +/** + * @brief 设置损失函数的名称列表,仅用于端侧训练。 + * + * @param train_cfg 训练配置对象指针。 + * @param loss_name 损失函数的名称列表。 + * @param num 损失函数数量。 + * @since 11 + */ +OH_AI_API void OH_AI_TrainCfgSetLossName(OH_AI_TrainCfgHandle train_cfg, const char **loss_name, size_t num); + +/** + * @brief 获取训练配置的优化等级,仅用于端侧训练。 + * + * @param train_cfg 训练配置对象指针。 + * @return 优化等级。 + * @since 11 + */ +OH_AI_API OH_AI_OptimizationLevel OH_AI_TrainCfgGetOptimizationLevel(OH_AI_TrainCfgHandle train_cfg); + +/** + * @brief 设置训练配置的优化等级,仅用于端侧训练。 + * + * @param train_cfg 训练配置对象指针。 + * @param level 优化等级。 + * @since 11 + */ +OH_AI_API void OH_AI_TrainCfgSetOptimizationLevel(OH_AI_TrainCfgHandle train_cfg, OH_AI_OptimizationLevel level); + +/** + * @brief 从内存缓冲区加载训练模型,并将模型编译至可在Device上运行的状态,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @param model_data 指向存储读入模型文件缓冲区的指针。 + * @param data_size 缓冲区大小。 + * @param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 + * @param model_context 模型运行时的上下文环境,具体见 {@link OH_AI_ContextHandle}。 + * @param train_cfg 训练配置对象指针。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_TrainModelBuild(OH_AI_ModelHandle model, const void *model_data, size_t data_size, + OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context, + const OH_AI_TrainCfgHandle train_cfg); + +/** + * @brief 根据路径读取加载训练模型,并将模型编译至可在Device上运行的状态,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @param model_path 模型文件路径。 + * @param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 + * @param model_context 模型运行时的上下文环境,具体见 {@link OH_AI_ContextHandle}。 + * @param train_cfg 训练配置对象指针。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_TrainModelBuildFromFile(OH_AI_ModelHandle model, const char *model_path, + OH_AI_ModelType model_type, + const OH_AI_ContextHandle model_context, + const OH_AI_TrainCfgHandle train_cfg); + +/** + * @brief 单步训练模型,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @param before 模型推理前执行的回调函数。 + * @param after 模型推理后执行的回调函数。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_RunStep(OH_AI_ModelHandle model, const OH_AI_KernelCallBack before, + const OH_AI_KernelCallBack after); + +/** + * @brief 设置训练的学习率,仅用于端侧训练。 + * + * @param learning_rate 学习率 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ModelSetLearningRate(OH_AI_ModelHandle model, float learning_rate); + +/** + * @brief 获取训练的学习率,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @return 学习率,没有设置优化器时为0.0。 + * @since 11 + */ +OH_AI_API float OH_AI_ModelGetLearningRate(OH_AI_ModelHandle model); + +/** + * @brief 获取模型的所有权重Tensors,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @return 模型的所有权重Tensor。 + * @since 11 + */ +OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetWeights(OH_AI_ModelHandle model); + +/** + * @brief 更新模型的权重Tensor内容,仅用于端侧训练。 + * + * @param new_weights 要更新的权重Tensor。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ModelUpdateWeights(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray new_weights); + +/** + * @brief 获取训练模式。 + * + * @param model 模型对象指针。 + * @return 表示是否是训练模式。 + * @since 11 + */ +OH_AI_API bool OH_AI_ModelGetTrainMode(OH_AI_ModelHandle model); + +/** + * @brief 设置训练模式,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @param train 是否为训练模式。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ModelSetTrainMode(OH_AI_ModelHandle model, bool train); + +/** + * @brief 设置虚拟batch用于训练,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @param virtual_batch_multiplier 虚拟batch乘法器,当设置值小于1时,表示禁用虚拟batch。 + * @param lr 学习率,默认为-1.0f。 + * @param momentum 动量,默认为-1.0f。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ModelSetupVirtualBatch(OH_AI_ModelHandle model, int virtual_batch_multiplier, float lr, + float momentum); + +/** + * @brief 导出训练模型,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 + * @param model_file 导出的模型文件路径。 + * @param quantization_type 量化类型。 + * @param export_inference_only 是否导出推理模型。 + * @param output_tensor_name 设置导出模型的输出Tensor,默认为空表示全量导出。 + * @param num 输出Tensor的数量。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ExportModel(OH_AI_ModelHandle model, OH_AI_ModelType model_type, const char *model_file, + OH_AI_QuantizationType quantization_type, bool export_inference_only, + char **output_tensor_name, size_t num); + +/** + * @brief 导出训练模型内存缓存,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 + * @param model_data 指向导出模型文件缓冲区的指针。 + * @param data_size 缓冲区大小。 + * @param quantization_type 量化类型。 + * @param export_inference_only 是否导出推理模型。 + * @param output_tensor_name 设置导出模型的输出Tensor,默认为空表示全量导出。 + * @param num 输出Tensor的数量。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ExportModelBuffer(OH_AI_ModelHandle model, OH_AI_ModelType model_type, char **model_data, + size_t *data_size, OH_AI_QuantizationType quantization_type, + bool export_inference_only, char **output_tensor_name, size_t num); + +/** + * @brief 导出模型权重,只能用于micro推理,仅用于端侧训练。 + * + * @param model 模型对象指针。 + * @param model_type 模型文件类型,具体见{@link OH_AI_ModelType}。 + * @param weight_file 导出的权重文件路径。 + * @param is_inference 是否导出推理模型,当前只支持设置为true。 + * @param enable_fp16 浮点权重是否保存为float16格式。 + * @param changeable_weights_name shape可变的权重Tensor名称。 + * @param num shape可变的权重Tensor名称的数量。 + * @return 枚举类型的状态码{@link OH_AI_Status},若返回OH_AI_Status::OH_AI_STATUS_SUCCESS则证明创建成功。 + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ExportWeightsCollaborateWithMicro(OH_AI_ModelHandle model, OH_AI_ModelType model_type, + const char *weight_file, bool is_inference, + bool enable_fp16, char **changeable_weights_name, + size_t num); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/ai/mindspore/status.h b/zh-cn/native_sdk/ai/mindspore/status.h index fcc78760..992223ef 100644 --- a/zh-cn/native_sdk/ai/mindspore/status.h +++ b/zh-cn/native_sdk/ai/mindspore/status.h @@ -29,6 +29,7 @@ * * @brief 提供了Mindspore Lite运行时的状态码。 * + * 引用文件 * @library libmindspore_lite_ndk.so * @since 9 */ diff --git a/zh-cn/native_sdk/ai/mindspore/tensor.h b/zh-cn/native_sdk/ai/mindspore/tensor.h index df8b750b..d495416f 100644 --- a/zh-cn/native_sdk/ai/mindspore/tensor.h +++ b/zh-cn/native_sdk/ai/mindspore/tensor.h @@ -29,6 +29,7 @@ * * @brief 提供了张量相关的接口,可用于创建和修改张量信息。 * + * 引用文件 * @library libmindspore_lite_ndk.so * @since 9 */ diff --git a/zh-cn/native_sdk/ai/mindspore/types.h b/zh-cn/native_sdk/ai/mindspore/types.h index 5ead46a3..57b53ed3 100644 --- a/zh-cn/native_sdk/ai/mindspore/types.h +++ b/zh-cn/native_sdk/ai/mindspore/types.h @@ -29,6 +29,7 @@ * * @brief 提供了MindSpore Lite支持的模型文件类型和设备类型。 * + * 引用文件 * @library libmindspore_lite_ndk.so * @since 9 */ @@ -194,6 +195,67 @@ typedef enum OH_AI_Priority { OH_AI_PRIORITY_HIGH = 3, } OH_AI_Priority; +/** + * @brief 训练优化等级 + * + * @since 11 + */ +typedef enum OH_AI_OptimizationLevel { + /** 无优化等级 + * + * @since 11 + */ + OH_AI_KO0 = 0, + /** 将网络转换为float16, 保持批量归一化层和损失函数为float32 + * + * @since 11 + */ + OH_AI_KO2 = 2, + /** 将网络转换为float16, 包括批量归一化层 + * + * @since 11 + */ + OH_AI_KO3 = 3, + /** 根据设备选择优化等级 + * + * @since 11 + */ + OH_AI_KAUTO = 4, + /** 无效优化等级 + * + * @since 11 + */ + OH_AI_KOPTIMIZATIONTYPE = 0xFFFFFFFF +} OH_AI_OptimizationLevel; + +/** + * @brief 量化类型信息 + * + * @since 11 + */ +typedef enum OH_AI_QuantizationType { + /** 不做量化 + * + * @since 11 + */ + OH_AI_NO_QUANT = 0, + /** 权重量化 + * + * @since 11 + */ + OH_AI_WEIGHT_QUANT = 1, + /** 全量化 + * + * @since 11 + */ + OH_AI_FULL_QUANT = 2, + /** 无效量化类型 + * + * @since 11 + */ + OH_AI_UNKNOWN_QUANT_TYPE = 0xFFFFFFFF +} OH_AI_QuantizationType; + /** * @brief NNRT设备信息描述,包含设备ID,设备名称等信息。 * -- Gitee From 33927be0aff14e7b63446e76cf91e07bcd9d4f3a Mon Sep 17 00:00:00 2001 From: liuziwei <1205054466@qq.com> Date: Tue, 21 Nov 2023 02:15:17 +0800 Subject: [PATCH 0094/2135] fix Signed-off-by: liuziwei <1205054466@qq.com> --- .../hdi/pin_auth/{ => v1_0}/IExecutor.idl | 313 ++++----- .../pin_auth/{ => v1_0}/IExecutorCallback.idl | 136 ++-- .../pin_auth/{ => v1_0}/IPinAuthInterface.idl | 115 ++-- .../hdi/pin_auth/{ => v1_0}/PinAuthTypes.idl | 272 ++++---- .../hdi/pin_auth/v1_1/IExecutor.idl | 85 +++ .../hdi/pin_auth/v1_1/IExecutorCallback.idl | 60 ++ .../hdi/pin_auth/v1_1/IPinAuthInterface.idl | 58 ++ .../hdi/pin_auth/v1_1/PinAuthTypes.idl | 67 ++ .../{ => v1_0}/IUserAuthInterface.idl | 627 ++++++++---------- .../user_auth/{ => v1_0}/UserAuthTypes.idl | 585 ++++++++-------- .../hdi/user_auth/v1_1/IUserAuthInterface.idl | 98 +++ .../hdi/user_auth/v1_1/UserAuthTypes.idl | 77 +++ .../hdi/user_auth/v1_2/IUserAuthInterface.idl | 343 ++++++++++ .../hdi/user_auth/v1_2/UserAuthTypes.idl | 353 ++++++++++ 14 files changed, 2128 insertions(+), 1061 deletions(-) rename zh-cn/device_api/hdi/pin_auth/{ => v1_0}/IExecutor.idl (90%) mode change 100755 => 100644 rename zh-cn/device_api/hdi/pin_auth/{ => v1_0}/IExecutorCallback.idl (90%) mode change 100755 => 100644 rename zh-cn/device_api/hdi/pin_auth/{ => v1_0}/IPinAuthInterface.idl (93%) mode change 100755 => 100644 rename zh-cn/device_api/hdi/pin_auth/{ => v1_0}/PinAuthTypes.idl (91%) mode change 100755 => 100644 create mode 100644 zh-cn/device_api/hdi/pin_auth/v1_1/IExecutor.idl create mode 100644 zh-cn/device_api/hdi/pin_auth/v1_1/IExecutorCallback.idl create mode 100644 zh-cn/device_api/hdi/pin_auth/v1_1/IPinAuthInterface.idl create mode 100644 zh-cn/device_api/hdi/pin_auth/v1_1/PinAuthTypes.idl rename zh-cn/device_api/hdi/user_auth/{ => v1_0}/IUserAuthInterface.idl (89%) mode change 100755 => 100644 rename zh-cn/device_api/hdi/user_auth/{ => v1_0}/UserAuthTypes.idl (91%) mode change 100755 => 100644 create mode 100644 zh-cn/device_api/hdi/user_auth/v1_1/IUserAuthInterface.idl create mode 100644 zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl create mode 100644 zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl create mode 100644 zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl diff --git a/zh-cn/device_api/hdi/pin_auth/IExecutor.idl b/zh-cn/device_api/hdi/pin_auth/v1_0/IExecutor.idl old mode 100755 new mode 100644 similarity index 90% rename from zh-cn/device_api/hdi/pin_auth/IExecutor.idl rename to zh-cn/device_api/hdi/pin_auth/v1_0/IExecutor.idl index b84ad831..392d14f8 --- a/zh-cn/device_api/hdi/pin_auth/IExecutor.idl +++ b/zh-cn/device_api/hdi/pin_auth/v1_0/IExecutor.idl @@ -1,170 +1,145 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdfPinAuth - * @{ - * - * @brief 提供口令认证驱动的标准API接口。 - * - * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, - * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 - * - * @since 3.2 - */ - -/** - * @file IExecutor.idl - * - * @brief 定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 - * - * @since 3.2 - */ - -package ohos.hdi.pin_auth.v1_0; - -import ohos.hdi.pin_auth.v1_0.PinAuthTypes; -import ohos.hdi.pin_auth.v1_0.IExecutorCallback; - -/** - * @brief 定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 - * - * @since 3.2 - * @version 1.0 - */ - -interface IExecutor { - /** - * @brief 获取执行器信息,口令认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 - * - * @param executorInfo 执行器信息{@link ExecutorInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetExecutorInfo([out] struct ExecutorInfo executorInfo); - /** - * @brief 获取凭据模版信息。 - * - * @param templateId 凭据模版ID。 - * @param templateInfo 凭据模版信息{@link TemplateInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo); - /** - * @brief 完成执行器注册,对口令模版信息进行对账,用于删除无效的口令模板及相关信息。 - * - * @param templateIdList 用户认证框架内由该执行器注册的口令凭据模版ID列表。 - * @param frameworkPublicKey 用户认证框架的公钥,用于校验用户认证框架私钥签名的信息。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); - /** - * @brief 设置口令数据,口令认证驱动处理注册或认证口令请求时,如果口令数据由口令认证服务获取,需要通过该接口将口令数据传给口令认证驱动。 - * - * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * @param authSubType 口令子类型,如六位数字PIN码等。 - * @param data 口令数据。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - OnSetData([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data); - /** - * @brief 注册口令。 - * - * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); - /** - * @brief 认证口令。 - * - * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * @param templateId 指定要认证的模版ID。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Authenticate([in] unsigned long scheduleId, [in] unsigned long templateId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); - /** - * @brief 删除口令。 - * - * @param templateId 模版ID。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Delete([in] unsigned long templateId); - /** - * @brief 取消操作请求。 - * - * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Cancel([in] unsigned long scheduleId); - /** - * @brief 发送口令认证功能相关操作命令。 - * - * @param commandId 操作命令ID{@link CommandId}。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief 提供口令认证驱动的标准API接口。 + * + * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, + * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 3.2 + */ + +/** + * @file IExecutor.idl + * + * @brief 定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 3.2 + */ + +package ohos.hdi.pin_auth.v1_0; + +import ohos.hdi.pin_auth.v1_0.PinAuthTypes; +import ohos.hdi.pin_auth.v1_0.IExecutorCallback; + +/** + * @brief 定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 3.2 + * @version 1.0 + */ + +interface IExecutor { + /** + * @brief 获取执行器信息,口令认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 + * + * @param executorInfo 执行器信息{@link ExecutorInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetExecutorInfo([out] struct ExecutorInfo executorInfo); + /** + * @brief 获取属性。 + * + * @param templateId 凭据模版ID。 + * @param templateInfo 凭据模版信息{@link TemplateInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @deprecated + */ + GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo); + /** + * @brief 完成执行器注册,对口令模版信息进行对账,用于删除无效的口令模板及相关信息。 + * + * @param templateIdList 用户认证框架内由该执行器注册的口令凭据模版ID列表。 + * @param frameworkPublicKey 用户认证框架的公钥,用于校验用户认证框架私钥签名的信息。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); + /** + * @brief 设置口令数据,口令认证驱动处理注册或认证口令请求时,如果口令数据由口令认证服务获取,需要通过该接口将口令数据传给口令认证驱动。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param authSubType 口令子类型,如六位数字PIN码等。 + * @param data 口令数据。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OnSetData([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data); + /** + * @brief 注册口令。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 认证口令。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param templateId 指定要认证的模版ID。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Authenticate([in] unsigned long scheduleId, [in] unsigned long templateId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 删除口令。 + * + * @param templateId 模版ID。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Delete([in] unsigned long templateId); + /** + * @brief 取消操作请求。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief 发送口令认证功能相关操作命令。 + * + * @param commandId 操作命令ID{@link CommandId}。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); +} /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/pin_auth/IExecutorCallback.idl b/zh-cn/device_api/hdi/pin_auth/v1_0/IExecutorCallback.idl old mode 100755 new mode 100644 similarity index 90% rename from zh-cn/device_api/hdi/pin_auth/IExecutorCallback.idl rename to zh-cn/device_api/hdi/pin_auth/v1_0/IExecutorCallback.idl index e3b36111..8638e921 --- a/zh-cn/device_api/hdi/pin_auth/IExecutorCallback.idl +++ b/zh-cn/device_api/hdi/pin_auth/v1_0/IExecutorCallback.idl @@ -1,72 +1,66 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdfPinAuth - * @{ - * - * @brief 提供口令认证驱动的标准API接口。 - * - * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, - * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 - * - * @since 3.2 - */ - -/** - * @file IExecutorCallback.idl - * - * @brief 定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。 - * - * @since 3.2 - */ - -package ohos.hdi.pin_auth.v1_0; - -/** - * @brief 定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。使用细节见{@link IExecutor}。 - * - * @since 3.2 - * @version 1.0 - */ -[callback] interface IExecutorCallback { - /** - * @brief 定义操作请求处理结果回调函数。 - * - * @param result 操作请求处理结果。 - * @param extraInfo 其他相关信息,如用户认证通过时用于返回执行器签发的认证令牌等。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - OnResult([in] int result, [in] unsigned char[] extraInfo); - /** - * @brief 定义请求获取口令数据回调函数。 - * - * @param salt 盐值,用于对口令明文进行单向处理。 - * @param authSubType 口令子类型,如六位数字PIN码等。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - OnGetData([in] unsigned long scheduleId, [in] unsigned char[] salt, [in] unsigned long authSubType); -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief 提供口令认证驱动的标准API接口。 + * + * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, + * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 3.2 + */ + +/** + * @file IExecutorCallback.idl + * + * @brief 定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。 + * + * @since 3.2 + */ + +package ohos.hdi.pin_auth.v1_0; + +/** + * @brief 定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。使用细节见{@link IExecutor}。 + * + * @since 3.2 + * @version 1.0 + */ +[callback] interface IExecutorCallback { + /** + * @brief 定义操作请求处理结果回调函数。 + * + * @param result 操作请求处理结果。 + * @param extraInfo 其他相关信息,如用户认证通过时用于返回执行器签发的认证令牌等。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OnResult([in] int result, [in] unsigned char[] extraInfo); + /** + * @brief 定义请求获取口令数据回调函数。 + * + * @param salt 盐值,用于对口令 明文进行单向处理。 + * @param authSubType 口令子类型,如六位数字PIN码等。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OnGetData([in] unsigned long scheduleId, [in] unsigned char[] salt, [in] unsigned long authSubType); +} /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/pin_auth/IPinAuthInterface.idl b/zh-cn/device_api/hdi/pin_auth/v1_0/IPinAuthInterface.idl old mode 100755 new mode 100644 similarity index 93% rename from zh-cn/device_api/hdi/pin_auth/IPinAuthInterface.idl rename to zh-cn/device_api/hdi/pin_auth/v1_0/IPinAuthInterface.idl index 4a9a1555..139c0a3d --- a/zh-cn/device_api/hdi/pin_auth/IPinAuthInterface.idl +++ b/zh-cn/device_api/hdi/pin_auth/v1_0/IPinAuthInterface.idl @@ -1,60 +1,57 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdfPinAuth - * @{ - * - * @brief 提供口令认证驱动的标准API接口。 - * - * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, - * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 - * - * @since 3.2 - */ - -/** - * @file IPinAuthInterface.idl - * - * @brief 定义获取口令认证驱动的执行器列表接口,用于从口令认证驱动获取执行器对象列表。 - * - * @since 3.2 - */ - -package ohos.hdi.pin_auth.v1_0; - -import ohos.hdi.pin_auth.v1_0.IExecutor; - -/** - * @brief 定义获取口令认证驱动的执行器列表接口。 - * - * @since 3.2 - * @version 1.0 - */ -interface IPinAuthInterface { - /** - * @brief 获取执行器列表,口令认证服务进程启动进行初始化操作时通过该接口获取口令认证驱动支持的执行器列表。 - * - * @param executorList 执行器对象列表{@link IExecutor}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetExecutorList([out] IExecutor[] executorList); -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief 提供口令认证驱动的标准API接口。 + * + * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, + * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 3.2 + */ + +/** + * @file IPinAuthInterface.idl + * + * @brief 定义获取口令认证驱动的执行器列表接口,用于从口令认证驱动获取执行器对象列表。 + * + * @since 3.2 + */ + +package ohos.hdi.pin_auth.v1_0; + +import ohos.hdi.pin_auth.v1_0.IExecutor; + +/** + * @brief 定义获取口令认证驱动的执行器列表接口。 + * + * @since 3.2 + * @version 1.0 + */ +interface IPinAuthInterface extends ohos.hdi.pin_auth.v1_0.IPinAuthInterface { + /** + * @brief 获取执行器列表,口令认证服务进程启动进行初始化操作时通过该接口获取口令认证驱动支持的执行器列表。 + * + * @param executorList 执行器对象列表{@link IExecutor}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetExecutorList([out] IExecutor[] executorList); +} /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/pin_auth/PinAuthTypes.idl b/zh-cn/device_api/hdi/pin_auth/v1_0/PinAuthTypes.idl old mode 100755 new mode 100644 similarity index 91% rename from zh-cn/device_api/hdi/pin_auth/PinAuthTypes.idl rename to zh-cn/device_api/hdi/pin_auth/v1_0/PinAuthTypes.idl index 4c97b075..8d1e60f1 --- a/zh-cn/device_api/hdi/pin_auth/PinAuthTypes.idl +++ b/zh-cn/device_api/hdi/pin_auth/v1_0/PinAuthTypes.idl @@ -1,136 +1,138 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdfPinAuth - * @{ - * - * @brief 提供口令认证驱动的标准API接口。 - * - * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, - * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 - * - * @since 3.2 - */ - -/** - * @file IPinTypes.idl - * - * @brief 定义口令认证驱动的枚举类和数据结构。 - * - * @since 3.2 - */ - -package ohos.hdi.pin_auth.v1_0; - -/** - * @brief 枚举用户认证凭据类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AuthType : int { - /** 认证凭据类型为口令。 */ - PIN = 1, - /** 认证凭据类型为人脸。 */ - FACE = 2, - /** 认证凭据类型为指纹。 */ - FINGERPRINT = 4, -}; - -/** - * @brief 枚举执行器角色。 - * - * @since 3.2 - * @version 1.0 - */ -enum ExecutorRole : int { - /** 执行器角色为采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 */ - COLLECTOR = 1, - /** 执行器角色为认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 */ - VERIFIER = 2, - /** 执行器角色为全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 */ - ALL_IN_ONE = 3, -}; - -/** - * @brief 枚举执行器安全等级。 - * - * @since 3.2 - * @version 1.0 - */ -enum ExecutorSecureLevel : int { - /** 执行器安全级别为0,关键操作在无访问控制执行环境中完成。 */ - ESL0 = 0, - /** 执行器安全级别为1,关键操作在有访问控制的执行环境中完成。 */ - ESL1 = 1, - /** 执行器安全级别为2,关键操作在可信执行环境中完成。 */ - ESL2 = 2, - /** 执行器安全级别为3,关键操作在高安环境如独立安全芯片中完成。 */ - ESL3 = 3, -}; - -/** - * @brief 枚举口令认证相关功能操作命令。 - * - * @since 3.2 - * @version 1.0 - */ -enum CommandId : int { - /** 默认无效操作命令。 */ - DEFAULT = 0, -}; - - -/** - * @brief 执行器信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct ExecutorInfo { - /** 传感器ID,不同传感器在口令认证驱动内的唯一标识。 */ - unsigned short sensorId; - /** 执行器类型,根据执行器支持的算法类型进行分类。 */ - unsigned int executorType; - /** 执行器角色@{ExecutorRole}。 */ - enum ExecutorRole executorRole; - /** 用户认证凭据类型@{AuthType}。 */ - enum AuthType authType; - /** 执行器安全等级@{ExecutorSecureLevel}。 */ - enum ExecutorSecureLevel esl; - /** 执行器公钥,用于校验该执行器私钥签名的信息。 */ - unsigned char[] publicKey; - /** 其他相关信息,用户支持信息扩展。 */ - unsigned char[] extraInfo; -}; - -/** - * @brief 凭据模版信息,口令模版在用户注册口令认证凭据时生成并存储,用于支持通过口令认证方式验证用户身份。 - * - * @since 3.2 - * @version 1.0 - */ -struct TemplateInfo { - /** 执行器类型,根据执行器支持的算法类型进行分类。 */ - unsigned int executorType; - /** 认证方式被冻结的时间。 */ - int freezingTime; - /** 认证方式距离被冻结的可处理认证请求次数。 */ - int remainTimes; - /** 其他相关信息,用于支持信息扩展。 */ - unsigned char[] extraInfo; -}; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief 提供口令认证驱动的标准API接口。 + * + * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, + * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 3.2 + */ + +/** + * @file PinAuthTypes.idl + * + * @brief 定义口令认证驱动的枚举类和数据结构。 + * + * @since 3.2 + */ + +package ohos.hdi.pin_auth.v1_0; + +/** + * @brief 枚举用户认证凭据类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum AuthType : int { + /** 认证凭据类型为口令。 */ + PIN = 1, + /** 认证凭据类型为人脸。 */ + FACE = 2, + /** 认证凭据类型为指纹。 */ + FINGERPRINT = 4, +}; + +/** + * @brief 枚举执行器角色。 + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorRole : int { + /** 执行器角色为采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 */ + COLLECTOR = 1, + /** 执行器角色为认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 */ + VERIFIER = 2, + /** 执行器角色为全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 */ + ALL_IN_ONE = 3, +}; + +/** + * @brief 枚举执行器安全等级。 + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorSecureLevel : int { + /** 执行器安全级别为0,关键操作在无访问控制执行环境中完成。 */ + ESL0 = 0, + /** 执行器安全级别为1,关键操作在有访问控制的执行环境中完成。 */ + ESL1 = 1, + /** 执行器安全级别为2,关键操作在可信执行环境中完成。 */ + ESL2 = 2, + /** 执行器安全级别为3,关键操作在高安环境如独立安全芯片中完成。 */ + ESL3 = 3, +}; + +/** + * @brief 枚举口令认证相关功能操作命令。 + * + * @since 3.2 + * @version 1.0 + */ +enum CommandId : int { + /** 默认无效操作命令。 */ + DEFAULT = 0, +}; + + +/** + * @brief 执行器信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct ExecutorInfo { + /** 传感器ID,不同传感器在口令认证驱动内的唯一标识。 */ + unsigned short sensorId; + /** 执行器类型,根据执行器支持的算法类型进行分类。 */ + unsigned int executorType; + /** 执行器角色@{ExecutorRole}。 */ + enum ExecutorRole executorRole; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器安全等级@{ExecutorSecureLevel}。 */ + enum ExecutorSecureLevel esl; + /** 执行器公钥,用于校验该执行器私钥签名的信息。 */ + unsigned char[] publicKey; + /** 其他相关信息,用于支持信息扩展。 */ + unsigned char[] extraInfo; +}; + +/** + * @brief 凭据模版信息,口令模版在用户注册口令认证凭据时生成并存储,用于支持通过口令认证方式验证用户身份。 + * + * @since 3.2 + * @version 1.0 + * + * @deprecated + */ +struct TemplateInfo { + /** 执行器类型,根据执行器支持的算法类型进行分类。 */ + unsigned int executorType; + /** 认证执行器的剩余冻结时间。 */ + int lockoutDuration; + /** 认证执行器的剩余可重试次数。 */ + int remainAttempts; + /** 其他相关信息,用于支持信息扩展。 */ + unsigned char[] extraInfo; +}; /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/pin_auth/v1_1/IExecutor.idl b/zh-cn/device_api/hdi/pin_auth/v1_1/IExecutor.idl new file mode 100644 index 00000000..39dfc025 --- /dev/null +++ b/zh-cn/device_api/hdi/pin_auth/v1_1/IExecutor.idl @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief 提供口令认证驱动的标准API接口。 + * + * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, + * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 4.0 + */ + +/** + * @file IExecutor.idl + * + * @brief 定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 4.0 + */ + +package ohos.hdi.pin_auth.v1_1; + +import ohos.hdi.pin_auth.v1_0.IExecutor; +import ohos.hdi.pin_auth.v1_1.PinAuthTypes; +import ohos.hdi.pin_auth.v1_1.IExecutorCallback; + +/** + * @brief 定义执行器标准API接口。接口可用于获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 4.0 + * @version 1.1 + */ + +interface IExecutor extends ohos.hdi.pin_auth.v1_0.IExecutor { + /** + * @brief 获取属性。 + * + * @param templateIdList 标识需要处理的模板。 + * @param propertyTypes 标识需要获取的属性类型{@link GetPropertyType}。 + * @param property 标识获取的属性{@link Property}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetProperty([in] unsigned long[] templateIdList, [in] enum GetPropertyType[] propertyTypes, [out] struct Property property); + /** + * @brief 注册口令。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + EnrollV1_1([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 认证口令。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param templateId 指定要认证的模版ID。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + AuthenticateV1_1([in] unsigned long scheduleId, [in] unsigned long templateId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/pin_auth/v1_1/IExecutorCallback.idl b/zh-cn/device_api/hdi/pin_auth/v1_1/IExecutorCallback.idl new file mode 100644 index 00000000..a5174120 --- /dev/null +++ b/zh-cn/device_api/hdi/pin_auth/v1_1/IExecutorCallback.idl @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief 提供口令认证驱动的标准API接口。 + * + * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, + * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 4.0 + */ + +/** + * @file IExecutorCallback.idl + * + * @brief 定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。 + * + * @since 4.0 + */ + +package ohos.hdi.pin_auth.v1_1; + +import ohos.hdi.pin_auth.v1_0.IExecutorCallback; + +/** + * @brief 定义异步API接口回调,用于返回异步接口的请求处理结果和获取信息。使用细节见{@link IExecutor}。 + * + * @since 4.0 + * @version 1.1 + */ +[callback] interface IExecutorCallback extends ohos.hdi.pin_auth.v1_0.IExecutorCallback { + /** + * @brief 定义请求获取口令数据回调函数。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的口令调度过程。 + * @param algoParameter 算法相关参数。 + * @param authSubType 口令子类型,如六位数字PIN码等。 + * @param algoVersion 算法版本。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OnGetDataV1_1([in] unsigned long scheduleId, [in] unsigned char[] algoParameter, [in] unsigned long authSubType, [in] unsigned int algoVersion); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/pin_auth/v1_1/IPinAuthInterface.idl b/zh-cn/device_api/hdi/pin_auth/v1_1/IPinAuthInterface.idl new file mode 100644 index 00000000..68968587 --- /dev/null +++ b/zh-cn/device_api/hdi/pin_auth/v1_1/IPinAuthInterface.idl @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief 提供口令认证驱动的标准API接口。 + * + * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, + * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 4.0 + */ + +/** + * @file IPinAuthInterface.idl + * + * @brief 定义获取口令认证驱动的执行器列表接口,用于从口令认证驱动获取执行器对象列表。 + * + * @since 4.0 + */ + +package ohos.hdi.pin_auth.v1_1; + +import ohos.hdi.pin_auth.v1_0.IPinAuthInterface; +import ohos.hdi.pin_auth.v1_1.IExecutor; + +/** + * @brief 定义获取口令认证驱动的执行器列表接口。 + * + * @since 4.0 + * @version 1.1 + */ +interface IPinAuthInterface extends ohos.hdi.pin_auth.v1_0.IPinAuthInterface { + /** + * @brief 获取执行器列表,口令认证服务进程启动进行初始化操作时通过该接口获取口令认证驱动支持的执行器列表。 + * + * @param executorList 执行器对象列表{@link IExecutor}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetExecutorListV1_1([out] IExecutor[] executorList); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/pin_auth/v1_1/PinAuthTypes.idl b/zh-cn/device_api/hdi/pin_auth/v1_1/PinAuthTypes.idl new file mode 100644 index 00000000..45c00888 --- /dev/null +++ b/zh-cn/device_api/hdi/pin_auth/v1_1/PinAuthTypes.idl @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief 提供口令认证驱动的标准API接口。 + * + * 口令认证驱动为口令认证服务提供统一的访问接口。获取口令认证驱动代理后,口令认证服务可以调用相关接口获取执行器,获取口令认证执行器后, + * 口令认证服务可以调用相关接口获取执行器信息,获取凭据模版信息,注册口令,认证口令,删除口令等。 + * + * @since 4.0 + */ + +/** + * @file PinAuthTypes.idl + * + * @brief 定义口令认证驱动的枚举类和数据结构。 + * + * @since 4.0 + */ + +package ohos.hdi.pin_auth.v1_1; + +/** + * @brief 获取执行器属性信息。 + * + * @since 4.0 + * @version 1.1 + */ +enum GetPropertyType : int { + /** 获取执行器的认证子类型。 */ + AUTH_SUB_TYPE = 1, + /** 获取执行器的剩余锁定时间。 */ + LOCKOUT_DURATION = 2, + /** 获取执行器的剩余可重试次数。 */ + REMAIN_ATTEMPTS = 3 +}; + +/** + * @brief 执行器属性。 + * + * @since 4.0 + * @version 1.1 + */ +struct Property { + /** 认证子类型。 */ + unsigned long authSubType; + /** 剩余锁定时间。 */ + int lockoutDuration; + /** 剩余可重试次数。 */ + int remainAttempts; +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/user_auth/IUserAuthInterface.idl b/zh-cn/device_api/hdi/user_auth/v1_0/IUserAuthInterface.idl old mode 100755 new mode 100644 similarity index 89% rename from zh-cn/device_api/hdi/user_auth/IUserAuthInterface.idl rename to zh-cn/device_api/hdi/user_auth/v1_0/IUserAuthInterface.idl index 3a1061d3..cf261306 --- a/zh-cn/device_api/hdi/user_auth/IUserAuthInterface.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_0/IUserAuthInterface.idl @@ -1,342 +1,285 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdfUserAuth - * @{ - * - * @brief 提供用户认证驱动的标准API接口。 - * - * 用户认证驱动为用户认证服务提供统一的访问接口。获取用户认证驱动代理后,用户认证服务可以调用相关接口注册执行器,管理用户认证凭据, - * 完成PIN码和生物特征认证。 - * - * @since 3.2 - */ - -/** - * @file IUserAuthInterface.idl - * - * @brief 声明用户认证驱动的API接口。接口可用于注册执行器,管理用户认证凭据,完成PIN码和生物特征认证。 - * - * @since 3.2 - */ - -package ohos.hdi.user_auth.v1_0; - -import ohos.hdi.user_auth.v1_0.UserAuthTypes; - -/** - * @brief 声明用户认证驱动的API接口。 - * - * @since 3.2 - * @version 1.0 - */ -interface IUserAuthInterface { - /** - * @brief 初始化用户认证驱动缓存信息,用于用户认证框架进程启动时初始化信息。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Init(); - /** - * @brief 添加认证执行器来获取认证能力,用于各认证基础服务如口令认证服务等将认证能力对接到用户认证框架。 - * - * @param info 执行器注册信息{@link ExecutorRegisterInfo}。 - * @param index 用户认证框架的执行器索引。 - * @param publicKey 用户认证框架公钥。 - * @param templateIds 该执行器已注册的模版ID列表。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - AddExecutor([in] struct ExecutorRegisterInfo info, [out] unsigned long index, - [out] unsigned char[] publicKey, [out] unsigned long[] templateIds); - /** - * @brief 删除执行器,用于清理失效的执行器信息。 - * - * @param index 用户认证框架的执行器索引。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - DeleteExecutor([in] unsigned long index); - /** - * @brief 开启一个认证凭据管理会话,用于在请求管理用户认证凭据前获取有效挑战值。 - * - * @param userId 用户ID。 - * @param challenge 随机挑战值,用于生成用户身份认证令牌。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - OpenSession([in] int userId, [out] unsigned char[] challenge); - /** - * @brief 关闭认证凭据管理会话,完成用户认证凭据管理请求处理后,调用该接口使原挑战值失效。 - * - * @param userId 用户ID。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - CloseSession([in] int userId); - /** - * @brief 开始注册用户认证凭据。当注册凭据类型为口令且该用户已经注册了口令凭据时,将会更新口令凭据。 - * - * @param userId 用户ID。 - * @param authToken 用户口令认证令牌。 - * @param param 注册凭据参数{@link EnrollParam}。 - * @param info 调度信息{@link ScheduleInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - BeginEnrollment([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, - [out] struct ScheduleInfo info); - /** - * @brief 更新用户凭据注册结果,完成凭据注册。 - * - * @param userId 用户ID。 - * @param scheduleResult 执行器签发的注册结果。 - * @param info 录入结果信息{@link EnrollResultInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - UpdateEnrollmentResult([in] int userId, [in] unsigned char[] scheduleResult, [out] struct EnrollResultInfo info); - /** - * @brief 取消注册请求。 - * - * @param userId 用户ID。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - CancelEnrollment([in] int userId); - /** - * @brief 删除用户凭据信息。 - * - * @param userId 用户ID。 - * @param credentialId 凭据ID。 - * @param authToken 用户口令认证令牌。 - * @param info 删除的凭据信息{@link CredentialInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - DeleteCredential([in] int userId, [in] unsigned long credentialId, [in] unsigned char[] authToken, - [out] struct CredentialInfo info); - /** - * @brief 查询用户凭据信息。 - * - * @param userId 用户ID。 - * @param authType 凭据类型{@link AuthType}。 - * @param infos 凭据信息{@link CredentialInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetCredential([in] int userId, [in] enum AuthType authType, [out] struct CredentialInfo[] infos); - /** - * @brief 查询用户认证相关信息。 - * - * @param userId 用户ID。 - * @param secureUid 安全用户ID。 - * @param pinSubType 口令认证子类型{@link PinSubType}。 - * @param infos 注册信息{@link EnrolledInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetUserInfo([in] int userId, [out] unsigned long secureUid, [out] enum PinSubType pinSubType, - [out] struct EnrolledInfo[] infos); - /** - * @brief 删除用户口令认证凭据,在用户IAM系统内删除该用户,该请求由用户触发。 - * - * @param userId 用户ID。 - * @param authToken 用户口令认证令牌。 - * @param deletedInfos 删除的凭据信息{@link CredentialInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - DeleteUser([in] int userId, [in] unsigned char[] authToken, [out] struct CredentialInfo[] deletedInfos); - /** - * @brief 强制删除用户,该请求由系统内管理用户的模块触发。 - * - * @param userId 用户ID。 - * @param deletedInfos 删除的凭据信息{@link CredentialInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - EnforceDeleteUser([in] int userId, [out] struct CredentialInfo[] deletedInfos); - /** - * @brief 开始认证用户,并生成认证方案。 - * - * @param contextId 上下文索引。 - * @param param 认证方案{@link AuthSolution}。 - * @param scheduleInfos 调度信息{@link ScheduleInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - BeginAuthentication([in] unsigned long contextId, [in] struct AuthSolution param, - [out] struct ScheduleInfo[] scheduleInfos); - /** - * @brief 更新认证结果,评估认证方案的认证结果。 - * - * @param contextId 上下文索引。 - * @param scheduleResult 执行器签发的认证结果。 - * @param info 认证结果信息{@link AuthResultInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - UpdateAuthenticationResult([in] unsigned long contextId, [in] unsigned char[] scheduleResult, - [out] struct AuthResultInfo info); - /** - * @brief 取消用户认证请求。 - * - * @param contextId 上下文索引。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - CancelAuthentication([in] unsigned long contextId); - /** - * @brief 开始用户身份识别,并生成识别方案。 - * - * @param contextId 上下文索引。 - * @param authType 用户身份识别类型@{AuthType}。 - * @param challenge 随机挑战值,用于生成用户身份识别令牌,防止重放。 - * @param executorSensorHint 执行器传感器提示,用于找到对应认证方式的传感器。 - * @param scheduleInfo 调度信息{@link ScheduleInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - BeginIdentification([in] unsigned long contextId, [in] enum AuthType authType, [in] unsigned char[] challenge, - [in] unsigned int executorSensorHint, [out] struct ScheduleInfo scheduleInfo); - /** - * @brief 更新用户身份识别结果,生成身份识别方案的结果。 - * - * @param contextId 上下文索引。 - * @param scheduleResult 执行器签发的用户身份识别结果。 - * @param info 用户身份识别结果{@link IdentifyResultInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - UpdateIdentificationResult([in] unsigned long contextId, [in] unsigned char[] scheduleResult, - [out] struct IdentifyResultInfo info); - /** - * @brief 取消用户身份识别请求。 - * - * @param contextId 上下文索引。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - CancelIdentification([in] unsigned long contextId); - /** - * @brief 获取当前认证类型的认证结果可信等级。 - * - * @param userId 用户ID。 - * @param authType 认证类型{@link AuthType}。 - * @param authTrustLevel 认证结果可信等级。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetAuthTrustLevel([in] int userId, [in] enum AuthType authType, [out] unsigned int authTrustLevel); - /** - * @brief 获取指定认证结果可信等级下有效的认证方式。 - * - * @param userId 用户ID。 - * @param authTypes 用于筛选的认证方式列表{@link AuthType}。 - * @param authTrustLevel 认证结果可信等级。 - * @param validTypes 有效的认证方式列表{@link AuthType}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetValidSolution([in] int userId, [in] enum AuthType[] authTypes, [in] unsigned int authTrustLevel, - [out] enum AuthType[] validTypes); -} -/** @} */ \ No newline at end of file +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfUserAuth + * @{ + * + * @brief 提供用户认证驱动的标准API接口。 + * + * 用户认证驱动为用户认证服务提供统一的访问接口。获取用户认证驱动代理后,用户认证服务可以调用相关接口注册执行器,管理用户认证凭据, + * 完成PIN码和生物特征认证。 + * + * @since 3.2 + */ + +/** + * @file IUserAuthInterface.idl + * + * @brief 声明用户认证驱动的API接口。接口可用于注册执行器,管理用户认证凭据,完成PIN码和生物特征认证。 + * + * @since 3.2 + */ + +package ohos.hdi.user_auth.v1_0; + +import ohos.hdi.user_auth.v1_0.UserAuthTypes; + +/** + * @brief 声明用户认证驱动的API接口。 + * + * @since 3.2 + * @version 1.0 + */ +interface IUserAuthInterface { + /** + * @brief 初始化用户认证驱动缓存信息,用于用户认证框架进程启动时初始化信息。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Init(); + /** + * @brief 添加认证执行器来获取认证能力,用于各认证基础服务如口令认证服务等将认证能力对接到用户认证框架。 + * + * @param info 执行器注册信息{@link ExecutorRegisterInfo}。 + * @param index 用户认证框架的执行器索引。 + * @param publicKey 用户认证框架公钥。 + * @param templateIds 该执行器已注册的模版ID列表。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + AddExecutor([in] struct ExecutorRegisterInfo info, [out] unsigned long index, + [out] unsigned char[] publicKey, [out] unsigned long[] templateIds); + /** + * @brief 删除执行器,用于清理失效的执行器信息。 + * + * @param index 用户认证框架的执行器索引。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + DeleteExecutor([in] unsigned long index); + /** + * @brief 开启一个认证凭据管理会话,用于在请求管理用户认证凭据前获取有效挑战值。 + * + * @param userId 用户ID。 + * @param challenge 随机挑战值,用于生成用户身份认证令牌。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OpenSession([in] int userId, [out] unsigned char[] challenge); + /** + * @brief 关闭认证凭据管理会话,完成用户认证凭据管理请求处理后,调用该接口使原挑战值失效。 + * + * @param userId 用户ID。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + CloseSession([in] int userId); + /** + * @brief 开始注册用户认证凭据。当注册凭据类型为口令且该用户已经注册了口令凭据时,将会更新口令凭据。 + * + * @param userId 用户ID。 + * @param authToken 用户口令认证令牌。 + * @param param 注册凭据参数{@link EnrollParam}。 + * @param info 调度信息{@link ScheduleInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @deprecated + */ + BeginEnrollment([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, + [out] struct ScheduleInfo info); + /** + * @brief 更新用户凭据注册结果,完成凭据注册。 + * + * @param userId 用户ID。 + * @param scheduleResult 执行器签发的注册结果。 + * @param info 录入结果信息{@link EnrollResultInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + UpdateEnrollmentResult([in] int userId, [in] unsigned char[] scheduleResult, [out] struct EnrollResultInfo info); + /** + * @brief 取消注册请求。 + * + * @param userId 用户ID。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + CancelEnrollment([in] int userId); + /** + * @brief 删除用户凭据信息。 + * + * @param userId 用户ID。 + * @param credentialId 凭据ID。 + * @param authToken 用户口令认证令牌。 + * @param info 删除的凭据信息{@link CredentialInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + DeleteCredential([in] int userId, [in] unsigned long credentialId, [in] unsigned char[] authToken, + [out] struct CredentialInfo info); + /** + * @brief 查询用户凭据信息。 + * + * @param userId 用户ID。 + * @param authType 凭据类型{@link AuthType}。 + * @param infos 凭据信息{@link CredentialInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetCredential([in] int userId, [in] enum AuthType authType, [out] struct CredentialInfo[] infos); + /** + * @brief 查询用户认证相关信息。 + * + * @param userId 用户ID。 + * @param secureUid 安全用户ID。 + * @param pinSubType 口令认证子类型{@link PinSubType}。 + * @param infos 注册信息{@link EnrolledInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetUserInfo([in] int userId, [out] unsigned long secureUid, [out] enum PinSubType pinSubType, + [out] struct EnrolledInfo[] infos); + /** + * @brief 删除用户口令认证凭据,在用户IAM系统内删除该用户,该请求由用户触发。 + * + * @param userId 用户ID。 + * @param authToken 用户口令认证令牌。 + * @param deletedInfos 删除的凭据信息{@link CredentialInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + DeleteUser([in] int userId, [in] unsigned char[] authToken, [out] struct CredentialInfo[] deletedInfos); + /** + * @brief 强制删除用户,该请求由系统内管理用户的模块触发。 + * + * @param userId 用户ID。 + * @param deletedInfos 删除的凭据信息{@link CredentialInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + EnforceDeleteUser([in] int userId, [out] struct CredentialInfo[] deletedInfos); + /** + * @brief 开始认证用户,并生成认证方案。 + * + * @param contextId 上下文索引。 + * @param param 认证方案{@link AuthSolution}。 + * @param scheduleInfos 调度信息{@link ScheduleInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @deprecated + */ + BeginAuthentication([in] unsigned long contextId, [in] struct AuthSolution param, + [out] struct ScheduleInfo[] scheduleInfos); + /** + * @brief 更新认证结果,评估认证方案的认证结果。 + * + * @param contextId 上下文索引。 + * @param scheduleResult 执行器签发的认证结果。 + * @param info 认证结果信息{@link AuthResultInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + UpdateAuthenticationResult([in] unsigned long contextId, [in] unsigned char[] scheduleResult, + [out] struct AuthResultInfo info); + /** + * @brief 取消用户认证请求。 + * + * @param contextId 上下文索引。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + CancelAuthentication([in] unsigned long contextId); + /** + * @brief 开始用户身份识别,并生成识别方案。 + * + * @param contextId 上下文索引。 + * @param authType 用户身份识别类型@{AuthType}。 + * @param challenge 随机挑战值,用于生成用户身份识别令牌,防止重放。 + * @param executorSensorHint 执行器传感器提示,用于找到对应认证方式的传感器。 + * @param scheduleInfo 调度信息{@link ScheduleInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @deprecated + */ + BeginIdentification([in] unsigned long contextId, [in] enum AuthType authType, [in] unsigned char[] challenge, + [in] unsigned int executorSensorHint, [out] struct ScheduleInfo scheduleInfo); + /** + * @brief 更新用户身份识别结果,生成身份识别方案的结果。 + * + * @param contextId 上下文索引。 + * @param scheduleResult 执行器签发的用户身份识别结果。 + * @param info 用户身份识别结果{@link IdentifyResultInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + UpdateIdentificationResult([in] unsigned long contextId, [in] unsigned char[] scheduleResult, + [out] struct IdentifyResultInfo info); + /** + * @brief 取消用户身份识别请求。 + * + * @param contextId 上下文索引。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + CancelIdentification([in] unsigned long contextId); + /** + * @brief 获取当前认证类型的认证结果可信等级。 + * + * @param userId 用户ID。 + * @param authType 认证类型{@link AuthType}。 + * @param authTrustLevel 认证结果可信等级。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetAuthTrustLevel([in] int userId, [in] enum AuthType authType, [out] unsigned int authTrustLevel); + /** + * @brief 获取指定认证结果可信等级下有效的认证方式。 + * + * @param userId 用户ID。 + * @param authTypes 用于筛选的认证方式列表{@link AuthType}。 + * @param authTrustLevel 认证结果可信等级。 + * @param validTypes 有效的认证方式列表{@link AuthType}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetValidSolution([in] int userId, [in] enum AuthType[] authTypes, [in] unsigned int authTrustLevel, + [out] enum AuthType[] validTypes); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/user_auth/UserAuthTypes.idl b/zh-cn/device_api/hdi/user_auth/v1_0/UserAuthTypes.idl old mode 100755 new mode 100644 similarity index 91% rename from zh-cn/device_api/hdi/user_auth/UserAuthTypes.idl rename to zh-cn/device_api/hdi/user_auth/v1_0/UserAuthTypes.idl index aae9eb95..e48dfbf6 --- a/zh-cn/device_api/hdi/user_auth/UserAuthTypes.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_0/UserAuthTypes.idl @@ -1,286 +1,301 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /** - * @addtogroup HdfUserAuth - * @{ - * - * @brief 提供用户认证驱动的标准API接口。 - * - * 用户认证驱动为用户认证服务提供统一的访问接口。 - * - * @since 3.2 - */ - - /** - * @file UserAuthTypes.idl - * - * @brief 定义用户认证驱动的枚举类和数据结构。 - * - * @since 3.2 - */ - -package ohos.hdi.user_auth.v1_0; - - /** - * @brief 枚举用户认证凭据类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AuthType : int { - /** 表示包含所有认证凭据类型。 */ - ALL = 0, - /** 认证凭据类型为口令。 */ - PIN = 1, - /** 认证凭据类型为人脸。 */ - FACE = 2, - /** 认证凭据类型为指纹。 */ - FINGERPRINT = 4, -}; - -/** - * @brief 枚举执行器角色。 - * - * @since 3.2 - * @version 1.0 - */ -enum ExecutorRole : int { - /** 执行器角色为采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 */ - COLLECTOR = 1, - /** 执行器角色为认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 */ - VERIFIER = 2, - /** 执行器角色为全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 */ - ALL_IN_ONE = 3, -}; - -/** - * @brief 枚举执行器安全等级。 - * - * @since 3.2 - * @version 1.0 - */ -enum ExecutorSecureLevel : int { - /** 执行器安全级别为0,关键操作在无访问控制执行环境中完成。 */ - ESL0 = 0, - /** 执行器安全级别为1,关键操作在有访问控制的执行环境中完成。 */ - ESL1 = 1, - /** 执行器安全级别为2,关键操作在可信执行环境中完成。 */ - ESL2 = 2, - /** 执行器安全级别为3,关键操作在高安环境如独立安全芯片中完成。 */ - ESL3 = 3, -}; - -/** - * @brief 口令认证子类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum PinSubType : int { - PIN_SIX = 10000, /**< 六位口令密码。 */ - PIN_NUMBER = 10001, /**< 数字口令密码。 */ - PIN_MIX = 10002, /**< 混合密码。 */ -}; - -/** - * @brief 执行器注册信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct ExecutorRegisterInfo { - /** 用户认证凭据类型@{AuthType}。 */ - enum AuthType authType; - /** 执行器角色@{ExecutorRole}。 */ - enum ExecutorRole executorRole; - /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ - unsigned int executorSensorHint; - /** 执行器匹配器,根据执行器支持的认证能力进行分类。 */ - unsigned int executorMatcher; - /** 执行器安全等级@{ExecutorSecureLevel}。 */ - enum ExecutorSecureLevel esl; - /** 执行器公钥,用于校验该执行器私钥签名的信息。 */ - unsigned char[] publicKey; -}; - -/** - * @brief 执行器信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct ExecutorInfo { - /** 用户认证框架的执行器索引。 */ - unsigned long executorIndex; - /** 执行器注册信息@{ExecutorRegisterInfo}。 */ - struct ExecutorRegisterInfo info; -}; - -/** - * @brief 调度信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct ScheduleInfo { - /** 调度ID,用于标识一次操作请求的执行器调度过程。 */ - unsigned long scheduleId; - /** 模版id列表。 */ - unsigned long[] templateIds; - /** 用户认证凭据类型@{AuthType}。 */ - enum AuthType authType; - /** 执行器匹配器。 */ - unsigned int executorMatcher; - /** 调度模式,支持注册、认证和识别模式。 */ - unsigned int scheduleMode; - /** 执行器信息列表@{ExecutorInfo}。 */ - struct ExecutorInfo[] executors; -}; - -/** - * @brief 认证方案。 - * - * @since 3.2 - * @version 1.0 - */ -struct AuthSolution { - /** 用户ID。 */ - int userId; - /** 认证结果可信等级。 */ - unsigned int authTrustLevel; - /** 用户认证凭据类型@{AuthType}。 */ - enum AuthType authType; - /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ - unsigned int executorSensorHint; - /** 挑战值,用于签发认证令牌。 */ - unsigned char[] challenge; -}; - -/** - * @brief 执行器发送的消息。 - * - * @since 3.2 - * @version 1.0 - */ -struct ExecutorSendMsg { - /** 用户认证框架的执行器索引。 */ - unsigned long executorIndex; - /** 消息命令ID。 */ - int commandId; - /** 执行器发送的消息。 */ - unsigned char[] msg; -}; - -/** - * @brief 用户身份认证结果信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct AuthResultInfo { - /** 用户身份认证结果。 */ - unsigned int result; - /** 认证方式被冻结的时间。 */ - int freezingTime; - /** 认证方式距离被冻结的可处理认证请求次数。 */ - int remainTimes; - /** 执行器发送的消息。 */ - struct ExecutorSendMsg[] msgs; - /** 用户身份认证令牌。 */ - unsigned char[] token; - /** 保护文件加密密钥的密钥。 */ - unsigned char[] rootSecret; -}; - -/** - * @brief 用户身份识别结果信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct IdentifyResultInfo { - /** 用户身份识别结果。 */ - int result; - /** 用户ID。 */ - int userId; - /** 用户身份识别令牌。 */ - unsigned char[] token; -}; - -/** - * @brief 注册认证凭据参数。 - * - * @since 3.2 - * @version 1.0 - */ -struct EnrollParam { - /** 用户认证凭据类型@{AuthType}。 */ - enum AuthType authType; - /** 执行器类型。 */ - unsigned int executorType; - /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ - unsigned int executorSensorHint; -}; - -/** - * @brief 认证凭据信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct CredentialInfo { - /** 认证凭据ID。 */ - unsigned long credentialId; - /** 用户认证框架的执行器索引。 */ - unsigned long index; - /** 认证凭据模版ID。 */ - unsigned long templateId; - /** 用户认证凭据类型@{AuthType}。 */ - enum AuthType authType; - /** 执行器匹配器。 */ - unsigned int executorMatcher; - /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ - unsigned int executorSensorHint; -}; - -/** - * @brief 注册信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct EnrolledInfo { - /** 注册ID,用户注册新的认证凭据时会更新注册ID。 */ - unsigned long enrolledId; - /** 用户认证凭据类型@{AuthType}。 */ - enum AuthType authType; -}; - -/** - * @brief 录入结果信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct EnrollResultInfo { - /** 认证凭据ID */ - unsigned long credentialId; - /** 旧凭据信息{@link CredentialInfo}。 */ - struct CredentialInfo oldInfo; - /** 保护文件加密密钥的密钥。 */ - unsigned char[] rootSecret; -}; +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup HdfUserAuth + * @{ + * + * @brief 提供用户认证驱动的标准API接口。 + * + * 用户认证驱动为用户认证服务提供统一的访问接口。 + * + * @since 3.2 + */ + + /** + * @file UserAuthTypes.idl + * + * @brief 定义用户认证驱动的枚举类和数据结构。 + * + * @since 3.2 + */ + +package ohos.hdi.user_auth.v1_0; + + /** + * @brief 枚举用户认证凭据类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum AuthType : int { + /** 表示包含所有认证凭据类型。 */ + ALL = 0, + /** 认证凭据类型为口令。 */ + PIN = 1, + /** 认证凭据类型为人脸。 */ + FACE = 2, + /** 认证凭据类型为指纹。 */ + FINGERPRINT = 4, +}; + +/** + * @brief 枚举执行器角色。 + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorRole : int { + /** 执行器角色为采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 */ + COLLECTOR = 1, + /** 执行器角色为认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 */ + VERIFIER = 2, + /** 执行器角色为全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 */ + ALL_IN_ONE = 3, +}; + +/** + * @brief 枚举执行器安全等级。 + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorSecureLevel : int { + /** 执行器安全级别为0,关键操作在无访问控制执行环境中完成。 */ + ESL0 = 0, + /** 执行器安全级别为1,关键操作在有访问控制的执行环境中完成。 */ + ESL1 = 1, + /** 执行器安全级别为2,关键操作在可信执行环境中完成。 */ + ESL2 = 2, + /** 执行器安全级别为3,关键操作在高安环境如独立安全芯片中完成。 */ + ESL3 = 3, +}; + +/** + * @brief 口令认证子类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum PinSubType : int { + PIN_SIX = 10000, /** 六位口令密码。 */ + PIN_NUMBER = 10001, /** 数字口令密码。 */ + PIN_MIX = 10002, /** 混合密码。 */ +}; + +/** + * @brief 调度模式。 + * + * @since 3.2 + * @version 1.0 + */ +enum ScheduleMode : int { + /** 录入模式。 */ + ENROLL = 0, + /** 认证模式。 */ + AUTH = 1, + /** 识别模式。 */ + IDENTIFY = 2, +}; + +/** + * @brief 执行器注册信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct ExecutorRegisterInfo { + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器角色@{ExecutorRole}。 */ + enum ExecutorRole executorRole; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ + unsigned int executorSensorHint; + /** 执行器匹配器,根据执行器支持的认证能力进行分类。 */ + unsigned int executorMatcher; + /** 执行器安全等级@{ExecutorSecureLevel}。 */ + enum ExecutorSecureLevel esl; + /** 执行器公钥,用于校验该执行器私钥签名的信息。 */ + unsigned char[] publicKey; +}; + +/** + * @brief 执行器信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct ExecutorInfo { + /** 用户认证框架的执行器索引。 */ + unsigned long executorIndex; + /** 执行器注册信息@{ExecutorRegisterInfo}。 */ + struct ExecutorRegisterInfo info; +}; + +/** + * @brief 调度信息。 + * + * @since 3.2 + * @version 1.0 + * + * @deprecated + */ +struct ScheduleInfo { + /** 调度ID,用于标识一次操作请求的执行器调度过程。 */ + unsigned long scheduleId; + /** 模版id列表。 */ + unsigned long[] templateIds; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器匹配器。 */ + unsigned int executorMatcher; + /** 调度模式@{scheduleMode}*/ + unsigned int scheduleMode; + /** 执行器信息列表@{ExecutorInfo}。 */ + struct ExecutorInfo[] executors; +}; + +/** + * @brief 认证方案。 + * + * @since 3.2 + * @version 1.0 + */ +struct AuthSolution { + /** 用户ID。 */ + int userId; + /** 认证结果可信等级。 */ + unsigned int authTrustLevel; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ + unsigned int executorSensorHint; + /** 挑战值,用于签发认证令牌。 */ + unsigned char[] challenge; +}; + +/** + * @brief 执行器发送的消息。 + * + * @since 3.2 + * @version 1.0 + */ +struct ExecutorSendMsg { + /** 用户认证框架的执行器索引。 */ + unsigned long executorIndex; + /** 消息命令ID。 */ + int commandId; + /** 执行器发送的消息。 */ + unsigned char[] msg; +}; + +/** + * @brief 用户身份认证结果信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct AuthResultInfo { + /** 用户身份认证结果。 */ + int result; + /** 认证方式被冻结的时间。 */ + int lockoutDuration; + /** 认证方式距离被冻结的可处理认证请求次数。 */ + int remainAttempts; + /** 执行器发送的消息 @{ExecutorSendMsg}. */ + struct ExecutorSendMsg[] msgs; + /** 用户身份认证令牌。 */ + unsigned char[] token; + /** 保护文件加密密钥的密钥。 */ + unsigned char[] rootSecret; +}; + +/** + * @brief 用户身份识别结果信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct IdentifyResultInfo { + /** 用户身份识别结果。 */ + int result; + /** 用户ID。 */ + int userId; + /** 用户身份识别令牌。 */ + unsigned char[] token; +}; + +/** + * @brief 注册认证凭据参数。 + * + * @since 3.2 + * @version 1.0 + */ +struct EnrollParam { + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ + unsigned int executorSensorHint; +}; + +/** + * @brief 认证凭据信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct CredentialInfo { + /** 认证凭据ID。 */ + unsigned long credentialId; + /** 用户认证框架的执行器索引。 */ + unsigned long executorIndex; + /** 认证凭据模版ID。 */ + unsigned long templateId; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器匹配器。 */ + unsigned int executorMatcher; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ + unsigned int executorSensorHint; +}; + +/** + * @brief 注册信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct EnrolledInfo { + /** 注册ID,用户注册新的认证凭据时会更新注册ID。 */ + unsigned long enrolledId; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; +}; + +/** + * @brief 录入结果信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct EnrollResultInfo { + /** 认证凭据ID */ + unsigned long credentialId; + /** 旧凭据信息{@link CredentialInfo}。 */ + struct CredentialInfo oldInfo; + /** 保护文件加密密钥的密钥。 */ + unsigned char[] rootSecret; +}; /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/user_auth/v1_1/IUserAuthInterface.idl b/zh-cn/device_api/hdi/user_auth/v1_1/IUserAuthInterface.idl new file mode 100644 index 00000000..24776249 --- /dev/null +++ b/zh-cn/device_api/hdi/user_auth/v1_1/IUserAuthInterface.idl @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfUserAuth + * @{ + * + * @brief 提供用户认证驱动的标准API接口。 + * + * 用户认证驱动为用户认证服务提供统一的访问接口。获取用户认证驱动代理后,用户认证服务可以调用相关接口注册执行器,管理用户认证凭据, + * 完成PIN码和生物特征认证。 + * + * @since 4.0 + */ + +/** + * @file IUserAuthInterface.idl + * + * @brief 声明用户认证驱动的API接口。接口可用于注册执行器,管理用户认证凭据,完成PIN码和生物特征认证。 + * + * @since 4.0 + */ + +package ohos.hdi.user_auth.v1_1; + +import ohos.hdi.user_auth.v1_0.UserAuthTypes; +import ohos.hdi.user_auth.v1_0.IUserAuthInterface; +import ohos.hdi.user_auth.v1_1.UserAuthTypes; + +/** + * @brief 声明用户认证驱动的API接口。 + * + * @since 4.0 + * @version 1.1 + */ +interface IUserAuthInterface extends ohos.hdi.user_auth.v1_0.IUserAuthInterface { + /** + * @brief 开始注册用户认证凭据。当注册凭据类型为口令且该用户已经注册了口令凭据时,将会更新口令凭据。 + * + * @param userId 用户ID。 + * @param authToken 用户口令认证令牌。 + * @param param 注册凭据参数{@link EnrollParam}。 + * @param info 调度信息{@link ScheduleInfoV1_1}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + BeginEnrollmentV1_1([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, + [out] struct ScheduleInfoV1_1 info); + /** + * @brief 开始认证用户,并生成认证方案。 + * + * @param contextId 上下文索引。 + * @param param 认证方案{@link AuthSolution}。 + * @param scheduleInfos 调度信息{@link ScheduleInfoV1_1}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + BeginAuthenticationV1_1([in] unsigned long contextId, [in] struct AuthSolution param, + [out] struct ScheduleInfoV1_1[] scheduleInfos); + /** + * @brief 开始用户身份识别,并生成识别方案。 + * + * @param contextId 上下文索引。 + * @param authType 用户身份识别类型@{AuthType}。 + * @param challenge 随机挑战值,用于生成用户身份识别令牌,防止重放。 + * @param executorSensorHint 执行器传感器提示,用于找到对应认证方式的传感器,值为0时表示没有指定传感器。 + * @param scheduleInfo 调度信息{@link ScheduleInfoV1_1}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + BeginIdentificationV1_1([in] unsigned long contextId, [in] enum AuthType authType, [in] unsigned char[] challenge, + [in] unsigned int executorSensorHint, [out] struct ScheduleInfoV1_1 scheduleInfo); + /** + * @brief 获取所有用户信息. + * + * @param userInfos 用户信息列表@{UserInfo}. + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetAllUserInfo([out] UserInfo[] userInfos); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl b/zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl new file mode 100644 index 00000000..fb96aee8 --- /dev/null +++ b/zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup HdfUserAuth + * @{ + * + * @brief 提供用户认证驱动的标准API接口。 + * + * 用户认证驱动为用户认证服务提供统一的访问接口。 + + * + * @since 4.0 + */ + + /** + * @file UserAuthTypes.idl + * + * @brief 定义用户认证驱动的枚举类和数据结构。 + * + * @since 4.0 + */ + +package ohos.hdi.user_auth.v1_1; + +import ohos.hdi.user_auth.v1_0.UserAuthTypes; + +/** + * @brief 调度信息。 + * + * @since 4.0 + * @version 1.1 + */ +struct ScheduleInfoV1_1 { + /** 调度ID,用于标识一次操作请求的执行器调度过程。 */ + unsigned long scheduleId; + /** 模版id列表。 */ + unsigned long[] templateIds; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器匹配器。 */ + unsigned int executorMatcher; + /** 调度模式@{scheduleMode}。 */ + unsigned int scheduleMode; + /** 执行器信息列表@{ExecutorInfo}。 */ + struct ExecutorInfo[] executors; + /** 其他相关信息,用于支持信息扩展。 */ + unsigned char[] extraInfo; +}; + +/** + * @brief 用户信息 + * + * @since 4.0 + * @version 1.1 + */ +struct UserInfo { + /** 用户的SecureUid。 */ + unsigned long secureUid; + /** 用户的口令认证子类型@{@PinSubType}。 */ + enum PinSubType pinSubType; + /** 用户的注册信息列表@{EnrolledInfo}。 */ + struct EnrolledInfo[] enrolledInfos; +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl b/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl new file mode 100644 index 00000000..2cab5479 --- /dev/null +++ b/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfUserAuth + * @{ + * + * @brief 提供用户认证驱动的标准API接口。 + * + * 用户认证驱动为用户认证服务提供统一的访问接口。获取用户认证驱动代理后,用户认证服务可以调用相关接口注册执行器,管理用户认证凭据, + * 完成PIN码和生物特征认证。 + * + * @since 4.1 + */ + +/** + * @file IUserAuthInterface.idl + * + * @brief 声明用户认证驱动的API接口。接口可用于注册执行器,管理用户认证凭据,完成PIN码和生物特征认证。 + + * + * @since 4.1 + */ + +package ohos.hdi.user_auth.v1_2; + +import ohos.hdi.user_auth.v1_2.UserAuthTypes; + +/** + * @brief 声明用户认证驱动的API接口。 + * + * @since 4.1 + * @version 1.2 + */ +interface IUserAuthInterface { + /** + * @brief 初始化用户认证驱动缓存信息,用于用户认证框架进程启动时初始化信息。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Init(); + /** + * @brief 添加认证执行器来获取认证能力,用于各认证基础服务如口令认证服务等将认证能力对接到用户认证框架。 + * + * @param info 执行器注册信息{@link ExecutorRegisterInfo}。 + * @param index 用户认证框架的执行器索引。 + * @param publicKey 用户认证框架公钥。 + * @param templateIds 该执行器已注册的模版ID列表。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + AddExecutor([in] struct ExecutorRegisterInfo info, [out] unsigned long index, + [out] unsigned char[] publicKey, [out] unsigned long[] templateIds); + /** + * @brief 删除执行器,用于清理失效的执行器信息。 + * + * @param index 用户认证框架的执行器索引。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + DeleteExecutor([in] unsigned long index); + /** + * @brief 开启一个认证凭据管理会话,用于在请求管理用户认证凭据前获取有效挑战值。 + * + * @param userId 用户ID。 + * @param challenge 随机挑战值,用于生成用户身份认证令牌。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OpenSession([in] int userId, [out] unsigned char[] challenge); + /** + * @brief 关闭认证凭据管理会话,完成用户认证凭据管理请求处理后,调用该接口使原挑战值失效。 + * + * @param userId 用户ID。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + CloseSession([in] int userId); + /** + * @brief 开始注册用户认证凭据。当注册凭据类型为口令且该用户已经注册了口令凭据时,将会更新口令凭据。 + * + * @param userId 用户ID。 + * @param authToken 用户口令认证令牌。 + * @param param 注册凭据参数{@link EnrollParam}。 + * @param info 调度信息{@link ScheduleInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @deprecated + */ + BeginEnrollment([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, + [out] struct ScheduleInfo info); + /** + * @brief 更新用户凭据注册结果,完成凭据注册。 + * + * @param userId 用户ID。 + * @param scheduleResult 执行器签发的注册结果。 + * @param info 录入结果信息{@link EnrollResultInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + UpdateEnrollmentResult([in] int userId, [in] unsigned char[] scheduleResult, [out] struct EnrollResultInfo info); + /** + * @brief 取消注册请求。 + * + * @param userId 用户ID。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + CancelEnrollment([in] int userId); + /** + * @brief 删除用户凭据信息。 + * + * @param userId 用户ID。 + * @param credentialId 凭据ID。 + * @param authToken 用户口令认证令牌。 + * @param info 删除的凭据信息{@link CredentialInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + DeleteCredential([in] int userId, [in] unsigned long credentialId, [in] unsigned char[] authToken, + [out] struct CredentialInfo info); + /** + * @brief 查询用户凭据信息。 + * + * @param userId 用户ID。 + * @param authType 凭据类型{@link AuthType}。 + * @param infos 凭据信息{@link CredentialInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetCredential([in] int userId, [in] enum AuthType authType, [out] struct CredentialInfo[] infos); + /** + * @brief 查询用户认证相关信息。 + * + * @param userId 用户ID。 + * @param secureUid 安全用户ID。 + * @param pinSubType 口令认证子类型{@link PinSubType}。 + * @param infos 注册信息{@link EnrolledInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetUserInfo([in] int userId, [out] unsigned long secureUid, [out] enum PinSubType pinSubType, + [out] struct EnrolledInfo[] infos); + /** + * @brief 删除用户口令认证凭据,在用户IAM系统内删除该用户,该请求由用户触发。 + * + * @param userId 用户ID。 + * @param authToken 用户口令认证令牌。 + * @param deletedInfos 删除的凭据信息{@link CredentialInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + DeleteUser([in] int userId, [in] unsigned char[] authToken, [out] struct CredentialInfo[] deletedInfos); + /** + * @brief 强制删除用户,该请求由系统内管理用户的模块触发。 + * + * @param userId 用户ID。 + * @param deletedInfos 删除的凭据信息{@link CredentialInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + EnforceDeleteUser([in] int userId, [out] struct CredentialInfo[] deletedInfos); + /** + * @brief 开始认证用户,并生成认证方案。 + * + * @param contextId 上下文索引。 + * @param param 认证方案{@link AuthSolution}。 + * @param scheduleInfos 调度信息{@link ScheduleInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @deprecated + */ + BeginAuthentication([in] unsigned long contextId, [in] struct AuthSolution param, + [out] struct ScheduleInfo[] scheduleInfos); + /** + * @brief 更新认证结果,评估认证方案的认证结果。 + * + * @param contextId 上下文索引。 + * @param scheduleResult 执行器签发的认证结果。 + * @param info 认证结果信息{@link AuthResultInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + UpdateAuthenticationResult([in] unsigned long contextId, [in] unsigned char[] scheduleResult, + [out] struct AuthResultInfo info); + /** + * @brief 取消用户认证请求。 + * + * @param contextId 上下文索引。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + CancelAuthentication([in] unsigned long contextId); + /** + * @brief 开始用户身份识别,并生成识别方案。 + * + * @param contextId 上下文索引。 + * @param authType 用户身份识别类型@{AuthType}。 + * @param challenge 随机挑战值,用于生成用户身份识别令牌,防止重放。 + * @param executorSensorHint 执行器传感器提示,用于找到对应认证方式的传感器。 + * @param scheduleInfo 调度信息{@link ScheduleInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @deprecated + */ + BeginIdentification([in] unsigned long contextId, [in] enum AuthType authType, [in] unsigned char[] challenge, + [in] unsigned int executorSensorHint, [out] struct ScheduleInfo scheduleInfo); + /** + * @brief 更新用户身份识别结果,生成身份识别方案的结果。 + * + * @param contextId 上下文索引。 + * @param scheduleResult 执行器签发的用户身份识别结果。 + * @param info 用户身份识别结果{@link IdentifyResultInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + UpdateIdentificationResult([in] unsigned long contextId, [in] unsigned char[] scheduleResult, + [out] struct IdentifyResultInfo info); + /** + * @brief 取消用户身份识别请求。 + * + * @param contextId 上下文索引。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + CancelIdentification([in] unsigned long contextId); + /** + * @brief 获取当前认证类型的认证结果可信等级。 + * + * @param userId 用户ID。 + * @param authType 认证类型{@link AuthType}。 + * @param authTrustLevel 认证结果可信等级。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetAuthTrustLevel([in] int userId, [in] enum AuthType authType, [out] unsigned int authTrustLevel); + /** + * @brief 获取指定认证结果可信等级下有效的认证方式。 + * + * @param userId 用户ID。 + * @param authTypes 用于筛选的认证方式列表{@link AuthType}。 + * @param authTrustLevel 认证结果可信等级。 + * @param validTypes 有效的认证方式列表{@link AuthType}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetValidSolution([in] int userId, [in] enum AuthType[] authTypes, [in] unsigned int authTrustLevel, + [out] enum AuthType[] validTypes); + /** + * @brief 开始注册用户认证凭据。当注册凭据类型为口令且该用户已经注册了口令凭据时,将会更新口令凭据。 + * + * @param userId 用户ID。 + * @param authToken 用户口令认证令牌。 + * @param param 注册凭据参数{@link EnrollParam}。 + * @param info 调度信息{@link ScheduleInfoV1_1}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + BeginEnrollmentV1_1([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, + [out] struct ScheduleInfoV1_1 info); + /** + * @brief 开始认证用户,并生成认证方案。 + * + * @param contextId 上下文索引。 + * @param param 认证方案{@link AuthSolution}。 + * @param scheduleInfos 调度信息{@link ScheduleInfoV1_1}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + BeginAuthenticationV1_1([in] unsigned long contextId, [in] struct AuthSolution param, + [out] struct ScheduleInfoV1_1[] scheduleInfos); + /** + * @brief 开始用户身份识别,并生成识别方案。 + * + * @param contextId 上下文索引。 + * @param authType 用户身份识别类型@{AuthType}。 + * @param challenge 随机挑战值,用于生成用户身份识别令牌,防止重放。 + * @param executorSensorHint 执行器传感器提示,用于找到对应认证方式的传感器,取值不为0。 + * @param scheduleInfo 调度信息{@link ScheduleInfoV1_1}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + BeginIdentificationV1_1([in] unsigned long contextId, [in] enum AuthType authType, [in] unsigned char[] challenge, + [in] unsigned int executorSensorHint, [out] struct ScheduleInfoV1_1 scheduleInfo); + /** + * @brief 获取所有用户信息。 + * + * @param userInfos 用户信息列表@{UserInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetAllUserInfo([out] UserInfo[] userInfos); + /** + * @brief 获取所有用户信息。 + * + * @param 用户信息列表@{ExtUserInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetAllExtUserInfo([out] ExtUserInfo[] userInfos); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl b/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl new file mode 100644 index 00000000..1634f974 --- /dev/null +++ b/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl @@ -0,0 +1,353 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup HdfUserAuth + * @{ + * + * @brief 提供用户认证驱动的标准API接口。 + * + * 用户认证驱动为用户认证服务提供统一的访问接口。 + + * + * @since 4.1 + */ + + /** + * @file UserAuthTypes.idl + * + * @brief 定义用户认证驱动的枚举类和数据结构。 + * + * @since 4.1 + */ + +package ohos.hdi.user_auth.v1_2; + + /** + * @brief 枚举用户认证凭据类型。 + * + * @since 4.1 + * @version 1.2 + */ +enum AuthType : int { + /** 表示包含所有认证凭据类型。 */ + ALL = 0, + /** 认证凭据类型为口令。 */ + PIN = 1, + /** 认证凭据类型为人脸。 */ + FACE = 2, + /** 认证凭据类型为指纹。 */ + FINGERPRINT = 4, +}; + +/** + * @brief 枚举执行器角色。 + * + * @since 4.1 + * @version 1.2 + */ +enum ExecutorRole : int { + /** 执行器角色为采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 */ + COLLECTOR = 1, + /** 执行器角色为认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 */ + VERIFIER = 2, + /** 执行器角色为全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 */ + ALL_IN_ONE = 3, +}; + +/** + * @brief 枚举执行器安全等级。 + * + * @since 4.1 + * @version 1.2 + */ +enum ExecutorSecureLevel : int { + /** 执行器安全级别为0,关键操作在无访问控制执行环境中完成。 */ + ESL0 = 0, + /** 执行器安全级别为1,关键操作在有访问控制的执行环境中完成。 */ + ESL1 = 1, + /** 执行器安全级别为2,关键操作在可信执行环境中完成。 */ + ESL2 = 2, + /** 执行器安全级别为3,关键操作在高安环境如独立安全芯片中完成。 */ + ESL3 = 3, +}; + +/** + * @brief 口令认证子类型。 + * + * @since 4.1 + * @version 1.2 + */ +enum PinSubType : int { + PIN_SIX = 10000, /** 六位口令密码。 */ + PIN_NUMBER = 10001, /** 数字口令密码。 */ + PIN_MIX = 10002, /** 混合密码。 */ +}; + +/** + * @brief 调度模式。 + * + * @since 4.1 + * @version 1.2 + */ +enum ScheduleMode : int { + /** 录入模式。 */ + ENROLL = 0, + /** 认证模式。 */ + AUTH = 1, + /** 识别模式。 */ + IDENTIFY = 2, +}; + +/** + * @brief 执行器注册信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct ExecutorRegisterInfo { + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器角色@{ExecutorRole}。 */ + enum ExecutorRole executorRole; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ + unsigned int executorSensorHint; + /** 执行器匹配器,根据执行器支持的认证能力进行分类。 */ + unsigned int executorMatcher; + /** 执行器安全等级@{ExecutorSecureLevel}。 */ + enum ExecutorSecureLevel esl; + /** 执行器公钥,用于校验该执行器私钥签名的信息。 */ + unsigned char[] publicKey; +}; + +/** + * @brief 执行器信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct ExecutorInfo { + /** 用户认证框架的执行器索引。 */ + unsigned long executorIndex; + /** 执行器注册信息@{ExecutorRegisterInfo}。 */ + struct ExecutorRegisterInfo info; +}; + +/** + * @brief 调度信息。 + * + * @since 4.1 + * @version 1.2 + * + * @deprecated + */ +struct ScheduleInfo { + /** 调度ID,用于标识一次操作请求的执行器调度过程。 */ + unsigned long scheduleId; + /** 模版id列表。 */ + unsigned long[] templateIds; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器匹配器。 */ + unsigned int executorMatcher; + /** 调度模式@{scheduleMode}。 */ + unsigned int scheduleMode; + /** 执行器信息列表@{ExecutorInfo}。 */ + struct ExecutorInfo[] executors; +}; + +/** + * @brief 认证方案。 + * + * @since 4.1 + * @version 1.2 + */ +struct AuthSolution { + /** 用户ID。 */ + int userId; + /** 认证结果可信等级。 */ + unsigned int authTrustLevel; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ + unsigned int executorSensorHint; + /** 挑战值,用于签发认证令牌。 */ + unsigned char[] challenge; +}; + +/** + * @brief 执行器发送的消息。 + * + * @since 4.1 + * @version 1.2 + */ +struct ExecutorSendMsg { + /** 用户认证框架的执行器索引。 */ + unsigned long executorIndex; + /** 消息命令ID。 */ + int commandId; + /** 执行器发送的消息。 */ + unsigned char[] msg; +}; + +/** + * @brief 用户身份认证结果信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct AuthResultInfo { + /** 用户身份认证结果。 */ + int result; + /** 认证执行器的剩余锁定时间。 */ + int lockoutDuration; + /** 认证执行器的剩余可重试次数。 */ + int remainAttempts; + /** 执行器发送的消息。 */ + struct ExecutorSendMsg[] msgs; + /** 用户身份认证令牌。 */ + unsigned char[] token; + /** 保护文件加密密钥的密钥。 */ + unsigned char[] rootSecret; +}; + +/** + * @brief 用户身份识别结果信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct IdentifyResultInfo { + /** 用户身份识别结果。 */ + int result; + /** 用户ID。 */ + int userId; + /** 用户身份识别令牌。 */ + unsigned char[] token; +}; + +/** + * @brief 注册认证凭据参数。 + * + * @since 4.1 + * @version 1.2 + */ +struct EnrollParam { + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器,取值不为0。 */ + unsigned int executorSensorHint; +}; + +/** + * @brief 认证凭据信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct CredentialInfo { + /** 认证凭据ID。 */ + unsigned long credentialId; + /** 用户认证框架的执行器索引。 */ + unsigned long executorIndex; + /** 认证凭据模版ID。 */ + unsigned long templateId; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器匹配器。 */ + unsigned int executorMatcher; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器,取值不为0。 */ + unsigned int executorSensorHint; +}; + +/** + * @brief 注册信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct EnrolledInfo { + /** 注册ID,用户注册新的认证凭据时会更新注册ID。 */ + unsigned long enrolledId; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; +}; + +/** + * @brief 录入结果信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct EnrollResultInfo { + /** 认证凭据ID */ + unsigned long credentialId; + /** 旧凭据信息{@link CredentialInfo}。 */ + struct CredentialInfo oldInfo; + /** 保护文件加密密钥的密钥。 */ + unsigned char[] rootSecret; +}; + +/** + * @brief 调度信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct ScheduleInfoV1_1 { + /** 调度ID,用于标识一次操作请求的执行器调度过程。 */ + unsigned long scheduleId; + /** 模版id列表。 */ + unsigned long[] templateIds; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 执行器匹配器。 */ + unsigned int executorMatcher; + /** 调度模式@{scheduleMode}。 */ + unsigned int scheduleMode; + /** 执行器信息列表@{ExecutorInfo}。 */ + struct ExecutorInfo[] executors; + /** 其他相关信息,用于支持信息扩展。 */ + unsigned char[] extraInfo; +}; + +/** + * @brief 用户信息 + * + * @since 4.1 + * @version 1.2 + */ +struct UserInfo { + /** 用户的SecureUid。 */ + unsigned long secureUid; + /** 用户的口令认证子类型@{@PinSubType}. */ + enum PinSubType pinSubType; + /** 用户的注册信息列表@{EnrolledInfo}. */ + struct EnrolledInfo[] enrolledInfos; +}; + +/** + * @brief 用户信息。 + * + * @since 4.1 + * @version 1.2 + */ +struct ExtUserInfo { + /** 用户ID。 */ + int userId; + /** 该用户的用户信息 */ + struct UserInfo userInfo; +}; +/** @} */ \ No newline at end of file -- Gitee From 28ebb3d9490480c3703cb896bb853302e03513e5 Mon Sep 17 00:00:00 2001 From: zwx1283032 Date: Wed, 22 Nov 2023 08:33:09 +0000 Subject: [PATCH 0095/2135] add usb hdi description document Signed-off-by: zwx1283032 --- zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl | 222 ++++++++++++++++++ .../hdi/usb/ddk/v1_0/UsbDdkTypes.idl | 108 +++++++++ .../gadget/mtp/v1_0/IUsbfnMtpInterface.idl | 165 +++++++++++++ .../hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl | 57 +++++ 4 files changed, 552 insertions(+) create mode 100644 zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl create mode 100644 zh-cn/device_api/hdi/usb/ddk/v1_0/UsbDdkTypes.idl create mode 100644 zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/IUsbfnMtpInterface.idl create mode 100644 zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl diff --git a/zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl b/zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl new file mode 100644 index 00000000..0fb5f823 --- /dev/null +++ b/zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* * + * @addtogroup HdiUsbDdk + * @{ + * + * @brief 提供USB DDK API以打开和关闭USB接口,执行非等时和等时。 + * + * 通过USB管道进行数据传输,并实现控制传输和中断传输等。 + * + * @since 4.0 + * @version 1.0 + */ + +/* * + * @file IUsbDdk.idl + * + * @brief 声明USB主机用于访问USB设备的USB DDK API。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.usb.ddk.v1_0; + +import ohos.hdi.usb.ddk.v1_0.UsbDdkTypes; + +/* * + * @brief 声明USB主机用于访问USB设备的USB DDK API。 + * + * 上层USB服务调用相关功能接口,可以打开/关闭设备,获取设备描述符,批量读取/写入数据等。 + * + * @since 4.0 + * @version 1.0 + */ +interface IUsbDdk +{ + + /* * + * @brief 初始化DDK。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + Init(); + + /* * + * @brief 在停止数据传输后关闭占用的USB设备接口,并释放相关资源。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + Release(); + + /* * + * @brief 获取USB设备描述符。 + * + * @param deviceId 要获取其描述符的设备的设备Id。 + * @param desc USB协议中定义的标准设备描述符。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + GetDeviceDescriptor([in] unsigned long deviceId, [out] struct UsbDeviceDescriptor desc); + + /* * + * @brief 获取配置描述符。 + * + * @param deviceId 要获取其描述符的设备的设备Id。 + * @param configIndex 配置索引,对应于USB协议中的bConfigurationValue。 + * @param configDesc 配置描述符,包括USB协议中定义的标准配置描述符以及相关的接口描述符和端点描述符。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + GetConfigDescriptor([in] unsigned long deviceId, [in] unsigned char configIndex, [out] List configDesc); + + /* * + * @brief 声明USB接口。 + * + * @param deviceId 要操作的设备的ID。 + * @param interfaceIndex 接口索引,对应于USB协议中的b接口编号。 + * @param interfaceHandle 接口操作处理。成功声明接口后,将为此参数分配一个值。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + ClaimInterface([in] unsigned long deviceId, [in] unsigned char interfaceIndex, [out] unsigned long interfaceHandle); + + /* * + * @brief 在停止数据传输后关闭占用的USB设备接口,并释放相关资源。 + * + * @param interfaceHandle 接口操作处理。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + ReleaseInterface([in] unsigned long interfaceHandle); + + /* * + * @brief 激活USB接口的备用设置。 + * + * @param interfaceHandle 接口操作处理。 + * @param settingIndex 备用设置的索引,对应于USB协议中的bAlternateSetting。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + SelectInterfaceSetting([in] unsigned long interfaceHandle, [in] unsigned char settingIndex); + + /* * + * @brief 获取USB接口的激活备用设置。 + * + * @param interfaceHandle 接口操作处理。 + * @param settingIndex 备用设置的索引,对应于USB协议中的bAlternateSetting。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + GetCurrentInterfaceSetting([in] unsigned long interfaceHandle, [out] unsigned char settingIndex); + + /* * + * @brief 发送控制读取传输请求。此API以同步方式工作。 + * + * @param interfaceHandle 接口操作处理。 + * @param setup 请求数据,对应于USB协议中的Setup Data。 + * @param timeout 超时持续时间,以毫秒为单位。 + * @param data 要传输的数据。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + SendControlReadRequest([in] unsigned long interfaceHandle, [in] struct UsbControlRequestSetup setup, [in] unsigned int timeout, [out] List data); + + /* * + * @brief 发送控制写入传输请求。此API以同步方式工作。 + * + * @param interfaceHandle 接口操作处理。 + * @param setup 请求数据,对应于USB协议中的Setup Data。 + * @param timeout 超时持续时间,以毫秒为单位。 + * @param data 要传输的数据。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + SendControlWriteRequest([in] unsigned long interfaceHandle, [in] struct UsbControlRequestSetup setup, [in] unsigned int timeout, [in] List data); + + /* * + * @brief 发送管道请求。此API以同步方式工作。此API适用于中断传输和批量传输。 + * + * @param 管道用于传输数据的管道。 + * @param size 缓冲区大小。 + * @param offset 所用缓冲区的偏移量。默认值为0,表示没有偏移,缓冲区从指定地址开始。 + * @param length 使用的缓冲区的长度。默认情况下,该值等于大小,表示使用了整个缓冲区。 + * @param transferedLength 传输数据的长度。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + SendPipeRequest([in] struct UsbRequestPipe pipe, [in] unsigned int size, [in] unsigned int offset, [in] unsigned int length, [out] unsigned int transferedLength); + + /* * + * @brief 获取内存映射的文件描述符。 + * + * @param deviceId 待操作设备的ID。 + * @param fd 为内存映射获取的文件描述符。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + GetDeviceMemMapFd([in] unsigned long deviceId, [out] FileDescriptor fd); +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/usb/ddk/v1_0/UsbDdkTypes.idl b/zh-cn/device_api/hdi/usb/ddk/v1_0/UsbDdkTypes.idl new file mode 100644 index 00000000..54eeb298 --- /dev/null +++ b/zh-cn/device_api/hdi/usb/ddk/v1_0/UsbDdkTypes.idl @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* * + * @addtogroup HdiUsbDdk + * @{ + * + * @brief 提供USB DDK类型,并声明USB DDK API所需的宏、枚举变量和数据结构。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file UsbDdkTypes.idl + * + * @brief 提供USB DDK API中使用的枚举变量、结构和宏。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.usb.ddk.v1_0; + +/* * + * @brief 控制传输的设置数据。它对应于USB协议中的Setup Data。 + * + * @since 4.0 + * @version 1.0 + */ +struct UsbControlRequestSetup { + /** 请求类型,对应于USB协议中的bmRequestType。 */ + unsigned char requestType; + /** 请求命令,对应USB协议中的bRequest。 */ + unsigned char requestCmd; + /** 与USB协议中的wValue相对应的值。其含义因要求而异。 */ + unsigned short value; + /** 与USB协议中的wIndex相对应的索引。它通常用于传输索引或偏移量。它的含义根据请求而不同。 */ + unsigned short index; + /** 数据长度,对应于USB协议中的wLength。如果传输数据,则此字段指示传输的字节数。 */ + unsigned short length; +}; + +/* * + * @brief 标准设备描述符,对应于USB协议中的标准设备描述符。 + * + * @since 4.0 + * @version 1.0 + */ +struct UsbDeviceDescriptor { + /** 描述符的大小,以字节为单位。 */ + unsigned char bLength; + /** 描述符类型。 */ + unsigned char bDescriptorType; + /** USB协议版本号。 */ + unsigned short bcdUSB; + /** USB-IF分配的设备类别代码。 */ + unsigned char bDeviceClass; + /** USB-IF分配的设备子类代码。该值受bDeviceClass的值限制。 */ + unsigned char bDeviceSubClass; + /** USB-IF分配的协议代码。该值受bDeviceClass和bDeviceSubClass的限制。 */ + unsigned char bDeviceProtocol; + /** 终结点0的最大数据包大小。只有值8、16、32和64是有效的。 */ + unsigned char bMaxPacketSize0; + /** USB-IF分配的供应商ID。 */ + unsigned short idVendor; + /** 供应商分配的产品ID。 */ + unsigned short idProduct; + /** 设备发布编号。 */ + unsigned short bcdDevice; + /** 描述供应商的字符串描述符的索引。 */ + unsigned char iManufacturer; + /** 描述产品的字符串描述符的索引。 */ + unsigned char iProduct; + /** 描述设备SN的字符串描述符的索引。 */ + unsigned char iSerialNumber; + /** 配置数量。 */ + unsigned char bNumConfigurations; +}; + + +/** + * @brief 请求管道。 + * + * @since 4.0 + * @version 1.0 + */ +struct UsbRequestPipe { + /** 接口操作处理。 */ + unsigned long interfaceHandle; + /** 超时持续时间,以毫秒为单位。 */ + unsigned int timeout; + /** 端点地址。 */ + unsigned char endpoint; +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/IUsbfnMtpInterface.idl b/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/IUsbfnMtpInterface.idl new file mode 100644 index 00000000..807e90b8 --- /dev/null +++ b/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/IUsbfnMtpInterface.idl @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* * + * @addtogroup HdiUsbfnMtp + * @{ + * + * @brief 为mtp服务提供统一的API,以访问usb mtp/ptp驱动程序。 + * + * mtp服务可以获得usb mtp/ptp驱动程序对象或代理,然后调用该对象或代理提供的API来传输不同类型的mtp/ptp数据包。 + * + * @since 4.0 + * @version 1.0 + */ + +/* * + * @file IUsbfnMtpInterface.idl + * + * @brief 声明usb模块提供的API,用于获取usb信息、订阅或取消订阅usb数据、启用或禁用usb、设置usb数据报告模式以及设置准确性和测量范围等usb选项。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.usb.gadget.mtp.v1_0; + +import ohos.hdi.usb.gadget.mtp.v1_0.UsbfnMtpTypes; + +/* * + * @brief 定义在usb上执行基本操作的函数。 + * + * 操作包括获取usb信息、订阅或取消订阅usb数据、启用或禁用usb、设置usb数据报告模式以及设置准确性和测量范围等usb选项。 + * + * @since 4.0 + * @version 1.0 + */ +interface IUsbfnMtpInterface { + + /* * + * @brief 打开USB MTP/PTP驱动程序。 + * + * @param 无需参数。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + Start(); + + /* * + * @brief 关闭USB MTP/PTP驱动程序。 + * + * @param 无需参数。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + Stop(); + + /* * + * @brief 通过USB MTP/PTP驱动程序读取数据。 + * + * @param data表示USB MTP/PTP驱动程序读取的数据。 + * + * @return 如果操作失败,则返回读取的字节数、-1或其他负值。 + * + * @since 4.0 + * @version 1.0 + */ + Read([out] unsigned char[] data); + + /* * + * @brief 通过USB MTP/PTP驱动程序写入数据。 + * + * @param 通过USB MTP/PTP驱动程序写入数据。data表示数据写入USB MTP/PT驱动程序。 + * + * @return 如果操作失败,则返回写入的字节数、-1或其他负值。 + * + * @since 4.0 + * @version 1.0 + */ + Write([in] unsigned char[] data); + + /* * + * @brief 通过USB MTP/PTP驱动程序接收文件。 + * 代理处理文件管理,包括fopen/fclose/feek/fread/fwrite和偏移量信息,Stub负责数据处理。 + * + * @param mfs 指示mtp文件切片信息。 + * + * @return 如果接收成功,则返回0;如果操作失败,则返回-1或其他负值。 + * + * @since 4.0 + * @version 1.0 + */ + ReceiveFile([in] struct UsbFnMtpFileSlice mfs); + + /* * + * @brief 通过USB MTP/PTP驱动程序发送文件。 + * 代理处理文件管理,包括fopen/fclose/feek/fread/fwrite和偏移量信息,Stub负责数据处理。 + * + * @param mfs 指示mtp文件范围信息,使用的是数据包标头。 + * + * @return 如果接收成功,则返回0;如果操作失败,则返回-1或其他负值。 + * + * @since 4.0 + * @version 1.0 + */ + SendFile([in] struct UsbFnMtpFileSlice mfs); + + /* * + * @brief 通过USB MTP/PTP驱动程序发送事件数据。 + * + * @param data 指示事件数据写入USB MTP/PTP驱动程序。 + * + * @return 如果接收成功,则返回0;如果操作失败,则返回-1或其他负值。 + * + * @since 4.0 + * @version 1.0 + */ + SendEvent([in] unsigned char[] eventData); + + /* * + * @brief 初始化USB MTP/PTP驱动程序。由usb_host使用。 + * + * @param 无需参数。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + Init(); + + /* * + * @brief 释放USB MTP/PTP驱动程序。由usb_host使用。 + * + * @param 无需参数。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.0 + */ + Release(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl b/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl new file mode 100644 index 00000000..d9bf0475 --- /dev/null +++ b/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* * + * @addtogroup HdiUsbfnMtp + * @{ + * + * @brief 为mtp服务提供统一的API,以访问usb mtp/ptp驱动程序。 + * + * mtp服务可以获得usb mtp/ptp驱动程序对象或代理,然后调用该对象或代理提供的API来传输不同类型的mtp/ptp数据包。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file UsbfnMtpTypes.idl + * + * @brief 定义usb模块使用的数据,包括usb信息,并上报了usb数据。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.usb.gadget.mtp.v1_0; + +/* * + * @brief 标准设备描述符,对应于USB协议中的标准设备描述符。 + * + * @since 4.0 + * @version 1.0 + */ +struct UsbFnMtpFileSlice { + /** 文件描述符。 */ + FileDescriptor fd; + /** 管道。 */ + long offset; + /** 数据长度 */ + long length; + /** 请求命令 */ + unsigned short command; + /** 传输id */ + unsigned int transactionId; +}; +/** @} */ \ No newline at end of file -- Gitee From 6aa96642939c72ac5819ad527308c98868ddfc37 Mon Sep 17 00:00:00 2001 From: lbl Date: Wed, 22 Nov 2023 15:38:53 +0800 Subject: [PATCH 0096/2135] translate Signed-off-by: lbl --- .../face_auth/{ => v1_0}/FaceAuthTypes.idl | 0 .../hdi/face_auth/{ => v1_0}/IExecutor.idl | 336 +++++++++--------- .../{ => v1_0}/IExecutorCallback.idl | 0 .../{ => v1_0}/IFaceAuthInterface.idl | 118 +++--- .../hdi/face_auth/v1_1/FaceAuthTypes.idl | 139 ++++++++ .../hdi/face_auth/v1_1/IExecutor.idl | 81 +++++ .../hdi/face_auth/v1_1/IFaceAuthInterface.idl | 58 +++ .../hdi/face_auth/v1_1/ISaCommandCallback.idl | 60 ++++ 8 files changed, 565 insertions(+), 227 deletions(-) rename zh-cn/device_api/hdi/face_auth/{ => v1_0}/FaceAuthTypes.idl (100%) mode change 100755 => 100644 rename zh-cn/device_api/hdi/face_auth/{ => v1_0}/IExecutor.idl (97%) mode change 100755 => 100644 rename zh-cn/device_api/hdi/face_auth/{ => v1_0}/IExecutorCallback.idl (100%) mode change 100755 => 100644 rename zh-cn/device_api/hdi/face_auth/{ => v1_0}/IFaceAuthInterface.idl (97%) mode change 100755 => 100644 create mode 100644 zh-cn/device_api/hdi/face_auth/v1_1/FaceAuthTypes.idl create mode 100644 zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl create mode 100644 zh-cn/device_api/hdi/face_auth/v1_1/IFaceAuthInterface.idl create mode 100644 zh-cn/device_api/hdi/face_auth/v1_1/ISaCommandCallback.idl diff --git a/zh-cn/device_api/hdi/face_auth/FaceAuthTypes.idl b/zh-cn/device_api/hdi/face_auth/v1_0/FaceAuthTypes.idl old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device_api/hdi/face_auth/FaceAuthTypes.idl rename to zh-cn/device_api/hdi/face_auth/v1_0/FaceAuthTypes.idl diff --git a/zh-cn/device_api/hdi/face_auth/IExecutor.idl b/zh-cn/device_api/hdi/face_auth/v1_0/IExecutor.idl old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device_api/hdi/face_auth/IExecutor.idl rename to zh-cn/device_api/hdi/face_auth/v1_0/IExecutor.idl index f34a5d2c..bdadbe74 --- a/zh-cn/device_api/hdi/face_auth/IExecutor.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_0/IExecutor.idl @@ -1,169 +1,169 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdfFaceAuth - * @{ - * - * @brief 提供人脸认证驱动的标准API接口。 - * - * 人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, - * 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 - * - * @since 3.2 - */ - -/** - * @file IExecutor.idl - * - * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 - * - * @since 3.2 - */ - -package ohos.hdi.face_auth.v1_0; - -import ohos.hdi.face_auth.v1_0.FaceAuthTypes; -import ohos.hdi.face_auth.v1_0.IExecutorCallback; - -/** - * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 - * - * @since 3.2 - * @version 1.0 - */ -interface IExecutor { - /** - * @brief 获取执行器信息,人脸认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 - * - * @param executorInfo 执行器信息{@link ExecutorInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetExecutorInfo([out] struct ExecutorInfo executorInfo); - /** - * @brief 获取凭据模版信息。 - * - * @param templateId 凭据模版ID。 - * @param templateInfo 凭据模版信息{@link TemplateInfo}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo); - /** - * @brief 完成执行器注册,对人脸特征模版进行对账,用于删除无效的人脸特征模板及相关信息。 - * - * @param templateIdList 用户认证框架内由该执行器注册的人脸特征模版ID列表。 - * @param frameworkPublicKey 用户认证框架的公钥,用于校验用户认证框架私钥签名的信息。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); - /** - * @brief 注册人脸特征模版。 - * - * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); - /** - * @brief 人脸认证。 - * - * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * @param templateIdList 指定要认证的模版ID列表。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); - /** - * @brief 人脸识别。 - * - * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Identify([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); - /** - * @brief 删除人脸特征模版。 - * - * @param templateIdList 指定要删除的模版ID列表。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Delete([in] unsigned long[] templateIdList); - /** - * @brief 取消操作请求。 - * - * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - Cancel([in] unsigned long scheduleId); - /** - * @brief 发送人脸认证功能相关操作命令。 - * - * @param commandId 操作命令ID{@link CommandId}。 - * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFaceAuth + * @{ + * + * @brief 提供人脸认证驱动的标准API接口。 + * + * 人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, + * 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 3.2 + */ + +/** + * @file IExecutor.idl + * + * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 3.2 + */ + +package ohos.hdi.face_auth.v1_0; + +import ohos.hdi.face_auth.v1_0.FaceAuthTypes; +import ohos.hdi.face_auth.v1_0.IExecutorCallback; + +/** + * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 3.2 + * @version 1.0 + */ +interface IExecutor { + /** + * @brief 获取执行器信息,人脸认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 + * + * @param executorInfo 执行器信息{@link ExecutorInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + GetExecutorInfo([out] struct ExecutorInfo executorInfo); + /** + * @brief 获取凭据模版信息。 + * + * @param templateId 凭据模版ID。 + * @param templateInfo 凭据模版信息{@link TemplateInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo); + /** + * @brief 完成执行器注册,对人脸特征模版进行对账,用于删除无效的人脸特征模板及相关信息。 + * + * @param templateIdList 用户认证框架内由该执行器注册的人脸特征模版ID列表。 + * @param frameworkPublicKey 用户认证框架的公钥,用于校验用户认证框架私钥签名的信息。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); + /** + * @brief 注册人脸特征模版。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 人脸认证。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param templateIdList 指定要认证的模版ID列表。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 人脸识别。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + Identify([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 删除人脸特征模版。 + * + * @param templateIdList 指定要删除的模版ID列表。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + Delete([in] unsigned long[] templateIdList); + /** + * @brief 取消操作请求。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief 发送人脸认证功能相关操作命令。 + * + * @param commandId 操作命令ID{@link CommandId}。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); +} /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/face_auth/IExecutorCallback.idl b/zh-cn/device_api/hdi/face_auth/v1_0/IExecutorCallback.idl old mode 100755 new mode 100644 similarity index 100% rename from zh-cn/device_api/hdi/face_auth/IExecutorCallback.idl rename to zh-cn/device_api/hdi/face_auth/v1_0/IExecutorCallback.idl diff --git a/zh-cn/device_api/hdi/face_auth/IFaceAuthInterface.idl b/zh-cn/device_api/hdi/face_auth/v1_0/IFaceAuthInterface.idl old mode 100755 new mode 100644 similarity index 97% rename from zh-cn/device_api/hdi/face_auth/IFaceAuthInterface.idl rename to zh-cn/device_api/hdi/face_auth/v1_0/IFaceAuthInterface.idl index c073488f..59dbd0fe --- a/zh-cn/device_api/hdi/face_auth/IFaceAuthInterface.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_0/IFaceAuthInterface.idl @@ -1,60 +1,60 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdfFaceAuth - * @{ - * - * @brief 提供人脸认证驱动的标准API接口。 - * - * 人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, - * 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 - * - * @since 3.2 - */ - -/** - * @file IFaceAuthInterface.idl - * - * @brief 定义获取人脸认证驱动的执行器列表接口,用于从人脸认证驱动获取执行器对象列表。 - * - * @since 3.2 - */ - -package ohos.hdi.face_auth.v1_0; - -import ohos.hdi.face_auth.v1_0.IExecutor; - -/** - * @brief 定义获取人脸认证驱动的执行器列表接口。 - * - * @since 3.2 - * @version 1.0 - */ -interface IFaceAuthInterface { - /** - * @brief 获取执行器列表,人脸认证服务进程启动进行初始化操作时通过该接口获取人脸认证驱动支持的执行器列表。 - * - * @param executorList 执行器对象列表{@link IExecutor}。 - * - * @return 0 表示操作成功。 - * @return 非0 表示操作失败。 - * - * @since 3.2 - * @version 1.0 - */ - GetExecutorList([out] IExecutor[] executorList); -} +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFaceAuth + * @{ + * + * @brief 提供人脸认证驱动的标准API接口。 + * + * 人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, + * 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 3.2 + */ + +/** + * @file IFaceAuthInterface.idl + * + * @brief 定义获取人脸认证驱动的执行器列表接口,用于从人脸认证驱动获取执行器对象列表。 + * + * @since 3.2 + */ + +package ohos.hdi.face_auth.v1_0; + +import ohos.hdi.face_auth.v1_0.IExecutor; + +/** + * @brief 定义获取人脸认证驱动的执行器列表接口。 + * + * @since 3.2 + * @version 1.0 + */ +interface IFaceAuthInterface { + /** + * @brief 获取执行器列表,人脸认证服务进程启动进行初始化操作时通过该接口获取人脸认证驱动支持的执行器列表。 + * + * @param executorList 执行器对象列表{@link IExecutor}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + GetExecutorList([out] IExecutor[] executorList); +} /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/face_auth/v1_1/FaceAuthTypes.idl b/zh-cn/device_api/hdi/face_auth/v1_1/FaceAuthTypes.idl new file mode 100644 index 00000000..524dec52 --- /dev/null +++ b/zh-cn/device_api/hdi/face_auth/v1_1/FaceAuthTypes.idl @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFaceAuth + * @{ + * + * @brief 提供人脸认证驱动的标准API接口。 + * + * 人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, + * 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 4.0 + */ + +/** + * @file FaceAuthTypes.idl + * + * @brief 定义人脸认证驱动的枚举类和数据结构,包括AuthType, ExecutorRole, ExecutorSecureLevel, + * CommandId, FaceTipsCode, ExecutorInfo, 和TemplateInfo。 + * + * @since 4.0 + */ + +package ohos.hdi.face_auth.v1_1; + +/** + * @brief 枚举获得属性类型。 + * + * @since 4.0 + * @version 1.1 + */ +enum GetPropertyType : int { + /** 人脸认证子类型。 */ + AUTH_SUB_TYPE = 1, + /** 认证方式被冻结的时间。 */ + LOCKOUT_DURATION = 2, + /** 认证方式距离被冻结的可处理认证请求次数。 */ + REMAIN_ATTEMPTS = 3, + /** 人脸录入进程。 */ + ENROLL_PROGRESS = 4, + /** 传感器信息。 */ + SENSOR_INFO = 5 +}; + +/** + * @brief Indicates executor property. + * + * @since 4.0 + * @version 1.1 + */ +struct Property { + /** 人脸认证子类型。 */ + unsigned long authSubType; + /** 认证方式被冻结的时间。 */ + int lockoutDuration; + /** 认证方式距离被冻结的可处理认证请求次数。 */ + int remainAttempts; + /** 人脸录入进程。 */ + String enrollmentProgress; + /** 传感器信息。 */ + String sensorInfo; +}; + +/** + * @brief Enumerates sa command ids. + * + * @since 4.0 + * @version 1.1 + */ +enum SaCommandId : int { + /** 开始增加屏幕亮度 */ + BEGIN_SCREEN_BRIGHTNESS_INCREASE = 1, + /** 结束增加屏幕亮度 */ + END_SCREEN_BRIGHTNESS_INCREASE = 2, +}; + +/** + * @brief sa命令参数为空。 + * + * @since 4.0 + * @version 1.1 + */ +struct SaCommandParamNone { +}; + +/** + * @brief sa命令参数。 + * + * @since 4.0 + * @version 1.1 + */ +union SaCommandParam { + /** sa命令参数为空。 See {@link SaCommandParamNone}. */ + struct SaCommandParamNone none; +}; + +/** + * @brief SA命令相关。 + * + * @since 4.0 + * @version 1.1 + */ +struct SaCommand { + /** sa命令ID。 See {@link SaCommandId}. */ + enum SaCommandId id; + /** sa命令参数。 See {@link SaCommandParam}. */ + union SaCommandParam param; +}; + +/** + * @brief 枚举人脸认证功能相关操作命令。 + * + * @since 4.0 + * @version 1.1 + */ +enum CommandId : int { + /** 锁定人脸模版。 */ + LOCK_TEMPLATE = 1, + /** 解锁人脸模版。 */ + UNLOCK_TEMPLATE = 2, + /** 初始化算法。 */ + INIT_ALGORITHM = 3, + /** 用于厂商自定义操作指令。 */ + VENDOR_COMMAND_BEGIN = 10000 +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl b/zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl new file mode 100644 index 00000000..69d60228 --- /dev/null +++ b/zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFaceAuth + * @{ + * + * @brief 提供人脸认证驱动的标准API接口。 + * + * 人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, + * 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 4.0 + */ + +/** + * @file IExecutor.idl + * + * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 4.0 + */ + +package ohos.hdi.face_auth.v1_1; + +import ohos.hdi.face_auth.v1_0.FaceAuthTypes; +import ohos.hdi.face_auth.v1_0.IExecutor; +import ohos.hdi.face_auth.v1_1.FaceAuthTypes; +import ohos.hdi.face_auth.v1_1.ISaCommandCallback; + +/** + * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 4.0 + * @version 1.1 + */ +interface IExecutor extends ohos.hdi.face_auth.v1_0.IExecutor { + /** + * @brief 获得人脸执行器属性。 + * + * @param templateIdList 模板id列表。 + * @param propertyTypes 人脸执行器属性类型。 {@link GetPropertyType}. + * @param property 人脸执行器属性。 {@link Property}. + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetProperty([in] unsigned long[] templateIdList, [in] enum GetPropertyType[] propertyTypes, [out] struct Property property); + /** + * @brief 设置缓存模板。 + * + * @param templateIdList 人脸缓存的模板列表。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + SetCachedTemplates([in] unsigned long[] templateIdList); + + /** + * @brief 注册sa命令回调。 + * + * @param callbackObj 表示sa命令回调。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + RegisterSaCommandCallback([in] ISaCommandCallback callbackObj); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/face_auth/v1_1/IFaceAuthInterface.idl b/zh-cn/device_api/hdi/face_auth/v1_1/IFaceAuthInterface.idl new file mode 100644 index 00000000..3dc8f169 --- /dev/null +++ b/zh-cn/device_api/hdi/face_auth/v1_1/IFaceAuthInterface.idl @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFaceAuth + * @{ + * + * @brief 提供人脸认证驱动的标准API接口。 + * + * 人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, + * 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 4.0 + */ + +/** + * @file IFaceAuthInterface.idl + * + * @brief 定义获取人脸认证驱动的执行器列表接口,用于从人脸认证驱动获取执行器对象列表。 + * + * @since 4.0 + */ + +package ohos.hdi.face_auth.v1_1; + +import ohos.hdi.face_auth.v1_0.IFaceAuthInterface; +import ohos.hdi.face_auth.v1_1.IExecutor; + +/** + * @brief 定义获取人脸认证驱动执行器列表的接口。 + * + * @since 4.0 + * @version 1.1 + */ +interface IFaceAuthInterface extends ohos.hdi.face_auth.v1_0.IFaceAuthInterface { + /** + * @brief 获得驱动的执行器列表。 + * + * @param executorList 执行器对象列表。 {@link IExecutor}. + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetExecutorListV1_1([out] IExecutor[] executorList); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/face_auth/v1_1/ISaCommandCallback.idl b/zh-cn/device_api/hdi/face_auth/v1_1/ISaCommandCallback.idl new file mode 100644 index 00000000..c242aec4 --- /dev/null +++ b/zh-cn/device_api/hdi/face_auth/v1_1/ISaCommandCallback.idl @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFaceAuth + * @{ + * + * @brief 提供人脸认证驱动的标准API接口。 + * + * 人脸认证驱动为人脸认证服务提供统一的访问接口。获取人脸认证驱动代理后,人脸认证服务可以调用相关接口获取执行器,获取人脸认证执行器后, + * 人脸认证服务可以调用相关接口获取执行器,获取凭据模版信息,注册人脸特征模版,进行用户人脸认证,删除人脸特征模版等。 + * + * @since 4.0 + */ + +/** + * @file ISaCommandCallback.idl + * + * @brief 定义异步 API 的回调,该回调可用于向 SA 发送命令。{@link IExecutor}. + * + * @since 4.0 + */ + +package ohos.hdi.face_auth.v1_1; + +import ohos.hdi.face_auth.v1_1.FaceAuthTypes; + +/** + * @brief 定义异步 API 的回调,该回调可用于向 SA 发送命令。{@link IExecutor}. + * + * @since 4.0 + * @version 1.1 + */ +[callback] interface ISaCommandCallback { + /** + * @brief 定义进程中sa命令的函数。 + * + * @param commands 表示SA命令。{@link SaCommand}. + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + OnSaCommands([in] struct SaCommand[] commands); +} +/** @} */ \ No newline at end of file -- Gitee From 44745bca2bad9a0b25ff2214d4444fbf27b887c5 Mon Sep 17 00:00:00 2001 From: liuziweicom Date: Wed, 22 Nov 2023 17:42:57 +0800 Subject: [PATCH 0097/2135] fix Signed-off-by: liuziweicom --- zh-cn/device_api/hdi/pin_auth/v1_0/IExecutor.idl | 2 +- zh-cn/device_api/hdi/pin_auth/v1_0/PinAuthTypes.idl | 2 +- zh-cn/device_api/hdi/user_auth/v1_0/IUserAuthInterface.idl | 6 +++--- zh-cn/device_api/hdi/user_auth/v1_0/UserAuthTypes.idl | 2 +- zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl | 1 - zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl | 7 +++---- zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl | 2 +- 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/zh-cn/device_api/hdi/pin_auth/v1_0/IExecutor.idl b/zh-cn/device_api/hdi/pin_auth/v1_0/IExecutor.idl index 392d14f8..f6c80ea6 100644 --- a/zh-cn/device_api/hdi/pin_auth/v1_0/IExecutor.idl +++ b/zh-cn/device_api/hdi/pin_auth/v1_0/IExecutor.idl @@ -64,7 +64,7 @@ interface IExecutor { * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link GetProperty}接口代替。 */ GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo); /** diff --git a/zh-cn/device_api/hdi/pin_auth/v1_0/PinAuthTypes.idl b/zh-cn/device_api/hdi/pin_auth/v1_0/PinAuthTypes.idl index 8d1e60f1..88cba1fd 100644 --- a/zh-cn/device_api/hdi/pin_auth/v1_0/PinAuthTypes.idl +++ b/zh-cn/device_api/hdi/pin_auth/v1_0/PinAuthTypes.idl @@ -123,7 +123,7 @@ struct ExecutorInfo { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link GetPropertyType}接口代替。 */ struct TemplateInfo { /** 执行器类型,根据执行器支持的算法类型进行分类。 */ diff --git a/zh-cn/device_api/hdi/user_auth/v1_0/IUserAuthInterface.idl b/zh-cn/device_api/hdi/user_auth/v1_0/IUserAuthInterface.idl index cf261306..9e83cfc8 100644 --- a/zh-cn/device_api/hdi/user_auth/v1_0/IUserAuthInterface.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_0/IUserAuthInterface.idl @@ -103,7 +103,7 @@ interface IUserAuthInterface { * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link BeginEnrollmentV1_1}接口代替。 */ BeginEnrollment([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, [out] struct ScheduleInfo info); @@ -195,7 +195,7 @@ interface IUserAuthInterface { * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link BeginAuthenticationV1_1}接口代替。 */ BeginAuthentication([in] unsigned long contextId, [in] struct AuthSolution param, [out] struct ScheduleInfo[] scheduleInfos); @@ -232,7 +232,7 @@ interface IUserAuthInterface { * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link BeginIdentificationV1_1}接口代替。 */ BeginIdentification([in] unsigned long contextId, [in] enum AuthType authType, [in] unsigned char[] challenge, [in] unsigned int executorSensorHint, [out] struct ScheduleInfo scheduleInfo); diff --git a/zh-cn/device_api/hdi/user_auth/v1_0/UserAuthTypes.idl b/zh-cn/device_api/hdi/user_auth/v1_0/UserAuthTypes.idl index e48dfbf6..b2b4d0b7 100644 --- a/zh-cn/device_api/hdi/user_auth/v1_0/UserAuthTypes.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_0/UserAuthTypes.idl @@ -150,7 +150,7 @@ struct ExecutorInfo { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link ScheduleInfoV1_1}接口代替。 */ struct ScheduleInfo { /** 调度ID,用于标识一次操作请求的执行器调度过程。 */ diff --git a/zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl b/zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl index fb96aee8..0e1be89d 100644 --- a/zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_1/UserAuthTypes.idl @@ -20,7 +20,6 @@ * @brief 提供用户认证驱动的标准API接口。 * * 用户认证驱动为用户认证服务提供统一的访问接口。 - * * @since 4.0 */ diff --git a/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl b/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl index 2cab5479..07f1f56c 100644 --- a/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl @@ -29,7 +29,6 @@ * @file IUserAuthInterface.idl * * @brief 声明用户认证驱动的API接口。接口可用于注册执行器,管理用户认证凭据,完成PIN码和生物特征认证。 - * * @since 4.1 */ @@ -104,7 +103,7 @@ interface IUserAuthInterface { * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link BeginEnrollmentV1_1}接口代替。 */ BeginEnrollment([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, [out] struct ScheduleInfo info); @@ -196,7 +195,7 @@ interface IUserAuthInterface { * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link BeginAuthenticationV1_1}接口代替。 */ BeginAuthentication([in] unsigned long contextId, [in] struct AuthSolution param, [out] struct ScheduleInfo[] scheduleInfos); @@ -233,7 +232,7 @@ interface IUserAuthInterface { * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link BeginIdentificationV1_1}接口代替。 */ BeginIdentification([in] unsigned long contextId, [in] enum AuthType authType, [in] unsigned char[] challenge, [in] unsigned int executorSensorHint, [out] struct ScheduleInfo scheduleInfo); diff --git a/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl b/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl index 1634f974..6d3127f4 100644 --- a/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl @@ -151,7 +151,7 @@ struct ExecutorInfo { * @since 4.1 * @version 1.2 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link ScheduleInfoV1_1}接口代替。 */ struct ScheduleInfo { /** 调度ID,用于标识一次操作请求的执行器调度过程。 */ -- Gitee From 89f32c67c1e3dba1f2b2f7098b97cbc973aab5b3 Mon Sep 17 00:00:00 2001 From: abonadon-hk Date: Wed, 22 Nov 2023 10:51:06 +0000 Subject: [PATCH 0098/2135] add: add finger hdi description document Signed-off-by: abonadon-hk --- .../v1_0/FingerprintAuthTypes.idl | 134 +++++++++++++ .../hdi/fingerprint_auth/v1_0/IExecutor.idl | 151 +++++++++++++++ .../v1_0/IExecutorCallback.idl | 65 +++++++ .../v1_0/IFingerprintAuthInterface.idl | 56 ++++++ .../v1_1/FingerprintAuthTypes.idl | 176 ++++++++++++++++++ .../hdi/fingerprint_auth/v1_1/IExecutor.idl | 100 ++++++++++ .../v1_1/IFingerprintAuthInterface.idl | 57 ++++++ .../v1_1/ISaCommandCallback.idl | 60 ++++++ 8 files changed, 799 insertions(+) create mode 100644 zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl create mode 100644 zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl create mode 100644 zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutorCallback.idl create mode 100644 zh-cn/device_api/hdi/fingerprint_auth/v1_0/IFingerprintAuthInterface.idl create mode 100644 zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl create mode 100644 zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl create mode 100644 zh-cn/device_api/hdi/fingerprint_auth/v1_1/IFingerprintAuthInterface.idl create mode 100644 zh-cn/device_api/hdi/fingerprint_auth/v1_1/ISaCommandCallback.idl diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl new file mode 100644 index 00000000..0367ffd2 --- /dev/null +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFingerprintAuth + * @{ + * + * @brief 提供指纹认证驱动的API接口。 + * + * 指纹认证驱动程序为指纹认证服务提供统一的接口,用于访问指纹认证驱动程序。获取指纹认证驱动代理后,服务可以调用相关API获取执行器。 + * 获取指纹认证执行器后,服务可以调用相关API获取执行器信息,获取凭据模板信息、注册指纹特征模板、进行用户指纹认证、删除指纹特征模板等。 + * + * @since 3.2 + */ + +/** + * @file FingerprintAuthTypes.idl + * + * @brief 定义指纹认证驱动枚举和数据结构,包括认证类型、执行器角色、 执行器安全等级、命令ID、指纹提示信息编码、执行器信息和模板信息。 + * + * @since 3.2 + */ + +package ohos.hdi.fingerprint_auth.v1_0; + +/** + * @brief 枚举用户认证的凭据类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum AuthType : int { + PIN = 1, /**< 认证凭据类型为口令。 */ + FACE = 2, /**< 认证凭据类型为人脸。 */ + FINGERPRINT = 4, /**< 认证凭据类型为指纹。 */ +}; + +/** + * @brief 枚举执行器角色。 + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorRole : int { + COLLECTOR = 1, /**< 表示执行器角色是采集器,提供用户认证时的数据采集能力,需要和认证器配合完成用户认证。 */ + VERIFIER = 2, /**< 表示执行器角色是认证器,提供用户认证时数据处理能力,读取存储凭据模板信息并完成比对。 */ + ALL_IN_ONE = 3, /**< 表示执行器角色是全功能执行器,可提供用户认证数据采集、处理、储存及比对能力。 */ +}; + +/** + * @brief 枚举执行器安全等级。 + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorSecureLevel : int { + ESL0 = 0, /**< 表示执行器安全等级是0,关键操作在无访问控制执行环境中完成。 */ + ESL1 = 1, /**< 表示执行器安全等级是1,关键操作在有访问控制的执行环境中完成。 */ + ESL2 = 2, /**< 表示执行器安全等级是2,关键操作在可信执行环境中完成。 */ + ESL3 = 3, /**< 表示执行器安全等级是3,关键操作在高安环境如独立安全芯片中完成。 */ +}; + +/** + * @brief 枚举指纹认证功能相关操作命令。 + * + * @since 3.2 + * @version 1.0 + */ +enum CommandId : int { + LOCK_TEMPLATE = 1, /**< 锁定指纹模板。 */ + UNLOCK_TEMPLATE = 2, /**< 解锁指纹模板。 */ + VENDOR_COMMAND_BEGIN = 10000 /**< 用于厂商自定义操作指令。 */ +}; + +/** + * @brief 枚举提示信息编码。 + * + * @since 3.2 + * @version 1.0 + * + * @deprecated + */ +enum FingerprintTipsCode : int { + FINGERPRINT_AUTH_TIP_GOOD = 0, /**< 获取的指纹图像是完整的。 */ + FINGERPRINT_AUTH_TIP_DIRTY = 1, /**< 指纹图像非常模糊,原因是传感器上存在可疑或检测到的污垢。 */ + FINGERPRINT_AUTH_TIP_INSUFFICIENT = 2, /**< 仅检测到部分指纹图像。 */ + FINGERPRINT_AUTH_TIP_PARTIAL = 3, /**< 仅检测到部分指纹图像。 */ + FINGERPRINT_AUTH_TIP_TOO_FAST = 4, /**< 指纹图像由于快速移动而不完整。 */ + FINGERPRINT_AUTH_TIP_TOO_SLOW = 5, /**< 指纹图像由于没有移动而无法读取。 */ + VENDOR_FINGERPRINT_AUTH_TIP_BEGIN = 10000 /**< 用于厂商自定义提示信息。 */ +}; + +/** + * @brief 执行器信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct ExecutorInfo { + unsigned short sensorId; /**< 传感器ID,不同传感器在人脸认证驱动内的唯一标识。 */ + unsigned int executorType; /**< 执行器类型,根据执行器支持的能力进行分类。 */ + enum ExecutorRole executorRole; /**< 执行器角色@{ExecutorRole}。 */ + enum AuthType authType; /**< 用户认证凭据类型@{AuthType}。 */ + enum ExecutorSecureLevel esl; /**< 执行器安全等级@{ExecutorSecureLevel}。 */ + unsigned char[] publicKey; /**< 执行器公钥,用于校验该执行器私钥签名的信息。 */ + unsigned char[] extraInfo; /**< 其他相关信息,用于支持信息扩展。 */ +}; + +/** + * @brief 凭据模板信息。 + * + * @since 3.2 + * @version 1.0 + * + * @deprecated + */ +struct TemplateInfo { + unsigned int executorType; /**< 执行器类型,根据执行器支持的能力进行分类。 */ + int lockoutDuration; /**< 认证方式被冻结的时间。 */ + int remainAttempts; /**< 认证方式距离被冻结的可处理认证请求次数。 */ + unsigned char[] extraInfo; /**< 其他相关信息,用于支持信息扩展。 */ +}; \ No newline at end of file diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl new file mode 100644 index 00000000..475e8707 --- /dev/null +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFingerprintAuth + * @{ + * + * @brief 提供指纹认证驱动的API接口。 + * + * 指纹认证驱动程序为指纹认证服务提供统一的接口,用于访问指纹认证驱动程序。获取指纹认证驱动代理后,服务可以调用相关API获取执行器。 + * 获取指纹认证执行器后,服务可以调用相关API获取执行器信息,获取凭据模板信息、注册指纹特征模板、进行用户指纹认证、删除指纹特征模板等。 + * + * @since 3.2 + */ + +/** + * @file IExecutor.idl + * + * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册指纹特征模版,进行用户指纹认证,删除指纹特征模版等。 + * + * @since 3.2 + */ + +package ohos.hdi.fingerprint_auth.v1_0; + +import ohos.hdi.fingerprint_auth.v1_0.FingerprintAuthTypes; +import ohos.hdi.fingerprint_auth.v1_0.IExecutorCallback; + +/** + * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册指纹特征模版,进行用户指纹认证,删除指纹特征模版等。 + * + * @since 3.2 + * @version 1.0 + */ +interface IExecutor { + /** + * @brief 获取执行器信息。 + * + * @param executorInfo 执行器信息{@link ExecutorInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetExecutorInfo([out] struct ExecutorInfo executorInfo); + /** + * @brief 获取凭据模板信息。 + * + * @param templateId 凭据模板ID。 + * @param templateInfo 凭据模板信息{@link TemplateInfo}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + * + * @deprecated + */ + GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo); + /** + * @brief 完成执行器注册,对指纹特征模版进行对账,用于删除无效的指纹特征模板及相关信息。 + * + * @param templateIdList 用户认证框架内由该执行器注册的指纹特征模版ID列表。 + * @param frameworkPublicKey 用户认证框架的公钥,用于校验用户认证框架私钥签名的信息。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); + /** + * @brief 注册指纹特征模版。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 指纹认证。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param templateIdList 指定要认证的模版ID列表。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + * + * @deprecated + */ + Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 指纹识别。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Identify([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 删除指纹特征模版。 + * + * @param templateIdList 指定要删除的模版ID列表。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Delete([in] unsigned long[] templateIdList); + /** + * @brief 取消操作请求。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief 发送指纹认证功能相关操作命令。 + * + * @param commandId 操作命令ID{@link CommandId}。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutorCallback.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutorCallback.idl new file mode 100644 index 00000000..339851cd --- /dev/null +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutorCallback.idl @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFingerprintAuth + * @{ + * + * @brief 提供指纹认证驱动的API接口。 + * + * 指纹认证驱动程序为指纹认证服务提供统一的接口,用于访问指纹认证驱动程序。获取指纹认证驱动代理后,服务可以调用相关API获取执行器。 + * 获取指纹认证执行器后,服务可以调用相关API获取执行器信息,获取凭据模板信息、注册指纹特征模板、进行用户指纹认证、删除指纹特征模板等。 + * + * @since 3.2 + */ + +/** + * @file IExecutorCallback.idl + * + * @brief 定义异步API接口回调,用于返回异步接口的请求处理结果和信息。 + * + * @since 3.2 + */ + +package ohos.hdi.fingerprint_auth.v1_0; + +/** + * @brief 定义异步API接口回调。当执行器使用者调用异步函数时该回调需要被注册。使用细节见{@link IExecutor}。 + * + * @since 3.2 + * @version 1.0 + */ +[callback] interface IExecutorCallback { + /** + * @brief 定义操作结果回调函数。 + * + * @param result 操作请求处理结果。 + * @param extraInfo 其他相关信息,如用户认证通过时用于返回执行器签发的认证令牌等。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OnResult([in] int result, [in] unsigned char[] extraInfo); + /** + * @brief 定义操作过程信息反馈回调函数。 + * + * @param tip 提示信息编码{@link FingerprintTipsCode}。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + OnTip([in] int tip, [in] unsigned char[] extraInfo); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IFingerprintAuthInterface.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IFingerprintAuthInterface.idl new file mode 100644 index 00000000..578188a1 --- /dev/null +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IFingerprintAuthInterface.idl @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFingerprintAuth + * @{ + * + * @brief 提供指纹认证驱动的API接口。 + * + * 指纹认证驱动程序为指纹认证服务提供统一的接口,用于访问指纹认证驱动程序。获取指纹认证驱动代理后,服务可以调用相关API获取执行器。 + * 获取指纹认证执行器后,服务可以调用相关API获取执行器信息,获取凭据模板信息、注册指纹特征模板、进行用户指纹认证、删除指纹特征模板等。 + * + * @since 3.2 + */ + +/** + * @file IFingerprintAuthInterface.idl + * + * @brief 定义指纹认证驱动的执行器列表接口。此接口可用于获取驱动的执行器列表。 + * + * @since 3.2 + */ + +package ohos.hdi.fingerprint_auth.v1_0; + +import ohos.hdi.fingerprint_auth.v1_0.IExecutor; + +/** + * @brief 定义获取指纹认证驱动的执行器列表接口。 + * + * @since 3.2 + * @version 1.0 + */ +interface IFingerprintAuthInterface { + /** + * @brief 获取执行器列表,指纹认证服务进程启动进行初始化操作时通过该接口获取指纹认证驱动支持的执行器列表。 + * + * @param executorList 执行器对象列表{@link IExecutor}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetExecutorList([out] IExecutor[] executorList); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl new file mode 100644 index 00000000..496a0324 --- /dev/null +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFingerprintAuth + * @{ + * + * @brief 提供指纹认证驱动的API接口。 + * + * 指纹认证驱动程序为指纹认证服务提供统一的接口,用于访问指纹认证驱动程序。获取指纹认证驱动代理后,服务可以调用相关API获取执行器。 + * 获取指纹认证执行器后,服务可以调用相关API获取执行器信息,获取凭据模板信息、注册指纹特征模板、进行用户指纹认证、删除指纹特征模板等。 + * + * @since 4.0 + */ + +/** + * @file FingerprintAuthTypes.idl + * + * @brief 定义指纹认证驱动枚举和数据结构,包括认证类型、执行器角色、 执行器安全等级、命令ID、指纹提示信息编码、执行器信息和模板信息。 + * + * @since 4.0 + */ + +package ohos.hdi.fingerprint_auth.v1_1; + +/** + * @brief 枚举提示信息编码。 + * + * @since 4.0 + * @version 1.1 + */ +enum FingerprintTipsCode : int { + FINGERPRINT_AUTH_TIP_GOOD = 0, /**< 获取的指纹图像是完整的。 */ + FINGERPRINT_AUTH_TIP_DIRTY = 1, /**< 指纹图像非常模糊,原因是传感器上存在可疑或检测到的污垢。 */ + FINGERPRINT_AUTH_TIP_INSUFFICIENT = 2, /**< 仅检测到部分指纹图像。 */ + FINGERPRINT_AUTH_TIP_PARTIAL = 3, /**< 仅检测到部分指纹图像。 */ + FINGERPRINT_AUTH_TIP_TOO_FAST = 4, /**< 指纹图像由于快速移动而不完整。 */ + FINGERPRINT_AUTH_TIP_TOO_SLOW = 5, /**< 指纹图像由于没有移动而无法读取。 */ + FINGERPRINT_AUTH_TIP_FINGER_DOWN = 6, /**< 按下手指。 */ + FINGERPRINT_AUTH_TIP_FINGER_UP = 7, /**< 抬起手指。 */ + VENDOR_FINGERPRINT_AUTH_TIP_BEGIN = 10000 /**< 用于厂商自定义提示信息。 */ +}; + +/** + * @brief 获取指纹执行器属性。 + * + * @since 4.0 + * @version 1.1 + */ +enum GetPropertyType : int { + /**< 获取认证子类型。 */ + AUTH_SUB_TYPE = 1, + /**< 获取指纹剩余锁定时间。 */ + LOCKOUT_DURATION = 2, + /**< 获取指纹剩余比对次数。 */ + REMAIN_ATTEMPTS = 3, + /**< 获取指纹录入进度。 */ + ENROLL_PROGRESS = 4, + /**< 获取指纹光斑的信息。 */ + SENSOR_INFO = 5 +}; + +/** + * @brief 执行器属性。 + * + * @since 4.0 + * @version 1.1 + */ +struct Property { + /**< 认证子类型。 */ + unsigned long authSubType; + /**< 指纹剩余锁定时间。 */ + int lockoutDuration; + /**< 指纹剩余可重试次数。 */ + int remainAttempts; + /**< 指纹录入进度。 */ + String enrollmentProgress; + /**< 指纹光斑信息。 */ + String sensorInfo; +}; + +/** + * @brief 枚举sa命令ID。 + * + * @since 4.0 + * @version 1.1 + */ +enum SaCommandId : int { + /**< 打开光斑功能。 */ + ENABLE_SENSOR_ILLUMINATION = 1, + /**< 关闭光斑功能。 */ + DISABLE_SENSOR_ILLUMINATION = 2, + /**< 点亮光斑。 */ + TURN_ON_SENSOR_ILLUMINATION = 3, + /**< 熄灭光斑。 */ + TURN_OFF_SENSOR_ILLUMINATION = 4, +}; + +/** + * @brief 光斑使能的sa命令参数。 + * + * @since 4.0 + * @version 1.1 + */ +struct SaCommandParamEnableSensorIllumination { + /**< 高亮显示圆心x坐标与屏幕宽度的比值。 */ + unsigned int centerX; + /**< 高亮显示圆心y坐标与屏幕高度的比值。 */ + unsigned int centerY; + /**< 高亮显示圆半径,单位为px。 */ + unsigned int radius; + /**< 高亮显示亮度。 */ + unsigned int brightness; + /**< 高亮显示颜色。 */ + unsigned int color; +}; + +/** + * @brief sa命令参数为空。 + * + * @since 4.0 + * @version 1.1 + */ +struct SaCommandParamNone { +}; + +/** + * @brief sa命令参数。 + * + * @since 4.0 + * @version 1.1 + */ +union SaCommandParam { + /**< sa命令参数为空。{@link SaCommandParamNone}。 */ + struct SaCommandParamNone none; + /**< sa命令参数是打开光斑使能 {@link SaCommandParamEnableSensorIllumination}。 */ + struct SaCommandParamEnableSensorIllumination enableSensorIllumination; +}; + +/** + * @brief sa命令ID + * + * @since 4.0 + * @version 1.1 + */ +struct SaCommand { + /**< sa命令ID。见{@link SaCommandId}。 */ + enum SaCommandId id; + /**< sa命令参数。见{@link SaCommandParam}。 */ + union SaCommandParam param; +}; + +/** + * @brief 枚举命令ID。 + * + * @since 4.0 + * @version 1.1 + */ +enum CommandId : int { + LOCK_TEMPLATE = 1, /**< 指纹锁定的命令ID。 */ + UNLOCK_TEMPLATE = 2, /**< 指纹解锁的命令ID。 */ + INIT_ALGORITHM = 3, /**< 初始化算法的命令ID。 */ + VENDOR_COMMAND_BEGIN = 10000 /**< 用于厂商自定义提示信息。 */ +}; \ No newline at end of file diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl new file mode 100644 index 00000000..49631bd2 --- /dev/null +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFingerprintAuth + * @{ + * + * @brief 提供指纹认证驱动的API接口。 + * + * 指纹认证驱动程序为指纹认证服务提供统一的接口,用于访问指纹认证驱动程序。获取指纹认证驱动代理后,服务可以调用相关API获取执行器。 + * 获取指纹认证执行器后,服务可以调用相关API获取执行器信息,获取凭据模板信息、注册指纹特征模板、进行用户指纹认证、删除指纹特征模板等。 + * + * @since 4.0 + */ + +/** + * @file IExecutor.idl + * + * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册指纹特征模版,进行用户指纹认证,删除指纹特征模版等。 + * + * @since 4.0 + */ + +package ohos.hdi.fingerprint_auth.v1_1; + +import ohos.hdi.fingerprint_auth.v1_0.FingerprintAuthTypes; +import ohos.hdi.fingerprint_auth.v1_0.IExecutor; +import ohos.hdi.fingerprint_auth.v1_0.IExecutorCallback; +import ohos.hdi.fingerprint_auth.v1_1.FingerprintAuthTypes; +import ohos.hdi.fingerprint_auth.v1_1.ISaCommandCallback; + +/** + * @brief 定义执行器接口,用于获取执行器,获取凭据模版信息,注册指纹特征模版,进行用户指纹认证,删除指纹特征模版等。 + * + * @since 4.0 + * @version 1.1 + */ +interface IExecutor extends ohos.hdi.fingerprint_auth.v1_0.IExecutor { + /** + * @brief 指纹识别。 + * + * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 + * @param para 指纹识别参数,见{@link AuthenticateParam}。 + * @param callbackObj 回调对象{@link IExecutorCallback}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + AuthenticateV1_1([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] boolean endAfterFirstFail, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief 获取指纹执行器属性。 + * + * @param templateIdList 指定要认证的模版ID列表。 + * @param propertyTypes 指纹执行器属性类型,见{@link GetPropertyType}。 + * @param property 指纹执行器属性{@link Property}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + GetProperty([in] unsigned long[] templateIdList, [in] enum GetPropertyType[] propertyTypes, [out] struct Property property); + /** + * @brief 设置指纹缓存模板。 + * + * @param templateIdList 指纹缓存模板列表。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + SetCachedTemplates([in] unsigned long[] templateIdList); + /** + * @brief 注册sa命令回调。 + * + * @param callbackObj sa命令回调对象。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + RegisterSaCommandCallback([in] ISaCommandCallback callbackObj); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IFingerprintAuthInterface.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IFingerprintAuthInterface.idl new file mode 100644 index 00000000..07508537 --- /dev/null +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IFingerprintAuthInterface.idl @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFingerprintAuth + * @{ + * + * @brief 提供指纹认证驱动的API接口。 + * + * 指纹认证驱动程序为指纹认证服务提供统一的接口,用于访问指纹认证驱动程序。获取指纹认证驱动代理后,服务可以调用相关API获取执行器。 + * 获取指纹认证执行器后,服务可以调用相关API获取执行器信息,获取凭据模板信息、注册指纹特征模板、进行用户指纹认证、删除指纹特征模板等。 + * + * @since 4.0 + */ + +/** + * @file IFingerprintAuthInterface.idl + * + * @brief 定义指纹认证驱动的执行器列表接口。此接口可用于获取驱动的执行器列表。 + * + * @since 4.0 + */ + +package ohos.hdi.fingerprint_auth.v1_1; + +import ohos.hdi.fingerprint_auth.v1_0.IFingerprintAuthInterface; +import ohos.hdi.fingerprint_auth.v1_1.IExecutor; + +/** + * @brief 定义获取指纹认证驱动的执行器列表接口。 + * + * @since 4.0 + * @version 1.1 + */ +interface IFingerprintAuthInterface extends ohos.hdi.fingerprint_auth.v1_0.IFingerprintAuthInterface { + /** + * @brief 获取执行器列表,指纹认证服务进程启动进行初始化操作时通过该接口获取指纹认证驱动支持的执行器列表。 + * + * @param executorList 执行器对象列表,详细细节见{@link IExecutor}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + GetExecutorListV1_1([out] IExecutor[] executorList); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/ISaCommandCallback.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/ISaCommandCallback.idl new file mode 100644 index 00000000..0ea48606 --- /dev/null +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/ISaCommandCallback.idl @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfFingerprintAuth + * @{ + * + * @brief 提供指纹认证驱动的API接口。 + * + * 指纹认证驱动程序为指纹认证服务提供统一的接口,用于访问指纹认证驱动程序。获取指纹认证驱动代理后,服务可以调用相关API获取执行器。 + * 获取指纹认证执行器后,服务可以调用相关API获取执行器信息,获取凭据模板信息、注册指纹特征模板、进行用户指纹认证、删除指纹特征模板等。 + * + * @since 4.0 + */ + +/** + * @file ISaCommandCallback.idl + * + * @brief 定义异步API接口回调,可以发送命令给SA。见{@link IExecutor}。 + * + * @since 4.0 + */ + +package ohos.hdi.fingerprint_auth.v1_1; + +import ohos.hdi.fingerprint_auth.v1_1.FingerprintAuthTypes; + +/** + * @brief 定义异步API接口回调,可以发送命令给SA。见{@link IExecutor}。 + * + * @since 4.0 + * @version 1.1 + */ +[callback] interface ISaCommandCallback { + /** + * @brief 定义SA命令过程回调函数。 + * + * @param commands SA命令见 {@link SaCommand}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + OnSaCommands([in] struct SaCommand[] commands); +} +/** @} */ \ No newline at end of file -- Gitee From 6c9e5e2a1077cfe5897ac9ea16d35c18f9fd5357 Mon Sep 17 00:00:00 2001 From: lbl Date: Fri, 24 Nov 2023 09:33:01 +0800 Subject: [PATCH 0099/2135] translate fixed Signed-off-by: lbl --- zh-cn/device_api/hdi/face_auth/v1_0/IExecutor.idl | 14 +++++++------- .../hdi/face_auth/v1_0/IExecutorCallback.idl | 2 +- .../hdi/face_auth/v1_0/IFaceAuthInterface.idl | 2 +- .../hdi/face_auth/v1_1/FaceAuthTypes.idl | 10 +++++----- zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl | 4 ++-- .../hdi/face_auth/v1_1/IFaceAuthInterface.idl | 2 +- .../hdi/face_auth/v1_1/ISaCommandCallback.idl | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/zh-cn/device_api/hdi/face_auth/v1_0/IExecutor.idl b/zh-cn/device_api/hdi/face_auth/v1_0/IExecutor.idl index bdadbe74..7df3d9e1 100644 --- a/zh-cn/device_api/hdi/face_auth/v1_0/IExecutor.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_0/IExecutor.idl @@ -48,7 +48,7 @@ interface IExecutor { /** * @brief 获取执行器信息,人脸认证服务将执行器注册到用户认证框架时需要通过该接口获取对应信息。 * - * @param executorInfo 执行器信息{@link ExecutorInfo}。 + * @param executorInfo 执行器信息。详细说明请参考{@link ExecutorInfo}。 * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 @@ -61,7 +61,7 @@ interface IExecutor { * @brief 获取凭据模版信息。 * * @param templateId 凭据模版ID。 - * @param templateInfo 凭据模版信息{@link TemplateInfo}。 + * @param templateInfo 凭据模版信息。详细说明请参考{@link TemplateInfo}。 * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 @@ -89,7 +89,7 @@ interface IExecutor { * * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 + * @param callbackObj 回调对象。详细说明请参考{@link IExecutorCallback}。 * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 @@ -104,7 +104,7 @@ interface IExecutor { * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 * @param templateIdList 指定要认证的模版ID列表。 * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 + * @param callbackObj 回调对象。详细说明请参考{@link IExecutorCallback}。 * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 @@ -118,7 +118,7 @@ interface IExecutor { * * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 + * @param callbackObj 回调对象。详细说明请参考{@link IExecutorCallback}。 * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 @@ -154,9 +154,9 @@ interface IExecutor { /** * @brief 发送人脸认证功能相关操作命令。 * - * @param commandId 操作命令ID{@link CommandId}。 + * @param commandId 操作命令ID。详细说明请参考{@link CommandId}。 * @param extraInfo 其他相关信息,用于支持信息扩展。 - * @param callbackObj 回调对象{@link IExecutorCallback}。 + * @param callbackObj 回调对象。详细说明请参考{@link IExecutorCallback}。 * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 diff --git a/zh-cn/device_api/hdi/face_auth/v1_0/IExecutorCallback.idl b/zh-cn/device_api/hdi/face_auth/v1_0/IExecutorCallback.idl index 1e7870d3..6542f13a 100644 --- a/zh-cn/device_api/hdi/face_auth/v1_0/IExecutorCallback.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_0/IExecutorCallback.idl @@ -58,7 +58,7 @@ package ohos.hdi.face_auth.v1_0; /** * @brief 定义操作过程信息反馈回调函数。 * - * @param acquire 提示信息编码{@link FaceTipsCode}。 + * @param acquire 提示信息编码。详细说明请参考{@link FaceTipsCode}。 * @param extraInfo 其他相关信息,用于支持信息扩展。 * * @return 0 表示操作成功。 diff --git a/zh-cn/device_api/hdi/face_auth/v1_0/IFaceAuthInterface.idl b/zh-cn/device_api/hdi/face_auth/v1_0/IFaceAuthInterface.idl index 59dbd0fe..68736cbb 100644 --- a/zh-cn/device_api/hdi/face_auth/v1_0/IFaceAuthInterface.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_0/IFaceAuthInterface.idl @@ -47,7 +47,7 @@ interface IFaceAuthInterface { /** * @brief 获取执行器列表,人脸认证服务进程启动进行初始化操作时通过该接口获取人脸认证驱动支持的执行器列表。 * - * @param executorList 执行器对象列表{@link IExecutor}。 + * @param executorList 执行器对象列表。详细说明请参考{@link IExecutor}。 * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 diff --git a/zh-cn/device_api/hdi/face_auth/v1_1/FaceAuthTypes.idl b/zh-cn/device_api/hdi/face_auth/v1_1/FaceAuthTypes.idl index 524dec52..94bce284 100644 --- a/zh-cn/device_api/hdi/face_auth/v1_1/FaceAuthTypes.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_1/FaceAuthTypes.idl @@ -56,7 +56,7 @@ enum GetPropertyType : int { }; /** - * @brief Indicates executor property. + * @brief 执行器相关属性。 * * @since 4.0 * @version 1.1 @@ -75,7 +75,7 @@ struct Property { }; /** - * @brief Enumerates sa command ids. + * @brief 枚举sa命令id。 * * @since 4.0 * @version 1.1 @@ -103,7 +103,7 @@ struct SaCommandParamNone { * @version 1.1 */ union SaCommandParam { - /** sa命令参数为空。 See {@link SaCommandParamNone}. */ + /** sa命令参数为空。详细说明请参考{@link SaCommandParamNone}. */ struct SaCommandParamNone none; }; @@ -114,9 +114,9 @@ union SaCommandParam { * @version 1.1 */ struct SaCommand { - /** sa命令ID。 See {@link SaCommandId}. */ + /** sa命令ID。详细说明请参考{@link SaCommandId}. */ enum SaCommandId id; - /** sa命令参数。 See {@link SaCommandParam}. */ + /** sa命令参数。详细说明请参考{@link SaCommandParam}. */ union SaCommandParam param; }; diff --git a/zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl b/zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl index 69d60228..c68f588d 100644 --- a/zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_1/IExecutor.idl @@ -51,8 +51,8 @@ interface IExecutor extends ohos.hdi.face_auth.v1_0.IExecutor { * @brief 获得人脸执行器属性。 * * @param templateIdList 模板id列表。 - * @param propertyTypes 人脸执行器属性类型。 {@link GetPropertyType}. - * @param property 人脸执行器属性。 {@link Property}. + * @param propertyTypes 人脸执行器属性类型。详细说明请参考{@link GetPropertyType}. + * @param property 人脸执行器属性。详细说明请参考{@link Property}. * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 diff --git a/zh-cn/device_api/hdi/face_auth/v1_1/IFaceAuthInterface.idl b/zh-cn/device_api/hdi/face_auth/v1_1/IFaceAuthInterface.idl index 3dc8f169..0656045b 100644 --- a/zh-cn/device_api/hdi/face_auth/v1_1/IFaceAuthInterface.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_1/IFaceAuthInterface.idl @@ -48,7 +48,7 @@ interface IFaceAuthInterface extends ohos.hdi.face_auth.v1_0.IFaceAuthInterface /** * @brief 获得驱动的执行器列表。 * - * @param executorList 执行器对象列表。 {@link IExecutor}. + * @param executorList 执行器对象列表。详细说明请参考{@link IExecutor}. * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 diff --git a/zh-cn/device_api/hdi/face_auth/v1_1/ISaCommandCallback.idl b/zh-cn/device_api/hdi/face_auth/v1_1/ISaCommandCallback.idl index c242aec4..5ef44c8e 100644 --- a/zh-cn/device_api/hdi/face_auth/v1_1/ISaCommandCallback.idl +++ b/zh-cn/device_api/hdi/face_auth/v1_1/ISaCommandCallback.idl @@ -28,7 +28,7 @@ /** * @file ISaCommandCallback.idl * - * @brief 定义异步 API 的回调,该回调可用于向 SA 发送命令。{@link IExecutor}. + * @brief 定义异步 API 的回调,该回调可用于向 SA 发送命令。详细说明请参考{@link IExecutor}. * * @since 4.0 */ @@ -38,7 +38,7 @@ package ohos.hdi.face_auth.v1_1; import ohos.hdi.face_auth.v1_1.FaceAuthTypes; /** - * @brief 定义异步 API 的回调,该回调可用于向 SA 发送命令。{@link IExecutor}. + * @brief 定义异步 API 的回调,该回调可用于向 SA 发送命令。详细说明请参考{@link IExecutor}. * * @since 4.0 * @version 1.1 @@ -47,7 +47,7 @@ import ohos.hdi.face_auth.v1_1.FaceAuthTypes; /** * @brief 定义进程中sa命令的函数。 * - * @param commands 表示SA命令。{@link SaCommand}. + * @param commands 表示SA命令。详细说明请参考{@link SaCommand}. * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 -- Gitee From c9ab369137a9bdf408776fd9361c9d8c34ce2280 Mon Sep 17 00:00:00 2001 From: lvqiang214 Date: Fri, 24 Nov 2023 10:22:38 +0800 Subject: [PATCH 0100/2135] intelligent voice hdi Signed-off-by: lvqiang214 --- .../engine/iintell_voice_engine_adapter.h | 117 +++++++++++ .../engine/iintell_voice_engine_callback.h | 89 +++++++++ .../engine/iintell_voice_engine_manager.h | 101 ++++++++++ .../engine/intell_voice_engine_types.h | 130 +++++++++++++ .../engine/v1_0/IIntellVoiceEngineAdapter.idl | 164 ++++++++++++++++ .../v1_0/IIntellVoiceEngineCallback.idl | 69 +++++++ .../engine/v1_0/IIntellVoiceEngineManager.idl | 96 +++++++++ .../engine/v1_0/IntellVoiceEngineTypes.idl | 184 ++++++++++++++++++ .../trigger/iintell_voice_trigger_adapter.h | 103 ++++++++++ .../trigger/iintell_voice_trigger_callback.h | 89 +++++++++ .../trigger/iintell_voice_trigger_manager.h | 97 +++++++++ .../trigger/intell_voice_trigger_types.h | 113 +++++++++++ .../v1_0/IIntellVoiceTriggerAdapter.idl | 121 ++++++++++++ .../v1_0/IIntellVoiceTriggerCallback.idl | 70 +++++++ .../v1_0/IIntellVoiceTriggerManager.idl | 83 ++++++++ .../trigger/v1_0/IntellVoiceTriggerTypes.idl | 130 +++++++++++++ 16 files changed, 1756 insertions(+) create mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_adapter.h create mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_callback.h create mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_manager.h create mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/intell_voice_engine_types.h create mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineAdapter.idl create mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineCallback.idl create mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineManager.idl create mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IntellVoiceEngineTypes.idl create mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_adapter.h create mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_callback.h create mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_manager.h create mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/intell_voice_trigger_types.h create mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerAdapter.idl create mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerCallback.idl create mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerManager.idl create mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IntellVoiceTriggerTypes.idl diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_adapter.h b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_adapter.h new file mode 100644 index 00000000..88120382 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_adapter.h @@ -0,0 +1,117 @@ +/* + * 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 OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEADAPTER_H +#define OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEADAPTER_H + +#include +#include +#include +#include +#include +#include +#include "intelligent_voice/engine/v1_0/iintell_voice_engine_callback.h" +#include "intelligent_voice/engine/v1_0/intell_voice_engine_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +namespace HDI { +namespace IntelligentVoice { +namespace Engine { +namespace V1_0 { +using namespace OHOS; +using namespace OHOS::HDI; + +enum { + CMD_INTELL_VOICE_ENGINE_ADAPTER_GET_VERSION = 0, + CMD_INTELL_VOICE_ENGINE_ADAPTER_SET_CALLBACK = 1, + CMD_INTELL_VOICE_ENGINE_ADAPTER_ATTACH = 2, + CMD_INTELL_VOICE_ENGINE_ADAPTER_DETACH = 3, + CMD_INTELL_VOICE_ENGINE_ADAPTER_SET_PARAMETER = 4, + CMD_INTELL_VOICE_ENGINE_ADAPTER_GET_PARAMETER = 5, + CMD_INTELL_VOICE_ENGINE_ADAPTER_START = 6, + CMD_INTELL_VOICE_ENGINE_ADAPTER_STOP = 7, + CMD_INTELL_VOICE_ENGINE_ADAPTER_WRITE_AUDIO = 8, + CMD_INTELL_VOICE_ENGINE_ADAPTER_READ = 9, +}; + +class IIntellVoiceEngineAdapter : public HdiBase { +public: + DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineAdapter"); + + virtual ~IIntellVoiceEngineAdapter() = default; + + virtual int32_t SetCallback(const sptr& engineCallback) = 0; + + virtual int32_t Attach(const IntellVoiceEngineAdapterInfo& info) = 0; + + virtual int32_t Detach() = 0; + + virtual int32_t SetParameter(const std::string& keyValueList) = 0; + + virtual int32_t GetParameter(const std::string& keyList, std::string& valueList) = 0; + + virtual int32_t Start(const StartInfo& info) = 0; + + virtual int32_t Stop() = 0; + + virtual int32_t WriteAudio(const std::vector& buffer) = 0; + + virtual int32_t Read(ContentType type, sptr& buffer) = 0; + + virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) + { + majorVer = 1; + minorVer = 0; + return HDF_SUCCESS; + } + + virtual bool IsProxy() + { + return false; + } + + virtual const std::u16string GetDesc() + { + return metaDescriptor_; + } +}; +} // V1_0 +} // Engine +} // IntelligentVoice +} // HDI +} // OHOS + +#endif // OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEADAPTER_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_callback.h b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_callback.h new file mode 100644 index 00000000..3876ffc5 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_callback.h @@ -0,0 +1,89 @@ +/* + * 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 OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINECALLBACK_H +#define OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINECALLBACK_H + +#include +#include +#include +#include "intelligent_voice/engine/v1_0/intell_voice_engine_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +namespace HDI { +namespace IntelligentVoice { +namespace Engine { +namespace V1_0 { +using namespace OHOS; +using namespace OHOS::HDI; + +enum { + CMD_INTELL_VOICE_ENGINE_CALLBACK_GET_VERSION = 0, + CMD_INTELL_VOICE_ENGINE_CALLBACK_ON_INTELL_VOICE_HDI_EVENT = 1, +}; + +class IIntellVoiceEngineCallback : public HdiBase { +public: + DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineCallback"); + + virtual ~IIntellVoiceEngineCallback() = default; + + virtual int32_t OnIntellVoiceHdiEvent(const IntellVoiceEngineCallBackEvent& event) = 0; + + virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) + { + majorVer = 1; + minorVer = 0; + return HDF_SUCCESS; + } + + virtual bool IsProxy() + { + return false; + } + + virtual const std::u16string GetDesc() + { + return metaDescriptor_; + } +}; +} // V1_0 +} // Engine +} // IntelligentVoice +} // HDI +} // OHOS + +#endif // OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINECALLBACK_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_manager.h b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_manager.h new file mode 100644 index 00000000..655c4070 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_manager.h @@ -0,0 +1,101 @@ +/* + * 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 OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEMANAGER_H +#define OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEMANAGER_H + +#include +#include +#include +#include +#include "intelligent_voice/engine/v1_0/iintell_voice_engine_adapter.h" +#include "intelligent_voice/engine/v1_0/intell_voice_engine_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +namespace HDI { +namespace IntelligentVoice { +namespace Engine { +namespace V1_0 { +using namespace OHOS; +using namespace OHOS::HDI; + +enum { + CMD_INTELL_VOICE_ENGINE_MANAGER_GET_VERSION = 0, + CMD_INTELL_VOICE_ENGINE_MANAGER_GET_ADAPTER_DESCRIPTORS = 1, + CMD_INTELL_VOICE_ENGINE_MANAGER_CREATE_ADAPTER = 2, + CMD_INTELL_VOICE_ENGINE_MANAGER_RELEASE_ADAPTER = 3, +}; + +class IIntellVoiceEngineManager : public HdiBase { +public: + DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineManager"); + + virtual ~IIntellVoiceEngineManager() = default; + + static sptr Get(bool isStub = false); + static sptr Get(const std::string &serviceName, bool isStub = false); + + virtual int32_t GetAdapterDescriptors(std::vector& descs) = 0; + + virtual int32_t CreateAdapter(const IntellVoiceEngineAdapterDescriptor& descriptor, + sptr& adapter) = 0; + + virtual int32_t ReleaseAdapter(const IntellVoiceEngineAdapterDescriptor& descriptor) = 0; + + virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) + { + majorVer = 1; + minorVer = 0; + return HDF_SUCCESS; + } + + virtual bool IsProxy() + { + return false; + } + + virtual const std::u16string GetDesc() + { + return metaDescriptor_; + } +}; +} // V1_0 +} // Engine +} // IntelligentVoice +} // HDI +} // OHOS + +#endif // OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEMANAGER_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/intell_voice_engine_types.h b/zh-cn/device_api/hdi/intelligent_voice/engine/intell_voice_engine_types.h new file mode 100644 index 00000000..aa27c655 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/intell_voice_engine_types.h @@ -0,0 +1,130 @@ +/* + * 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 OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_INTELLVOICEENGINETYPES_H +#define OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_INTELLVOICEENGINETYPES_H + +#include +#include +#include + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +class MessageParcel; +} + +namespace OHOS { +namespace HDI { +namespace IntelligentVoice { +namespace Engine { +namespace V1_0 { + +using namespace OHOS; + +enum IntellVoiceEngineAdapterType : int32_t { + ENROLL_ADAPTER_TYPE = 0, + WAKEUP_ADAPTER_TYPE = 1, + UPDATE_ADAPTER_TYPE = 2, + ADAPTER_TYPE_BUT, +}; + +enum ContentType : int32_t { + DSP_MODLE = 0, + CONTENT_TYPE_BUT, +}; + +enum IntellVoiceEngineMessageType : int32_t { + INTELL_VOICE_ENGINE_MSG_NONE = 0, + INTELL_VOICE_ENGINE_MSG_INIT_DONE = 1, + INTELL_VOICE_ENGINE_MSG_ENROLL_COMPLETE = 2, + INTELL_VOICE_ENGINE_MSG_COMMIT_ENROLL_COMPLETE = 3, + INTELL_VOICE_ENGINE_MSG_RECOGNIZE_COMPLETE = 4, +}; + +enum IntellVoiceEngineErrors : int32_t { + INTELL_VOICE_ENGINE_OK = 0, + INTELL_VOICE_ENGINE_ERROR_OFFSET = -100, + INTELL_VOICE_ENGINE_INVALID_PARAMS = -101, + INTELL_VOICE_ENGINE_INIT_FAILED = -102, + INTELL_VOICE_ENGINE_ENROLL_FAILED = -103, + INTELL_VOICE_ENGINE_COMMIT_ENROLL_FAILED = -104, + INTELL_VOICE_ENGINE_WAKEUP_FAILED = -105, +}; + +struct IntellVoiceEngineAdapterDescriptor { + IntellVoiceEngineAdapterType adapterType; +} __attribute__ ((aligned(8))); + +struct IntellVoiceEngineAdapterInfo { + std::string wakeupPhrase; + int32_t minBufSize; + int32_t sampleChannels; + int32_t bitsPerSample; + int32_t sampleRate; +}; + +struct StartInfo { + bool isLast; +} __attribute__ ((aligned(8))); + +struct IntellVoiceEngineCallBackEvent { + IntellVoiceEngineMessageType msgId; + IntellVoiceEngineErrors result; + std::string info; +}; + +bool IntellVoiceEngineAdapterDescriptorBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceEngineAdapterDescriptor& dataBlock); + +bool IntellVoiceEngineAdapterDescriptorBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceEngineAdapterDescriptor& dataBlock); + +bool IntellVoiceEngineAdapterInfoBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceEngineAdapterInfo& dataBlock); + +bool IntellVoiceEngineAdapterInfoBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceEngineAdapterInfo& dataBlock); + +bool StartInfoBlockMarshalling(OHOS::MessageParcel &data, const StartInfo& dataBlock); + +bool StartInfoBlockUnmarshalling(OHOS::MessageParcel &data, StartInfo& dataBlock); + +bool IntellVoiceEngineCallBackEventBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceEngineCallBackEvent& dataBlock); + +bool IntellVoiceEngineCallBackEventBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceEngineCallBackEvent& dataBlock); + +} // V1_0 +} // Engine +} // IntelligentVoice +} // HDI +} // OHOS + +#endif // OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_INTELLVOICEENGINETYPES_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineAdapter.idl b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineAdapter.idl new file mode 100644 index 00000000..2e95e373 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineAdapter.idl @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup IntelligentVoiceEngine + * @{ + * + * @brief IntelligentVoiceEngine模块向上层服务提供了统一接口。 + * + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁算法引擎、启动停止算法引擎、写数据、读文件、回调函数注册等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IIntellVoiceEngineAdapter.idl + * + * @brief IntelligentVoiceEngine模块智能语音引擎适配器接口,包括设置回调、加载引擎、卸载引擎、设置参数、获取参数、启动引擎、停止引擎、读写数据等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief IntelligentVoiceEngine模块接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.engine.v1_0; + +import ohos.hdi.intelligent_voice.engine.v1_0.IntellVoiceEngineTypes; +import ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineCallback; + + /** + * @brief IntelligentVoiceEngine模块向上层服务提供了智能语音引擎适配器接口。 + * + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上智能语音引擎适配器接口实现设置回调、加载引擎、卸载引擎、设置参数、获取参数、启动引擎、停止引擎、读写数据等功能。 + * + * @since 4.0 + * @version 1.0 + */ +interface IIntellVoiceEngineAdapter { + /** + * @brief 上层服务设置回调接口。 + * + * @param engineCallback 回调接口,具体参考{@link IIntellVoiceEngineCallback}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + SetCallback([in] IIntellVoiceEngineCallback engineCallback); + /** + * @brief 加载引擎。 + * + * @param info 智能语音引擎适配器信息,具体参考{@link IntellVoiceEngineAdapterInfo}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Attach([in] struct IntellVoiceEngineAdapterInfo info); + /** + * @brief 卸载引擎。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Detach(); + /** + * @brief 设置参数。 + * + * @param keyValueList 键值对列表,键值对的格式为"key=value",键值对之间使用,分隔。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + SetParameter([in] String keyValueList); + /** + * @brief 获取参数。 + * + * @param keyList 键列表,键之间使用,分隔。 + * @param valueList 返回值列表,返回值之间使用,分隔。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetParameter([in] String keyList, [out] String valueList); + /** + * @brief 启动引擎。 + * + * @param info 启动信息,具体参考{@link StartInfo}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Start([in] struct StartInfo info); + /** + * @brief 停止引擎。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Stop(); + /** + * @brief 写语音数据。 + * + * @param buffer 语音数据。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + WriteAudio([in] List buffer); + /** + * @brief 读数据。 + * + * @param type 数据类型,具体参考{@link ContentType}。 + * @param buffer 数据内容。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Read([in] enum ContentType type, [out] Ashmem buffer); +} diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineCallback.idl b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineCallback.idl new file mode 100644 index 00000000..e52a69fb --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineCallback.idl @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup IntelligentVoiceEngine + * @{ + * + * @brief IntelligentVoiceEngine模块向上层服务提供了统一接口。 + * + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁算法引擎、启动停止算法引擎、写数据、读文件、回调函数注册等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IIntellVoiceEngineCallback.idl + * + * @brief IntelligentVoiceEngine模块智能语音引擎回调接口,用于通知上层服务事件信息。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief IntelligentVoiceEngine模块接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.engine.v1_0; + +import ohos.hdi.intelligent_voice.engine.v1_0.IntellVoiceEngineTypes; + + /** + * @brief IntelligentVoiceEngine模块向上层服务提供了智能语音引擎回调接口。 + * + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上智能语音引擎回调接口实现底层事件上报的功能。 + * + * @since 4.0 + * @version 1.0 + */ +[callback] interface IIntellVoiceEngineCallback { + /** + * @brief 引擎回调函数。 + * + * @param event 智能语音引擎回调事件信息,具体参考{@link IntellVoiceEngineCallBackEvent}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + OnIntellVoiceHdiEvent([in] struct IntellVoiceEngineCallBackEvent event); +} diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineManager.idl b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineManager.idl new file mode 100644 index 00000000..f92263d4 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineManager.idl @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup IntelligentVoiceEngine + * @{ + * + * @brief IntelligentVoiceEngine模块向上层服务提供了统一接口。 + * + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁算法引擎、启动停止算法引擎、写数据、读文件、回调函数注册等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IIntellVoiceEngineManager.idl + * + * @brief IntelligentVoiceEngine模块引擎管理接口,包括获取引擎适配器描述符、创建引擎适配器、释放引擎适配器等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief IntelligentVoiceEngine模块接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.engine.v1_0; + +import ohos.hdi.intelligent_voice.engine.v1_0.IntellVoiceEngineTypes; +import ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineAdapter; +import ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceDataOprCallback; + + /** + * @brief IntelligentVoiceEngine模块向上层服务提供了智能语音引擎管理接口。 + * + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上智能语音引擎管理接口实现获取引擎适配器描述符、创建引擎适配器、释放引擎适配器等功能。 + * + * @since 4.0 + * @version 1.0 + */ +interface IIntellVoiceEngineManager { + /** + * @brief 上层服务查询智能语音引擎适配器描述符。 + * + * @param descs 存放智能语音引擎适配器描述符的数组,信息包含智能语音引擎适配器类型,具体参考{@link IntellVoiceEngineAdapterDescriptor}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetAdapterDescriptors([out] List descs); + /** + * @brief 上层服务创建智能语音引擎适配器。 + * + * @param descriptor 智能语音引擎适配器描述符,信息包含智能语音引擎适配器类型,具体参考{@link IntellVoiceEngineAdapterDescriptor}。 + * @param adapter 智能语音引擎适配器,具体参考{@link IIntellVoiceEngineAdapter}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + CreateAdapter([in] struct IntellVoiceEngineAdapterDescriptor descriptor, [out] IIntellVoiceEngineAdapter adapter); + /** + * @brief 上层服务释放智能语音引擎适配器。 + * + * @param descriptor 智能语音引擎适配器描述符,信息包含智能语音引擎适配器类型,具体参考{@link IntellVoiceEngineAdapterDescriptor}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + ReleaseAdapter([in] struct IntellVoiceEngineAdapterDescriptor descriptor); +} diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IntellVoiceEngineTypes.idl b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IntellVoiceEngineTypes.idl new file mode 100644 index 00000000..141e62a5 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IntellVoiceEngineTypes.idl @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup IntelligentVoiceEngine + * @{ + * + * @brief IntelligentVoiceEngine模块向上层服务提供了统一接口。 + * + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁算法引擎、启动停止算法引擎、写数据、读文件、回调函数注册等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IntellVoiceEngineTypes.idl + * + * @brief IntelligentVoiceEngine模块接口定义中使用的数据类型,包括引擎适配器类型、数据类型、回调消息类型、回调消息错误码、引擎适配器描述、回调事件信息等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief IntelligentVoiceEngine模块接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.engine.v1_0; + +/** + * @brief 智能语音引擎适配器类型。 + * + * @since 4.0 + * @version 1.0 + */ +enum IntellVoiceEngineAdapterType { + /** 注册引擎适配器 */ + ENROLL_ADAPTER_TYPE = 0, + /** 唤醒引擎适配器 */ + WAKEUP_ADAPTER_TYPE = 1, + /** 静默升级引擎适配器 */ + UPDATE_ADAPTER_TYPE = 2, + /** 无效引擎适配器 */ + ADAPTER_TYPE_BUT, +}; + +/** + * @brief 数据类型。 + * + * 上层服务读取的数据类型。\n + * + * @since 4.0 + * @version 1.0 + */ +enum ContentType { + /** DSP模型文件 */ + DSP_MODLE = 0, + /** 无效数据类型 */ + CONTENT_TYPE_BUT, +}; + +/** + * @brief 回调消息类型。 + * + * 通知上层服务的消息类型。\n + * + * @since 4.0 + * @version 1.0 + */ +enum IntellVoiceEngineMessageType { + /** 无效消息类型 */ + INTELL_VOICE_ENGINE_MSG_NONE = 0, + /** 初始化完成消息 */ + INTELL_VOICE_ENGINE_MSG_INIT_DONE = 1, + /** 注册完成消息 */ + INTELL_VOICE_ENGINE_MSG_ENROLL_COMPLETE = 2, + /** 确认注册完成消息 */ + INTELL_VOICE_ENGINE_MSG_COMMIT_ENROLL_COMPLETE = 3, + /** 唤醒识别消息 */ + INTELL_VOICE_ENGINE_MSG_RECOGNIZE_COMPLETE = 4, +}; + +/** + * @brief 回调消息错误码。 + * + * 通知上层服务的消息错误码。\n + * + * @since 4.0 + * @version 1.0 + */ +enum IntellVoiceEngineErrors { + /** 成功 */ + INTELL_VOICE_ENGINE_OK = 0, + /** 错误码偏移 */ + INTELL_VOICE_ENGINE_ERROR_OFFSET = -100, + /** 无效参数 */ + INTELL_VOICE_ENGINE_INVALID_PARAMS = -101, + /** 初始化失败 */ + INTELL_VOICE_ENGINE_INIT_FAILED = -102, + /** 注册失败 */ + INTELL_VOICE_ENGINE_ENROLL_FAILED = -103, + /** 确认注册失败 */ + INTELL_VOICE_ENGINE_COMMIT_ENROLL_FAILED = -104, + /** 唤醒失败 */ + INTELL_VOICE_ENGINE_WAKEUP_FAILED = -105, +}; + +/** + * @brief 智能语音引擎适配器描述符。 + * + * 一个智能语音引擎适配器(adapter)对应一个智能语音引擎算法实例。 + * + * @since 4.0 + * @version 1.0 + * + */ +struct IntellVoiceEngineAdapterDescriptor { + /** 智能语音引擎适配器类型。 */ + enum IntellVoiceEngineAdapterType adapterType; +}; + +/** + * @brief 智能语音引擎适配器信息。 + * + * @since 4.0 + * @version 1.0 + * + */ +struct IntellVoiceEngineAdapterInfo { + /** 唤醒词。 */ + String wakeupPhrase; + /** 最小语音数据量。 */ + int minBufSize; + /** 通道数。 */ + int sampleChannels; + /** 位宽。 */ + int bitsPerSample; + /** 采样率。 */ + int sampleRate; +}; + +/** + * @brief 智能语音引擎启动信息。 + * + * @since 4.0 + * @version 1.0 + * + */ +struct StartInfo { + /** 是否最后一次启动引擎。 */ + boolean isLast; +}; + +/** + * @brief 智能语音引擎回调事件信息。 + * + * @since 4.0 + * @version 1.0 + * + */ +struct IntellVoiceEngineCallBackEvent { + /** 回调消息类型。 */ + enum IntellVoiceEngineMessageType msgId; + /** 回调消息结果。 */ + enum IntellVoiceEngineErrors result; + /** 回调消息内容。 */ + String info; +}; \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_adapter.h b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_adapter.h new file mode 100644 index 00000000..3b1f9594 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_adapter.h @@ -0,0 +1,103 @@ +/* + * 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 OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERADAPTER_H +#define OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERADAPTER_H + +#include +#include +#include +#include "intelligent_voice/trigger/v1_0/iintell_voice_trigger_callback.h" +#include "intelligent_voice/trigger/v1_0/intell_voice_trigger_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +namespace HDI { +namespace IntelligentVoice { +namespace Trigger { +namespace V1_0 { +using namespace OHOS; +using namespace OHOS::HDI; + +enum { + CMD_INTELL_VOICE_TRIGGER_ADAPTER_GET_VERSION = 0, + CMD_INTELL_VOICE_TRIGGER_ADAPTER_GET_PROPERTIES = 1, + CMD_INTELL_VOICE_TRIGGER_ADAPTER_LOAD_MODEL = 2, + CMD_INTELL_VOICE_TRIGGER_ADAPTER_UNLOAD_MODEL = 3, + CMD_INTELL_VOICE_TRIGGER_ADAPTER_START = 4, + CMD_INTELL_VOICE_TRIGGER_ADAPTER_STOP = 5, +}; + +class IIntellVoiceTriggerAdapter : public HdiBase { +public: + DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerAdapter"); + + virtual ~IIntellVoiceTriggerAdapter() = default; + + virtual int32_t GetProperties(IntellVoiceTriggerProperties& properties) = 0; + + virtual int32_t LoadModel(const IntellVoiceTriggerModel& model, + const sptr& triggerCallback, int32_t cookie, int32_t& handle) = 0; + + virtual int32_t UnloadModel(int32_t handle) = 0; + + virtual int32_t Start(int32_t handle) = 0; + + virtual int32_t Stop(int32_t handle) = 0; + + virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) + { + majorVer = 1; + minorVer = 0; + return HDF_SUCCESS; + } + + virtual bool IsProxy() + { + return false; + } + + virtual const std::u16string GetDesc() + { + return metaDescriptor_; + } +}; +} // V1_0 +} // Trigger +} // IntelligentVoice +} // HDI +} // OHOS + +#endif // OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERADAPTER_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_callback.h b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_callback.h new file mode 100644 index 00000000..93d890a5 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_callback.h @@ -0,0 +1,89 @@ +/* + * 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 OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERCALLBACK_H +#define OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERCALLBACK_H + +#include +#include +#include +#include "intelligent_voice/trigger/v1_0/intell_voice_trigger_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +namespace HDI { +namespace IntelligentVoice { +namespace Trigger { +namespace V1_0 { +using namespace OHOS; +using namespace OHOS::HDI; + +enum { + CMD_INTELL_VOICE_TRIGGER_CALLBACK_GET_VERSION = 0, + CMD_INTELL_VOICE_TRIGGER_CALLBACK_ON_RECOGNITION_HDI_EVENT = 1, +}; + +class IIntellVoiceTriggerCallback : public HdiBase { +public: + DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerCallback"); + + virtual ~IIntellVoiceTriggerCallback() = default; + + virtual int32_t OnRecognitionHdiEvent(const IntellVoiceRecognitionEvent& event, int32_t cookie) = 0; + + virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) + { + majorVer = 1; + minorVer = 0; + return HDF_SUCCESS; + } + + virtual bool IsProxy() + { + return false; + } + + virtual const std::u16string GetDesc() + { + return metaDescriptor_; + } +}; +} // V1_0 +} // Trigger +} // IntelligentVoice +} // HDI +} // OHOS + +#endif // OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERCALLBACK_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_manager.h b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_manager.h new file mode 100644 index 00000000..541f303d --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_manager.h @@ -0,0 +1,97 @@ +/* + * 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 OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERMANAGER_H +#define OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERMANAGER_H + +#include +#include +#include +#include "intelligent_voice/trigger/v1_0/iintell_voice_trigger_adapter.h" +#include "intelligent_voice/trigger/v1_0/intell_voice_trigger_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +namespace HDI { +namespace IntelligentVoice { +namespace Trigger { +namespace V1_0 { +using namespace OHOS; +using namespace OHOS::HDI; + +enum { + CMD_INTELL_VOICE_TRIGGER_MANAGER_GET_VERSION = 0, + CMD_INTELL_VOICE_TRIGGER_MANAGER_LOAD_ADAPTER = 1, + CMD_INTELL_VOICE_TRIGGER_MANAGER_UNLOAD_ADAPTER = 2, +}; + +class IIntellVoiceTriggerManager : public HdiBase { +public: + DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerManager"); + + virtual ~IIntellVoiceTriggerManager() = default; + + static sptr Get(bool isStub = false); + static sptr Get(const std::string &serviceName, bool isStub = false); + + virtual int32_t LoadAdapter(const IntellVoiceTriggerAdapterDsecriptor& descriptor, + sptr& adapter) = 0; + + virtual int32_t UnloadAdapter(const IntellVoiceTriggerAdapterDsecriptor& descriptor) = 0; + + virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) + { + majorVer = 1; + minorVer = 0; + return HDF_SUCCESS; + } + + virtual bool IsProxy() + { + return false; + } + + virtual const std::u16string GetDesc() + { + return metaDescriptor_; + } +}; +} // V1_0 +} // Trigger +} // IntelligentVoice +} // HDI +} // OHOS + +#endif // OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERMANAGER_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/intell_voice_trigger_types.h b/zh-cn/device_api/hdi/intelligent_voice/trigger/intell_voice_trigger_types.h new file mode 100644 index 00000000..1de51b08 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/intell_voice_trigger_types.h @@ -0,0 +1,113 @@ +/* + * 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 OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_INTELLVOICETRIGGERTYPES_H +#define OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_INTELLVOICETRIGGERTYPES_H + +#include +#include +#include +#include + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +class MessageParcel; +} + +namespace OHOS { +namespace HDI { +namespace IntelligentVoice { +namespace Trigger { +namespace V1_0 { + +using namespace OHOS; + +enum IntellVoiceTriggerModelType : int32_t { + UNKNOWN = -1, + DEFAULT = 1, +}; + +enum RecognitionStatus : int32_t { + SUCCESS = 0, + ABORT = 1, + FAILURE = 2, +}; + +struct IntellVoiceTriggerAdapterDsecriptor { + std::string adapterName; +}; + +struct IntellVoiceTriggerProperties { + std::string implementor; + std::string description; + uint32_t version; + uint32_t maxIntellVoiceModels; +}; + +struct IntellVoiceTriggerModel { + IntellVoiceTriggerModelType type; + uint32_t uid; + sptr data; +}; + +struct IntellVoiceRecognitionEvent { + RecognitionStatus status; + IntellVoiceTriggerModelType type; + int32_t modelHandle; +} __attribute__ ((aligned(8))); + +bool IntellVoiceTriggerAdapterDsecriptorBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceTriggerAdapterDsecriptor& dataBlock); + +bool IntellVoiceTriggerAdapterDsecriptorBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceTriggerAdapterDsecriptor& dataBlock); + +bool IntellVoiceTriggerPropertiesBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceTriggerProperties& dataBlock); + +bool IntellVoiceTriggerPropertiesBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceTriggerProperties& dataBlock); + +bool IntellVoiceTriggerModelBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceTriggerModel& dataBlock); + +bool IntellVoiceTriggerModelBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceTriggerModel& dataBlock); + +bool IntellVoiceRecognitionEventBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceRecognitionEvent& dataBlock); + +bool IntellVoiceRecognitionEventBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceRecognitionEvent& dataBlock); + +} // V1_0 +} // Trigger +} // IntelligentVoice +} // HDI +} // OHOS + +#endif // OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_INTELLVOICETRIGGERTYPES_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerAdapter.idl b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerAdapter.idl new file mode 100644 index 00000000..4df818c8 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerAdapter.idl @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup IntelligentVoiceTrigger + * @{ + * + * @brief IntelligentVoiceTrigger模块向上层服务提供了统一接口。 + * + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载、触发器适配器卸载、模型加载、模型卸载、启动算法、停止算法等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IIntellVoiceTriggerAdapter.idl + * + * @brief IntelligentVoiceTrigger模块触发器适配器接口,包括获取智能语音触发器属性、加载模型、卸载模型、启动算法、停止算法等。 + * + * @since 4.0 + * @version 1.0 + */ + + /** + * @brief IntelligentVoiceTrigger模块接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.trigger.v1_0; + +import ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerTypes; +import ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerCallback; + + /** + * @brief IntelligentVoiceTrigger模块向上层服务提供了智能语音触发器适配器接口。 + * + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上智能语音触发器适配器接口实现获取智能语音触发器属性、加载模型、卸载模型、启动算法、停止算法等功能。 + * + * @since 4.0 + * @version 1.0 + */ +interface IIntellVoiceTriggerAdapter { + /** + * @brief 获取智能语音触发器属性。 + * + * @param properties 智能语音触发器属性,信息包含触发器名称、描述、版本、支持最大模型数,具体参考{@link IntellVoiceTriggerProperties}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetProperties([out] struct IntellVoiceTriggerProperties properties); + /** + * @brief 加载模型。 + * + * @param model 智能语音触发器模型信息,信息包含类型、标识、内容,具体参考{@link IntellVoiceTriggerModel}。 + * @param triggerCallback 触发器回调接口,具体参考{@link IIntellVoiceTriggerCallback}。 + * @param cookie 上层调用者标识。 + * @param handle 返回给上层的模型句柄。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + LoadModel([in] struct IntellVoiceTriggerModel model, [in] IIntellVoiceTriggerCallback triggerCallback, [in] int cookie, [out] int handle); + /** + * @brief 加载模型。 + * + * @param handle 模型句柄。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + UnloadModel([in] int handle); + /** + * @brief 启动算法。 + * + * @param handle 模型句柄。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Start([in] int handle); + /** + * @brief 停止算法。 + * + * @param handle 模型句柄。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Stop([in] int handle); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerCallback.idl b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerCallback.idl new file mode 100644 index 00000000..4c12bb22 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerCallback.idl @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup IntelligentVoiceTrigger + * @{ + * + * @brief IntelligentVoiceTrigger模块向上层服务提供了统一接口。 + * + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载、触发器适配器卸载、模型加载、模型卸载、启动算法、停止算法等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IIntellVoiceTriggerCallback.idl + * + * @brief IntelligentVoiceTrigger模块触发器回调接口,包括识别事件上报等。 + * + * @since 4.0 + * @version 1.0 + */ + + /** + * @brief IntelligentVoiceTrigger模块接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.trigger.v1_0; + +import ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerTypes; + + /** + * @brief IntelligentVoiceTrigger模块向上层服务提供了智能语音触发器回调接口。 + * + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上智能语音触发器回调接口实现通知上层识别事件等功能。 + * + * @since 4.0 + * @version 1.0 + */ +[callback] interface IIntellVoiceTriggerCallback { + /** + * @brief 识别事件上报 + * + * @param event 智能语音识别事件信息,信息包含识别状态、智能语音触发器模型类型、智能语音触发器模型句柄,具体参考{@link IntellVoiceRecognitionEvent}。 + * @param cookie 上层调用者标识。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + OnRecognitionHdiEvent([in] struct IntellVoiceRecognitionEvent event, [in] int cookie); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerManager.idl b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerManager.idl new file mode 100644 index 00000000..8d388357 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerManager.idl @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup IntelligentVoiceTrigger + * @{ + * + * @brief IntelligentVoiceTrigger模块向上层服务提供了统一接口。 + * + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载、触发器适配器卸载、模型加载、模型卸载、启动算法、停止算法等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IIntellVoiceTriggerManager.idl + * + * @brief IntelligentVoiceTrigger模块触发器管理接口,包括触发器适配器加载、触发器适配器卸载等。 + * + * @since 4.0 + * @version 1.0 + */ + + /** + * @brief IntelligentVoiceTrigger模块接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.trigger.v1_0; + +import ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerTypes; +import ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerAdapter; + + /** + * @brief IntelligentVoiceTrigger模块向上层服务提供了智能语音触发器管理接口。 + * + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上智能语音触发器管理接口实现驱动适配器加载、驱动适配器卸载等功能。 + * + * @since 4.0 + * @version 1.0 + */ +interface IIntellVoiceTriggerManager { + /** + * @brief 加载触发器适配器。 + * + * @param descriptor 智能语音触发器适配器描述符,信息包含适配器名称,具体参考{@link IntellVoiceTriggerAdapterDsecriptor}。 + * @param adapter 智能语音触发器适配器,具体参考{@link IIntellVoiceTriggerAdapter}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + LoadAdapter([in] struct IntellVoiceTriggerAdapterDsecriptor descriptor, [out] IIntellVoiceTriggerAdapter adapter); + /** + * @brief 卸载触发器适配器。 + * + * @param descriptor 智能语音触发器适配器描述符,信息包含适配器名称,具体参考{@link IntellVoiceTriggerAdapterDsecriptor}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + UnloadAdapter([in] struct IntellVoiceTriggerAdapterDsecriptor descriptor); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IntellVoiceTriggerTypes.idl b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IntellVoiceTriggerTypes.idl new file mode 100644 index 00000000..afdd1fb9 --- /dev/null +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IntellVoiceTriggerTypes.idl @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup IntelligentVoiceTrigger + * @{ + * + * @brief IntelligentVoiceTrigger模块向上层服务提供了统一接口。 + * + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载、触发器适配器卸载、模型加载、模型卸载、启动算法、停止算法等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IntellVoiceTriggerTypes.idl + * + * @brief IntelligentVoiceTrigger模块接口定义中使用的数据类型,包括模型类型、识别状态、触发器适配器描述符、驱动属性、模型信息、识别事件信息等。 + * + * @since 4.0 + * @version 1.0 + */ + + /** + * @brief IntelligentVoiceTrigger模块接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.trigger.v1_0; + +/** + * @brief 智能语音触发器模型类型。 + * + * @since 4.0 + * @version 1.0 + */ +enum IntellVoiceTriggerModelType { + /** 未知模型 */ + UNKNOWN = -1, + /** 默认模型 */ + DEFAULT = 1, +}; + +/** + * @brief 识别状态。 + * + * @since 4.0 + * @version 1.0 + */ +enum RecognitionStatus { + /** 识别成功 */ + SUCCESS = 0, + /** 识别中止 */ + ABORT = 1, + /** 识别失败 */ + FAILURE = 2, +}; + +/** + * @brief 智能语音触发器适配器描述符。 + * + * @since 4.0 + * @version 1.0 + */ +struct IntellVoiceTriggerAdapterDsecriptor { + /** 适配器名称 */ + String adapterName; +}; + +/** + * @brief 智能语音触发器属性。 + * + * @since 4.0 + * @version 1.0 + */ +struct IntellVoiceTriggerProperties { + /** 触发器名称 */ + String implementor; + /** 触发器描述 */ + String description; + /** 触发器版本号 */ + unsigned int version; + /** 触发器支持最大可加载模型数 */ + unsigned int maxIntellVoiceModels; +}; + +/** + * @brief 智能语音触发器模型信息。 + * + * @since 4.0 + * @version 1.0 + */ +struct IntellVoiceTriggerModel { + /** 智能语音触发器模型类型 */ + enum IntellVoiceTriggerModelType type; + /** 智能语音触发器模型标识 */ + unsigned int uid; + /** 智能语音触发器模型内容 */ + Ashmem data; +}; + +/** + * @brief 智能语音识别事件信息。 + * + * @since 4.0 + * @version 1.0 + */ +struct IntellVoiceRecognitionEvent { + /** 识别状态 */ + enum RecognitionStatus status; + /** 智能语音触发器模型类型 */ + enum IntellVoiceTriggerModelType type; + /** 智能语音触发器模型句柄 */ + int modelHandle; +}; \ No newline at end of file -- Gitee From 90a66fe4ce547facb77ea9ebcee5e86b3f4af4ab Mon Sep 17 00:00:00 2001 From: caiyiming Date: Mon, 20 Nov 2023 03:12:20 +0000 Subject: [PATCH 0101/2135] 1120 Signed-off-by: caiyiming --- .../v1_0/IMemoryTrackerInterface.idl | 69 ++++++++++++ .../memorytracker/v1_0/MemoryTrackerTypes.idl | 102 ++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 zh-cn/device_api/hdi/memorytracker/v1_0/IMemoryTrackerInterface.idl create mode 100644 zh-cn/device_api/hdi/memorytracker/v1_0/MemoryTrackerTypes.idl diff --git a/zh-cn/device_api/hdi/memorytracker/v1_0/IMemoryTrackerInterface.idl b/zh-cn/device_api/hdi/memorytracker/v1_0/IMemoryTrackerInterface.idl new file mode 100644 index 00000000..0252f092 --- /dev/null +++ b/zh-cn/device_api/hdi/memorytracker/v1_0/IMemoryTrackerInterface.idl @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup MemoryTracker + * @{ + * + * @brief 实现对设备(如GPU)内存占用的统一查询,如GPU占用的GL和Graphic内存等。 + * + * 需要查询GPU等外设内存占用时使用,例如hidumper中使用本模块IMemoryTrackerInterface接口列出每个进程的GPU内存占用。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IMemoryTrackerInterface.idl + * + * @brief 包含IMemoryTrackerInterface接口的声明、各项参数及返回值的意义。 + * + * 需要查询外设内存占用时使用,通过该文件中定义的接口,获取指定类型的设备内存信息。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief 设备内存跟踪接口的包路径 + * + * @since 3.2 + */ +package ohos.hdi.memorytracker.v1_0; + +import ohos.hdi.memorytracker.v1_0.MemoryTrackerTypes; + +/** + * @brief 用于获取指定类型的设备内存信息的接口。 + * + * 需要查询GPU等外设内存占用时使用,例如hidumper中使用本接口列出每个进程的GPU内存占用。 + * + * @since 3.2 + */ +interface IMemoryTrackerInterface { + /** + * @brief 获取指定类型的设备内存信息。 + * + * @param pid表示进程的id,若pid为0则表示获取所有进程的内存记录。 + * @param type表示内存类型。 + * @param records表示内存记录列表。 + * + * @return 若操作成功,返回值为0。 + * @return 若操作失败,返回值为负值。 + * + * @since 3.2 + */ + GetDevMem([in] int pid, [in] enum MemoryTrackerType type, [out] struct MemoryRecord[] records); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/memorytracker/v1_0/MemoryTrackerTypes.idl b/zh-cn/device_api/hdi/memorytracker/v1_0/MemoryTrackerTypes.idl new file mode 100644 index 00000000..b2a04911 --- /dev/null +++ b/zh-cn/device_api/hdi/memorytracker/v1_0/MemoryTrackerTypes.idl @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup MemoryTracker + * @{ + * + * @brief 实现对设备(如GPU)内存占用的统一查询,如GPU占用的GL和Graphic内存等。 + * + * 需要查询GPU等外设内存占用时使用,例如hidumper中使用本模块IMemoryTrackerInterface接口列出每个进程的GPU内存占用。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file MemoryTrackerTypes.idl + * + * @brief 设备内存跟踪模块中使用的数据类型,包括内存类型、内存类型标记、设备内存信息。 + * + * 需要查询外设内存占用时使用,定义的内存类型、内存类型标记、内存设备信息配合模块中其他部分使用。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief 设备内存跟踪接口的包路径 + * + * @since 3.2 + */ +package ohos.hdi.memorytracker.v1_0; + +/** + * @brief 内存类型 + * + * @since 3.2 + */ +enum MemoryTrackerType { + /** 多媒体相关 */ + MEMORY_TRACKER_TYPE_MM = 0, + /** GL相关 */ + MEMORY_TRACKER_TYPE_GL = 1, + /** 相机相关 */ + MEMORY_TRACKER_TYPE_CAM = 2, + /** 图形相关 */ + MEMORY_TRACKER_TYPE_GRAPH = 3, + /** 其他 */ + MEMORY_TRACKER_TYPE_OTHER = 4, + MEMORY_TRACKER_TYPE_COUNTS, +}; + +/** + * @brief 内存类型标记 + * + * @since 3.2 + */ +enum MemoryTrackerFlag { + /** 与其他进程共享内存 */ + FLAG_SHARED_RSS = 2, + /** 与其他进程共享内存 / 共享内存计数 */ + FLAG_SHARED_PSS = 4, + /** 不与其他进程共享内存 */ + FLAG_PRIVATE = 8, + /** 内存映射到smaps中 */ + FLAG_MAPPED = 16, + /** 内存不映射到smaps中 */ + FLAG_UNMAPPED = 32, + /** CPU安全模式相关 */ + FLAG_PROTECTED = 64, + /** CPU安全模式无关 */ + FLAG_UNPROTECTED = 128, + /** 系统管理内存 */ + FLAG_SYSTEM = 256, + /** 系统管理例外情况 */ + FLAG_SYSTEM_EXCEPT = 512, + +}; + +/** + * @brief 设备内存信息 + * + * @since 3.2 + */ +struct MemoryRecord { + /** 内存类型标记,可选类型请参考{@Link MemoryTrackerFlag} */ + int flags; + /** 该类型内存大小,以字节为单位 */ + long size; +}; -- Gitee From c0d612cb210cd0660ba19c12be0bec657a60ef2a Mon Sep 17 00:00:00 2001 From: lvqiang214 Date: Fri, 24 Nov 2023 17:10:16 +0800 Subject: [PATCH 0102/2135] intelligent voice hdi interface Signed-off-by: lvqiang214 --- .../engine/iintell_voice_engine_adapter.h | 117 ---------------- .../engine/iintell_voice_engine_callback.h | 89 ------------ .../engine/iintell_voice_engine_manager.h | 101 -------------- .../engine/intell_voice_engine_types.h | 130 ------------------ .../engine/v1_0/IIntellVoiceEngineAdapter.idl | 28 ++-- .../v1_0/IIntellVoiceEngineCallback.idl | 2 +- .../engine/v1_0/IIntellVoiceEngineManager.idl | 2 +- .../engine/v1_0/IntellVoiceEngineTypes.idl | 8 +- .../trigger/iintell_voice_trigger_adapter.h | 103 -------------- .../trigger/iintell_voice_trigger_callback.h | 89 ------------ .../trigger/iintell_voice_trigger_manager.h | 97 ------------- .../trigger/intell_voice_trigger_types.h | 113 --------------- .../v1_0/IIntellVoiceTriggerAdapter.idl | 18 +-- .../v1_0/IIntellVoiceTriggerCallback.idl | 2 +- .../v1_0/IIntellVoiceTriggerManager.idl | 6 +- .../trigger/v1_0/IntellVoiceTriggerTypes.idl | 4 +- 16 files changed, 35 insertions(+), 874 deletions(-) delete mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_adapter.h delete mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_callback.h delete mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_manager.h delete mode 100644 zh-cn/device_api/hdi/intelligent_voice/engine/intell_voice_engine_types.h delete mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_adapter.h delete mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_callback.h delete mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_manager.h delete mode 100644 zh-cn/device_api/hdi/intelligent_voice/trigger/intell_voice_trigger_types.h diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_adapter.h b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_adapter.h deleted file mode 100644 index 88120382..00000000 --- a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_adapter.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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 OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEADAPTER_H -#define OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEADAPTER_H - -#include -#include -#include -#include -#include -#include -#include "intelligent_voice/engine/v1_0/iintell_voice_engine_callback.h" -#include "intelligent_voice/engine/v1_0/intell_voice_engine_types.h" - -#ifndef HDI_BUFF_MAX_SIZE -#define HDI_BUFF_MAX_SIZE (1024 * 200) -#endif - -#ifndef HDI_CHECK_VALUE_RETURN -#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ - if ((lv) compare (rv)) { \ - return ret; \ - } \ -} while (false) -#endif - -#ifndef HDI_CHECK_VALUE_RET_GOTO -#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ - if ((lv) compare (rv)) { \ - ret = value; \ - goto table; \ - } \ -} while (false) -#endif - -namespace OHOS { -namespace HDI { -namespace IntelligentVoice { -namespace Engine { -namespace V1_0 { -using namespace OHOS; -using namespace OHOS::HDI; - -enum { - CMD_INTELL_VOICE_ENGINE_ADAPTER_GET_VERSION = 0, - CMD_INTELL_VOICE_ENGINE_ADAPTER_SET_CALLBACK = 1, - CMD_INTELL_VOICE_ENGINE_ADAPTER_ATTACH = 2, - CMD_INTELL_VOICE_ENGINE_ADAPTER_DETACH = 3, - CMD_INTELL_VOICE_ENGINE_ADAPTER_SET_PARAMETER = 4, - CMD_INTELL_VOICE_ENGINE_ADAPTER_GET_PARAMETER = 5, - CMD_INTELL_VOICE_ENGINE_ADAPTER_START = 6, - CMD_INTELL_VOICE_ENGINE_ADAPTER_STOP = 7, - CMD_INTELL_VOICE_ENGINE_ADAPTER_WRITE_AUDIO = 8, - CMD_INTELL_VOICE_ENGINE_ADAPTER_READ = 9, -}; - -class IIntellVoiceEngineAdapter : public HdiBase { -public: - DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineAdapter"); - - virtual ~IIntellVoiceEngineAdapter() = default; - - virtual int32_t SetCallback(const sptr& engineCallback) = 0; - - virtual int32_t Attach(const IntellVoiceEngineAdapterInfo& info) = 0; - - virtual int32_t Detach() = 0; - - virtual int32_t SetParameter(const std::string& keyValueList) = 0; - - virtual int32_t GetParameter(const std::string& keyList, std::string& valueList) = 0; - - virtual int32_t Start(const StartInfo& info) = 0; - - virtual int32_t Stop() = 0; - - virtual int32_t WriteAudio(const std::vector& buffer) = 0; - - virtual int32_t Read(ContentType type, sptr& buffer) = 0; - - virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) - { - majorVer = 1; - minorVer = 0; - return HDF_SUCCESS; - } - - virtual bool IsProxy() - { - return false; - } - - virtual const std::u16string GetDesc() - { - return metaDescriptor_; - } -}; -} // V1_0 -} // Engine -} // IntelligentVoice -} // HDI -} // OHOS - -#endif // OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEADAPTER_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_callback.h b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_callback.h deleted file mode 100644 index 3876ffc5..00000000 --- a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_callback.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINECALLBACK_H -#define OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINECALLBACK_H - -#include -#include -#include -#include "intelligent_voice/engine/v1_0/intell_voice_engine_types.h" - -#ifndef HDI_BUFF_MAX_SIZE -#define HDI_BUFF_MAX_SIZE (1024 * 200) -#endif - -#ifndef HDI_CHECK_VALUE_RETURN -#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ - if ((lv) compare (rv)) { \ - return ret; \ - } \ -} while (false) -#endif - -#ifndef HDI_CHECK_VALUE_RET_GOTO -#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ - if ((lv) compare (rv)) { \ - ret = value; \ - goto table; \ - } \ -} while (false) -#endif - -namespace OHOS { -namespace HDI { -namespace IntelligentVoice { -namespace Engine { -namespace V1_0 { -using namespace OHOS; -using namespace OHOS::HDI; - -enum { - CMD_INTELL_VOICE_ENGINE_CALLBACK_GET_VERSION = 0, - CMD_INTELL_VOICE_ENGINE_CALLBACK_ON_INTELL_VOICE_HDI_EVENT = 1, -}; - -class IIntellVoiceEngineCallback : public HdiBase { -public: - DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineCallback"); - - virtual ~IIntellVoiceEngineCallback() = default; - - virtual int32_t OnIntellVoiceHdiEvent(const IntellVoiceEngineCallBackEvent& event) = 0; - - virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) - { - majorVer = 1; - minorVer = 0; - return HDF_SUCCESS; - } - - virtual bool IsProxy() - { - return false; - } - - virtual const std::u16string GetDesc() - { - return metaDescriptor_; - } -}; -} // V1_0 -} // Engine -} // IntelligentVoice -} // HDI -} // OHOS - -#endif // OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINECALLBACK_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_manager.h b/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_manager.h deleted file mode 100644 index 655c4070..00000000 --- a/zh-cn/device_api/hdi/intelligent_voice/engine/iintell_voice_engine_manager.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEMANAGER_H -#define OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEMANAGER_H - -#include -#include -#include -#include -#include "intelligent_voice/engine/v1_0/iintell_voice_engine_adapter.h" -#include "intelligent_voice/engine/v1_0/intell_voice_engine_types.h" - -#ifndef HDI_BUFF_MAX_SIZE -#define HDI_BUFF_MAX_SIZE (1024 * 200) -#endif - -#ifndef HDI_CHECK_VALUE_RETURN -#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ - if ((lv) compare (rv)) { \ - return ret; \ - } \ -} while (false) -#endif - -#ifndef HDI_CHECK_VALUE_RET_GOTO -#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ - if ((lv) compare (rv)) { \ - ret = value; \ - goto table; \ - } \ -} while (false) -#endif - -namespace OHOS { -namespace HDI { -namespace IntelligentVoice { -namespace Engine { -namespace V1_0 { -using namespace OHOS; -using namespace OHOS::HDI; - -enum { - CMD_INTELL_VOICE_ENGINE_MANAGER_GET_VERSION = 0, - CMD_INTELL_VOICE_ENGINE_MANAGER_GET_ADAPTER_DESCRIPTORS = 1, - CMD_INTELL_VOICE_ENGINE_MANAGER_CREATE_ADAPTER = 2, - CMD_INTELL_VOICE_ENGINE_MANAGER_RELEASE_ADAPTER = 3, -}; - -class IIntellVoiceEngineManager : public HdiBase { -public: - DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineManager"); - - virtual ~IIntellVoiceEngineManager() = default; - - static sptr Get(bool isStub = false); - static sptr Get(const std::string &serviceName, bool isStub = false); - - virtual int32_t GetAdapterDescriptors(std::vector& descs) = 0; - - virtual int32_t CreateAdapter(const IntellVoiceEngineAdapterDescriptor& descriptor, - sptr& adapter) = 0; - - virtual int32_t ReleaseAdapter(const IntellVoiceEngineAdapterDescriptor& descriptor) = 0; - - virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) - { - majorVer = 1; - minorVer = 0; - return HDF_SUCCESS; - } - - virtual bool IsProxy() - { - return false; - } - - virtual const std::u16string GetDesc() - { - return metaDescriptor_; - } -}; -} // V1_0 -} // Engine -} // IntelligentVoice -} // HDI -} // OHOS - -#endif // OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_IINTELLVOICEENGINEMANAGER_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/intell_voice_engine_types.h b/zh-cn/device_api/hdi/intelligent_voice/engine/intell_voice_engine_types.h deleted file mode 100644 index aa27c655..00000000 --- a/zh-cn/device_api/hdi/intelligent_voice/engine/intell_voice_engine_types.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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 OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_INTELLVOICEENGINETYPES_H -#define OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_INTELLVOICEENGINETYPES_H - -#include -#include -#include - -#ifndef HDI_BUFF_MAX_SIZE -#define HDI_BUFF_MAX_SIZE (1024 * 200) -#endif - -#ifndef HDI_CHECK_VALUE_RETURN -#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ - if ((lv) compare (rv)) { \ - return ret; \ - } \ -} while (false) -#endif - -#ifndef HDI_CHECK_VALUE_RET_GOTO -#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ - if ((lv) compare (rv)) { \ - ret = value; \ - goto table; \ - } \ -} while (false) -#endif - -namespace OHOS { -class MessageParcel; -} - -namespace OHOS { -namespace HDI { -namespace IntelligentVoice { -namespace Engine { -namespace V1_0 { - -using namespace OHOS; - -enum IntellVoiceEngineAdapterType : int32_t { - ENROLL_ADAPTER_TYPE = 0, - WAKEUP_ADAPTER_TYPE = 1, - UPDATE_ADAPTER_TYPE = 2, - ADAPTER_TYPE_BUT, -}; - -enum ContentType : int32_t { - DSP_MODLE = 0, - CONTENT_TYPE_BUT, -}; - -enum IntellVoiceEngineMessageType : int32_t { - INTELL_VOICE_ENGINE_MSG_NONE = 0, - INTELL_VOICE_ENGINE_MSG_INIT_DONE = 1, - INTELL_VOICE_ENGINE_MSG_ENROLL_COMPLETE = 2, - INTELL_VOICE_ENGINE_MSG_COMMIT_ENROLL_COMPLETE = 3, - INTELL_VOICE_ENGINE_MSG_RECOGNIZE_COMPLETE = 4, -}; - -enum IntellVoiceEngineErrors : int32_t { - INTELL_VOICE_ENGINE_OK = 0, - INTELL_VOICE_ENGINE_ERROR_OFFSET = -100, - INTELL_VOICE_ENGINE_INVALID_PARAMS = -101, - INTELL_VOICE_ENGINE_INIT_FAILED = -102, - INTELL_VOICE_ENGINE_ENROLL_FAILED = -103, - INTELL_VOICE_ENGINE_COMMIT_ENROLL_FAILED = -104, - INTELL_VOICE_ENGINE_WAKEUP_FAILED = -105, -}; - -struct IntellVoiceEngineAdapterDescriptor { - IntellVoiceEngineAdapterType adapterType; -} __attribute__ ((aligned(8))); - -struct IntellVoiceEngineAdapterInfo { - std::string wakeupPhrase; - int32_t minBufSize; - int32_t sampleChannels; - int32_t bitsPerSample; - int32_t sampleRate; -}; - -struct StartInfo { - bool isLast; -} __attribute__ ((aligned(8))); - -struct IntellVoiceEngineCallBackEvent { - IntellVoiceEngineMessageType msgId; - IntellVoiceEngineErrors result; - std::string info; -}; - -bool IntellVoiceEngineAdapterDescriptorBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceEngineAdapterDescriptor& dataBlock); - -bool IntellVoiceEngineAdapterDescriptorBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceEngineAdapterDescriptor& dataBlock); - -bool IntellVoiceEngineAdapterInfoBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceEngineAdapterInfo& dataBlock); - -bool IntellVoiceEngineAdapterInfoBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceEngineAdapterInfo& dataBlock); - -bool StartInfoBlockMarshalling(OHOS::MessageParcel &data, const StartInfo& dataBlock); - -bool StartInfoBlockUnmarshalling(OHOS::MessageParcel &data, StartInfo& dataBlock); - -bool IntellVoiceEngineCallBackEventBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceEngineCallBackEvent& dataBlock); - -bool IntellVoiceEngineCallBackEventBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceEngineCallBackEvent& dataBlock); - -} // V1_0 -} // Engine -} // IntelligentVoice -} // HDI -} // OHOS - -#endif // OHOS_HDI_INTELLIGENT_VOICE_ENGINE_V1_0_INTELLVOICEENGINETYPES_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineAdapter.idl b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineAdapter.idl index 2e95e373..13988849 100644 --- a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineAdapter.idl +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineAdapter.idl @@ -19,7 +19,7 @@ * * @brief IntelligentVoiceEngine模块向上层服务提供了统一接口。 * - * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁算法引擎、启动停止算法引擎、写数据、读文件、回调函数注册等。 + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁唤醒算法引擎、启动停止唤醒算法引擎、写语音数据、读文件、回调函数注册等。 * * @since 4.0 * @version 1.0 @@ -28,7 +28,7 @@ /** * @file IIntellVoiceEngineAdapter.idl * - * @brief IntelligentVoiceEngine模块智能语音引擎适配器接口,包括设置回调、加载引擎、卸载引擎、设置参数、获取参数、启动引擎、停止引擎、读写数据等。 + * @brief IntelligentVoiceEngine模块智能语音引擎适配器接口,包括设置回调、加载唤醒算法引擎、卸载唤醒算法引擎、设置唤醒算法参数、获取唤醒算法参数、启动唤醒算法引擎、停止唤醒算法引擎、读写数据等。 * * @since 4.0 * @version 1.0 @@ -49,7 +49,7 @@ import ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineCallback; /** * @brief IntelligentVoiceEngine模块向上层服务提供了智能语音引擎适配器接口。 * - * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上智能语音引擎适配器接口实现设置回调、加载引擎、卸载引擎、设置参数、获取参数、启动引擎、停止引擎、读写数据等功能。 + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上智能语音引擎适配器接口实现设置回调、加载唤醒算法引擎、卸载唤醒算法引擎、设置唤醒算法参数、获取唤醒算法参数、启动唤醒算法引擎、停止唤醒算法引擎、读写数据等功能。 * * @since 4.0 * @version 1.0 @@ -68,9 +68,9 @@ interface IIntellVoiceEngineAdapter { */ SetCallback([in] IIntellVoiceEngineCallback engineCallback); /** - * @brief 加载引擎。 + * @brief 加载唤醒算法引擎。 * - * @param info 智能语音引擎适配器信息,具体参考{@link IntellVoiceEngineAdapterInfo}。 + * @param info 智能语音唤醒算法引擎适配器信息,具体参考{@link IntellVoiceEngineAdapterInfo}。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -80,7 +80,7 @@ interface IIntellVoiceEngineAdapter { */ Attach([in] struct IntellVoiceEngineAdapterInfo info); /** - * @brief 卸载引擎。 + * @brief 卸载唤醒算法引擎。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -90,9 +90,9 @@ interface IIntellVoiceEngineAdapter { */ Detach(); /** - * @brief 设置参数。 + * @brief 设置唤醒算法参数。 * - * @param keyValueList 键值对列表,键值对的格式为"key=value",键值对之间使用,分隔。 + * @param keyValueList 键值对列表,键值对的格式为"key=value",多个键值对之间通过分号分割,key和value的具体值由开发者自定义。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -102,10 +102,10 @@ interface IIntellVoiceEngineAdapter { */ SetParameter([in] String keyValueList); /** - * @brief 获取参数。 + * @brief 获取唤醒算法参数。 * - * @param keyList 键列表,键之间使用,分隔。 - * @param valueList 返回值列表,返回值之间使用,分隔。 + * @param keyList 键列表,多个键之间通过分号分割,key和value的具体值由开发者自定义。 + * @param valueList 返回值列表,多个返回值之间通过分号分割。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -115,7 +115,7 @@ interface IIntellVoiceEngineAdapter { */ GetParameter([in] String keyList, [out] String valueList); /** - * @brief 启动引擎。 + * @brief 启动唤醒算法引擎。 * * @param info 启动信息,具体参考{@link StartInfo}。 * @@ -127,7 +127,7 @@ interface IIntellVoiceEngineAdapter { */ Start([in] struct StartInfo info); /** - * @brief 停止引擎。 + * @brief 停止唤醒算法引擎。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -139,7 +139,7 @@ interface IIntellVoiceEngineAdapter { /** * @brief 写语音数据。 * - * @param buffer 语音数据。 + * @param buffer 语音数据,语音数据大小由开发者指定,默认是20ms语音数据。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineCallback.idl b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineCallback.idl index e52a69fb..67655940 100644 --- a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineCallback.idl +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineCallback.idl @@ -19,7 +19,7 @@ * * @brief IntelligentVoiceEngine模块向上层服务提供了统一接口。 * - * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁算法引擎、启动停止算法引擎、写数据、读文件、回调函数注册等。 + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁唤醒算法引擎、启动停止唤醒算法引擎、写语音数据、读文件、回调函数注册等。 * * @since 4.0 * @version 1.0 diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineManager.idl b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineManager.idl index f92263d4..650a9b7a 100644 --- a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineManager.idl +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IIntellVoiceEngineManager.idl @@ -19,7 +19,7 @@ * * @brief IntelligentVoiceEngine模块向上层服务提供了统一接口。 * - * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁算法引擎、启动停止算法引擎、写数据、读文件、回调函数注册等。 + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁唤醒算法引擎、启动停止唤醒算法引擎、写语音数据、读文件、回调函数注册等。 * * @since 4.0 * @version 1.0 diff --git a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IntellVoiceEngineTypes.idl b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IntellVoiceEngineTypes.idl index 141e62a5..18a7b910 100644 --- a/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IntellVoiceEngineTypes.idl +++ b/zh-cn/device_api/hdi/intelligent_voice/engine/v1_0/IntellVoiceEngineTypes.idl @@ -19,7 +19,7 @@ * * @brief IntelligentVoiceEngine模块向上层服务提供了统一接口。 * - * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁算法引擎、启动停止算法引擎、写数据、读文件、回调函数注册等。 + * 上层服务开发人员可根据IntelligentVoiceEngine模块提供的向上统一接口获取如下能力:创建销毁唤醒算法引擎、启动停止唤醒算法引擎、写语音数据、读文件、回调函数注册等。 * * @since 4.0 * @version 1.0 @@ -63,7 +63,7 @@ enum IntellVoiceEngineAdapterType { /** * @brief 数据类型。 * - * 上层服务读取的数据类型。\n + * 上层服务读取的数据类型。 * * @since 4.0 * @version 1.0 @@ -78,7 +78,7 @@ enum ContentType { /** * @brief 回调消息类型。 * - * 通知上层服务的消息类型。\n + * 通知上层服务的消息类型。 * * @since 4.0 * @version 1.0 @@ -99,7 +99,7 @@ enum IntellVoiceEngineMessageType { /** * @brief 回调消息错误码。 * - * 通知上层服务的消息错误码。\n + * 通知上层服务的消息错误码。 * * @since 4.0 * @version 1.0 diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_adapter.h b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_adapter.h deleted file mode 100644 index 3b1f9594..00000000 --- a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_adapter.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERADAPTER_H -#define OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERADAPTER_H - -#include -#include -#include -#include "intelligent_voice/trigger/v1_0/iintell_voice_trigger_callback.h" -#include "intelligent_voice/trigger/v1_0/intell_voice_trigger_types.h" - -#ifndef HDI_BUFF_MAX_SIZE -#define HDI_BUFF_MAX_SIZE (1024 * 200) -#endif - -#ifndef HDI_CHECK_VALUE_RETURN -#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ - if ((lv) compare (rv)) { \ - return ret; \ - } \ -} while (false) -#endif - -#ifndef HDI_CHECK_VALUE_RET_GOTO -#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ - if ((lv) compare (rv)) { \ - ret = value; \ - goto table; \ - } \ -} while (false) -#endif - -namespace OHOS { -namespace HDI { -namespace IntelligentVoice { -namespace Trigger { -namespace V1_0 { -using namespace OHOS; -using namespace OHOS::HDI; - -enum { - CMD_INTELL_VOICE_TRIGGER_ADAPTER_GET_VERSION = 0, - CMD_INTELL_VOICE_TRIGGER_ADAPTER_GET_PROPERTIES = 1, - CMD_INTELL_VOICE_TRIGGER_ADAPTER_LOAD_MODEL = 2, - CMD_INTELL_VOICE_TRIGGER_ADAPTER_UNLOAD_MODEL = 3, - CMD_INTELL_VOICE_TRIGGER_ADAPTER_START = 4, - CMD_INTELL_VOICE_TRIGGER_ADAPTER_STOP = 5, -}; - -class IIntellVoiceTriggerAdapter : public HdiBase { -public: - DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerAdapter"); - - virtual ~IIntellVoiceTriggerAdapter() = default; - - virtual int32_t GetProperties(IntellVoiceTriggerProperties& properties) = 0; - - virtual int32_t LoadModel(const IntellVoiceTriggerModel& model, - const sptr& triggerCallback, int32_t cookie, int32_t& handle) = 0; - - virtual int32_t UnloadModel(int32_t handle) = 0; - - virtual int32_t Start(int32_t handle) = 0; - - virtual int32_t Stop(int32_t handle) = 0; - - virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) - { - majorVer = 1; - minorVer = 0; - return HDF_SUCCESS; - } - - virtual bool IsProxy() - { - return false; - } - - virtual const std::u16string GetDesc() - { - return metaDescriptor_; - } -}; -} // V1_0 -} // Trigger -} // IntelligentVoice -} // HDI -} // OHOS - -#endif // OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERADAPTER_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_callback.h b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_callback.h deleted file mode 100644 index 93d890a5..00000000 --- a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_callback.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERCALLBACK_H -#define OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERCALLBACK_H - -#include -#include -#include -#include "intelligent_voice/trigger/v1_0/intell_voice_trigger_types.h" - -#ifndef HDI_BUFF_MAX_SIZE -#define HDI_BUFF_MAX_SIZE (1024 * 200) -#endif - -#ifndef HDI_CHECK_VALUE_RETURN -#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ - if ((lv) compare (rv)) { \ - return ret; \ - } \ -} while (false) -#endif - -#ifndef HDI_CHECK_VALUE_RET_GOTO -#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ - if ((lv) compare (rv)) { \ - ret = value; \ - goto table; \ - } \ -} while (false) -#endif - -namespace OHOS { -namespace HDI { -namespace IntelligentVoice { -namespace Trigger { -namespace V1_0 { -using namespace OHOS; -using namespace OHOS::HDI; - -enum { - CMD_INTELL_VOICE_TRIGGER_CALLBACK_GET_VERSION = 0, - CMD_INTELL_VOICE_TRIGGER_CALLBACK_ON_RECOGNITION_HDI_EVENT = 1, -}; - -class IIntellVoiceTriggerCallback : public HdiBase { -public: - DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerCallback"); - - virtual ~IIntellVoiceTriggerCallback() = default; - - virtual int32_t OnRecognitionHdiEvent(const IntellVoiceRecognitionEvent& event, int32_t cookie) = 0; - - virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) - { - majorVer = 1; - minorVer = 0; - return HDF_SUCCESS; - } - - virtual bool IsProxy() - { - return false; - } - - virtual const std::u16string GetDesc() - { - return metaDescriptor_; - } -}; -} // V1_0 -} // Trigger -} // IntelligentVoice -} // HDI -} // OHOS - -#endif // OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERCALLBACK_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_manager.h b/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_manager.h deleted file mode 100644 index 541f303d..00000000 --- a/zh-cn/device_api/hdi/intelligent_voice/trigger/iintell_voice_trigger_manager.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERMANAGER_H -#define OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERMANAGER_H - -#include -#include -#include -#include "intelligent_voice/trigger/v1_0/iintell_voice_trigger_adapter.h" -#include "intelligent_voice/trigger/v1_0/intell_voice_trigger_types.h" - -#ifndef HDI_BUFF_MAX_SIZE -#define HDI_BUFF_MAX_SIZE (1024 * 200) -#endif - -#ifndef HDI_CHECK_VALUE_RETURN -#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ - if ((lv) compare (rv)) { \ - return ret; \ - } \ -} while (false) -#endif - -#ifndef HDI_CHECK_VALUE_RET_GOTO -#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ - if ((lv) compare (rv)) { \ - ret = value; \ - goto table; \ - } \ -} while (false) -#endif - -namespace OHOS { -namespace HDI { -namespace IntelligentVoice { -namespace Trigger { -namespace V1_0 { -using namespace OHOS; -using namespace OHOS::HDI; - -enum { - CMD_INTELL_VOICE_TRIGGER_MANAGER_GET_VERSION = 0, - CMD_INTELL_VOICE_TRIGGER_MANAGER_LOAD_ADAPTER = 1, - CMD_INTELL_VOICE_TRIGGER_MANAGER_UNLOAD_ADAPTER = 2, -}; - -class IIntellVoiceTriggerManager : public HdiBase { -public: - DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerManager"); - - virtual ~IIntellVoiceTriggerManager() = default; - - static sptr Get(bool isStub = false); - static sptr Get(const std::string &serviceName, bool isStub = false); - - virtual int32_t LoadAdapter(const IntellVoiceTriggerAdapterDsecriptor& descriptor, - sptr& adapter) = 0; - - virtual int32_t UnloadAdapter(const IntellVoiceTriggerAdapterDsecriptor& descriptor) = 0; - - virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) - { - majorVer = 1; - minorVer = 0; - return HDF_SUCCESS; - } - - virtual bool IsProxy() - { - return false; - } - - virtual const std::u16string GetDesc() - { - return metaDescriptor_; - } -}; -} // V1_0 -} // Trigger -} // IntelligentVoice -} // HDI -} // OHOS - -#endif // OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_IINTELLVOICETRIGGERMANAGER_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/intell_voice_trigger_types.h b/zh-cn/device_api/hdi/intelligent_voice/trigger/intell_voice_trigger_types.h deleted file mode 100644 index 1de51b08..00000000 --- a/zh-cn/device_api/hdi/intelligent_voice/trigger/intell_voice_trigger_types.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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 OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_INTELLVOICETRIGGERTYPES_H -#define OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_INTELLVOICETRIGGERTYPES_H - -#include -#include -#include -#include - -#ifndef HDI_BUFF_MAX_SIZE -#define HDI_BUFF_MAX_SIZE (1024 * 200) -#endif - -#ifndef HDI_CHECK_VALUE_RETURN -#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ - if ((lv) compare (rv)) { \ - return ret; \ - } \ -} while (false) -#endif - -#ifndef HDI_CHECK_VALUE_RET_GOTO -#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ - if ((lv) compare (rv)) { \ - ret = value; \ - goto table; \ - } \ -} while (false) -#endif - -namespace OHOS { -class MessageParcel; -} - -namespace OHOS { -namespace HDI { -namespace IntelligentVoice { -namespace Trigger { -namespace V1_0 { - -using namespace OHOS; - -enum IntellVoiceTriggerModelType : int32_t { - UNKNOWN = -1, - DEFAULT = 1, -}; - -enum RecognitionStatus : int32_t { - SUCCESS = 0, - ABORT = 1, - FAILURE = 2, -}; - -struct IntellVoiceTriggerAdapterDsecriptor { - std::string adapterName; -}; - -struct IntellVoiceTriggerProperties { - std::string implementor; - std::string description; - uint32_t version; - uint32_t maxIntellVoiceModels; -}; - -struct IntellVoiceTriggerModel { - IntellVoiceTriggerModelType type; - uint32_t uid; - sptr data; -}; - -struct IntellVoiceRecognitionEvent { - RecognitionStatus status; - IntellVoiceTriggerModelType type; - int32_t modelHandle; -} __attribute__ ((aligned(8))); - -bool IntellVoiceTriggerAdapterDsecriptorBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceTriggerAdapterDsecriptor& dataBlock); - -bool IntellVoiceTriggerAdapterDsecriptorBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceTriggerAdapterDsecriptor& dataBlock); - -bool IntellVoiceTriggerPropertiesBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceTriggerProperties& dataBlock); - -bool IntellVoiceTriggerPropertiesBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceTriggerProperties& dataBlock); - -bool IntellVoiceTriggerModelBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceTriggerModel& dataBlock); - -bool IntellVoiceTriggerModelBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceTriggerModel& dataBlock); - -bool IntellVoiceRecognitionEventBlockMarshalling(OHOS::MessageParcel &data, const IntellVoiceRecognitionEvent& dataBlock); - -bool IntellVoiceRecognitionEventBlockUnmarshalling(OHOS::MessageParcel &data, IntellVoiceRecognitionEvent& dataBlock); - -} // V1_0 -} // Trigger -} // IntelligentVoice -} // HDI -} // OHOS - -#endif // OHOS_HDI_INTELLIGENT_VOICE_TRIGGER_V1_0_INTELLVOICETRIGGERTYPES_H \ No newline at end of file diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerAdapter.idl b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerAdapter.idl index 4df818c8..f44a4dc3 100644 --- a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerAdapter.idl +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerAdapter.idl @@ -19,7 +19,7 @@ * * @brief IntelligentVoiceTrigger模块向上层服务提供了统一接口。 * - * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载、触发器适配器卸载、模型加载、模型卸载、启动算法、停止算法等。 + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载卸载、智能语音触发器模型加载卸载、底层唤醒业务启动停止等。 * * @since 4.0 * @version 1.0 @@ -28,7 +28,7 @@ /** * @file IIntellVoiceTriggerAdapter.idl * - * @brief IntelligentVoiceTrigger模块触发器适配器接口,包括获取智能语音触发器属性、加载模型、卸载模型、启动算法、停止算法等。 + * @brief IntelligentVoiceTrigger模块触发器适配器接口,包括获取智能语音触发器属性、加载卸载智能语音触发器模型、启动停止底层唤醒业务等。 * * @since 4.0 * @version 1.0 @@ -49,7 +49,7 @@ import ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerCallback; /** * @brief IntelligentVoiceTrigger模块向上层服务提供了智能语音触发器适配器接口。 * - * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上智能语音触发器适配器接口实现获取智能语音触发器属性、加载模型、卸载模型、启动算法、停止算法等功能。 + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上智能语音触发器适配器接口实现获取智能语音触发器属性、加载卸载智能语音触发器模型、启动停止底层唤醒业务等功能。 * * @since 4.0 * @version 1.0 @@ -83,9 +83,9 @@ interface IIntellVoiceTriggerAdapter { */ LoadModel([in] struct IntellVoiceTriggerModel model, [in] IIntellVoiceTriggerCallback triggerCallback, [in] int cookie, [out] int handle); /** - * @brief 加载模型。 + * @brief 卸载模型。 * - * @param handle 模型句柄。 + * @param handle 智能语音触发器模型句柄。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -95,9 +95,9 @@ interface IIntellVoiceTriggerAdapter { */ UnloadModel([in] int handle); /** - * @brief 启动算法。 + * @brief 启动底层唤醒算法。 * - * @param handle 模型句柄。 + * @param handle 智能语音触发器模型句柄。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -107,9 +107,9 @@ interface IIntellVoiceTriggerAdapter { */ Start([in] int handle); /** - * @brief 停止算法。 + * @brief 停止底层唤醒算法。 * - * @param handle 模型句柄。 + * @param handle 智能语音触发器模型句柄。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerCallback.idl b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerCallback.idl index 4c12bb22..46c1690e 100644 --- a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerCallback.idl +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerCallback.idl @@ -19,7 +19,7 @@ * * @brief IntelligentVoiceTrigger模块向上层服务提供了统一接口。 * - * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载、触发器适配器卸载、模型加载、模型卸载、启动算法、停止算法等。 + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载卸载、智能语音触发器模型加载卸载、底层唤醒业务启动停止等。 * * @since 4.0 * @version 1.0 diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerManager.idl b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerManager.idl index 8d388357..bbc3aca3 100644 --- a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerManager.idl +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IIntellVoiceTriggerManager.idl @@ -19,7 +19,7 @@ * * @brief IntelligentVoiceTrigger模块向上层服务提供了统一接口。 * - * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载、触发器适配器卸载、模型加载、模型卸载、启动算法、停止算法等。 + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载卸载、智能语音触发器模型加载卸载、底层唤醒业务启动停止等。 * * @since 4.0 * @version 1.0 @@ -56,7 +56,7 @@ import ohos.hdi.intelligent_voice.trigger.v1_0.IIntellVoiceTriggerAdapter; */ interface IIntellVoiceTriggerManager { /** - * @brief 加载触发器适配器。 + * @brief 加载一个触发器适配器。 * * @param descriptor 智能语音触发器适配器描述符,信息包含适配器名称,具体参考{@link IntellVoiceTriggerAdapterDsecriptor}。 * @param adapter 智能语音触发器适配器,具体参考{@link IIntellVoiceTriggerAdapter}。 @@ -69,7 +69,7 @@ interface IIntellVoiceTriggerManager { */ LoadAdapter([in] struct IntellVoiceTriggerAdapterDsecriptor descriptor, [out] IIntellVoiceTriggerAdapter adapter); /** - * @brief 卸载触发器适配器。 + * @brief 卸载一个触发器适配器。 * * @param descriptor 智能语音触发器适配器描述符,信息包含适配器名称,具体参考{@link IntellVoiceTriggerAdapterDsecriptor}。 * diff --git a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IntellVoiceTriggerTypes.idl b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IntellVoiceTriggerTypes.idl index afdd1fb9..36b1227b 100644 --- a/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IntellVoiceTriggerTypes.idl +++ b/zh-cn/device_api/hdi/intelligent_voice/trigger/v1_0/IntellVoiceTriggerTypes.idl @@ -19,7 +19,7 @@ * * @brief IntelligentVoiceTrigger模块向上层服务提供了统一接口。 * - * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载、触发器适配器卸载、模型加载、模型卸载、启动算法、停止算法等。 + * 上层服务开发人员可根据IntelligentVoiceTrigger模块提供的向上统一接口获取如下能力:触发器适配器加载卸载、智能语音触发器模型加载卸载、底层唤醒业务启动停止等。 * * @since 4.0 * @version 1.0 @@ -28,7 +28,7 @@ /** * @file IntellVoiceTriggerTypes.idl * - * @brief IntelligentVoiceTrigger模块接口定义中使用的数据类型,包括模型类型、识别状态、触发器适配器描述符、驱动属性、模型信息、识别事件信息等。 + * @brief IntelligentVoiceTrigger模块接口定义中使用的数据类型,包括智能语音触发器模型类型、识别状态、触发器适配器描述符、驱动属性、模型信息、识别事件信息等。 * * @since 4.0 * @version 1.0 -- Gitee From 54118b7df6aa0df3c0ac157952eec929cbe43ff2 Mon Sep 17 00:00:00 2001 From: Clone_Zhang Date: Fri, 24 Nov 2023 17:42:24 +0800 Subject: [PATCH 0103/2135] fix: add dcamera hdi docs Signed-off-by: Clone_Zhang --- .../distributed_camera/v1_0/DCameraTypes.idl | 307 ++++++++++++++++ .../v1_0/IDCameraProvider.idl | 144 ++++++++ .../v1_0/IDCameraProviderCallback.idl | 156 ++++++++ .../distributed_camera/v1_0/DCameraTypes.idl | 334 ++++++++++++++++++ .../v1_0/IDCameraProvider.idl | 140 ++++++++ .../v1_0/IDCameraProviderCallback.idl | 152 ++++++++ 6 files changed, 1233 insertions(+) create mode 100644 en/device_api/hdi/distributed_camera/v1_0/DCameraTypes.idl create mode 100644 en/device_api/hdi/distributed_camera/v1_0/IDCameraProvider.idl create mode 100644 en/device_api/hdi/distributed_camera/v1_0/IDCameraProviderCallback.idl create mode 100644 zh-cn/device_api/hdi/distributed_camera/v1_0/DCameraTypes.idl create mode 100644 zh-cn/device_api/hdi/distributed_camera/v1_0/IDCameraProvider.idl create mode 100644 zh-cn/device_api/hdi/distributed_camera/v1_0/IDCameraProviderCallback.idl diff --git a/en/device_api/hdi/distributed_camera/v1_0/DCameraTypes.idl b/en/device_api/hdi/distributed_camera/v1_0/DCameraTypes.idl new file mode 100644 index 00000000..cfb2f913 --- /dev/null +++ b/en/device_api/hdi/distributed_camera/v1_0/DCameraTypes.idl @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Distributed Camera + * @{ + * + * @brief Provides APIs for the Distributed Camera module. + * + * You can use the APIs which are consistent with camera APIs to perform operations on + * distributed camera devices and streams, and implement various callbacks. + * Communicate with Source SA through IDCameraProvider to achieve distributed functionality. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file DCameraTypes.idl + * + * @brief Declares data types used by the Hardware Driver Interfaces (HDIs) of the distributed camera module. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the distributed camera module APIs. + * + * @since 3.2 + * @version 1.0 + */ +package ohos.hdi.distributed_camera.v1_0; + +/** + * @brief Enumerates distributed camera metadata updating types. + */ +enum DCSettingsType { + /** + * Set the whole package metadata. + */ + UPDATE_METADATA = 0, + /** + * Enable metadata configuration. + */ + ENABLE_METADATA = 1, + /** + * Disable metadata configuration. + */ + DISABLE_METADATA = 2, + /** + * Return metadata result from distributed camera. + */ + METADATA_RESULT = 3, + /** + * Set flash light to distribtued camera. + */ + SET_FLASH_LIGHT = 4, + /** + * Set fps range to distributed camera. + */ + FPS_RANGE = 5, + /** + * Set the frame metadata to distributed camera. + */ + UPDATE_FRAME_METADATA = 6, +}; + +/** + * @brief Enumerates return values of the HDIs. + */ +enum DCamRetCode { + /** + * Successful call. + */ + SUCCESS = 0, + /** + * The camera device is busy. + */ + CAMERA_BUSY = 1, + /** + * Invalid parameters. + */ + INVALID_ARGUMENT = 2, + /** + * Unsupported function. + */ + METHOD_NOT_SUPPORTED = 3, + /** + * The camera device is offlined. + */ + CAMERA_OFFLINE = 4, + /** + * The number of distributed camera devices enabled exceeds the limit. + */ + EXCEED_MAX_NUMBER = 5, + /** + * The device is not initialized. + */ + DEVICE_NOT_INIT = 6, + /** + * Failed call. + */ + FAILED = 7, +}; + +/** + * @brief Enumerates encoding types of stream data. + */ +enum DCEncodeType { + /** + * Unspecified encode type. + */ + ENCODE_TYPE_NULL = 0, + /** + * H.264 encode type. + */ + ENCODE_TYPE_H264 = 1, + /** + * H.265 encode type. + */ + ENCODE_TYPE_H265 = 2, + /** + * JPEG encode type. + */ + ENCODE_TYPE_JPEG = 3, + /** + * mpeg4-es encode type. + */ + ENCODE_TYPE_MPEG4_ES = 4, +}; + +/** + * @brief Enumerates distributed camera inner stream types. + */ +enum DCStreamType { + /** + * Continuous capture stream. For example preview streams, video streams. + */ + CONTINUOUS_FRAME = 0, + /** + * Single capture stream. For example photographing streams. + */ + SNAPSHOT_FRAME = 1, +}; + +/** + * @brief Distributed hardware device base info. + */ +struct DHBase { + /** + * The device id, here is networkId. + */ + String deviceId_; + /** + * The distributed hardware id. + */ + String dhId_; +}; + +/** + * @brief The control settings of the distributed camera device. + */ +struct DCameraSettings { + /** + * Settings type, see {@link DCSettingsType}. + */ + enum DCSettingsType type_; + /** + * Settings value. Serialized from bool, array, structure, etc. + */ + String value_; +}; + +/** + * @brief Defines the inner stream information of the distributed camera, + * which is used to pass configuration parameters during stream creation. + */ +struct DCStreamInfo { + /** + * Stream ID, which uniquely identifies a stream on a camera device. + */ + int streamId_; + /** + * Image width,see {@link StreamInfo}. + */ + int width_; + /** + * Image height,see {@link StreamInfo}. + */ + int height_; + /** + * Image stride,see {@link StreamInfo}. + */ + int stride_; + /** + * Image format,see {@link StreamInfo}. + */ + int format_; + /** + * Image color space,see {@link StreamInfo}. + */ + int dataspace_; + /** + * Encoding type, see {@link DCEncodeType}. + */ + enum DCEncodeType encodeType_; + /** + * Stream type, see {@link DCStreamType}. + */ + enum DCStreamType type_; +}; + +/** + * @brief Defines the information about a inner capture request of the distributed camera. + */ +struct DCCaptureInfo { + /** + * IDs of captured streams. + */ + int[] streamIds_; + /** + * Image width. + */ + int width_; + /** + * Image height. + */ + int height_; + /** + * Image stride. + */ + int stride_; + /** + * Image format. + */ + int format_; + /** + * Image color space. + */ + int dataspace_; + /** + * Is trigger sink capture. + */ + boolean isCapture_; + /** + * Encoding type, see {@link DCEncodeType}. + */ + enum DCEncodeType encodeType_; + /** + * Stream type, see {@link DCStreamType}. + */ + enum DCStreamType type_; + /** + * Stream settings, see {@link DCameraSettings}. + */ + struct DCameraSettings[] captureSettings_; +}; + +/** + * @brief Defines the inner buffer of the distributed camera, + * which is used to acquire buffer during processing capture requests. + */ +struct DCameraBuffer { + /** + * Buffer index. + */ + int index_; + /** + * Buffer size. + */ + unsigned int size_; + /** + * Native buffer, see {@link NativeBuffer}. + */ + NativeBuffer bufferHandle_; +}; + +/** + * @brief Notification event of the distributed camera. + */ +struct DCameraHDFEvent { + /** + * Event type. + */ + int type_; + /** + * Event result. + */ + int result_; + /** + * Extended content (optional). + */ + String content_; +}; diff --git a/en/device_api/hdi/distributed_camera/v1_0/IDCameraProvider.idl b/en/device_api/hdi/distributed_camera/v1_0/IDCameraProvider.idl new file mode 100644 index 00000000..35231369 --- /dev/null +++ b/en/device_api/hdi/distributed_camera/v1_0/IDCameraProvider.idl @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Distributed Camera + * @{ + * + * @brief Provides APIs for the Distributed Camera module. + * + * You can use the APIs which are consistent with camera APIs to perform operations on + * distributed camera devices and streams, and implement various callbacks. + * Communicate with Source SA through IDCameraProvider to achieve distributed functionality. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IDCameraProvider.idl + * + * @brief Transfer interfaces call between distributed camera SA service and distributed camera HDF service, + * and provide Hardware Driver Interfaces (HDIs) for the upper layer. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the distributed camera module APIs. + * + * @since 3.2 + * @version 1.0 + */ +package ohos.hdi.distributed_camera.v1_0; + +import ohos.hdi.distributed_camera.v1_0.DCameraTypes; +import ohos.hdi.distributed_camera.v1_0.IDCameraProviderCallback; + +/** + * @brief Defines the basic operations available for distributed camera devices. + * + * You can set Enable distributed camera devices, set stream processing, update control parameters, + * execute metadata and other related operations. + */ +interface IDCameraProvider { + /** + * @brief Enable distributed camera device and set callback. For details about the callbacks, + * see {@link IDCameraProviderCallback}. + * + * @param dhBase Distributed hardware device base info. + * @param abilityInfo The static capability info of the distributed camera device to be enabled. + * @param callbackObj Indicates the callbacks to set. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + EnableDCameraDevice([in] struct DHBase dhBase,[in] String abilityInfo,[in] IDCameraProviderCallback callbackObj); + + /** + * @brief Disable distributed camera device. + * + * @param dhBase Distributed hardware device base info. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + DisableDCameraDevice([in] struct DHBase dhBase); + + /** + * @brief Acquire a frame buffer from the procedure handle which attached to the streamId. + * + * @param dhBase Distributed hardware device base info. + * @param streamId Indicates the ID of the stream to which the procedure handle is to be attached. + * @param buffer A frame buffer. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + AcquireBuffer([in] struct DHBase dhBase,[in] int streamId,[out] struct DCameraBuffer buffer); + + /** + * @brief Notify distributed camera HDF service when a frame buffer has been filled. + * + * @param dhBase Distributed hardware device base info. + * @param streamId Indicates the ID of the stream to which the frame buffer is to be attached. + * @param buffer output frame buffer. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + ShutterBuffer([in] struct DHBase dhBase,[in] int streamId,[in] struct DCameraBuffer buffer); + + /** + * @brief Called to report metadata related to the distributed camera device. + * + * @param dhBase Distributed hardware device base info. + * @param result Indicates the metadata reported. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + OnSettingsResult([in] struct DHBase dhBase,[in] struct DCameraSettings result); + + /** + * @brief Called to notify some events from distributed camera SA service to distributed camera HDF service. + * + * @param dhBase Distributed hardware device base info. + * @param event Detail event contents. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + Notify([in] struct DHBase dhBase,[in] struct DCameraHDFEvent event); +} diff --git a/en/device_api/hdi/distributed_camera/v1_0/IDCameraProviderCallback.idl b/en/device_api/hdi/distributed_camera/v1_0/IDCameraProviderCallback.idl new file mode 100644 index 00000000..1a42f7a4 --- /dev/null +++ b/en/device_api/hdi/distributed_camera/v1_0/IDCameraProviderCallback.idl @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Distributed Camera + * @{ + * + * @brief Provides APIs for the Distributed Camera module. + * + * You can use the APIs which are consistent with camera APIs to perform operations on + * distributed camera devices and streams, and implement various callbacks. + * Communicate with Source SA through IDCameraProvider to achieve distributed functionality. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IDCameraProviderCallback.idl + * + * @brief Declares callbacks for distributed camera SA service. The caller needs to implement the callbacks. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the distributed camera module APIs. + * + * @since 3.2 + * @version 1.0 + */ +package ohos.hdi.distributed_camera.v1_0; + +import ohos.hdi.distributed_camera.v1_0.DCameraTypes; + +/** + * @brief Define the callback operation for the Distributed Camera device. + * + * Perform operations such as creating channels, creating streams, capturing images, + * and updating settings on the Distributed Camera device. + */ +[callback] interface IDCameraProviderCallback { + /** + * @brief Create the transmission channel between the source device and the sink device. + * Open and initialize the distributed camera session. + * + * @param dhBase Distributed hardware device base info. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + OpenSession([in] struct DHBase dhBase); + + /** + * @brief Close the distributed camera session, and destroy the transmission channel between. + * the source device and the sink device. + * + * @param dhBase Distributed hardware device base info. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + CloseSession([in] struct DHBase dhBase); + + /** + * @brief Configures streams. + * + * @param dhBase Distributed hardware device base info. + * @param streamInfos Indicates the list of stream information, which is defined by {@link DCStreamInfo}. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + ConfigureStreams([in] struct DHBase dhBase,[in] struct DCStreamInfo[] streamInfos); + + /** + * @brief Releases streams. + * + * @param dhBase Distributed hardware device base info. + * @param streamIds Indicates the IDs of the streams to release. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + ReleaseStreams([in] struct DHBase dhBase,[in] int[] streamIds); + + /** + * @brief Start capture images. + * This function must be called after {@link ConfigStreams}. + * There are two image capture modes: continuous capture and single capture. + * + * @param dhBase Distributed hardware device base info. + * @param captureInfos Indicates the capture request configuration information. + * For details, see {@link DCCaptureInfo}. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + StartCapture([in] struct DHBase dhBase,[in] struct DCCaptureInfo[] captureInfos); + + /** + * @brief Stop capture images. + * + * @param dhBase Distributed hardware device base info. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + StopCapture([in] struct DHBase dhBase,[in] int[] streamIds); + + /** + * @brief Updates distributed camera device control parameters. + * + * @param dhBase Distributed hardware device base info. + * @param settings Indicates the camera parameters, including the sensor frame rate and 3A parameters. + * For details about the settings, see {@link DCameraSettings}. + * + * @return Returns NO_ERROR if the operation is successful, + * @return an error code defined in {@link DCamRetCode} otherwise. + * + * @since 3.2 + * @version 1.0 + */ + UpdateSettings([in] struct DHBase dhBase,[in] struct DCameraSettings[] settings); +} diff --git a/zh-cn/device_api/hdi/distributed_camera/v1_0/DCameraTypes.idl b/zh-cn/device_api/hdi/distributed_camera/v1_0/DCameraTypes.idl new file mode 100644 index 00000000..e89101c3 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_camera/v1_0/DCameraTypes.idl @@ -0,0 +1,334 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Distributed Camera + * @{ + * + * @brief Distributed Camera模块接口定义。 + * + * Distributed Camera模块包括对分布式相机设备的操作、流的操作和各种回调等,这部分接口与Camera一致。 + * 通过IDCameraProvider与Source SA通信交互,实现分布式功能。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file DCameraTypes.idl + * + * @brief Distributed Camera模块HDI接口使用的数据类型。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Distributed Camera设备接口的包路径。 + * + * @since 3.2 + * @version 1.0 + */ +package ohos.hdi.distributed_camera.v1_0; + +/** + * @brief 分布式相机metadata更新类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum DCSettingsType { + /** + * 设置整包数据。 + */ + UPDATE_METADATA = 0, + /** + * 使能数据配置。 + */ + ENABLE_METADATA = 1, + /** + * 去使能数据配置。 + */ + DISABLE_METADATA = 2, + /** + * 分布式相机返回结果。 + */ + METADATA_RESULT = 3, + /** + * 闪光灯设置。 + */ + SET_FLASH_LIGHT = 4, + /** + * fps范围设置。 + */ + FPS_RANGE = 5, + /** + * 帧数设置。 + */ + UPDATE_FRAME_METADATA = 6, +}; + +/** + * @brief HDI接口的返回值。 + * + * @since 3.2 + * @version 1.0 + */ +enum DCamRetCode { + /** + * 调用成功。 + */ + SUCCESS = 0, + /** + * 设备当前忙。 + */ + CAMERA_BUSY = 1, + /** + * 参数错误。 + */ + INVALID_ARGUMENT = 2, + /** + * 不支持当前调用方法。 + */ + METHOD_NOT_SUPPORTED = 3, + /** + * 设备已经下线。 + */ + CAMERA_OFFLINE = 4, + /** + * 使能的分布式相机设备超过限制。 + */ + EXCEED_MAX_NUMBER = 5, + /** + * 设备没有初始化。 + */ + DEVICE_NOT_INIT = 6, + /** + * 调用失败。 + */ + FAILED = 7, +}; + +/** + * @brief 流数据的编码类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum DCEncodeType { + /** + * 未设置编码类型。 + */ + ENCODE_TYPE_NULL = 0, + /** + * 编码类型为H264。 + */ + ENCODE_TYPE_H264 = 1, + /** + * 编码类型为H265。 + */ + ENCODE_TYPE_H265 = 2, + /** + * 编码类型为JPEG。 + */ + ENCODE_TYPE_JPEG = 3, + /** + * 编码类型为mpeg4-es。 + */ + ENCODE_TYPE_MPEG4_ES = 4, +}; + +/** + * @brief 内部流的类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum DCStreamType { + /** + * 连续流。例如:预览流,录像流。 + */ + CONTINUOUS_FRAME = 0, + /** + * 单个捕获流。例如:拍照流。 + */ + SNAPSHOT_FRAME = 1, +}; + +/** + * @brief 分布式硬件设备基础信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct DHBase { + /** + * 设备Id。 + */ + String deviceId_; + /** + * 分布式硬件Id。 + */ + String dhId_; +}; + +/** + * @brief 分布式相机控制设置。 + * + * @since 3.2 + * @version 1.0 + */ +struct DCameraSettings { + /** + * 设置类型,具体类型查看{@link DCSettingsType}。 + */ + enum DCSettingsType type_; + /** + * Settings值的序列化值。 + */ + String value_; +}; + +/** + * @brief 分布式相机内部流信息,用于创建流时传入相关的配置参数。 + * + * @since 3.2 + * @version 1.0 + */ +struct DCStreamInfo { + /** + * 流的ID,用于在设备内唯一标识一条流。 + */ + int streamId_; + /** + * 图像宽度,具体宽度查看{@link StreamInfo}。 + */ + int width_; + /** + * 图像高度,具体高度查看{@link StreamInfo}。 + */ + int height_; + /** + * 图像步幅,具体步幅查看{@link StreamInfo}。 + */ + int stride_; + /** + * 图像格式,具体格式查看{@link StreamInfo}。 + */ + int format_; + /** + * 图像颜色空间,具体颜色空间查看{@link StreamInfo}。 + */ + int dataspace_; + /** + * 编码类型,具体类型查看{@link DCEncodeType}。 + */ + enum DCEncodeType encodeType_; + /** + * 流类型,具体类型查看{@link DCStreamType}。 + */ + enum DCStreamType type_; +}; + +/** + * @brief 分布式相机内部捕获请求的信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct DCCaptureInfo { + /** + * 捕获的流ID集合。 + */ + int[] streamIds_; + /** + * 捕获的图像宽度。 + */ + int width_; + /** + * 捕获的图像高度。 + */ + int height_; + /** + * 捕获的图像步幅。 + */ + int stride_; + /** + * 捕获的图像格式。 + */ + int format_; + /** + * 捕获的图像颜色空间。 + */ + int dataspace_; + /** + * 是否触发接收捕获。 + */ + boolean isCapture_; + /** + * 捕获的编码类型,具体类型查看{@link DCEncodeType}。 + */ + enum DCEncodeType encodeType_; + /** + * 捕获的流类型,具体类型查看{@link DCStreamType}。 + */ + enum DCStreamType type_; + /** + * 捕获的配置信息,具体定义查看{@link DCameraSettings}。 + */ + struct DCameraSettings[] captureSettings_; +}; + +/** + * @brief 分布式相机进程间传递数据的共享内存结构体。 + * + * @since 3.2 + * @version 1.0 + */ +struct DCameraBuffer { + /** + * 缓冲区索引。 + */ + int index_; + /** + * 缓冲区大小。 + */ + unsigned int size_; + /** + * Native缓冲区,具体定义查看{@link NativeBuffer}。 + */ + NativeBuffer bufferHandle_; +}; + +/** + * @brief 分布式相机的通知事件。 + * + * @since 3.2 + * @version 1.0 + */ +struct DCameraHDFEvent { + /** + * 事件类型。具体类型查看{@link DCameraEventType}。 + */ + int type_; + /** + * 事件结果。具体结果查看{@link DCameraEventResult}。 + */ + int result_; + /** + * 扩展内容(可选)。 + */ + String content_; +}; diff --git a/zh-cn/device_api/hdi/distributed_camera/v1_0/IDCameraProvider.idl b/zh-cn/device_api/hdi/distributed_camera/v1_0/IDCameraProvider.idl new file mode 100644 index 00000000..3df171da --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_camera/v1_0/IDCameraProvider.idl @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Distributed Camera + * @{ + * + * @brief Distributed Camera模块接口定义。 + * + * Distributed Camera模块包括对分布式相机设备的操作、流的操作和各种回调等,这部分接口与Camera一致。 + * 通过IDCameraProvider与Source SA通信交互,实现分布式功能。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IDCameraProvider.idl + * + * @brief 分布式相机SA服务和分布式相机HDF服务之间传输接口调用,并为上层提供硬件驱动接口。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Distributed Camera设备接口的包路径。 + * + * @since 3.2 + * @version 1.0 + */ +package ohos.hdi.distributed_camera.v1_0; + +import ohos.hdi.distributed_camera.v1_0.DCameraTypes; +import ohos.hdi.distributed_camera.v1_0.IDCameraProviderCallback; + +/** + * @brief 定义Distributed Camera设备基本的操作。 + * + * 启用分布式相机设备、设置流处理、更新控制参数、执行metadata等相关操作。 + */ +interface IDCameraProvider { + /** + * @brief 启用分布式相机并设置回调。有关回调的详细信息可查看{@link IDCameraProviderCallback}。 + * + * @param dhBase 分布式相机设备基础信息。 + * @param abilityInfo 分布式相机静态能力信息。 + * @param callbackObj 要设置的回调。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + EnableDCameraDevice([in] struct DHBase dhBase,[in] String abilityInfo,[in] IDCameraProviderCallback callbackObj); + + /** + * @brief 禁用分布式相机。 + * + * @param dhBase 分布式相机设备基础信息。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + DisableDCameraDevice([in] struct DHBase dhBase); + + /** + * @brief 获取帧缓冲区。 + * + * @param dhBase 分布式相机设备基础信息。 + * @param streamId 用于标识要获取的流。 + * @param buffer 帧缓冲区。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + AcquireBuffer([in] struct DHBase dhBase,[in] int streamId,[out] struct DCameraBuffer buffer); + + /** + * @brief 当帧缓冲区已满时,通知分布式相机HDF服务。 + * + * @param dhBase 分布式相机设备基础信息。 + * @param streamId 帧缓冲区要增加的流的ID。 + * @param buffer 输出帧缓冲区。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + ShutterBuffer([in] struct DHBase dhBase,[in] int streamId,[in] struct DCameraBuffer buffer); + + /** + * @brief 上报分布式相机设备相关的数据。 + * + * @param dhBase 分布式相机设备基础信息。 + * @param result 上报的数据。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + OnSettingsResult([in] struct DHBase dhBase,[in] struct DCameraSettings result); + + /** + * @brief Source SA与分布式相机驱动的事件通知接口。 + * + * @param dhBase 分布式相机设备基础信息。 + * @param event 详细事件内容。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + Notify([in] struct DHBase dhBase,[in] struct DCameraHDFEvent event); +} diff --git a/zh-cn/device_api/hdi/distributed_camera/v1_0/IDCameraProviderCallback.idl b/zh-cn/device_api/hdi/distributed_camera/v1_0/IDCameraProviderCallback.idl new file mode 100644 index 00000000..11a9ae21 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_camera/v1_0/IDCameraProviderCallback.idl @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Distributed Camera + * @{ + * + * @brief Distributed Camera模块接口定义。 + * + * Distributed Camera模块包括对分布式相机设备的操作、流的操作和各种回调等,这部分接口与Camera一致。 + * 通过IDCameraProvider与Source SA通信交互,实现分布式功能。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IDCameraProviderCallback.idl + * + * @brief 声明分布式相机SA服务的回调。调用者需要实现回调。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Distributed Camera设备接口的包路径。 + * + * @since 3.2 + * @version 1.0 + */ +package ohos.hdi.distributed_camera.v1_0; + +import ohos.hdi.distributed_camera.v1_0.DCameraTypes; + +/** + * @brief 定义Distributed Camera设备功能回调操作。 + * + * 对Distributed Camera设备执行创建通道,创建流,捕获图像和更新设置等操作。 + */ +[callback] interface IDCameraProviderCallback { + /** + * @brief 在源设备和目的设备之间创建传输通道。打开并初始化分布式相机会话。 + * + * @param dhBase 分布式相机设备基础信息。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + OpenSession([in] struct DHBase dhBase); + + /** + * @brief 关闭分布式相机会话,并销毁源设备和目的设备之间的传输通道。 + * + * @param dhBase 分布式相机设备基础信息。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + CloseSession([in] struct DHBase dhBase); + + /** + * @brief 配置流。 + * + * @param dhBase 分布式相机设备基础信息。 + * @param streamInfos 流信息列表,流信息定义在{@link DCStreamInfo}。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + ConfigureStreams([in] struct DHBase dhBase,[in] struct DCStreamInfo[] streamInfos); + + /** + * @brief 释放流。 + * + * @param dhBase 分布式相机设备基础信息。 + * @param streamIds 要释放的流ID列表。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + ReleaseStreams([in] struct DHBase dhBase,[in] int[] streamIds); + + /** + * @brief 开始捕获图像。 + * + * 本接口必须在调用{@link ConfigStreams}配置流之后调用。 + * 图像捕获有两种模式,分别是连续捕获和单次捕获。 + * + * @param dhBase 分布式相机设备基础信息。 + * @param captureInfos 捕获请求的参数信息,具体信息查看{@link DCCaptureInfo}。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + StartCapture([in] struct DHBase dhBase,[in] struct DCCaptureInfo[] captureInfos); + + /** + * @brief 停止捕获图像。 + * + * @param dhBase 分布式相机设备基础信息。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + StopCapture([in] struct DHBase dhBase,[in] int[] streamIds); + + /** + * @brief 更新设备控制参数。 + * + * @param dhBase 分布式相机设备基础信息。 + * + * @param settings 设置参数,包括sensor帧率,3A相关参数等。具体信息查看{@link DCameraSettings}。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DCamRetCode}。 + * + * @since 3.2 + * @version 1.0 + */ + UpdateSettings([in] struct DHBase dhBase,[in] struct DCameraSettings[] settings); +} -- Gitee From 1ccdc30e6e55a11fc7318b08780a3e6750f0ad09 Mon Sep 17 00:00:00 2001 From: Gloria Date: Mon, 27 Nov 2023 16:56:08 +0800 Subject: [PATCH 0104/2135] updated three En docs Signed-off-by: Gloria --- en/native_sdk/graphic/external_window.h | 30 ++++- en/native_sdk/graphic/native_buffer.h | 150 ++++++++++++++++++++++++ en/native_sdk/graphic/native_image.h | 61 ++++++++++ 3 files changed, 239 insertions(+), 2 deletions(-) diff --git a/en/native_sdk/graphic/external_window.h b/en/native_sdk/graphic/external_window.h index 4f279aeb..3a2c7266 100644 --- a/en/native_sdk/graphic/external_window.h +++ b/en/native_sdk/graphic/external_window.h @@ -32,6 +32,7 @@ * * @brief Defines the functions for obtaining and using NativeWindow. * + * File to include: * @library libnative_window.so * @since 8 * @version 1.0 @@ -300,8 +301,20 @@ void OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window); OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(void* pSurfaceBuffer); /** - * @brief Decreases the reference count of an OHNativeWindowBuffer instance by 1 and - * when the reference count reaches 0, destroys the instance. + * @brief Creates an OHNativeWindowBuffer instance. + * A new OHNativeWindowBuffer instance is created each time this function is called. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param nativeBuffer Pointer to an OH_NativeBuffer instance. + * @return Returns the pointer to the OHNativeWindowBuffer instance created. + * @since 11 + * @version 1.0 + */ +OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(OH_NativeBuffer* nativeBuffer); + +/** + * @brief Decreases the reference count of an OHNativeWindowBuffer instance by 1 + * and when the reference count reaches 0, destroys the instance. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param buffer Pointer to an OHNativeWindowBuffer instance. @@ -340,6 +353,19 @@ int32_t OH_NativeWindow_NativeWindowRequestBuffer(OHNativeWindow *window, int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer, int fenceFd, Region region); +/** + * @brief Obtains the OHNativeWindowBuffer that was flushed to the buffer queue last time + * through an OHNativeWindow instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window Pointer to an OHNativeWindow instance. + * @param buffer Double pointer to an OHNativeWindowBuffer instance. + * @return Returns 0 if the operation is successful. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer); + /** * @brief Returns the OHNativeWindowBuffer to the buffer queue through an OHNativeWindow instance, * without filling in any content. The OHNativeWindowBuffer can be used for a new request. diff --git a/en/native_sdk/graphic/native_buffer.h b/en/native_sdk/graphic/native_buffer.h index 2947a5e2..157ae9c6 100644 --- a/en/native_sdk/graphic/native_buffer.h +++ b/en/native_sdk/graphic/native_buffer.h @@ -33,6 +33,7 @@ * * @brief Declares the functions for obtaining and using NativeBuffer. * + * File to include: * @library libnative_buffer.so * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer * @since 9 @@ -165,6 +166,143 @@ enum OH_NativeBuffer_Format { NATIVEBUFFER_PIXEL_FMT_BUTT = 0X7FFFFFFF }; +/** + * @brief Enumerates the color spaces of an OH_NativeBuffer instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 11 + * @version 1.0 + */ +enum OH_NativeBuffer_ColorSpace { + /** No color space is available. */ + OH_COLORSPACE_NONE, + /** + * The color gamut is BT601_P, the transfer function is BT709, the conversion matrix is BT601_P, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_BT601_EBU_FULL, + /** + * The color gamut is BT601_N, the transfer function is BT709, the conversion matrix is BT601_N, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_BT601_SMPTE_C_FULL, + /** + * The color gamut is BT709, the transfer function is BT709, the conversion matrix is BT709, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_BT709_FULL, + /** + * The color gamut is BT2020, the transfer function is HLG, the conversion matrix is BT2020, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_BT2020_HLG_FULL, + /** + * The color gamut is BT2020, the transfer function is PQ, the conversion matrix is BT2020, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_BT2020_PQ_FULL, + /** + * The color gamut is BT601_P, the transfer function is BT709, the conversion matrix is BT601_P, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_BT601_EBU_LIMIT, + /** + * The color gamut is BT601_N, the transfer function is BT709, the conversion matrix is BT601_N, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_BT601_SMPTE_C_LIMIT, + /** + * The color gamut is BT709, the transfer function is BT709, the conversion matrix is BT709, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_BT709_LIMIT, + /** + * The color gamut is BT2020, the transfer function is HLG, the conversion matrix is BT2020, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_BT2020_HLG_LIMIT, + /** + * The color gamut is BT2020, the transfer function is PQ, the conversion matrix is BT2020, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_BT2020_PQ_LIMIT, + /** + * The color gamut is SRGB, the transfer function is SRGB, the conversion matrix is BT601_N, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_SRGB_FULL, + /** + * The color gamut is P3_D65, the transfer function is SRGB, the conversion matrix is P3, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_P3_FULL, + /** + * The color gamut is P3_D65, the transfer function is HLG, the conversion matrix is P3, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_P3_HLG_FULL, + /** + * The color gamut is P3_D65, the transfer function is PQ, the conversion matrix is P3, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_P3_PQ_FULL, + /** + * The color gamut is ADOBERGB, the transfer function is ADOBERGB, the conversion matrix is ADOBERGB, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_ADOBERGB_FULL, + /** + * The color gamut is SRGB, the transfer function is SRGB, the conversion matrix is BT601_N, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_SRGB_LIMIT, + /** + * The color gamut is P3_D65, the transfer function is SRGB, the conversion matrix is P3, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_P3_LIMIT, + /** + * The color gamut is P3_D65, the transfer function is HLG, the conversion matrix is P3, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_P3_HLG_LIMIT, + /** + * The color gamut is P3_D65, the transfer function is PQ, the conversion matrix is P3, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_P3_PQ_LIMIT, + /** + * The color gamut is ADOBERGB, the transfer function is ADOBERGB, the conversion matrix is ADOBERGB, + * and the data range is RANGE_LIMITED. + */ + OH_COLORSPACE_ADOBERGB_LIMIT, + /** The color gamut is SRGB, and the transfer function is LINEAR. */ + OH_COLORSPACE_LINEAR_SRGB, + /** It is equivalent to OH_COLORSPACE_LINEAR_SRGB. */ + OH_COLORSPACE_LINEAR_BT709, + /** The color gamut is P3_D65, and the transfer function is LINEAR. */ + OH_COLORSPACE_LINEAR_P3, + /** The color gamut is BT2020, and the transfer function is LINEAR. */ + OH_COLORSPACE_LINEAR_BT2020, + /** It is equivalent to OH_COLORSPACE_SRGB_FULL. */ + OH_COLORSPACE_DISPLAY_SRGB, + /** It is equivalent to OH_COLORSPACE_P3_FULL. */ + OH_COLORSPACE_DISPLAY_P3_SRGB, + /** It is equivalent to OH_COLORSPACE_P3_HLG_FULL. + OH_COLORSPACE_DISPLAY_P3_HLG, + /** It is equivalent to OH_COLORSPACE_P3_PQ_FULL. */ + OH_COLORSPACE_DISPLAY_P3_PQ, + /** + * The color gamut is BT2020, the transfer function is SRGB, the conversion matrix is BT2020, + * and the data range is RANGE_FULL. + */ + OH_COLORSPACE_DISPLAY_BT2020_SRGB, + /** It is equivalent to OH_COLORSPACE_BT2020_HLG_FULL. */ + OH_COLORSPACE_DISPLAY_BT2020_HLG, + /** It is equivalent to OH_COLORSPACE_BT2020_PQ_FULL. */ + OH_COLORSPACE_DISPLAY_BT2020_PQ, +}; + /** * @brief Defines the OH_NativeBuffer attribute configuration, which is used when you apply for * a new OH_NativeBuffer instance or query the attributes of an existing instance. @@ -280,6 +418,18 @@ int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); */ uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); +/** + * @brief Sets the color space for an OH_NativeBuffer instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @param buffer Pointer to an OH_NativeBuffer instance. + * @param colorSpace Color space to set. The value is obtained from OH_NativeBuffer_ColorSpace. + * @return Returns 0 if the operation is successful. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeBuffer_SetColorSpace(OH_NativeBuffer *buffer, OH_NativeBuffer_ColorSpace colorSpace); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_image.h b/en/native_sdk/graphic/native_image.h index 5b7dc7fc..16e3f792 100644 --- a/en/native_sdk/graphic/native_image.h +++ b/en/native_sdk/graphic/native_image.h @@ -33,6 +33,7 @@ * * @brief Defines the functions for obtaining and using NativeImage. * + * File to include: <native_image/native_image.h> * @library libnative_image.so * @since 9 * @version 1.0 @@ -62,6 +63,31 @@ typedef struct OH_NativeImage OH_NativeImage; */ typedef struct NativeWindow OHNativeWindow; +/** + * @brief Defines the callback function triggered when a frame is available. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param context Defines user-defined context information, which is returned when the callback is triggered. + * @since 11 + * @version 1.0 + */ +typedef void (*OH_OnFrameAvailable)(void *context); + +/** + * @brief Defines an OH_NativeImage listener, which is registered through + * {@link OH_NativeImage_SetOnFrameAvailableListener}. + * The listener triggers a callback when a frame is available. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_OnFrameAvailableListener { + /** User-defined context information, which is returned when the callback is triggered. */ + void *context; + /** Defines the callback function triggered when a frame is available. */ + OH_OnFrameAvailable onFrameAvailable; +} OH_OnFrameAvailableListener; + /** * @brief Creates an OH_NativeImage instance to be associated with the OpenGL ES texture ID and target. * @@ -151,6 +177,41 @@ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); */ int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]); +/** + * @brief Obtains the surface ID of an OH_NativeImage instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param image Pointer to an OH_NativeImage instance. + * @param surfaceId Pointer to the surface ID. + * @return Returns 0 if the operation is successful. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId); + +/** + * @brief Registers a listener to listen for frame availability events. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param image Pointer to an OH_NativeImage instance. + * @param listener Listener to register. + * @return Returns 0 if the operation is successful. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeImage_SetOnFrameAvailableListener(OH_NativeImage* image, OH_OnFrameAvailableListener listener); + +/** + * @brief Deregisters the listener used to listen for frame availability events. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param image Pointer to an OH_NativeImage instance. + * @return Returns 0 if the operation is successful. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeImage_UnsetOnFrameAvailableListener(OH_NativeImage* image); + /** * @brief Destroys an OH_NativeImage instance created by calling OH_NativeImage_Create. * After the instance is destroyed, the pointer to the OH_NativeImage instance is assigned NULL. -- Gitee From 2142e17980dae357ad23c258f7aa59404c4abc07 Mon Sep 17 00:00:00 2001 From: shegangbin Date: Mon, 27 Nov 2023 21:14:07 +0800 Subject: [PATCH 0105/2135] fix description Signed-off-by: shegangbin --- zh-cn/native_sdk/graphic/external_window.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index 59036fdd..ec1fa450 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -95,7 +95,7 @@ enum NativeWindowOperation { /** * 设置本地窗口缓冲区几何图形, * 函数中的可变参数是 - * [输入] int32_t height,[输入] int32_t width。 + * [输入] int32_t width,[输入] int32_t height。 */ SET_BUFFER_GEOMETRY, /** -- Gitee From f8d01d20aaed627ce94826f473b08e7e4fd99ae5 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Tue, 28 Nov 2023 09:35:28 +0800 Subject: [PATCH 0106/2135] commit msg Signed-off-by: xuxuehai --- .../hdi/audio/v1_0/IAudioRender.idl | 12 + .../device_api/hdi/audio/v1_1/AudioTypes.idl | 603 ++++++++++++++++++ .../hdi/audio/v1_1/IAudioAdapter.idl | 331 ++++++++++ .../hdi/audio/v1_1/IAudioCallback.idl | 88 +++ .../hdi/audio/v1_1/IAudioCapture.idl | 479 ++++++++++++++ .../hdi/audio/v1_1/IAudioManager.idl | 114 ++++ .../hdi/audio/v1_1/IAudioRender.idl | 602 +++++++++++++++++ 7 files changed, 2229 insertions(+) create mode 100644 zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl create mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl create mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioCallback.idl create mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioCapture.idl create mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioManager.idl create mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioRender.idl diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl index a2f35b15..a40eab64 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl @@ -586,5 +586,17 @@ interface IAudioRender { * @version 1.0 */ IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); + + /** + * @brief 设置低功耗模式缓存长度。 + * + * @param size 包含音频数据的缓存长度。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + SetBufferSize([in] unsigned int size); } /** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl new file mode 100644 index 00000000..89f3e489 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl @@ -0,0 +1,603 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file AudioTypes.idl + * + * @brief Audio模块接口定义中使用的数据类型。 + * + * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 3.2 + * @version 1.0 + */ +package ohos.hdi.audio.v1_1; + +/** + * @brief 音频端口的类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioPortDirection { + PORT_OUT = 1, /**< 音频输出端口。*/ + PORT_IN = 2, /**< 音频输入端口。 */ + PORT_OUT_IN = 3, /**< 音频输出输入端口。 */ +}; + +/** + * @brief 音频端口上的Pin脚。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioPortPin { + PIN_NONE = 0, /**< 无效端口。*/ + PIN_OUT_SPEAKER = 1 << 0, /**< 喇叭输出。 */ + PIN_OUT_HEADSET = 1 << 1, /**< 有线耳机输出。 */ + PIN_OUT_LINEOUT = 1 << 2, /**< Lineout输出。 */ + PIN_OUT_HDMI = 1 << 3, /**< HDMI输出。 */ + PIN_OUT_USB = 1 << 4, /**< USB输出。*/ + PIN_OUT_USB_EXT = 1 << 5, /**< USB外部声卡输出。*/ + PIN_OUT_EARPIECE = 1 << 5 | 1 << 4, /**< 有线耳机输出。 */ + PIN_OUT_BLUETOOTH_SCO = 1 << 6, /**< 蓝牙SCO输出 */ + PIN_OUT_DAUDIO_DEFAULT = 1 << 7, /**< 音频默认输出 */ + PIN_OUT_HEADPHONE = 1 << 8, /**< 有线耳机输出。*/ + PIN_OUT_USB_HEADSET = 1 << 9, /**< ARM USB输出 */ + PIN_OUT_BLUETOOTH_A2DP = 1 << 10, /**< 蓝牙A2DP输出 */ + PIN_IN_MIC = 1 << 27 | 1 << 0, /**< 麦克风输入 */ + PIN_IN_HS_MIC = 1 << 27 | 1 << 1, /**< 耳机麦克风输入 */ + PIN_IN_LINEIN = 1 << 27 | 1 << 2, /**< Linein输入。 */ + PIN_IN_USB_EXT = 1 << 27 | 1 << 3, /**< USB外部声卡输入。*/ + PIN_IN_BLUETOOTH_SCO_HEADSET = 1 << 27 | 1 << 4, /**< 蓝牙SCO耳机输入 */ + PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5, /**< 音频默认输入 */ + PIN_IN_USB_HEADSET = 1 << 27 | 1 << 6, /**< ARM USB输入 */ +}; + +/** + * @brief 音频类型(场景)。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioCategory { + AUDIO_IN_MEDIA = 0, /**< 媒体。 */ + AUDIO_IN_COMMUNICATION = 1, /**< 通信。 */ + AUDIO_IN_RINGTONE = 2, /**< 电话铃声。 */ + AUDIO_IN_CALL = 3, /**< 呼叫。 */ + AUDIO_MMAP_NOIRQ = 4, /**< Mmap模式 */ + AUDIO_OFFLOAD = 5, /**< 低功耗 */ + AUDIO_MULTI_CHANNEL = 6, /**< 多声道 */ +}; + +/** + * @brief 音频格式。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioFormat { + AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8bit位宽PCM(Pulse Code Modulation)格式。*/ + AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16bit位宽PCM格式。 */ + AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24bit位宽PCM格式。 */ + AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32bit位宽PCM格式。*/ + AUDIO_FORMAT_TYPE_PCM_FLOAT = 1 << 2 | 1 << 0, /**< PCM浮点格式 */ + AUDIO_FORMAT_TYPE_MP3 = 1 << 24, /**< MP3格式 */ + AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main格式 */ + AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC格式 */ + AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD格式 */ + AUDIO_FORMAT_TYPE_AAC_ELD = 1 << 24 | 1 << 2, /**< AAC ELD格式 */ + AUDIO_FORMAT_TYPE_AAC_HE_V1 = 1 << 24 | 1 << 2 | 1 << 0, /**< AAC HE_V1格式 */ + AUDIO_FORMAT_TYPE_AAC_HE_V2 = 1 << 24 | 1 << 2 | 1 << 1, /**< AAC HE_V2格式 */ + AUDIO_FORMAT_TYPE_G711A = 1 << 25 | 1 << 0, /**< PCM G711A格式 */ + AUDIO_FORMAT_TYPE_G711U = 1 << 25 | 1 << 1, /**< PCM G711u格式 */ + AUDIO_FORMAT_TYPE_G726 = 1 << 25 | 1 << 1 | 1 << 0, /**< PCM G726格式 */ +}; + +/** + *@brief 音频通道掩码。 + * + * 定义音频声道的位置掩码。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioChannelMask { + AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。 */ + AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< 声道布局前右。*/ + AUDIO_CHANNEL_MONO = 1, /**< 单声道。 */ + AUDIO_CHANNEL_STEREO = 3, /**< 立体声,由左右声道组成。 */ +}; + +/** + * @brief 音频采样频率掩码。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioSampleRatesMask { + AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< 无效的采样频率。 */ +}; + +/** + * @brief 音频端口的数据透传模式。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioPortPassthroughMode { + PORT_PASSTHROUGH_LPCM = 1 << 0, /**< 立体声PCM。*/ + PORT_PASSTHROUGH_RAW = 1 << 1, /**< HDMI透传。 */ + PORT_PASSTHROUGH_HBR2LBR = 1 << 2, /**< 蓝光次世代音频降规格输出。 */ + PORT_PASSTHROUGH_AUTO = 1 << 3, /**< 根据HDMI EDID能力自动匹配。 */ +}; + +/** + * @brief 原始音频样本格式。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioSampleFormat { + /* 8 bits */ + AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。 **/ + /* 16 bits */ + AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。 **/ + /* 24 bits */ + AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。 **/ + /* 32 bits */ + AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。 **/ + /* 64 bits */ + AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。 **/ + /* float double */ + AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 32bit位宽浮点型非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F64P = 23, /**< 64bit位宽双精度浮点型非交织样本。 **/ +}; + +/** + * @brief 音频播放的通道模式。 + * + * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioChannelMode { + AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。 */ + AUDIO_CHANNEL_BOTH_LEFT = 1, /**< 两个声道全部为左声道声音。 */ + AUDIO_CHANNEL_BOTH_RIGHT = 2, /**< 两个声道全部为右声道声音。 */ + AUDIO_CHANNEL_EXCHANGE = 3, /**< 左右声道数据互换,左声道为右声道声音,右声道为左声道声音。*/ + AUDIO_CHANNEL_MIX = 4, /**< 左右两个声道输出为左右声道相加(混音)。 */ + AUDIO_CHANNEL_LEFT_MUTE = 5, /**< 左声道静音,右声道播放原右声道声音。 */ + AUDIO_CHANNEL_RIGHT_MUTE = 6, /**< 右声道静音,左声道播放原左声道声音。 */ + AUDIO_CHANNEL_BOTH_MUTE = 7, /**< 左右声道均静音。*/ +}; + +/** + * @brief 音频数据结束类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioDrainNotifyType { + AUDIO_DRAIN_NORMAL_MODE = 0, /**< 曲目的所有数据播放完就结束。 */ + AUDIO_DRAIN_EARLY_MODE = 1, /**< 曲目的所有数据未播放完就结束,以便给音频服务做连续性曲目切换留出时间。 */ +}; + +/** + * @brief 回调函数通知事件类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioCallbackType { + AUDIO_NONBLOCK_WRITE_COMPELETED = 0, /**< 非阻塞式写完成。 */ + AUDIO_DRAIN_COMPELETED = 1, /**< DrainBuffer完成,详情参考{@link DrainBuffer}。 */ + AUDIO_FLUSH_COMPLETED = 2, /**< Flush完成,详情参考{@link Flush}。 */ + AUDIO_RENDER_FULL = 3, /**< 录音缓冲区已满。 */ + AUDIO_ERROR_OCCUR = 4, /**< 发生了错误。 */ +}; + +/** + * @brief 音频端口角色。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioPortRole { + AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。 */ + AUDIO_PORT_SOURCE_ROLE = 1, /**< 指定端口为发送端角色。 */ + AUDIO_PORT_SINK_ROLE = 2, /**< 指定端口为接受端角色。 */ +}; + +/** + * @brief 音频端口类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioPortType { + AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。 */ + AUDIO_PORT_DEVICE_TYPE = 1, /**< 指定端口为设备类型。 */ + AUDIO_PORT_MIX_TYPE = 2, /**< 指定端口为复合类型。 */ + AUDIO_PORT_SESSION_TYPE = 3, /**< 指定端口为会话类型。 */ +}; + +/** + * @brief 端口会话类型。 + * + * @since 3.2 + * @version 1.0 + */ +enum AudioSessionType { + AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。 */ + AUDIO_OUTPUT_MIX_SESSION = 1, /**< 会话绑定到特定音轨。 */ + AUDIO_ALLOCATE_SESSION = 2, /**< 会话ID需重新申请。 */ + AUDIO_INVALID_SESSION = 3, /**< 无效会话类型。 */ +}; + +/** + * @brief 音频设备类型。 + */ +enum AudioDeviceType { + AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。 */ + AUDIO_HEADPHONE = 1 << 1, /**< 耳机。 */ + AUDIO_HEADSET = 1 << 2, /**< 头戴式耳机。 */ + AUDIO_USB_HEADSET = 1 << 3, /**< USB头戴式耳机。 */ + AUDIO_USB_HEADPHONE = 1 << 4, /**< USB耳机。 */ + AUDIO_USBA_HEADSET = 1 << 5, /**< USB模拟头戴式耳机。 */ + AUDIO_USBA_HEADPHONE = 1 << 6, /**< USB模拟耳机。 */ + AUDIO_PRIMARY_DEVICE = 1 << 7, /**< 主音频设备。 */ + AUDIO_USB_DEVICE = 1 << 8, /**< USB音频设备。 */ + AUDIO_A2DP_DEVICE = 1 << 9, /**< 蓝牙音频设备。 */ + AUDIO_HDMI_DEVICE = 1 << 10, /**< HDMI音频设备 */ + AUDIO_ADAPTER_DEVICE = 1 << 11, /**< 声卡设备 */ + AUDIO_DEVICE_UNKNOWN, /**< 未知设备。 */ +}; + +/** + * @brief 音频事件类型。 + */ +enum AudioEventType { + AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。 */ + AUDIO_DEVICE_REMOVE = 2, /**< 音频设备移除。 */ + AUDIO_LOAD_SUCCESS = 3, /**< 声卡加载成功。 */ + AUDIO_LOAD_FAILURE = 4, /**< 声卡加载失败。 */ + AUDIO_UNLOAD = 5, /**< 声卡卸载。 */ + AUDIO_SERVICE_VALID = 7, /**< 音频服务可用。 */ + AUDIO_SERVICE_INVALID = 8, /**< 音频服务不可用。 */ + AUDIO_CAPTURE_THRESHOLD = 9, /**< 录音阈值上报。 */ + AUDIO_EVENT_UNKNOWN = 10, /**< 未知事件。 */ +}; + +/** + * @brief 音频扩展参数键类型。 + */ +enum AudioExtParamKey { + AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。 */ + AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< 分布式音频-音量事件。 */ + AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< 分布式音频-焦点事件。 */ + AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< 分布式音频-媒体按钮事件。 */ + AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< 分布式音频-音频效果事件。 */ + AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< 分布式音频-设备状态事件。 */ + AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< USB设备类型( ARM 或 HIFI)*/ + AUDIO_EXT_PARAM_KEY_PERF_INFO = 201, /**< 分布式音频-dsp加载事件。 */ + AUDIO_EXT_PARAM_KEY_MMI = 301, /**< 分布式音频-主机接口测试。 */ + AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< 低电量事件。 */ +}; + +/** + * @brief 音频设备状态。 + */ +struct AudioDeviceStatus { + unsigned int pnpStatus; /**< PnP设备状态,详情参考{@link AudioDeviceType},{@link AudioEventType}。 */ +}; + +/** + * @brief 音频场景描述。 + */ +union SceneDesc { + unsigned int id; /**< 音频场景的ID,详情参考{@link AudioCategory}。*/ +}; + +/** + * @brief 音频端口。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioPort { + enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。 */ + unsigned int portId; /**< 音频端口的ID。 */ + String portName; /**< 音频端口的名称。 */ +}; + +/** + * @brief 音频适配器描述符。 + * + * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, + * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioAdapterDescriptor { + String adapterName; /**< 音频适配器的名称。 */ + struct AudioPort[] ports; /**< 一个音频适配器支持的端口列表,详情参考{@link AudioPort}。 */ +}; + +/** + * @brief 音频设备描述符。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioDeviceDescriptor { + unsigned int portId; /**< 音频端口ID。 */ + enum AudioPortPin pins; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ + String desc; /**< 以字符串命名的音频设备。 */ +}; + +/** + * @brief 音频场景描述符。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioSceneDescriptor { + union SceneDesc scene; /**< 音频场景描述,详情参考{@link SceneDesc}。 */ + struct AudioDeviceDescriptor desc; /**< 音频设备描述符,详情参考{@link AudioDeviceDescriptor}。 */ +}; + +/** + * @brief 音频输入类型. + */ +enum AudioInputType { + AUDIO_INPUT_DEFAULT_TYPE = 0, /**< 默认输入 */ + AUDIO_INPUT_MIC_TYPE = 1 << 0, /**< 麦克风输入 */ + AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, /**< 语音唤醒输入 */ + AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, /**< 通话 */ + AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< 声音识别 */ + AUDIO_INPUT_VOICE_UPLINK_TYPE = 1 << 4, /**< 上行输入 */ + AUDIO_INPUT_VOICE_DOWNLINK_TYPE = 1 << 5, /**< 下行输入 */ + AUDIO_INPUT_VOICE_CALL_TYPE = 1 << 6, /**< 电话 */ + AUDIO_INPUT_CAMCORDER_TYPE = 1 << 7, /**< 摄像机输入 */ +}; + +/** + * @brief 音频低功耗属性 + */ +struct AudioOffloadInfo +{ + unsigned int sampleRate; /**< 采样率 */ + unsigned int channelCount; /**< 声道数 */ + unsigned int bitRate; /**< 比特率 */ + unsigned int bitWidth; /**< 比特位宽 */ + enum AudioFormat format; /**< 音频格式 */ + unsigned int offloadBufferSize; /**< 音频数据缓存长度 */ + unsigned long duration; /** 音频持续时间,单位纳秒*/ +}; + +/** + * @brief 音频采样属性。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioSampleAttributes { + enum AudioCategory type; /**< 音频类型,详情参考{@link AudioCategory}。 */ + boolean interleaved; /**< 音频数据交织的标记。 */ + enum AudioFormat format; /**< 音频数据格式,详情参考{@link AudioFormat}。 */ + unsigned int sampleRate; /**< 音频采样频率。 */ + unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。*/ + unsigned int period; /**< 音频采样周期,单位赫兹。 */ + unsigned int frameSize; /**< 音频数据的帧大小。 */ + boolean isBigEndian; /**< 音频数据的大端标志。 */ + boolean isSignedData; /**< 音频数据有符号或无符号标志。 */ + unsigned int startThreshold; /**< 音频播放起始阈值。 */ + unsigned int stopThreshold; /**< 音频播放停止阈值。 */ + unsigned int silenceThreshold; /**< 录音缓冲区阈值。 */ + int streamId; /**< 录音或播放的标识符。 */ + int sourceType; /**< 播放或录音的音源类型 */ + struct AudioOffloadInfo offloadInfo; /**< offload流信息 */ +}; + +/** + * @brief 音频时间戳。 + * + * 时间定义,POSIX timespec的替代品。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioTimeStamp { + long tvSec; /**< tvSec时间,单位:秒。 */ + long tvNSec; /**< tvNSec时间,单位:纳秒。 */ +}; + +/** + * @brief 音频子端口的支持能力。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioSubPortCapability { + unsigned int portId; /**< 子端口ID。 */ + String desc; /**< 以字符串命名的子端口。 */ + enum AudioPortPassthroughMode mask; /**< 数据透传模式,详情参考{@link AudioPortPassthroughMode}。 */ +}; + +/** + * @brief 音频端口的支持能力。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioPortCapability { + unsigned int deviceType; /**< 设备输出、输入类型。 */ + unsigned int deviceId; /**< 设备ID,唯一的设备识别符。 */ + boolean hardwareMode; /**< 是否支持设备绑定处理。 */ + unsigned int formatNum; /**< 支持的音频格式数目。 */ + enum AudioFormat[] formats; /**< 支持的音频格式,详情参考{@link AudioFormat}。 */ + unsigned int sampleRateMasks; /**< 支持的音频采样频率(8k、16k、32k、48k)。 */ + enum AudioChannelMask channelMasks; /**< 设备的声道布局掩码,详情参考{@link AudioChannelMask}。 */ + unsigned int channelCount; /**< 最大支持的声道总数。 */ + struct AudioSubPortCapability[] subPorts; /**< 支持的子端口列表,详情参考{@link AudioSubPortCapability}。 */ + enum AudioSampleFormat[] supportSampleFormats; /**< 支持的采样率列表,详情参考{@link AudioSampleFormat}。 */ +}; + +/** + * @brief mmap缓冲区描述符。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioMmapBufferDescripter { + byte[] memoryAddress; /**< 指向mmap缓冲区的指针。 */ + FileDescriptor memoryFd; /**< mmap缓冲区的文件描述符。 */ + int totalBufferFrames; /**< 缓冲区总大小,单位:帧。 */ + int transferFrameSize; /**< 传输大小,单位:帧。 */ + int isShareable; /**< mmap缓冲区是否可以在进程间共享。 */ + unsigned int offset; /**< 文件偏移。 */ + String filePath; /**< mmap文件路径。 */ +}; + +/** + * @brief 音频设备拓展信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioDevExtInfo { + int moduleId; /**< 音频流绑定的模块ID。 */ + enum AudioPortPin type; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ + String desc; /**< 地址描述。 */ +}; + +/** + * @brief 音轨拓展信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioMixExtInfo { + int moduleId; /**< 流所属模块标识符。 */ + int streamId; /**< 由调用者传递的Render或Capture标识符。 */ +}; + +/** + * @brief 会话拓展信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioSessionExtInfo { + enum AudioSessionType sessionType; /**< 音频会话类型,详情参考{@link AudioSessionType}。 */ +}; + +/** + * @brief 音频端口特定信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioInfo { + struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。 */ + struct AudioMixExtInfo mix; /**< 音轨特定信息,详情参考{@link AudioMixExtInfo}。 */ + struct AudioSessionExtInfo session; /**< 会话特定信息,详情参考{@link AudioSessionExtInfo}。 */ +}; + +/** + * @brief 音频路由节点。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioRouteNode { + int portId; /**< 音频端口ID。 */ + enum AudioPortRole role; /**< 指定端口角色为发送端或接收端,详情参考{@link AudioPortRole}。 */ + enum AudioPortType type; /**< 指定端口类型可以为设备类型、复合类型、绘画类型,详情参考{@link AudioPortType}。 */ + struct AudioInfo ext; /**< 音频端口特定信息,详情参考{@link AudioInfo}。 */ +}; + +/** + * @brief 音频路由信息。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioRoute { + struct AudioRouteNode[] sources; /**< 发送端列表,详情参考{@link AudioRouteNode}。 */ + struct AudioRouteNode[] sinks; /**< 接受端列表,详情参考{@link AudioRouteNode}。 */ +}; + +/** + * @brief 音频事件。 + * + * @since 3.2 + * @version 1.0 + */ +struct AudioEvent { + unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。 */ + unsigned int deviceType; /**< 设备类型,详情参考{@link enum AudioDeviceType}。 */ +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl new file mode 100644 index 00000000..014f3f94 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audioģӿڶ塣 + * + * Ƶӿ漰͡ؽӿڡӿڡƵŽӿڡƵ¼ӿڵȡ + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioAdapter.idl + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Ƶӿڵİ· + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_1; + +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioRender; +import ohos.hdi.audio.v1_1.IAudioCapture; +import ohos.hdi.audio.v1_1.IAudioCallback; + +/** + * @brief AudioAdapterƵӿڡ + * + * ṩƵֵ֧ʼ˿ڡ¼ȡ˿ȡ + * + * @see IAudioRender + * @see IAudioCapture + * + * @since 4.1 + * @version 1.1 + */ +interface IAudioAdapter { + /** + * @brief ʼһƵеĶ˿ + * ƵУӿǰҪȵøýӿڼ˿ǷѾʼɣ˿ûгʼɣ + * Ҫȴһʱ䣨100ms½м飬ֱ˿ڳʼɺټ + * + * @param adapter õǰAudioAdapterָ + * + * @return ʼɷֵ0ʼʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + InitAllPorts(); + + /** + * @brief һƵŽӿڵĶ + * + * @param adapter õǰAudioAdapterָ + * @param desc 򿪵Ƶ豸ο{@link AudioDeviceDescriptor} + * @param attrs 򿪵Ƶԣο{@link AudioSampleAttributes} + * @param render ȡƵŽӿڵĶʵ浽renderУο{@link IAudioRender} + * @param renderId ȡƵŽӿš + * + * @return ɹֵ0ʧܷظֵ + * + * @see GetPortCapability + * @see DestroyRender + * + * @since 4.1 + * @version 1.1 + */ + CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioRender render, [out] unsigned int renderId); + + /** + * @brief һƵŽӿڵĶ + * + * @attention ƵŹУٸýӿڶ + * + * @param adapter õǰAudioAdapterָ + * @param renderId ٵƵŽӿڵ + * + * @return ɹֵ0ʧܷظֵ + * @see CreateRender + * + * @since 4.1 + * @version 1.1 + */ + DestroyRender([in] unsigned int renderId); + + /** + * @brief һƵ¼ӿڵĶ + * + * @param adapter õǰAudioAdapterָ + * @param desc 򿪵Ƶ豸ο{@link AudioDeviceDescriptor} + * @param attrs 򿪵Ƶԣο{@link AudioSampleAttributes} + * @param capture ȡƵ¼ӿڵĶʵ浽captureУο{@link IAudioCapture} + * @param captureId ȡƵ¼ӿڵ + * @return ɹֵ0ʧܷظֵ + * + * @see GetPortCapability + * @see DestroyCapture + + * @since 4.1 + * @version 1.1 + */ + CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioCapture capture, [out] unsigned int captureId); + + /** + * @brief һƵ¼ӿڵĶ + * + * @attention Ƶ¼Уٸýӿڶ + * + * @param adapter õǰAudioAdapterָ + * @param captureId ٵƵ¼ӿڵ + * + * @return ɹֵ0ʧܷظֵ + * @see CreateCapture + * + * @since 4.1 + * @version 1.1 + */ + DestroyCapture([in] unsigned int captureId); + + /** + * @brief ȡһƵĶ˿ + * + * @param adapter õǰAudioAdapterָ + * @param port ȡĶ˿ڣο{@link AudioPort} + * @param capability ȡĶ˿浽capabilityУο{@link AudioPortCapability} + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); + + /** + * @brief Ƶ˿͸ģʽ + * + * @param adapter õǰAudioAdapterָ + * @param port õĶ˿ڣο{@link AudioPort} + * @param mode õĴģʽο{@link AudioPortPassthroughMode} + * @return ɹֵ0ʧܷظֵ + * @see GetPassthroughMode + * + * @since 4.1 + * @version 1.1 + */ + SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); + + /** + * @brief ȡƵ˿͸ģʽ + * + * @param adapter õǰAudioAdapterָ + * @param port ȡĶ˿ڣο{@link AudioPort} + * @param mode ȡĴģʽ浽modeУο{@link AudioPortPassthroughMode} + * @return ɹֵ0ʧܷظֵ + * @see SetPassthroughMode + * + * @since 4.1 + * @version 1.1 + */ + GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); + + /** + * @brief ȡһƵ豸״̬ + * + * @param adapter õǰAudioAdapterָ + * @param status ȡ豸״̬浽statusУο{@link AudioDeviceStatus} + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetDeviceStatus([out] struct AudioDeviceStatus status); + + /** + * @brief Ƶ·ɡ + * + * @param adapter õǰAudioAdapterָ + * @param route µ·ɣο{@link AudioRoute} + * @param routeHandle ºƵ·ɾ浽routeHandleС + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); + + /** + * @brief ͷƵ·ɡ + * + * @param adapter õǰAudioAdapterָ + * @param routeHandle ͷŵƵ·ɾ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + ReleaseAudioRoute([in] int routeHandle); + + /** + * @brief Ƶ + * + * @param adapter õǰAudioAdapterָ + * @param mute ʾǷƵtrueʾfalseʾǾ + * + * @return ɹֵ0ʧܷظֵ + * + * @see SetMicMute + * + * @since 4.1 + * @version 1.1 + */ + SetMicMute([in] boolean mute); + + /** + * @brief ȡƵ״̬ + * + * @param adapter õǰAudioAdapterָ + * @param mute ȡľ״̬浽muteУtrueʾfalseʾǾ + * + * @return ɹֵ0ʧܷظֵ + * + * @see GetMicMute + * + * @since 4.1 + * @version 1.1 + */ + GetMicMute([out] boolean mute); + + /** + * @brief е + * + * Χ0.01.0Ƶеˮƽ015ķΧڣ + * 0.0ʾƵ1.0ָʾ15 + * + * @param adapter õǰAudioAdapterָ + * @param volume õֵΧΪ0.0-1.00.0ʾСֵ1.0ʾֵ + * @return ɹֵ0ʧܷظֵ + * @see GetVolume + * + * @since 4.1 + * @version 1.1 + */ + SetVoiceVolume([in] float volume); + + /** + * @brief ָƵչ + * + * @param adapter õǰAudioAdapterָ + * @param key ָչͣο{@link AudioExtParamKey} + * @param condition ָչѯ + * @param value ָչֵ + * + * conditionΪֵɵֵַֺ֮ͨŷָֵԵĸʽΪ"keytype=keyvalue" + * keyֵΪAudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUMEʱconditionĸʽΪ + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE ʾ¼: 1ʾ, 4ʾþ + * VOLUME_GROUP_ID ʾõƵչص顣 + * AUDIO_VOLUME_TYPE ʾõƵչص͡ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); + + /** + * @brief ָȡƵչȡֵ + * + * @param adapter õǰAudioAdapterָ + * @param key ָչͣο{@link AudioExtParamKey} + * @param condition ָչѯ + * @param value صָչĵǰֵ + * @param lenth valueij + * + * conditionΪֵɵֵַֺ֮ͨŷָֵԵĸʽΪ"keytype=keyvalue" + * keyֵΪAudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUMEʱconditionĸʽΪ + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE ʾ¼: 1ʾ, 4ʾþ + * VOLUME_GROUP_ID ʾѯƵչص顣 + * AUDIO_VOLUME_TYPE ʾѯƵչص͡ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); + + /** + * @brief עչص + * + * @param adapter õǰAudioAdapterָ + * @param callback עĻصο{@link AudioCallback} + * @param cookie ڴݡ + * @return ɹֵ0ʧܷظֵ + * + * @since 3.2 + * @version 1.0 + */ + RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioCallback.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioCallback.idl new file mode 100644 index 00000000..295010ef --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1_1/IAudioCallback.idl @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audioģӿڶ塣 + * + * Ƶӿ漰͡ؽӿڡӿڡƵŽӿڡƵ¼ӿڵȡ + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioCallback.idl + * + * @brief AudioŵĻصļ + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Ƶӿڵİ· + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_1; + +import ohos.hdi.audio.v1_1.AudioTypes; + +/** + * @brief Audioصӿڡ + * + * @since 4.1 + * @version 1.1 + */ +[callback] interface IAudioCallback { + + /** + * @brief ص + * + * @param type ص֪ͨ¼ͣο{@link AudioCallbackType} + * @param reserved ֶΡ + * @param cookie ڴݡ + * + * @return ɹֵ0ʧܷظֵ + * + * @see RegCallback + * + * @since 4.1 + * @version 1.1 + */ + RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); + /** + * @brief Ƶչص + * + * @param key չͣο{@link AudioExtParamKey} + * @param condition չ + * @param value չֵ + * @param reserved ֶΡ + * @param cookie ڴݡ + * + * @return ɹֵ0ʧܷظֵ + * + * @see ParamCallback + * + * @since 4.1 + * @version 1.1 + */ + ParamCallback([in] enum AudioExtParamKey key, [in] byte condition, [in] byte value, [out] byte reserved, [out] byte cookie); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioCapture.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioCapture.idl new file mode 100644 index 00000000..d99f4491 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1_1/IAudioCapture.idl @@ -0,0 +1,479 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audioģӿڶ塣 + * + * Ƶӿ漰͡ؽӿڡӿڡƵŽӿڡƵ¼ӿڵȡ + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioCapture.idl + * + * @brief Audio¼Ľӿڶļ + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Ƶӿڵİ· + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_0; + +import ohos.hdi.audio.v1_1.AudioTypes; + + +/** + * @brief AudioCaptureƵ¼ӿڡ + * + * ṩƵ¼ֵ֧ƵơƵԡƵƵ¼Ƶ֡ݵȡ + * + * @since 4.1 + * @version 1.1 + */ +interface IAudioCapture { + /** + * @brief Ƶ¼һ֡ݣ¼Ƶݣ + * + * @param capture õǰIAudioCaptureָ + * @param frame ݵƵframe + * @param requestBytes ݵƵframeСֽ + * @param replyBytes ָҪȡƵݵʵʳȣֽΪλָ롣 + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief Obtains the last number of input audio frames. + * + * @param capture õǰIAudioCaptureָ + * @param frames ȡƵ֡浽framesС + * @param time ȡĹʱ浽timeУο{@link AudioTimeStamp} + * @return ɹֵ0ʧܷظֵ + * @see CaptureFrame + * + * @since 4.1 + * @version 1.1 + */ + GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief жijƵǷ֧֡ + * + * @param scene жϵƵο{@link AudioSceneDescriptor} + * @param supported Ƿֵ֧״̬浽supportedУtrueʾ֧֣falseʾ֧֡ + * + * @return ɹֵ0ʧܷظֵ + * + * @see SelectScene + * + * @since 4.1 + * @version 1.1 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief ѡƵ + * + *
    + *
  • ѡһdzƵӦó豸ϣͬʹֻеΪ豸 + *
      + *
    • ý岥ųУsceneΪmedia_speaker
    • + *
    • ͨ᳡УsceneΪvoice_speaker
    • + *
    + *
  • ֻѡһƵʹóΪý岥ţmediaӰţmovieϷţgame
  • + *
  • ֻѡһƵ豸豸ΪͲreceiverȣspeaker߶headset
  • + *
+ * + * @param scene õƵο{@link AudioSceneDescriptor} + * + * @return ɹֵ0ʧܷظֵ + * + * @see CheckSceneCapability + * + * @since 4.1 + * @version 1.1 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief Ƶľ״̬ + * + * @param mute õľ״̬trueʾfalseʾȡ + * + * @return ɹֵ0ʧܷظֵ + * + * @see GetMute + * + * @since 4.1 + * @version 1.1 + */ + SetMute([in] boolean mute); + + /** + * @brief ȡƵľ״̬ + * + * @param mute ȡľ״̬浽muteУtrueʾfalseʾȡ + * + * @return ɹֵ0ʧܷظֵ + * + * @see SetMute + * + * @since 4.1 + * @version 1.1 + */ + GetMute([out] boolean mute); + + /** + * @brief һƵ + * + * ȡֵΧ0.0~1.0ƵеȼΧ0 ~ 15 + * ӳϵΪ0.00ʾ1.015ʾȼ + * + * @param volume õΧ0.0~1.0 + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + SetVolume([in] float volume); + + /** + * @brief ȡһƵ + * + * @param volume ȡ浽volumeУΧ0.0~1.0 + * + * @return ɹֵ0ʧܷظֵ + * + * @see SetVolume + * + * @since 4.1 + * @version 1.1 + */ + GetVolume([out] float volume); + + /** + * @brief ȡƵֵ + * + * ھĹʵУԸоƬƽ̨ʵд + * + *
    + *
  • ʹʵʵֵķΧΪ-50db ~ 6db
  • + *
  • ҲԽ淶Χ趨Ϊ0.0~1.0ķΧΪ-50db ~ 6db + * ӳϵΪ0.0ʾ-50db1.0ʾ棨6db
  • + *
+ * + * @param min ȡƵֵޱ浽minС + * @param max ȡƵֵޱ浽maxС + * + * @return ɹֵ0ʧܷظֵ + * + * @see GetGain + * @see SetGain + * + * @since 4.1 + * @version 1.1 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief ȡƵ档 + * + * @param gain 浱ǰȡ浽gainС + * + * @return ɹֵ0ʧܷظֵ + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.1 + * @version 1.1 + */ + GetGain([out] float gain); + + /** + * @brief Ƶ档 + * + * @param gain õ棬СΪ0.0Ϊ1.0 + * + * @return ɹֵ0ʧܷظֵ + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.1 + * @version 1.1 + */ + SetGain([in] float gain); + + /** + * @brief ȡһ֡ƵݵijȣֽС + * + * @param size ȡƵ֡Сֽ浽sizeС + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief ȡƵbufferеƵ֡ + * + * @param count һƵbufferаƵ֡ȡ󱣴浽countС + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief ƵԲ + * + * @param attrs õƵԣƵʡȡͨο{@link AudioSampleAttributes} + * + * @return ɹֵ0ʧܷظֵ + * + * @see GetSampleAttributes + * + * @since 4.1 + * @version 1.1 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief ȡƵԲ + * + * @param attrs ȡƵԣƵʡȡͨ浽attrsУο{@link AudioSampleAttributes} + * + * @return ɹֵ0ʧܷظֵ + * + * @see SetSampleAttributes + * + * @since 4.1 + * @version 1.1 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief ȡƵͨID + * + * @param channelId ȡͨID浽channelIdС + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief Ƶչ + * + * @param keyValueList չֵַбʽΪkey=valueֵֺͨŷָ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief ȡƵչ + * + * @param keyValueList չֵַбʽΪkey=valueֵֺͨŷָ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief mmap + * + * @param reqSize 󻺳ĴСλֽڡ + * @param desc ο{@link AudioMmapBufferDescripter} + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); + + /** + * @brief ȡǰmmapĶ/дλá + * + * @param frames ȡƵ֡浽framesС + * @param time ȡĹʱ浽timeУο{@link AudioTimeStamp} + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief ƵЧ + * + * @param effectid ӵƵЧʵʶ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief ƳƵЧ + * + * @param effectid ƳƵЧʵʶ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief ȡС + * + * @param bufferSize ȡĻСbufferSizeУλΪֽڡ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief һƵݼ + * + * @return ɹֵ0ʧܷظֵ + * + * @see Stop + * + * @since 4.1 + * @version 1.1 + */ + Start(); + + /** + * @brief ֹͣһƵݼ + * + * @return ɹֵ0ʧܷظֵ + * + * @see Start + * + * @since 4.1 + * @version 1.1 + */ + Stop(); + + /** + * @brief ͣһƵݼ + * + * @return ɹֵ0ʧܷظֵ + * + * @see Resume + * + * @since 4.1 + * @version 1.1 + */ + Pause(); + + /** + * @brief ָһƵݼ + * + * @return ɹֵ0ʧܷظֵ + * + * @see Pause + * + * @since 4.1 + * @version 1.1 + */ + Resume(); + + /** + * @brief ˢƵbufferеݡ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + Flush(); + + /** + * @brief ûȥ豸Ĵģʽ + * + * @return 豸ģʽɹֵ0ٴִкȥôģʽɹֵʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + TurnStandbyMode(); + + /** + * @brief Ƶ豸Ϣ + * + * @param range ҪϢΧ3 ~ 5ΪҪϢ3һϢ4ȫϢ5 + * @param fd 浽ָĿļ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief жǷ֧Ƶ¼Ƶͣͻָܡ + * + * @param supportPause Ƿ֧ͣܵ״̬浽supportPauseУtrueʾ֧֣falseʾ֧֡ + * @param supportResume Ƿָֻ֧ܵ״̬浽supportResumeУtrueʾ֧֣falseʾ֧֡ + * + * @return ɹֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioManager.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioManager.idl new file mode 100644 index 00000000..cb182f4c --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1_1/IAudioManager.idl @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audioģӿڶ塣 + * + * Ƶӿ漰͡ؽӿڡӿڡƵŽӿڡƵ¼ӿڵȡ + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioManager.idl + * + * @brief AudioصĽӿڶļ + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Ƶӿڵİ· + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_0; + +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioAdapter; + +/** + * @brief AudioManagerƵӿڡ + * + * Ƶ·ƵһƵ + * + * @see IAudioAdapter + * + * @since 4.1 + * @version 1.1 + */ +interface IAudioManager { + + /** + * @brief ȡƵֵ֧б + * + * @param descs ȡƵб浽descsУο{@link AudioAdapterDescriptor} + * + * @return ɹֵ0ʧܷظֵ + * + * @see LoadAdapter + * + * @since 4.1 + * @version 1.1 + */ + GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); + + /** + * @brief һƵ + * + * һƵusbھʵпܼصһ̬ӿ⣨*.so + * + * @param desc صƵο{@link AudioAdapterDescriptor} + * @param adapter ȡƵӿڵĶʵ浽adapterУο{@link IAudioAdapter} + * + * @return ɹֵ0ʧܷظֵ + * + * @see GetAllAdapters + * @see UnloadAdapter + * + * @since 4.1 + * @version 1.1 + */ + LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); + + /** + * @brief жƵ + * + * @param adapterName жصƵӿڵĶơ + * + * @see LoadAdapter + * + * @since 4.1 + * @version 1.1 + */ + UnloadAdapter([in] String adapterName); + + /** + * @brief ͷƵӿڶ + * + * @return ֵ0ʧܷظֵ + * + * @since 4.1 + * @version 1.1 + */ + ReleaseAudioManagerObject(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioRender.idl new file mode 100644 index 00000000..5d17a989 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1_1/IAudioRender.idl @@ -0,0 +1,602 @@ +/* + * 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. + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_1; + +/** + * @addtogroup Audio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioRender.idl + * + * @brief Audio播放的接口定义文件。 + * + * @since 4.1 + * @version 1.1 + */ + +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioCallback; + +/** + * @brief AudioRender音频播放接口。 + * + * 提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据等。 + * + * @since 4.1 + * @version 1.1 + */ +interface IAudioRender { + /** + * @brief 获取音频硬件驱动的延迟时间。 + * + * @param ms 获取的延迟时间(单位:毫秒)保存到ms中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetLatency([out] unsigned int ms); + + /** + * @brief 向音频驱动中播放一帧输出数据(放音,音频下行数据)。 + * + * @param frame 待写入的输出数据的音频frame。 + * @param replyBytes 实际写入的音频数据长度(字节数),获取后保存到replyBytes中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief 获取音频已输出的帧数。 + * + * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 + * @param time 获取的关联时间戳保存到time中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RenderFrame + * + * @since 4.1 + * @version 1.1 + */ + GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 设置一个音频的播放速度。 + * + * @param speed 待设置的播放速度(倍速),例0.5、0.75、1.0、1.25、1.5、2.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetRenderSpeed + * + * @since 4.1 + * @version 1.1 + */ + SetRenderSpeed([in] float speed); + + /** + * @brief 获取一个音频当前的播放速度。 + * + * @param speed 获取的播放速度保存到speed中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetRenderSpeed + * + * @since 4.1 + * @version 1.1 + */ + GetRenderSpeed([out] float speed); + + /** + * @brief 设置音频播放的通道模式。 + * + * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetChannelMode + * + * @since 4.1 + * @version 1.1 + */ + SetChannelMode([in] enum AudioChannelMode mode); + + /** + * @brief 获取音频播放当前的通道模式。 + * + * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetChannelMode + * + * @since 4.1 + * @version 1.1 + */ + GetChannelMode([out] enum AudioChannelMode mode); + + /** + * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 + * + * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 + * @param cookie 回调函数的入参。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 1.1 + */ + RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); + + /** + * @brief 排空缓冲区中的数据。 + * + * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 1.1 + */ + DrainBuffer([out] enum AudioDrainNotifyType type); + + /** + * @brief 判断是否支持清空缓冲区数据的功能。 + * + * @param support 是否支持的状态保存到support中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + IsSupportsDrain([out] boolean support); + /** + * @brief 是否支持某个音频场景的配置。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.1 + * @version 1.1 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
    + *
  • 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
      + *
    • 在媒体播放场景scene为media_speaker。
    • + *
    • 在语音通话免提场景scene为voice_speaker。
    • + *
    + *
  • 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
  • + *
  • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
  • + *
+ * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.1 + * @version 1.1 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.1 + * @version 1.1 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.1 + * @version 1.1 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), + * 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15)。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.1 + * @version 1.1 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
    + *
  • 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
  • + *
  • 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db)。
  • + *
+ * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.1 + * @version 1.1 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.1 + * @version 1.1 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.1 + * @version 1.1 + */ + SetGain([in] float gain); + + /** + * @brief 获取音频帧的大小。 + * + * 获取一帧音频数据的长度(字节数)。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.1 + * @version 1.1 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) + * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.1 + * @version 1.1 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + ReqMmapBuffer([in] int reqSize, [in] struct AudioMmapBufferDescripter desc); + + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.1 + * @version 1.1 + */ + Start(); + + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.1 + * @version 1.1 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.1 + * @version 1.1 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.1 + * @version 1.1 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,失败返回负值;设置取消设备待机模式成功返回正值,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + TurnStandbyMode(); + + /** + * @brief Dump音频设备信息。 + * + * @param range Dump信息范围,分为简要信息、全量信息。 + * @param fd 指定Dump目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频播放的暂停和恢复功能 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); + + /** + * @brief 设置低功耗模式缓存长度。 + * + * @param size 包含音频数据的缓存长度。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetBufferSize([in] unsigned int size); +} +/** @} */ -- Gitee From 725df83a91348e653b910595b9f49bb496b4da47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Tue, 28 Nov 2023 01:42:51 +0000 Subject: [PATCH 0107/2135] update zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl index 89f3e489..4c7d319b 100644 --- a/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl +++ b/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl @@ -181,32 +181,26 @@ enum AudioPortPassthroughMode { * @version 1.0 */ enum AudioSampleFormat { - /* 8 bits */ AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。 **/ AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。 **/ - /* 16 bits */ AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。 **/ AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。 **/ - /* 24 bits */ AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。 **/ AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。 **/ - /* 32 bits */ AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。 **/ AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。 **/ - /* 64 bits */ AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。 **/ AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。 **/ AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。 **/ - /* float double */ AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。 **/ AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 32bit位宽浮点型非交织样本。 **/ AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。 **/ -- Gitee From 3cf25edb909467667911ab5bdde5d28603266c36 Mon Sep 17 00:00:00 2001 From: shegangbin Date: Wed, 29 Nov 2023 12:41:32 +0800 Subject: [PATCH 0108/2135] fix syscap Signed-off-by: shegangbin --- en/native_sdk/graphic/native_buffer.h | 20 ++++++++++---------- en/native_sdk/graphic/native_image.h | 18 +++++++++--------- zh-cn/native_sdk/graphic/native_buffer.h | 20 ++++++++++---------- zh-cn/native_sdk/graphic/native_image.h | 18 +++++++++--------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/en/native_sdk/graphic/native_buffer.h b/en/native_sdk/graphic/native_buffer.h index 2947a5e2..24903dbe 100644 --- a/en/native_sdk/graphic/native_buffer.h +++ b/en/native_sdk/graphic/native_buffer.h @@ -23,7 +23,7 @@ * @brief Provides the capabilities of NativeBuffer. Using the functions provided by this module, * you can apply for, use, and release the shared memory, and query its attributes. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 9 * @version 1.0 */ @@ -34,7 +34,7 @@ * @brief Declares the functions for obtaining and using NativeBuffer. * * @library libnative_buffer.so - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 9 * @version 1.0 */ @@ -169,7 +169,7 @@ enum OH_NativeBuffer_Format { * @brief Defines the OH_NativeBuffer attribute configuration, which is used when you apply for * a new OH_NativeBuffer instance or query the attributes of an existing instance. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 9 * @version 1.0 */ @@ -201,7 +201,7 @@ typedef struct { * @brief Creates an OH_NativeBuffer instance based on an OH_NativeBuffer_Config struct. * A new OH_NativeBuffer instance is created each time this function is called. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param config Pointer to an OH_NativeBuffer_Config instance. * @return Returns the pointer to the OH_NativeBuffer instance created if the operation is successful; * returns NULL otherwise. @@ -213,7 +213,7 @@ OH_NativeBuffer* OH_NativeBuffer_Alloc(const OH_NativeBuffer_Config* config); /** * @brief Increases the reference count of an OH_NativeBuffer instance by 1. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Pointer to an OH_NativeBuffer instance. * @return Returns 0 if the operation is successful. * @since 9 @@ -225,7 +225,7 @@ int32_t OH_NativeBuffer_Reference(OH_NativeBuffer *buffer); * @brief Decreases the reference count of an OH_NativeBuffer instance by 1 and * when the reference count reaches 0, destroys the instance. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Pointer to an OH_NativeBuffer instance. * @return Returns 0 if the operation is successful. * @since 9 @@ -236,7 +236,7 @@ int32_t OH_NativeBuffer_Unreference(OH_NativeBuffer *buffer); /** * @brief Obtains the attributes of an OH_NativeBuffer instance. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Pointer to an OH_NativeBuffer instance. * @param config Pointer to an OH_NativeBuffer_Config instance, which is used to * receive the attributes of OH_NativeBuffer. @@ -248,7 +248,7 @@ void OH_NativeBuffer_GetConfig(OH_NativeBuffer *buffer, OH_NativeBuffer_Config* /** * @brief Maps the ION memory corresponding to an OH_NativeBuffer instance to the process address space. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Pointer to an OH_NativeBuffer instance. * @param virAddr Double pointer to the address of the virtual memory. * @return Returns 0 if the operation is successful. @@ -261,7 +261,7 @@ int32_t OH_NativeBuffer_Map(OH_NativeBuffer *buffer, void **virAddr); /** * @brief Unmaps the ION memory corresponding to an OH_NativeBuffer instance from the process address space. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Pointer to an OH_NativeBuffer instance. * @return Returns 0 if the operation is successful. * @since 9 @@ -272,7 +272,7 @@ int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); /** * @brief Obtains the sequence number of an OH_NativeBuffer instance. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Pointer to an OH_NativeBuffer instance. * @return Returns the unique sequence number of the OH_NativeBuffer instance. * @since 9 diff --git a/en/native_sdk/graphic/native_image.h b/en/native_sdk/graphic/native_image.h index 5b7dc7fc..898c5ed2 100644 --- a/en/native_sdk/graphic/native_image.h +++ b/en/native_sdk/graphic/native_image.h @@ -23,7 +23,7 @@ * @brief Provides the capabilities of NativeImage. Functioning as a data consumer, this module is used to * associate data with the OpenGL texture. It is used in the OpenGL environment. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @since 9 * @version 1.0 */ @@ -65,7 +65,7 @@ typedef struct NativeWindow OHNativeWindow; /** * @brief Creates an OH_NativeImage instance to be associated with the OpenGL ES texture ID and target. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param textureId OpenGL ES texture ID. * @param textureTarget OpenGL ES texture target. * @return Returns the pointer to the OH_NativeImage instance created; @@ -80,7 +80,7 @@ OH_NativeImage* OH_NativeImage_Create(uint32_t textureId, uint32_t textureTarget * You need to call OH_NativeWindow_DestroyNativeWindow to release the OHNativeWindow instance * when it is no longer required. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Pointer to an OH_NativeImage instance. * @return Returns a pointer to the OHNativeWindow instance if the operation is successful; * returns NULL otherwise. @@ -94,7 +94,7 @@ OHNativeWindow* OH_NativeImage_AcquireNativeWindow(OH_NativeImage* image); * The OpenGL ES texture will be bound to an GL_TEXTURE_EXTERNAL_OES instance and updated * through the OH_NativeImage instance. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Pointer to an OH_NativeImage instance. * @param textureId ID of the OpenGL ES texture to which the OH_NativeImage instance is to be attached. * @return Returns 0 if the operation is successful. @@ -106,7 +106,7 @@ int32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId); /** * @brief Detaches an OH_NativeImage instance from the current OpenGL ES context. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Pointer to an OH_NativeImage instance. * @return Returns 0 if the operation is successful. * @since 9 @@ -118,7 +118,7 @@ int32_t OH_NativeImage_DetachContext(OH_NativeImage* image); /** * @brief Updates the OpenGL ES texture associated with the latest frame through an OH_NativeImage instance. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Pointer to an OH_NativeImage instance. * @return Returns 0 if the operation is successful. * @since 9 @@ -130,7 +130,7 @@ int32_t OH_NativeImage_UpdateSurfaceImage(OH_NativeImage* image); * @brief Obtains the timestamp of the texture image * that recently called the OH_NativeImage_UpdateSurfaceImage function. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Pointer to an OH_NativeImage instance. * @return Returns the timestamp of the texture image. * @since 9 @@ -142,7 +142,7 @@ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); * @brief Obtains the transform matrix of the texture image * that recently called the OH_NativeImage_UpdateSurfaceImage function. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Pointer to an OH_NativeImage instance. * @param matrix Buffer used to store the 4 x 4 transform matrix obtained. * @return Returns 0 if the operation is successful. @@ -155,7 +155,7 @@ int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16 * @brief Destroys an OH_NativeImage instance created by calling OH_NativeImage_Create. * After the instance is destroyed, the pointer to the OH_NativeImage instance is assigned NULL. * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image Pointer to an OH_NativeImage instance. * @since 9 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index 6871cfcf..d952641b 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -22,7 +22,7 @@ * * @brief 提供NativeBuffer功能,通过提供的接口,可以实现共享内存的申请、使用、属性查询、释放等操作 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 9 * @version 1.0 */ @@ -34,7 +34,7 @@ * * 引用文件 * @library libnative_buffer.so - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 9 * @version 1.0 */ @@ -242,7 +242,7 @@ enum OH_NativeBuffer_ColorSpace { /** * @brief OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 9 * @version 1.0 */ @@ -273,7 +273,7 @@ typedef struct { /** * @brief 通过OH_NativeBuffer_Config创建OH_NativeBuffer实例,每次调用都会产生一个新的OH_NativeBuffer实例 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param config 一个指向OH_NativeBuffer_Config类型的指针 * @return 创建成功则返回一个指向OH_NativeBuffer结构体实例的指针,否则返回NULL * @since 9 @@ -284,7 +284,7 @@ OH_NativeBuffer* OH_NativeBuffer_Alloc(const OH_NativeBuffer_Config* config); /** * @brief 将OH_NativeBuffer对象的引用计数加1 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer 一个指向OH_NativeBuffer实例的指针 * @return 返回值为0表示执行成功 * @since 9 @@ -295,7 +295,7 @@ int32_t OH_NativeBuffer_Reference(OH_NativeBuffer *buffer); /** * @brief 将OH_NativeBuffer对象的引用计数减1,当引用计数为0的时候,该NativeBuffer对象会被析构掉 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer 一个指向OH_NativeBuffer实例的指针 * @return 返回值为0表示执行成功 * @since 9 @@ -306,7 +306,7 @@ int32_t OH_NativeBuffer_Unreference(OH_NativeBuffer *buffer); /** * @brief 用于获取OH_NativeBuffer的属性 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer 一个指向OH_NativeBuffer实例的指针 * @param config 一个指向OH_NativeBuffer_Config的指针,用于接收OH_NativeBuffer的属性 * @since 9 @@ -317,7 +317,7 @@ void OH_NativeBuffer_GetConfig(OH_NativeBuffer *buffer, OH_NativeBuffer_Config* /** * @brief 将OH_NativeBuffer对应的ION内存映射到进程空间 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer 一个指向OH_NativeBuffer实例的指针 * @param virAddr 一个二级指针,二级指针指向映射到当前进程的虚拟内存的地址 * @return 返回值为0表示执行成功 @@ -330,7 +330,7 @@ int32_t OH_NativeBuffer_Map(OH_NativeBuffer *buffer, void **virAddr); /** * @brief 将OH_NativeBuffer对应的ION内存从进程空间移除 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer 一个指向OH_NativeBuffer实例的指针 * @return 返回值为0表示执行成功 * @since 9 @@ -341,7 +341,7 @@ int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); /** * @brief 获取OH_NativeBuffer的序列号 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeBuffer + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer 一个指向OH_NativeBuffer实例的指针 * @return 返回对应OH_NativeBuffer的唯一序列号 * @since 9 diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index 853c8091..48869bbb 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -22,7 +22,7 @@ * * @brief 提供NativeImage功能,作为数据消费者,主要用来将数据和OpenGL纹理对接,需在OpenGL环境下使用 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @since 9 * @version 1.0 */ @@ -89,7 +89,7 @@ typedef struct OH_OnFrameAvailableListener { /** * @brief 创建一个OH_NativeImage实例,该实例与OpenGL ES的纹理ID和纹理目标相关联 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param textureId OpenGL ES的纹理ID,OH_NativeImage实例会与之相关联 * @param textureTarget OpenGL ES的纹理目标 * @return 返回一个指向OH_NativeImage实例的指针 @@ -103,7 +103,7 @@ OH_NativeImage* OH_NativeImage_Create(uint32_t textureId, uint32_t textureTarget * @brief 获取与OH_NativeImage相关联的OHNativeWindow指针. 该OHNativeWindow后续不再需要时需要调用\n * OH_NativeWindow_DestroyNativeWindow释放 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image 是指向OH_NativeImage实例的指针 * @return 成功则返回一个指向OHNativeWindow实例的指针,否则返回NULL * @since 9 @@ -115,7 +115,7 @@ OHNativeWindow* OH_NativeImage_AcquireNativeWindow(OH_NativeImage* image); * @brief 将OH_NativeImage实例附加到当前OpenGL ES上下文, 且该OpenGL ES纹理会绑定到 \n * GL_TEXTURE_EXTERNAL_OES, 并通过OH_NativeImage进行更新 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image 是指向OH_NativeImage实例的指针 * @param textureId 是OH_NativeImage要附加到的OpenGL ES纹理的id * @return 返回值为0表示执行成功 @@ -127,7 +127,7 @@ int32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId); /** * @brief 将OH_NativeImage实例从当前OpenGL ES上下文分离 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image 是指向OH_NativeImage实例的指针 * @return 返回值为0表示执行成功 * @since 9 @@ -139,7 +139,7 @@ int32_t OH_NativeImage_DetachContext(OH_NativeImage* image); /** * @brief 通过OH_NativeImage获取最新帧更新相关联的OpenGL ES纹理 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image 是指向OH_NativeImage实例的指针 * @return 返回值为0表示执行成功 * @since 9 @@ -150,7 +150,7 @@ int32_t OH_NativeImage_UpdateSurfaceImage(OH_NativeImage* image); /** * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image 是指向OH_NativeImage实例的指针 * @return 返回纹理图像的相关时间戳 * @since 9 @@ -161,7 +161,7 @@ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); /** * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image 是指向OH_NativeImage实例的指针 * @param matrix 用来存储要获取的4*4的变化矩阵 * @return 返回值为0表示执行成功 @@ -209,7 +209,7 @@ int32_t OH_NativeImage_UnsetOnFrameAvailableListener(OH_NativeImage* image); * @brief 销毁通过OH_NativeImage_Create创建的OH_NativeImage实例, 销毁后该\n * OH_NativeImage指针会被赋值为空 * - * @syscap SystemCapability.Graphic.Graphic2D.OH_NativeImage + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @param image 是指向OH_NativeImage实例的指针 * @since 9 * @version 1.0 -- Gitee From 95a2c73498e1fc760712d02deaeac2ac68e37dd7 Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Thu, 30 Nov 2023 02:56:18 +0000 Subject: [PATCH 0109/2135] add vibrator native header Signed-off-by: hellohyh001 --- zh-cn/native_sdk/vibrator/vibrator.h | 84 +++++++++++++++++++ zh-cn/native_sdk/vibrator/vibrator_type.h | 98 +++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 zh-cn/native_sdk/vibrator/vibrator.h create mode 100644 zh-cn/native_sdk/vibrator/vibrator_type.h diff --git a/zh-cn/native_sdk/vibrator/vibrator.h b/zh-cn/native_sdk/vibrator/vibrator.h new file mode 100644 index 00000000..5533f73a --- /dev/null +++ b/zh-cn/native_sdk/vibrator/vibrator.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup 马达 + * @{ + * + * @brief 为马达服务提供统一的API以访问马达驱动程序。 + * @since 11 + */ + +/** + * @file vibrator.h + * + * @brief 为您提供标准的开放api,用于控制马达振动的启停。 + * @library libohvibrator.z.so + * @syscap SystemCapability.Sensors.MiscDevice + * @since 11 + */ + +#ifndef VIBRATOR_H +#define VIBRATOR_H + +#include "vibrator_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +namespace OHOS { +namespace Sensors { +/** + * @brief 控制马达在指定时间内持续振动。 + * + * @param duration - 振动时长,单位:毫秒。 + * @param attribute - 振动属性,请参考{@Link VibrateAttribute}。 + * @return 如果操作成功,则返回0;否则返回非零值。请参阅 {@link Vibrator_ErrorCode}。 + * @permission ohos.permission.VIBRATE + * + * @since 11 + */ +int32_t OH_Vibrator_PlayVibration(int32_t duration, Vibrator_Attribute attribute); + +/** + * @brief 播放自定义振动序列。 + * + * @param fileDescription - 自定义振动效果文件描述符,请参阅 {@link Vibrator_FileDescription}。 + * @param vibrateAttribute - 振动属性,请参阅 {@link Vibrator_Attribute}。 + * @return 如果操作成功,则返回0;否则返回非零值。请参阅 {@link Vibrator_ErrorCode}。 + * @permission ohos.permission.VIBRATE + * + * @since 11 + */ +int32_t OH_Vibrator_PlayVibrationCustom(Vibrator_FileDescription fileDescription, + Vibrator_Attribute vibrateAttribute); + +/** + * @brief 停止马达振动。 + * + * @return 如果操作成功,则返回0;否则返回非零值。请参阅 {@link Vibrator_ErrorCode}。 + * @permission ohos.permission.VIBRATE + * + * @since 11 + */ +int32_t OH_Vibrator_Cancel(); +} // namespace Sensors +} // namespace OHOS +#ifdef __cplusplus +}; +#endif +/** @} */ +#endif // endif VIBRATOR_H \ No newline at end of file diff --git a/zh-cn/native_sdk/vibrator/vibrator_type.h b/zh-cn/native_sdk/vibrator/vibrator_type.h new file mode 100644 index 00000000..d5efe54d --- /dev/null +++ b/zh-cn/native_sdk/vibrator/vibrator_type.h @@ -0,0 +1,98 @@ +/* + * 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 VIBRATOR_TYPE_H +#define VIBRATOR_TYPE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** +* @brief 为用户定义错误码。 +* +* @since 11 +*/ +typedef enum Vibrator_ErrorCode : int32_t { + /**< 权限校验失败。 */ + PERMISSION_DENIED = 201, + /**< 参数检查失败,包括必选参数没有传入,参数类型错误等。 */ + PARAMETER_ERROR = 401, + /**< 该设备不支持此 API,通常用于在设备已支持该 SysCap 时,针对其少量的 API 的支持处理。 */ + UNSUPPORTED = 801, + /**< 设备操作失败。 */ + DEVICE_OPERATION_FAILED = 14600101, +} Vibrator_ErrorCode; + +/** + * @brief 振动优先级。 + * + * @since 11 + */ +typedef enum Vibrator_Usage { + /**< 未知场景 */ + USAGE_UNKNOWN = 0, + /**< 报警 */ + USAGE_ALARM = 1, + /**< 铃声 */ + USAGE_RING = 2, + /**< 通知 */ + USAGE_NOTIFICATION = 3, + /**< 通信 */ + USAGE_COMMUNICATION = 4, + /**< 触摸 */ + USAGE_TOUCH = 5, + /**< 媒体 */ + USAGE_MEDIA = 6, + /**< 物理反馈 */ + USAGE_PHYSICAL_FEEDBACK = 7, + /**< 模拟现实 */ + USAGE_SIMULATE_REALITY = 8, + USAGE_MAX = 9 +} Vibrator_Usage; + +/** + * @brief 马达属性。 + * + * @since 11 + */ +typedef struct Vibrator_Attribute { + /**< 马达ID */ + int32_t id; + /**< 振动场景 */ + Vibrator_Usage usage; +} Vibrator_Attribute; + +/** + * @brief 振动文件描述。 + * + * @since 11 + */ +typedef struct Vibrator_FileDescription { + /**< 自定义振动序列的文件句柄。 */ + int32_t fd; + /**< 自定义振动序列的偏移地址。 */ + int64_t offset; + /**< 自定义振动序列的总长度。 */ + int64_t length; +} Vibrator_FileDescription; +/** @} */ +#ifdef __cplusplus +}; +#endif + +#endif // endif VIBRATOR_TYPE_H \ No newline at end of file -- Gitee From 32d77232b2a65e5bd6a752a75f0bd1e8e33b8b50 Mon Sep 17 00:00:00 2001 From: chunsen Date: Thu, 30 Nov 2023 14:37:24 +0800 Subject: [PATCH 0110/2135] add power_manager IDL translation Signed-off-by: chunsen --- zh-cn/device_api/hdi/battery/v1_1/BUILD.gn | 34 ++ .../hdi/battery/v1_1/IBatteryCallback.idl | 65 ++++ .../hdi/battery/v1_1/IBatteryInterface.idl | 241 +++++++++++++++ zh-cn/device_api/hdi/battery/v1_1/Types.idl | 165 ++++++++++ zh-cn/device_api/hdi/battery/v1_2/BUILD.gn | 34 ++ .../hdi/battery/v1_2/IBatteryCallback.idl | 66 ++++ .../hdi/battery/v1_2/IBatteryInterface.idl | 291 ++++++++++++++++++ zh-cn/device_api/hdi/battery/v1_2/Types.idl | 188 +++++++++++ zh-cn/device_api/hdi/battery/v2_0/BUILD.gn | 34 ++ .../hdi/battery/v2_0/IBatteryCallback.idl | 66 ++++ .../hdi/battery/v2_0/IBatteryInterface.idl | 291 ++++++++++++++++++ zh-cn/device_api/hdi/battery/v2_0/Types.idl | 190 ++++++++++++ zh-cn/device_api/hdi/power/v1_1/BUILD.gn | 35 +++ .../hdi/power/v1_1/IPowerHdiCallback.idl | 68 ++++ .../hdi/power/v1_1/IPowerInterface.idl | 149 +++++++++ .../device_api/hdi/power/v1_1/PowerTypes.idl | 91 ++++++ .../hdi/power/v1_1/RunningLockTypes.idl | 115 +++++++ zh-cn/device_api/hdi/thermal/v1_1/BUILD.gn | 35 +++ .../hdi/thermal/v1_1/IFanCallback.idl | 62 ++++ .../hdi/thermal/v1_1/IThermalCallback.idl | 62 ++++ .../hdi/thermal/v1_1/IThermalInterface.idl | 152 +++++++++ .../hdi/thermal/v1_1/ThermalTypes.idl | 63 ++++ 22 files changed, 2497 insertions(+) create mode 100644 zh-cn/device_api/hdi/battery/v1_1/BUILD.gn create mode 100644 zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl create mode 100644 zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl create mode 100644 zh-cn/device_api/hdi/battery/v1_1/Types.idl create mode 100644 zh-cn/device_api/hdi/battery/v1_2/BUILD.gn create mode 100644 zh-cn/device_api/hdi/battery/v1_2/IBatteryCallback.idl create mode 100644 zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl create mode 100644 zh-cn/device_api/hdi/battery/v1_2/Types.idl create mode 100644 zh-cn/device_api/hdi/battery/v2_0/BUILD.gn create mode 100644 zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl create mode 100644 zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface.idl create mode 100644 zh-cn/device_api/hdi/battery/v2_0/Types.idl create mode 100644 zh-cn/device_api/hdi/power/v1_1/BUILD.gn create mode 100644 zh-cn/device_api/hdi/power/v1_1/IPowerHdiCallback.idl create mode 100644 zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl create mode 100644 zh-cn/device_api/hdi/power/v1_1/PowerTypes.idl create mode 100644 zh-cn/device_api/hdi/power/v1_1/RunningLockTypes.idl create mode 100644 zh-cn/device_api/hdi/thermal/v1_1/BUILD.gn create mode 100644 zh-cn/device_api/hdi/thermal/v1_1/IFanCallback.idl create mode 100644 zh-cn/device_api/hdi/thermal/v1_1/IThermalCallback.idl create mode 100644 zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl create mode 100644 zh-cn/device_api/hdi/thermal/v1_1/ThermalTypes.idl diff --git a/zh-cn/device_api/hdi/battery/v1_1/BUILD.gn b/zh-cn/device_api/hdi/battery/v1_1/BUILD.gn new file mode 100644 index 00000000..af04e4b3 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_1/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libbattery_proxy_1.1") { + deps = [] + public_configs = [] + } +} else { + hdi("battery") { + module_name = "battery_interface_service" + + sources = [ + "IBatteryCallback.idl", + "IBatteryInterface.idl", + "Types.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_battery" + } +} diff --git a/zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl new file mode 100644 index 00000000..7bacfcb8 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取和订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IBatteryCallback.idl + * + * @brief 提供电池信息的回调。 + * + * 电池模块为电池服务提供回调,以便订阅电池信息的变更。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.battery.v1_1; + +import ohos.hdi.battery.v1_1.Types; + +/** + * @brief 表示电池信息的回调。 + * + * 创建回调对象后,电池服务可调用 {@link IBatteryInterface} 接口注册回调,订阅电池信息变更。 + * + * @since 3.1 + */ +[callback] interface IBatteryCallback { + + /** + * @brief 电池更改信息回调。 + * + * + * + * @param 输入参数,事件 电池信息,如电池电量、电压和健康状态。 + * @see 电池信息。 + * + * @since 3.1 + */ + Update([in] struct BatteryInfo event); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl new file mode 100644 index 00000000..8dc02a55 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file IBatteryInterface.idl + * + * @brief 提供用于获取和订阅电池信息的接口 + * + * 获取该模块的对象或代理后,电池服务可调用相关借口获取和订阅电池信息。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.battery.v1_1; + +import ohos.hdi.battery.v1_1.Types; +import ohos.hdi.battery.v1_1.IBatteryCallback; + +/** + * @brief 获取、订阅电池信息的接口。 + * + * + * + * @since 3.1 + */ +interface IBatteryInterface { + /** + * @brief 注册电池信息的回调。 + * + * @param 注册事件的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + Register([in] IBatteryCallback event); + + /** + * @brief 取消注册电池信息的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + UnRegister(); + + /** + * @brief 设置电池信息节点的路径。 + * + * @param path 输入参数,电池信息节点的路径。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + ChangePath([in] String path); + + /** + * @brief 获取电池的电量百分比。 + * + * @param capacity 输出参数,表示电量的百分比值 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCapacity([out] int capacity); + + /** + * @brief 获取电池的电压。 + * + * @param voltage 输出参数,表示电池的电压。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetVoltage([out] int voltage); + + /** + * @brief 获取电池的充电温度,单位0.1摄氏度。 + * + * @param temperature 输出参数,表示电池温度 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTemperature([out] int temperature); + + /** + * @brief 获取电池的健康状态。 + * + * @param healthState 输出参数,表示电池健康状态。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryHealthState + * + * @since 3.1 + */ + GetHealthState([out] enum BatteryHealthState healthState); + + /** + * @brief 获取充电设备类型。 + * + * @param pluggedType 输出参数,表示充电设备类型。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryPluggedType + * + * @since 3.1 + */ + GetPluggedType([out] enum BatteryPluggedType pluggedType); + + /** + * @brief 获取充电状态。 + * + * @param chargeState 输出参数,表示充电状态。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryChargeState + * + * @since 3.1 + */ + GetChargeState([out] enum BatteryChargeState chargeState); + + /** + * @brief 获取是否支持电池或者电池是否在位。 + * + * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetPresent([out] boolean present); + + /** + * @brief 获取电池的技术型号。 + * + * @param technology 输出参数,当前电池技术型号。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTechnology([out] String technology); + + /** + * @brief 获取电池的总容量。 + * + * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTotalEnergy([out] int totalEnergy); + + /** + * @brief 获取电池的平均电流。 + * + * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCurrentAverage([out] int curAverage); + + /** + * @brief 获取电池的实时电流。 + * + * @param curNow 输出参数,表示电池的实时电流,单位毫安 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCurrentNow([out] int curNow); + + /** + * @brief 获取电池的剩余容量。 + * + * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetRemainEnergy([out] int remainEnergy); + + /** + * @brief 获取电池的全部信息。 + * + * @param info 输出参数,电池的全部信息。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryInfo + * + * @since 3.1 + */ + GetBatteryInfo([out] struct BatteryInfo info); + + /** + * @brief 设置电池充电电流或电压限制。 + * + * @param ChargingLimit 输出参数,对电池充电电流或电压的限制。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.2 + */ + SetChargingLimit([in] struct ChargingLimit[] chargingLimit); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v1_1/Types.idl b/zh-cn/device_api/hdi/battery/v1_1/Types.idl new file mode 100644 index 00000000..40381095 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_1/Types.idl @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取电池信息、订阅电池信息的变化。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file Types.idl + * + * @brief 电池信息相关数据类型。 + * + * 电池信息中使用的数据类型,包括健康状态、充电状态、充电设备类型和电池信息结构。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.battery.v1_1; + + +/** + * @brief 电池的健康状态。 + * + * @since 3.1 + */ +enum BatteryHealthState +{ + /** 表示电池健康状态未知。 */ + BATTERY_HEALTH_UNKNOWN = 0, + /** 表示电池健康状态为正常。 */ + BATTERY_HEALTH_GOOD, + /** 表示电池健康状态为过热。 */ + BATTERY_HEALTH_OVERHEAT, + /** 表示电池健康状态为过压。 */ + BATTERY_HEALTH_OVERVOLTAGE, + /** 表示电池健康状态为低温。 */ + BATTERY_HEALTH_COLD, + /** 表示电池健康状态为耗尽。 */ + BATTERY_HEALTH_DEAD, + /** 预留。 */ + BATTERY_HEALTH_RESERVED, +}; + +/** + * @brief 电池的充电状态。 + * + * @since 3.1 + */ +enum BatteryChargeState +{ + /** 表示电池充电状态未知。 */ + CHARGE_STATE_NONE = 0, + /** 表示电池充电状态为使能状态。 */ + CHARGE_STATE_ENABLE, + /** 表示电池充电状态为停止状态。 */ + CHARGE_STATE_DISABLE, + /** 表示电池充电状态为已充满状态。 */ + CHARGE_STATE_FULL, + /** 预留。 */ + CHARGE_STATE_RESERVED, +}; + +/** + * @brief 电池的充电设备类型。 + * + * @since 3.2 + */ +enum BatteryPluggedType +{ + /** 表示连接充电器类型未知。 */ + PLUGGED_TYPE_NONE = 0, + /** 表示连接的充电器类型为交流充电器。 */ + PLUGGED_TYPE_AC, + /** 表示连接的充电器类型为USB充电器。 */ + PLUGGED_TYPE_USB, + /** 表示连接的充电器类型为无线充电器。 */ + PLUGGED_TYPE_WIRELESS, + /** 预留。 */ + PLUGGED_TYPE_BUTT +}; + +/** + * @brief 电池相关信息。 + * + * @since 3.1 + */ +struct BatteryInfo { + /** 表示电池的电量百分比。 */ + int capacity; + /** 表示电池的电压。 */ + int voltage; + /** 表示电池的温度 */ + int temperature; + /** 表示电池的健康状态。 */ + int healthState; + /** 表示电池的充电设备类型。 */ + int pluggedType; + /** 表示电池的最大充电电流。 */ + int pluggedMaxCurrent; + /** 表示电池的最大充电电压。 */ + int pluggedMaxVoltage; + /** 表示电池的充电状态。 */ + int chargeState; + /** 表示电池的充电次数。 */ + int chargeCounter; + /** 表示电池的总容量。 */ + int totalEnergy; + /** 表示电池的平均电流。 */ + int curAverage; + /** 表示电池的实时电流。 */ + int curNow; + /** 表示电池的剩余容量。 */ + int remainEnergy; + /** 表示是否支持电池或者电池是否在位。 */ + byte present; + /** 表示电池的技术型号。 */ + String technology; +}; + +/** + * @brief 电池充电限制类型。 + * + * @since 3.2 + */ +enum ChargingLimitType +{ + /** 限制类型:充电电流 */ + TYPE_CURRENT = 0, + /** 限制类型:充电电压 */ + TYPE_VOLTAGE, +}; + +/** + * @brief 定义电池充电电流或电压的限制。 + * + * @since 3.2 + */ +struct ChargingLimit +{ + enum ChargingLimitType type; + String protocol; + int value; +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v1_2/BUILD.gn b/zh-cn/device_api/hdi/battery/v1_2/BUILD.gn new file mode 100644 index 00000000..f4abad5a --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_2/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libbattery_proxy_1.2") { + deps = [] + public_configs = [] + } +} else { + hdi("battery") { + module_name = "battery_interface_service" + + sources = [ + "IBatteryCallback.idl", + "IBatteryInterface.idl", + "Types.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_battery" + } +} diff --git a/zh-cn/device_api/hdi/battery/v1_2/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v1_2/IBatteryCallback.idl new file mode 100644 index 00000000..3838584b --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_2/IBatteryCallback.idl @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取和订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IBatteryCallback.idl + * + * @brief 提供电池信息的回调。 + * + * 电池模块为电池服务提供回调,以便订阅电池信息的变更。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.battery.v1_2; + +import ohos.hdi.battery.v1_2.Types; + +/** + * @brief 表示电池信息的回调。 + * + * 创建回调对象后,电池服务可调用 {@link IBatteryInterface} 接口注册回调,订阅电池信息变更。 + * + * + * @since 3.1 + */ +[callback] interface IBatteryCallback { + + /** + * @brief 电池更改信息回调。 + * + * + * + * @param 输入参数,事件 电池信息,如电池电量、电压和健康状态。 + * @see 电池信息。 + * + * @since 3.1 + */ + Update([in] struct BatteryInfo event); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl new file mode 100644 index 00000000..5541ecab --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file IBatteryInterface.idl + * + * @brief 获取、订阅电池信息的接口。 + * + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.battery.v1_2; + +import ohos.hdi.battery.v1_2.Types; +import ohos.hdi.battery.v1_2.IBatteryCallback; + +/** + * @brief 获取、订阅电池信息的接口。 + * + * + * + * @since 3.1 + */ +interface IBatteryInterface { + /** + * @brief 注册电池信息的回调。 + * + * @param 注册事件的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + Register([in] IBatteryCallback event); + + /** + * @brief 取消注册电池信息的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + UnRegister(); + + /** + * @brief 设置电池信息节点的路径。 + * + * @param path 输入参数,电池信息节点的路径。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + ChangePath([in] String path); + + /** + * @brief 获取电池的电量百分比。 + * + * @param capacity 输出参数,表示电量的百分比值 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCapacity([out] int capacity); + + /** + * @brief 获取电池的电压。 + * + * @param voltage 输出参数,表示电池的电压。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetVoltage([out] int voltage); + + /** + * @brief 获取电池的充电温度,单位0.1摄氏度。 + * + * @param temperature 输出参数,表示电池温度 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTemperature([out] int temperature); + + /** + * @brief 获取电池的健康状态。 + * + * @param healthState 输出参数,表示电池健康状态。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryHealthState + * + * @since 3.1 + */ + GetHealthState([out] enum BatteryHealthState healthState); + + /** + * @brief 获取充电设备类型。 + * + * @param pluggedType 输出参数,表示充电设备类型。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryPluggedType + * + * @since 3.1 + */ + GetPluggedType([out] enum BatteryPluggedType pluggedType); + + /** + * @brief 获取充电状态。 + * + * @param chargeState 输出参数,表示充电状态。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryChargeState + * + * @since 3.1 + */ + GetChargeState([out] enum BatteryChargeState chargeState); + + /** + * @brief 获取是否支持电池或者电池是否在位。 + * + * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetPresent([out] boolean present); + + /** + * @brief 获取电池的技术型号。 + * + * @param technology 输出参数,当前电池技术型号。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTechnology([out] String technology); + + /** + * @brief 获取电池的总容量。 + * + * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTotalEnergy([out] int totalEnergy); + + /** + * @brief 获取电池的平均电流。 + * + * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCurrentAverage([out] int curAverage); + + /** + * @brief 获取电池的实时电流。 + * + * @param curNow 输出参数,表示电池的实时电流,单位毫安 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCurrentNow([out] int curNow); + + /** + * @brief 获取电池的剩余容量。 + * + * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetRemainEnergy([out] int remainEnergy); + + /** + * @brief 获取电池的全部信息。 + * + * @param info 输出参数,电池的全部信息。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryInfo + * + * @since 3.1 + */ + GetBatteryInfo([out] struct BatteryInfo info); + + /** + * @brief 设置电池充电电流或电压限制。 + * + * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.2 + */ + SetChargingLimit([in] struct ChargingLimit[] chargingLimit); + + /** + * @brief 获取插入的充电器类型。 + * + * @param type 输出参数,充电器类型。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 4.0 + */ + GetChargeType([out] enum ChargeType type); + + /** + * @brief 根据场景名称设置电池配置 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输入参数,电池组配置值。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 4.1 + */ + SetBatteryConfig([in] String sceneName, [in] String value); + + /** + * @brief 根据场景名称获取电池配置 。 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输出参数,电池组配置值。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 4.1 + */ + GetBatteryConfig([in] String sceneName, [out] String value); + + /** + * @brief 通过场景名称检查电池配置是否启用 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输出参数,电源配置是否启用。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 4.1 + */ + IsBatteryConfigSupported([in] String sceneName, [out] boolean value); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v1_2/Types.idl b/zh-cn/device_api/hdi/battery/v1_2/Types.idl new file mode 100644 index 00000000..46ed723e --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v1_2/Types.idl @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取电池信息、订阅电池信息的变化。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file Types.idl + * + * @brief 电池信息相关数据类型。 + * + * 电池信息中使用的数据类型,包括健康状态、充电状态、充电设备类型和电池信息结构。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.battery.v1_1; + + +/** + * @brief 电池的健康状态。 + * + * @since 3.1 + */ +enum BatteryHealthState +{ + /** 表示电池健康状态未知。 */ + BATTERY_HEALTH_UNKNOWN = 0, + /** 表示电池健康状态为正常。 */ + BATTERY_HEALTH_GOOD, + /** 表示电池健康状态为过热。 */ + BATTERY_HEALTH_OVERHEAT, + /** 表示电池健康状态为过压。 */ + BATTERY_HEALTH_OVERVOLTAGE, + /** 表示电池健康状态为低温。 */ + BATTERY_HEALTH_COLD, + /** 表示电池健康状态为耗尽。 */ + BATTERY_HEALTH_DEAD, + /** 预留。 */ + BATTERY_HEALTH_RESERVED, +}; + +/** + * @brief 电池的充电状态。 + * + * @since 3.1 + */ +enum BatteryChargeState +{ + /** 表示电池充电状态未知。 */ + CHARGE_STATE_NONE = 0, + /** 表示电池充电状态为使能状态。 */ + CHARGE_STATE_ENABLE, + /** 表示电池充电状态为停止状态。 */ + CHARGE_STATE_DISABLE, + /** 表示电池充电状态为已充满状态。 */ + CHARGE_STATE_FULL, + /** 预留。 */ + CHARGE_STATE_RESERVED, +}; + +/** + * @brief 电池的充电设备类型。 + * + * @since 3.2 + */ +enum BatteryPluggedType +{ + /** 表示连接充电器类型未知。 */ + PLUGGED_TYPE_NONE = 0, + /** 表示连接的充电器类型为交流充电器。 */ + PLUGGED_TYPE_AC, + /** 表示连接的充电器类型为USB充电器。 */ + PLUGGED_TYPE_USB, + /** 表示连接的充电器类型为无线充电器。 */ + PLUGGED_TYPE_WIRELESS, + /** 预留。 */ + PLUGGED_TYPE_BUTT +}; + +/** + * @brief 电池相关信息。 + * + * @since 3.1 + */ +struct BatteryInfo { + /** 表示电池的电量百分比。 */ + int capacity; + /** 表示电池的电压。 */ + int voltage; + /** 表示电池的温度 */ + int temperature; + /** 表示电池的健康状态。 */ + int healthState; + /** 表示电池的充电设备类型。 */ + int pluggedType; + /** 表示电池的最大充电电流。 */ + int pluggedMaxCurrent; + /** 表示电池的最大充电电压。 */ + int pluggedMaxVoltage; + /** 表示电池的充电状态。 */ + int chargeState; + /** 表示电池的充电次数。 */ + int chargeCounter; + /** 表示电池的总容量。 */ + int totalEnergy; + /** 表示电池的平均电流。 */ + int curAverage; + /** 表示电池的实时电流。 */ + int curNow; + /** 表示电池的剩余容量。 */ + int remainEnergy; + /** 表示是否支持电池或者电池是否在位。 */ + byte present; + /** 表示电池的技术型号。 */ + String technology; +}; + +/** + * @brief 电池充电限制类型。 + * + * @since 3.2 + */ +enum ChargingLimitType +{ + /** 限制类型:充电电流 */ + TYPE_CURRENT = 0, + /** 限制类型:充电电压 */ + TYPE_VOLTAGE, +}; + +/** + * @brief 定义电池充电电流或电压的限制。 + * + * @since 3.2 + */ +struct ChargingLimit +{ + enum ChargingLimitType type; + String protocol; + int value; +}; + +/** + * @brief 表示插入的充电器类型。 + * + * @since 4.0 + */ +enum ChargeType +{ + /** 未知类型 */ + CHARGE_TYPE_NONE = 0, + /** 有线普通型 */ + CHARGE_TYPE_WIRED_NORMAL, + /** 有线快速型 */ + CHARGE_TYPE_WIRED_QUICK, + /** 有线超快速型 */ + CHARGE_TYPE_WIRED_SUPER_QUICK, + /** 无线普通型 */ + CHARGE_TYPE_WIRELESS_NORMAL, + /** 无线快速型*/ + CHARGE_TYPE_WIRELESS_QUICK, + /** 无线超快速型 */ + CHARGE_TYPE_WIRELESS_SUPER_QUICK, +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v2_0/BUILD.gn b/zh-cn/device_api/hdi/battery/v2_0/BUILD.gn new file mode 100644 index 00000000..ac8f9200 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v2_0/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libbattery_proxy_2.0") { + deps = [] + public_configs = [] + } +} else { + hdi("battery") { + module_name = "battery_interface_service" + + sources = [ + "IBatteryCallback.idl", + "IBatteryInterface.idl", + "Types.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_battery" + } +} diff --git a/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl new file mode 100644 index 00000000..8eb4e787 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取和订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IBatteryCallback.idl + * + * @brief 提供电池信息的回调。 + * + * 电池模块为电池服务提供回调,以便订阅电池信息的变更。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.battery.v2_0; + +import ohos.hdi.battery.v2_0.Types; + +/** + * @brief 表示电池信息的回调。 + * + * 创建回调对象后,电池服务可调用 {@link IBatteryInterface} 接口注册回调,订阅电池信息变更。 + * subscribe to battery information changes. + * + * @since 3.1 + */ +[callback] interface IBatteryCallback { + + /** + * @brief 电池更改信息回调。 + * + * + * + * @param 事件 电池信息,如电池电量、电压和健康状态。 + * @see 电池信息。 + * + * @since 3.1 + */ + Update([in] struct BatteryInfo event); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface.idl new file mode 100644 index 00000000..d436f4dd --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface.idl @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file IBatteryInterface.idl + * + * @brief Provides 获取、订阅电池信息的接口。 + * + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.battery.v2_0; + +import ohos.hdi.battery.v2_0.Types; +import ohos.hdi.battery.v2_0.IBatteryCallback; + +/** + * @brief 获取、订阅电池信息的接口。 + * + * + * + * @since 3.1 + */ +interface IBatteryInterface { + /** + * @brief 注册电池信息的回调。 + * + * @param 注册事件的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + Register([in] IBatteryCallback event); + + /** + * @brief 取消注册电池信息的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + UnRegister(); + + /** + * @brief 设置电池信息节点的路径。 + * + * @param path 输入参数,电池信息节点的路径。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + ChangePath([in] String path); + + /** + * @brief 获取电池的电量百分比。 + * + * @param capacity 输出参数,表示电量的百分比值 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCapacity([out] int capacity); + + /** + * @brief 获取电池的电压。 + * + * @param voltage 输出参数,表示电池的电压。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetVoltage([out] int voltage); + + /** + * @brief 获取电池的充电温度,单位0.1摄氏度。 + * + * @param temperature 输出参数,表示电池温度。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTemperature([out] int temperature); + + /** + * @brief 获取电池的健康状态。 + * + * @param healthState 输出参数,表示电池健康状态。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryHealthState + * + * @since 3.1 + */ + GetHealthState([out] enum BatteryHealthState healthState); + + /** + * @brief 获取充电设备类型。 + * + * @param pluggedType 输出参数,表示充电设备类型。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryPluggedType + * + * @since 3.1 + */ + GetPluggedType([out] enum BatteryPluggedType pluggedType); + + /** + * @brief 获取充电状态。 + * + * @param chargeState 输出参数,表示充电状态。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryChargeState + * + * @since 3.1 + */ + GetChargeState([out] enum BatteryChargeState chargeState); + + /** + * @brief 获取是否支持电池或者电池是否在位。 + * + * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetPresent([out] boolean present); + + /** + * @brief 获取电池的技术型号。 + * + * @param technology 输出参数,当前电池技术型号。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTechnology([out] String technology); + + /** + * @brief 获取电池的总容量。 + * + * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetTotalEnergy([out] int totalEnergy); + + /** + * @brief 获取电池的平均电流。 + * + * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCurrentAverage([out] int curAverage); + + /** + * @brief 获取电池的实时电流。 + * + * @param curNow 输出参数,表示电池的实时电流,单位毫安 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetCurrentNow([out] int curNow); + + /** + * @brief 获取电池的剩余容量。 + * + * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.1 + */ + GetRemainEnergy([out] int remainEnergy); + + /** + * @brief 获取电池的全部信息。 + * + * @param info 输出参数,电池的全部信息。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see BatteryInfo + * + * @since 3.1 + */ + GetBatteryInfo([out] struct BatteryInfo info); + + /** + * @brief 设置电池充电电流或电压限制。 + * + * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 3.2 + */ + SetChargingLimit([in] struct ChargingLimit[] chargingLimit); + + /** + * @brief 获取插入的充电器类型。 + * + * @param type 输出参数,充电器类型。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 4.0 + */ + GetChargeType([out] enum ChargeType type); + + /** + * @brief 根据场景名称设置电池配置 。 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输出参数,电池组配置值。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 4.1 + */ + SetBatteryConfig([in] String sceneName, [in] String value); + + /** + * @brief 根据场景名称获取电池配置 。 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输出参数,电池组配置值。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 4.1 + */ + GetBatteryConfig([in] String sceneName, [out] String value); + + /** + * @brief 通过场景名称检查电池配置是否启用。 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输出参数,电池配置是否启用。 + * + * @return HDF_SUCCESS 表示注册成功。 + * + * @since 4.1 + */ + IsBatteryConfigSupported([in] String sceneName, [out] boolean value); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/battery/v2_0/Types.idl b/zh-cn/device_api/hdi/battery/v2_0/Types.idl new file mode 100644 index 00000000..dec198d2 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v2_0/Types.idl @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取电池信息、订阅电池信息的变化。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file Types.idl + * + * @brief 电池信息相关数据类型。 + * + * 电池信息中使用的数据类型,包括健康状态、充电状态、充电设备类型和电池信息结构。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.battery.v1_1; + + +/** + * @brief 电池的健康状态。 + * + * @since 3.1 + */ +enum BatteryHealthState +{ + /** 表示电池健康状态未知。 */ + BATTERY_HEALTH_UNKNOWN = 0, + /** 表示电池健康状态为正常。 */ + BATTERY_HEALTH_GOOD, + /** 表示电池健康状态为过热。 */ + BATTERY_HEALTH_OVERHEAT, + /** 表示电池健康状态为过压。 */ + BATTERY_HEALTH_OVERVOLTAGE, + /** 表示电池健康状态为低温。 */ + BATTERY_HEALTH_COLD, + /** 表示电池健康状态为耗尽。 */ + BATTERY_HEALTH_DEAD, + /** 预留。 */ + BATTERY_HEALTH_RESERVED, +}; + +/** + * @brief 电池的充电状态。 + * + * @since 3.1 + */ +enum BatteryChargeState +{ + /** 表示电池充电状态未知。 */ + CHARGE_STATE_NONE = 0, + /** 表示电池充电状态为使能状态。 */ + CHARGE_STATE_ENABLE, + /** 表示电池充电状态为停止状态。 */ + CHARGE_STATE_DISABLE, + /** 表示电池充电状态为已充满状态。 */ + CHARGE_STATE_FULL, + /** 预留。 */ + CHARGE_STATE_RESERVED, +}; + +/** + * @brief 电池的充电设备类型。 + * + * @since 3.2 + */ +enum BatteryPluggedType +{ + /** 表示连接充电器类型未知。 */ + PLUGGED_TYPE_NONE = 0, + /** 表示连接的充电器类型为交流充电器。 */ + PLUGGED_TYPE_AC, + /** 表示连接的充电器类型为USB充电器。 */ + PLUGGED_TYPE_USB, + /** 表示连接的充电器类型为无线充电器。 */ + PLUGGED_TYPE_WIRELESS, + /** 预留。 */ + PLUGGED_TYPE_BUTT +}; + +/** + * @brief 电池相关信息。 + * + * @since 3.1 + */ +struct BatteryInfo { + /** 表示电池的电量百分比。 */ + int capacity; + /** 表示电池的电压。 */ + int voltage; + /** 表示电池的温度 */ + int temperature; + /** 表示电池的健康状态。 */ + int healthState; + /** 表示电池的充电设备类型。 */ + int pluggedType; + /** 表示电池的最大充电电流。 */ + int pluggedMaxCurrent; + /** 表示电池的最大充电电压。 */ + int pluggedMaxVoltage; + /** 表示电池的充电状态。 */ + int chargeState; + /** 表示电池的充电次数。 */ + int chargeCounter; + /** 表示电池的总容量。 */ + int totalEnergy; + /** 表示电池的平均电流。 */ + int curAverage; + /** 表示电池的实时电流。 */ + int curNow; + /** 表示电池的剩余容量。 */ + int remainEnergy; + /** 表示是否支持电池或者电池是否在位。 */ + byte present; + /** 表示电池的技术型号。 */ + String technology; + /** 事件名 */ + String uevent; +}; + +/** + * @brief 定义电池充电限制类型。 + * + * @since 3.2 + */ +enum ChargingLimitType +{ + /** Limit type: charging current */ + TYPE_CURRENT = 0, + /** Limit type: charging voltage */ + TYPE_VOLTAGE, +}; + +/** + * @brief 定义电池充电电流或电压的限制。 + * + * @since 3.2 + */ +struct ChargingLimit +{ + enum ChargingLimitType type; + String protocol; + int value; +}; + +/** + * @brief 表示插入的充电器类型。 + * + * @since 4.0 + */ +enum ChargeType +{ + /** 未知类型 */ + CHARGE_TYPE_NONE = 0, + /** 有线普通型 */ + CHARGE_TYPE_WIRED_NORMAL, + /** 有线快速型 */ + CHARGE_TYPE_WIRED_QUICK, + /** 有线超快速型 */ + CHARGE_TYPE_WIRED_SUPER_QUICK, + /** 无线普通型 */ + CHARGE_TYPE_WIRELESS_NORMAL, + /** 无线快速型*/ + CHARGE_TYPE_WIRELESS_QUICK, + /** 无线超快速型 */ + CHARGE_TYPE_WIRELESS_SUPER_QUICK, +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/power/v1_1/BUILD.gn b/zh-cn/device_api/hdi/power/v1_1/BUILD.gn new file mode 100644 index 00000000..09d4bb47 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_1/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libpower_proxy_1.1") { + deps = [] + public_configs = [] + } +} else { + hdi("power") { + module_name = "power_interface_service" + + sources = [ + "IPowerHdiCallback.idl", + "IPowerInterface.idl", + "PowerTypes.idl", + "RunningLockTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_power" + } +} diff --git a/zh-cn/device_api/hdi/power/v1_1/IPowerHdiCallback.idl b/zh-cn/device_api/hdi/power/v1_1/IPowerHdiCallback.idl new file mode 100644 index 00000000..cd64ac27 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_1/IPowerHdiCallback.idl @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup power + * @{ + * + * @brief 提供休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * + * 电源模块为电源服务提供的休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 + * + * @since 3.1 + * @version 1.0 + */ + + /** + * @file IPowerHdiCallback.idl + * + * @brief 休眠/唤醒状态的回调。 + * + * 电源模块为电源服务提供的订阅休眠/唤醒状态的回调。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.power.v1_1; + +/** + * @brief 休眠/唤醒状态的回调。 + * + * 服务创建此回调对象后,可以调用{@link IPowerInterface}的接口注册回调,从而订阅休眠/唤醒状态的变化。 + * + * @since 3.1 + */ +[callback] interface IPowerHdiCallback { + /** + * @brief 休眠状态的回调方法。 + * + * 当设备进入休眠状态时,将通过此方法通知给服务。 + * + * @since 3.1 + */ + OnSuspend(); + + /** + * @brief 唤醒状态的回调方法。 + * + * 当设备进入唤醒状态时,将通过此方法通知给服务。 + * + * @since 3.1 + */ + OnWakeup(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl b/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl new file mode 100644 index 00000000..46ba8b9f --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup power + * @{ + * + * @brief 提供休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 电源模块为电源服务提供的休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file IPowerInterface.idl + * + * @brief 休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 电源模块为电源服务提供休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.power.v1_1; + +import ohos.hdi.power.v1_1.IPowerHdiCallback; +import ohos.hdi.power.v1_1.PowerTypes; +import ohos.hdi.power.v1_1.RunningLockTypes; + +/** + * @brief 休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * + * @since 3.1 + */ +interface IPowerInterface { + /** + * @brief 注册休眠/唤醒状态的回调。 + * + * @param ipowerHdiCallback 输入参数,服务注册的回调。 + * + * @return HDF_SUCCESS 表示注册成功。 + * @see IPowerHdiCallback + * + * @since 3.1 + */ + RegisterCallback([in] IPowerHdiCallback ipowerHdiCallback); + + /** + * @brief 执行设备休眠操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + StartSuspend(); + + /** + * @brief 执行设备唤醒操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + StopSuspend(); + + /** + * @brief 执行设备强制休眠操作。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + ForceSuspend(); + + /** + * @brief 打开运行锁,阻止休眠。 + * + * @param name 输入参数,运行锁的名称。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + * @deprecated + */ + SuspendBlock([in] String name); + + /** + * @brief 关闭运行锁,取消阻止休眠。 + * + * @param name 输入参数,运行锁的名称。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + * @deprecated + */ + SuspendUnblock([in] String name); + + /** + * @brief 获取电源的Dump信息。 + * + * @param info 输出参数,电源的Dump信息。 + * + * @return HDF_SUCCESS 表示操作成功。 + * + * @since 3.1 + */ + PowerDump([out] String info); + + /** + * @brief 持有运行锁,阻止设备休眠。 + * + * @param info 输出参数,运行锁信息。 + * + * @return 成功返回 HDF_SUCCESS; 运行锁与当前锁冲突返回 HDF_FAILED。 + * + * @since 4.0 + */ + HoldRunningLock([in] struct RunningLockInfo info); + + /** + * @brief 解除运行锁,解除设备休眠。 + * + * @param info 输出参数,运行锁信息。 + * + * @return 成功返回 HDF_SUCCESS。 + * + * @since 4.0 + */ + UnholdRunningLock([in] struct RunningLockInfo info); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/power/v1_1/PowerTypes.idl b/zh-cn/device_api/hdi/power/v1_1/PowerTypes.idl new file mode 100644 index 00000000..fc1d5780 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_1/PowerTypes.idl @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup power + * @{ + * + * @brief 提供休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 电源模块为电源服务提供的休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file PowerTypes.idl + * + * @brief 电源相关的数据类型。 + * + * 电源管理中使用的数据类型,包括命令参数、回调参数和系统状态。 + * + * @since 3.1 + * @version 1.0 + */ + +package ohos.hdi.power.v1_1; + +/** + * @brief 枚举电源命令的参数。 + * + * @since 3.1 + * @deprecated + */ +enum PowerHdfCmd { + /** 订阅状态的命令参数 */ + CMD_REGISTER_CALLBCK = 0, + /** 休眠的命令参数 */ + CMD_START_SUSPEND, + /** 唤醒的命令参数 */ + CMD_STOP_SUSPEND, + /** 强制休眠的命令参数 */ + CMD_FORCE_SUSPEND, + /** 打开运行锁的命令参数 */ + CMD_SUSPEND_BLOCK, + /** 关闭运行锁的命令参数 */ + CMD_SUSPEND_UNBLOCK, + /** Dump的命令参数 */ + CMD_DUMP, +}; + +/** + * @brief 枚举电源状态回调的参数。 + * + * @since 3.1 + * @deprecated + */ +enum PowerHdfCallbackCmd { + /** 休眠回调的命令参数。 */ + CMD_ON_SUSPEND = 0, + /** 唤醒回调的命令参数。 */ + CMD_ON_WAKEUP, +}; + +/** + * @brief 枚举电源的状态。 + * + * @since 3.1 + */ +enum PowerHdfState { + /** 唤醒状态。 */ + AWAKE = 0, + /** 非活动状态。 */ + INACTIVE, + /** 休眠状态。 */ + SLEEP, +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/power/v1_1/RunningLockTypes.idl b/zh-cn/device_api/hdi/power/v1_1/RunningLockTypes.idl new file mode 100644 index 00000000..185bf286 --- /dev/null +++ b/zh-cn/device_api/hdi/power/v1_1/RunningLockTypes.idl @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup power + * @{ + * + * @brief 提供休眠/唤醒操作、订阅休眠/唤醒状态、运行锁管理的接口。 + * + * 电源模块为电源服务提供的休眠/唤醒操作、订阅休眠/唤醒状态和运行锁管理的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口对设备进行休眠/唤醒、订阅休眠/唤醒状态和管理运行锁。 + * + * @since 3.1 + * @version 1.0 + */ + +/** + * @file RunningLockTypes.idl + * + * @brief 枚举与运行锁管理相关的数据类型。 + * + * 这些数据类型包括运行锁类型和运行锁信息。 + * + * @since 4.0 + * @version 1.1 + */ + +package ohos.hdi.power.v1_1; + +/** + * @brief 枚举基本运行锁类型。 + * + * @since 4.0 + */ +enum BaseRunningLockType { + /** + * 用于保持屏幕开启。 + */ + RUNNINGLOCK_SCREEN = 0, + /** + * 用于保持 CPU 处于运行状态,以完成后台任务。 + */ + RUNNINGLOCK_BACKGROUND = 1, + /** + * 通过传感器控制屏幕的开关。 + */ + RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL = 2, +}; + +/** + * @brief 枚举运行锁类型。 + * + * @since 4.0 + */ +enum RunningLockType { + /** + * 用于保持后台手机任务的完成。 + */ + RUNNINGLOCK_BACKGROUND_PHONE = 3, // RUNNINGLOCK_BACKGROUND | 1 << 1 = 0b00000011 + /** + * 用于保持后台通知任务完成。 + */ + RUNNINGLOCK_BACKGROUND_NOTIFICATION = 5, // RUNNINGLOCK_BACKGROUND | 1 << 2 = 0b00000101 + /** + * 用于保持后台音频任务完成。 + */ + RUNNINGLOCK_BACKGROUND_AUDIO = 9, // RUNNINGLOCK_BACKGROUND | 1 << 3 = 0b00001001 + /** + * 用于保持后台运动任务的完成。 + */ + RUNNINGLOCK_BACKGROUND_SPORT = 17, // RUNNINGLOCK_BACKGROUND | 1 << 4 = 0b00010001 + /** + * 用于保持后台导航任务的完成。 + */ + RUNNINGLOCK_BACKGROUND_NAVIGATION = 33, // RUNNINGLOCK_BACKGROUND | 1 << 5 = 0b00100001 + /** + * 用于保持后台常见任务的完成。 + */ + RUNNINGLOCK_BACKGROUND_TASK = 65, // RUNNINGLOCK_BACKGROUND | 1 << 6 = 0b01000001 + /** + * 预留运行锁类型。 + */ + RUNNINGLOCK_BUTT +}; + +/** + * @brief 定义运行中的锁的信息。 + * + * @since 4.0 + */ +struct RunningLockInfo { + /** 运行锁的名称。不能为空或空值 */ + String name; + /** 运行锁类型 */ + enum RunningLockType type; // The default value is RUNNINGLOCK_BACKGROUND_TASK. + /** 运行锁的超时时间,毫秒。值小于 0 表示没有超时。 */ + int timeoutMs; // The default value is 3000. + /** PID */ + int pid; + /** UID */ + int uid; +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_1/BUILD.gn b/zh-cn/device_api/hdi/thermal/v1_1/BUILD.gn new file mode 100644 index 00000000..742c0c71 --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_1/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libthermal_proxy_1.1") { + deps = [] + public_configs = [] + } +} else { + hdi("thermal") { + module_name = "thermal_interface_service" + + sources = [ + "IFanCallback.idl", + "IThermalCallback.idl", + "IThermalInterface.idl", + "ThermalTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_thermal" + } +} diff --git a/zh-cn/device_api/hdi/thermal/v1_1/IFanCallback.idl b/zh-cn/device_api/hdi/thermal/v1_1/IFanCallback.idl new file mode 100644 index 00000000..d7290b43 --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_1/IFanCallback.idl @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup thermal + * @{ + * + * @brief 提供设备温度管理、控制及订阅接口。 + * + * 热模块为热服务提供的设备温度管理、控制及订阅接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口管理、控制和订阅设备温度。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @file IFanCallback.idl + * + * @brief 提供风扇故障检测回调。 + * + * 为热服务提供回调,以获取设备温度和风扇转速的变化。 + * + * @since 4.0 + * @version 1.1 + */ + +package ohos.hdi.thermal.v1_1; + +import ohos.hdi.thermal.v1_1.ThermalTypes; + +/** + * @brief 代表风扇状态变化的回调。 + * + * 创建回调对象后,热服务可调用 {@link IThermalInterface} 借口注册回调,以便订阅风扇状态变化。 + * + * @since 4.0 + */ +[callback] interface IFanCallback { + /** + * @brief 回调风扇状态变化。 + * + * @param event 输入参数,设备的风扇信息,包括设备温度和风扇速度。 + * @see HdfThermalCallbackInfo + * + * @since4.0 + */ + OnFanDataEvent([in] struct HdfThermalCallbackInfo event); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_1/IThermalCallback.idl b/zh-cn/device_api/hdi/thermal/v1_1/IThermalCallback.idl new file mode 100644 index 00000000..5d76e4c9 --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_1/IThermalCallback.idl @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup thermal + * @{ + * + * @brief 提供设备温度管理、控制及订阅接口。 + * + * 热模块为热服务提供的设备温度管理、控制及订阅接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口管理、控制和订阅设备温度。 + * + * @since 3.1 + * @version 1.1 + */ + +/** + * @file IThermalCallback.idl + * + * @brief 设备发热状态的回调。 + * + * 热模块为热服务提供的设备发热状态的回调。 + * + * @since 3.1 + * @version 1.1 + */ + +package ohos.hdi.thermal.v1_1; + +import ohos.hdi.thermal.v1_1.ThermalTypes; + +/** + * @brief 订阅设备发热状态的回调。 + * + * 服务创建此回调对象后,可以调用{@link IThermalInterface}的接口注册回调,从而订阅设备发热状态的变化。 + * + * @since 3.1 + */ +[callback] interface IThermalCallback { + /** + * @brief 热状态变化的回调。 + * + * @param event 输入参数,设备发热信息,包括器件类型、器件温度。 + * @see HdfThermalCallbackInfo + * + * @since 3.1 + */ + OnThermalDataEvent([in] struct HdfThermalCallbackInfo event); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl b/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl new file mode 100644 index 00000000..c72076a7 --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup thermal + * @{ + * + * @brief 提供设备温度管理、控制及订阅接口。 + * + * 热模块为热服务提供的设备温度管理、控制及订阅接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口管理、控制和订阅设备温度。 + * + * @since 3.1 + * @version 1.1 + */ + +/** + * @file IThermalInterface.idl + * + * @brief 设备温度管理、控制及订阅接口。 + * + * + * + * @since 3.1 + * @version 1.1 + */ + +package ohos.hdi.thermal.v1_1; + +import ohos.hdi.thermal.v1_1.ThermalTypes; +import ohos.hdi.thermal.v1_1.IThermalCallback; +import ohos.hdi.thermal.v1_1.IFanCallback; + +/** + * @brief 备温度管理、控制及订阅接口。 + * + * + * + * @since 3.1 + */ +interface IThermalInterface { + /** + * @brief 设置CPU频率。 + * + * @param freq 输入参数,设置CPU频率的值。 + * + * @return HDF_SUCCESS 表示设置成功。 + * + * @since 3.1 + */ + SetCpuFreq([in] int freq); + + /** + * @brief 设置GPU频率。 + * + * @param freq 输入参数,设置GPU频率的值。 + * + * @return HDF_SUCCESS 表示设置成功。 + * + * @since 3.1 + */ + SetGpuFreq([in] int freq); + + /** + * @brief 设置充电电流。 + * + * @param current 输入参数,充电电流,单位毫安。 + * + * @return HDF_SUCCESS 表示设置成功 + * + * @since 3.1 + */ + SetBatteryCurrent([in] int current); + + /** + * @brief 获取设备发热的信息。 + * + * @param event 输出参数,设备发热信息,包括器件类型、器件温度。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see HdfThermalCallbackInfo + * + * @since 3.1 + */ + GetThermalZoneInfo([out] struct HdfThermalCallbackInfo event); + + /** + * @brief 隔离内核CPU。 + * + * @param num 输入参数,CPU内核编号。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 4.0 + */ + IsolateCpu([in] int num); + + /** + * @brief 注册设备热状态回调。 + * + * @param callbackObj 输入参数,要注册的回调函数。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see IThermalCallback + * + * @since 3.1 + */ + Register([in] IThermalCallback callbackObj); + + /** + * @brief 注册设备热状态回调。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 3.1 + */ + Unregister(); + + /** + * @brief 注册风扇故障检测的回调。 + * + * @param callbackObj 输入参数,要注册的回调函数。 + * + * @return HDF_SUCCESS 表示获取成功。 + * @see IFanCallback + * + * @since 4.0 + */ + RegisterFanCallback([in] IFanCallback callbackObj); + + /** + * @brief 取消注册风扇故障检测的回调。 + * + * @return HDF_SUCCESS 表示获取成功。 + * + * @since 4.0 + */ + UnregisterFanCallback(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_1/ThermalTypes.idl b/zh-cn/device_api/hdi/thermal/v1_1/ThermalTypes.idl new file mode 100644 index 00000000..fe2d6ebc --- /dev/null +++ b/zh-cn/device_api/hdi/thermal/v1_1/ThermalTypes.idl @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup thermal + * @{ + * + * @brief 提供设备温度管理、控制及订阅接口。 + * + * 热模块为热服务提供的设备温度管理、控制及订阅接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口管理、控制和订阅设备温度。 + * + * @since 3.1 + * @version 1.1 + */ + +/** + * @file ThermalTypes.idl + * + * @brief 设备发热状态相关的数据类型。 + * + * 热管理中使用的数据类型,包括设备发热的信息和设备发热的信息列表。 + * + * @since 3.1 + * @version 1.1 + */ + +package ohos.hdi.thermal.v1_1; + +/** + * @brief 设备发热的信息。 + * + * @since 3.1 + */ +struct ThermalZoneInfo { + /** 发热器件的类型。 */ + String type; + /** 器件的温度值。 */ + int temp; +}; + +/** + * @brief 设备发热的信息列表。 + * + * @since 3.1 + */ +struct HdfThermalCallbackInfo { + /** 设备发热的信息列表。 */ + List info; +}; +/** @} */ -- Gitee From 04a4c0deee05d8f242381c3016c6bf6731ce6791 Mon Sep 17 00:00:00 2001 From: lvjintao Date: Thu, 30 Nov 2023 16:34:39 +0800 Subject: [PATCH 0111/2135] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lvjintao --- zh-cn/native_sdk/media/player/avplayer.h | 434 ++++++++++++++++++ zh-cn/native_sdk/media/player/avplayer_base.h | 192 ++++++++ 2 files changed, 626 insertions(+) create mode 100644 zh-cn/native_sdk/media/player/avplayer.h create mode 100644 zh-cn/native_sdk/media/player/avplayer_base.h diff --git a/zh-cn/native_sdk/media/player/avplayer.h b/zh-cn/native_sdk/media/player/avplayer.h new file mode 100644 index 00000000..32a883a5 --- /dev/null +++ b/zh-cn/native_sdk/media/player/avplayer.h @@ -0,0 +1,434 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup AVPlayer + * @{ + * + * @brief Provides APIs of Playback capability for Media Source. + * + * @Syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + * @version 1.0 + */ + +/** + * @file avplayer.h + * + * @brief Defines the avplayer APIs. Uses the Native APIs provided by Media AVPlayer + * to play the media source. + * + * @library libavplayer.so + * @since 11 + * @version 1.0 + */ + +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H + +#include +#include +#include "native_averrors.h" +#include "avplayer_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Create a player + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @return Returns a pointer to an OH_AVPlayer instance + * @since 11 + * @version 1.0 +*/ +OH_AVPlayer *OH_AVPlayer_Create(void); + +/** + * @brief Sets the playback source for the player. The corresponding source can be http url + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param url Indicates the playback source. + * @return Returns {@link AV_ERR_OK} if the url is set successfully; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetURLSource(OH_AVPlayer *player, const char *url); + +/** + * @brief Sets the playback media file descriptor source for the player. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer 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 Returns {@link AV_ERR_OK} if the fd source is set successfully; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetFDSource(OH_AVPlayer *player, int32_t fd, int64_t offset, int64_t size); + +/** + * @brief Prepares the playback environment and buffers media data asynchronous. + * + * This function must be called after {@link SetSource}. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns {@link AV_ERR_OK} if {@link Prepare} is successfully added to the task queue; + * returns an error code defined in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_Prepare(OH_AVPlayer *player); + +/** + * @brief Start playback. + * + * This function must be called after {@link Prepare}. If the player state is Prepared, + * this function is called to start playback. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns {@link AV_ERR_OK} if the playback is started; otherwise returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_Play(OH_AVPlayer *player); + +/** + * @brief Pauses playback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns {@link AV_ERR_OK} if {@link Pause} is successfully added to the task queue; + * returns an error code defined in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_Pause(OH_AVPlayer *player); + +/** + * @brief Stop playback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns {@link AV_ERR_OK} if {@link Stop} is successfully added to the task queue; + * returns an error code defined in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_Stop(OH_AVPlayer *player); + +/** + * @brief Restores the player to the initial state. + * + * After the function is called, add a playback source by calling {@link SetSource}, + * call {@link Play} to start playback again after {@link Prepare} is called. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns {@link AV_ERR_OK} if {@link Reset} is successfully added to the task queue; + * returns an error code defined in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_Reset(OH_AVPlayer *player); + +/** + * @brief Releases player resources async + * + * Asynchronous release guarantees the performance + * but cannot ensure whether the surfacebuffer is released. + * The caller needs to ensure the life cycle security of the surface + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns {@link AV_ERR_OK} if {@link Release} is successfully added to the task queue; + * returns an error code defined in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_Release(OH_AVPlayer *player); + +/** + * @brief Releases player resources sync + * + * Synchronous release ensures effective release of surfacebuffer + * but this interface will take a long time (when the engine is not idle state) + * requiring the caller to design an asynchronous mechanism by itself + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns {@link AV_ERR_OK} if the playback is released; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_ReleaseSync(OH_AVPlayer *player); + +/** + * @brief Sets the volume of the player. + * + * This function can be used during playback or pause. The value 0 indicates no sound, + * and 1 indicates the original volume. If no audio device is started or no audio + * stream exists, the value -1 is returned. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param leftVolume Indicates the target volume of the left audio channel to set, + * ranging from 0 to 1. each step is 0.01. + * @param rightVolume Indicates the target volume of the right audio channel to set, + * ranging from 0 to 1. each step is 0.01. + * @return Returns {@link AV_ERR_OK} if the volume is set; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetVolume(OH_AVPlayer *player, float leftVolume, float rightVolume); + +/** + * @brief Changes the playback position. + * + * This function can be used during play or pause. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param mSeconds Indicates the target playback position, accurate to milliseconds. + * @param mode Indicates the player seek mode. For details, see {@link AVPlayerSeekMode}. + * @return Returns {@link AV_ERR_OK} if the seek is done; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 +*/ +OH_AVErrCode OH_AVPlayer_Seek(OH_AVPlayer *player, int32_t mSeconds, AVPlayerSeekMode mode); + +/** + * @brief Obtains the playback position, accurate to millisecond. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param currentTime Indicates the playback position. + * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_GetCurrentTime(OH_AVPlayer *player, int32_t *currentTime); + +/** + * @brief get the video width. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param videoWidth The video width + * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_GetVideoWidth(OH_AVPlayer *player, int32_t *videoWidth); + +/** + * @brief get the video height. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param videoHeight The video height + * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_GetVideoHeight(OH_AVPlayer *player, int32_t *videoHeight); + +/** + * @brief set the player playback rate + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param speed the rate mode {@link AVPlaybackSpeed} which can set. + * @return Returns {@link AV_ERR_OK} if the playback rate is set successful; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed speed); + +/** + * @brief get the current player playback rate + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param speed the rate mode {@link AVPlaybackSpeed} which can get. + * @return Returns {@link AV_ERR_OK} if the current player playback rate is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed *speed); + +/** + * @brief set the bit rate use for hls player + * + * the playback bitrate expressed in bits per second, expressed in bits per second, + * which is only valid for HLS protocol network flow. By default, + * the player will select the appropriate bit rate and speed according to the network connection. + * report the effective bit rate linked list by "INFO_TYPE_BITRATE_COLLECT" + * set and select the specified bit rate, and select the bit rate that is less than and closest + * to the specified bit rate for playback. When ready, read it to query the currently selected bit rate. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param bitRate the bit rate, The unit is bps. + * @return Returns {@link AV_ERR_OK} if the bit rate is set successfully; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SelectBitRate(OH_AVPlayer *player, uint32_t bitRate); + +/** + * @brief Method to set the surface. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} + * @return Returns {@link AV_ERR_OK} if the surface is set; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetVideoSurface(OH_AVPlayer *player, OHNativeWindow *window); + +/** + * @brief Obtains the total duration of media files, accurate to milliseconds. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param duration Indicates the total duration of media files. + * @return Returns {@link AV_ERR_OK} if the current duration is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_GetDuration(OH_AVPlayer *player, int32_t *duration); + +/** + * @brief get current playback state. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param state the current playback state + * @return Returns {@link AV_ERR_OK} if the current duration is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_GetState(OH_AVPlayer *player, AVPlayerState *state); + +/** + * @brief Checks whether the player is playing. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns true if the playback is playing; false otherwise. + * @since 11 + * @version 1.0 + */ +bool OH_AVPlayer_IsPlaying(OH_AVPlayer *player); + +/** + * @brief Returns the value whether single looping is enabled or not . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @return Returns true if the playback is single looping; false otherwise. + * @since 11 + * @version 1.0 + */ +bool OH_AVPlayer_IsLooping(OH_AVPlayer *player); + +/** + * @brief Enables single looping of the media playback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param loop The switch to set loop + * @return Returns {@link AV_ERR_OK} if the single looping is set; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetLooping(OH_AVPlayer *player, bool loop); + +/** + * @brief Method to set player callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param callback object pointer. + * @return Returns {@link AV_ERR_OK} if the playercallback is set; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetPlayerCallback(OH_AVPlayer *player, AVPlayerCallback callback); + +/** + * @brief Select audio or subtitle track. + * + * By default, the first audio stream with data is played, and the subtitle track is not played. + * After the settings take effect, the original track will become invalid. Please set subtitles + * in prepared/playing/paused/completed state and set audio tracks in prepared state. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param index Track index + * @return Returns {@link AV_ERR_OK} if selected successfully; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 +*/ +OH_AVErrCode OH_AVPlayer_SelectTrack(OH_AVPlayer *player, int32_t index); + +/** + * @brief Deselect the current audio or subtitle track. + * + * After audio is deselected, the default track will be played, and after subtitles are deselected, + * they will not be played. Please set subtitles in prepared/playing/paused/completed state and set + * audio tracks in prepared state. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param index Track index + * @return Returns {@link AV_ERR_OK} if selected successfully; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 +*/ +OH_AVErrCode OH_AVPlayer_DeselectTrack(OH_AVPlayer *player, int32_t index); + +/** + * @brief Obtain the currently effective track index. + * + * Please get it in the prepared/playing/paused/completed state. + * + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param trackType Media type. + * @param index Track index + * @return Returns {@link AV_ERR_OK} if the track index is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_GetCurrentTrack(OH_AVPlayer *player, int32_t trackType, int32_t *index); + + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H diff --git a/zh-cn/native_sdk/media/player/avplayer_base.h b/zh-cn/native_sdk/media/player/avplayer_base.h new file mode 100644 index 00000000..3128b685 --- /dev/null +++ b/zh-cn/native_sdk/media/player/avplayer_base.h @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup AVPlayer + * @{ + * + * @brief Provides APIs of Playback capability for Media Source. + * + * @Syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + * @version 1.0 + */ + +/** + * @file avplayer_base.h + * + * @brief Defines the structure and enumeration for Media AVPlayer. + * + * @library libavplayer.so + * @since 11 + * @version 1.0 + */ + +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_BASH_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_BASH_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OH_AVPlayer OH_AVPlayer; +typedef struct NativeWindow OHNativeWindow; + +/** + * @brief Player States + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + * @version 1.0 + */ +typedef enum AVPlayerState { + /* idle states */ + AV_IDLE = 0, + /* initialized states */ + AV_INITIALIZED = 1, + /* prepared states */ + AV_PREPARED = 2, + /* playing states */ + AV_PLAYING = 3, + /* paused states */ + AV_PAUSED = 4, + /* stopped states */ + AV_STOPPED = 5, + /* Play to the end states */ + AV_COMPLETED = 6, + /* released states */ + AV_RELEASED = 7, + /* error states */ + AV_ERROR = 8, +} AVPlayerState; + +/** + * @brief Player Seek Mode + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + * @version 1.0 + */ +typedef enum AVPlayerSeekMode { + /* sync to keyframes after the time point. */ + AV_SEEK_NEXT_SYNC = 0, + /* sync to keyframes before the time point. */ + AV_SEEK_PREVIOUS_SYNC, +} AVPlayerSeekMode; + +/** + * @brief Playback Speed + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + * @version 1.0 + */ +typedef enum AVPlaybackSpeed { + /* Video playback at 0.75x normal speed */ + AV_SPEED_FORWARD_0_75_X, + /* Video playback at normal speed */ + AV_SPEED_FORWARD_1_00_X, + /* Video playback at 1.25x normal speed */ + AV_SPEED_FORWARD_1_25_X, + /* Video playback at 1.75x normal speed */ + AV_SPEED_FORWARD_1_75_X, + /* Video playback at 2.0x normal speed */ + AV_SPEED_FORWARD_2_00_X, +} AVPlaybackSpeed; + +/** + * @brief Player OnInfo Type + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + * @version 1.0 + */ +typedef enum AVPlayerOnInfoType { + /* return the message when seeking done. */ + AV_INFO_TYPE_SEEKDONE = 0, + /* return the message when speeding done. */ + AV_INFO_TYPE_SPEEDDONE = 1, + /* return the message when select bitrate done */ + AV_INFO_TYPE_BITRATEDONE = 2, + /* return the message when playback is end of steam. */ + AV_INFO_TYPE_EOS = 3, + /* return the message when PlayerStates changed. */ + AV_INFO_TYPE_STATE_CHANGE = 4, + /* return the current posion of playback automatically. */ + AV_INFO_TYPE_POSITION_UPDATE = 5, + /* return the playback message. */ + AV_INFO_TYPE_MESSAGE = 6, + /* return the message when volume changed. */ + AV_INFO_TYPE_VOLUME_CHANGE = 7, + /* return the message when video size is first known or updated. */ + AV_INFO_TYPE_RESOLUTION_CHANGE = 8, + /* return multiqueue buffering time. */ + AV_INFO_TYPE_BUFFERING_UPDATE = 9, + /* return hls bitrate. + Bitrate is to convert data into uint8_t array storage, + which needs to be forcibly converted to uint32_t through offset access. */ + AV_INFO_TYPE_BITRATE_COLLECT = 10, + /* return the message when audio focus changed. */ + AV_INFO_TYPE_INTERRUPT_EVENT = 11, + /* return the duration of playback. */ + AV_INFO_TYPE_DURATION_UPDATE = 12, + /* return the playback is live stream. */ + AV_INFO_TYPE_IS_LIVE_STREAM = 13, + /* return the message when track changes. */ + AV_INFO_TYPE_TRACKCHANGE = 14, + /* return the message when subtitle track info updated. */ + AV_INFO_TYPE_TRACK_INFO_UPDATE = 15, + /* return the subtitle of playback. */ + AV_INFO_TYPE_SUBTITLE_UPDATE = 16, +} AVPlayerOnInfoType; + +/** + * @brief Called when a player message or alarm is received. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player The pointer to an OH_AVPlayer instance. + * @param type Indicates the information type. For details, see {@link AVPlayerOnInfoType}. + * @param extra Indicates other information, for example, the start time position of a playing file. + * @since 11 + * @version 1.0 + */ +typedef void (*OH_AVPlayerOnInfo)(OH_AVPlayer *player, AVPlayerOnInfoType type, int32_t extra); + +/** + * @brief Called when an error occurred for versions above api9 + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player The pointer to an OH_AVPlayer instance. + * @param errorCode Error code. + * @param errorMsg Error message. + * @since 11 + * @version 1.0 + */ +typedef void (*OH_AVPlayerOnError)(OH_AVPlayer *player, int32_t errorCode, const char *errorMsg); + +/** + * @brief A collection of all callback function pointers in OH_AVPlayer. Register an instance of this + * structure to the OH_AVPlayer instance, and process the information reported through the callback to ensure the + * normal operation of OH_AVPlayer. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param onInfo Monitor OH_AVPlayer operation information, refer to {@link OH_AVPlayerOnInfo} + * @param onError Monitor OH_AVPlayer operation errors, refer to {@link OH_AVPlayerOnError} + * @since 11 + * @version 1.0 + */ +typedef struct AVPlayerCallback { + OH_AVPlayerOnInfo onInfo; + OH_AVPlayerOnError onError; +} AVPlayerCallback; + + +#ifdef __cplusplus +} +#endif +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_BASH_H -- Gitee From 3691384da26248a9bd66187b01381ab624f3ffde Mon Sep 17 00:00:00 2001 From: lixinsheng2 Date: Thu, 30 Nov 2023 17:20:51 +0800 Subject: [PATCH 0112/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E4=B8=8D=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lixinsheng2 --- zh-cn/native_sdk/hid/hid_ddk_api.h | 8 +-- zh-cn/native_sdk/hid/hid_ddk_types.h | 100 +++++++++++++-------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/zh-cn/native_sdk/hid/hid_ddk_api.h b/zh-cn/native_sdk/hid/hid_ddk_api.h index 11654163..5665b4a3 100644 --- a/zh-cn/native_sdk/hid/hid_ddk_api.h +++ b/zh-cn/native_sdk/hid/hid_ddk_api.h @@ -53,21 +53,21 @@ extern "C" { * @since 11 * @version 1.0 */ -int32_t OH_Hid_CreateDevice(HidDevice *hidDevice, HidEventProperties *hidEventProperties); +int32_t OH_Hid_CreateDevice(Hid_Device *hidDevice, Hid_EventProperties *hidEventProperties); /** * @brief 向指定设备发送事件列表。 * * @permission ohos.permission.ACCESS_DDK_HID * @param deviceId 设备ID。 - * @param items 发送的事件列表,事件包括类型(取值来源事件类型HidEventType)、编码(取值来源同步事件编码HidSynEvent、键值编码HidKeyCode、按钮编码HidBtnCode、 - * 绝对坐标编码HidAbsAxes、相对坐标编码HidRelAxes、其它类型的输入事件编码HidMscEvent)、值(根据实际设备输入决定)。 + * @param items 发送的事件列表,事件包括类型(取值来源事件类型Hid_EventType)、编码(取值来源同步事件编码Hid_SynEvent、键值编码Hid_KeyCode、按钮编码HidBtnCode、 + * 绝对坐标编码Hid_AbsAxes、相对坐标编码Hid_RelAxes、其它类型的输入事件编码Hid_MscEvent)、值(根据实际设备输入决定)。 * @param length 发送事件列表长度(一次发送事件个数)。 * @return 成功返回0,否则返回负数。 * @since 11 * @version 1.0 */ -int32_t OH_Hid_EmitEvent(int32_t deviceId, const EmitItem items[], uint16_t length); +int32_t OH_Hid_EmitEvent(int32_t deviceId, const Hid_EmitItem items[], uint16_t length); /** * @brief 销毁设备。 diff --git a/zh-cn/native_sdk/hid/hid_ddk_types.h b/zh-cn/native_sdk/hid/hid_ddk_types.h index f1960c8e..d964ae15 100644 --- a/zh-cn/native_sdk/hid/hid_ddk_types.h +++ b/zh-cn/native_sdk/hid/hid_ddk_types.h @@ -48,14 +48,14 @@ extern "C" { * @since 11 * @version 1.0 */ -typedef struct EmitItem { +typedef struct Hid_EmitItem { /** 事件类型 */ uint16_t type; /** 事件编码 */ uint16_t code; /** 事件值 */ uint32_t value; -} EmitItem; +} Hid_EmitItem; /** * @brief 输入设备特性定义。 @@ -69,16 +69,16 @@ typedef enum { /** 直接输入设备 */ HID_PROP_DIRECT = 0x01, /** 底部按键触摸设备 */ - HID_PROP_BUTTONPAD = 0x02, + HID_PROP_BUTTON_PAD = 0x02, /** 全多点触控设备 */ HID_PROP_SEMI_MT = 0x03, /** 顶部软按键触摸设备 */ - HID_PROP_TOPBUTTONPAD = 0x04, + HID_PROP_TOP_BUTTON_PAD = 0x04, /** 指点杆设备 */ HID_PROP_POINTING_STICK = 0x05, /** 加速度传感器设备 */ HID_PROP_ACCELEROMETER = 0x06 -} HidDeviceProp; +} Hid_DeviceProp; /** * @brief 设备基本信息。 @@ -86,7 +86,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef struct HidDevice { +typedef struct Hid_Device { /** 设备名称 */ const char *deviceName; /** 厂商ID */ @@ -98,10 +98,10 @@ typedef struct HidDevice { /** 总线类型 */ uint16_t bustype; /** 设备特性 */ - HidDeviceProp *properties; + Hid_DeviceProp *properties; /** 设备特性数量 */ uint16_t propLength; -} HidDevice; +} Hid_Device; /** * @brief 事件类型。 @@ -120,7 +120,7 @@ typedef enum { HID_EV_ABS = 0x03, /** 特殊事件 */ HID_EV_MSC = 0x04 -} HidEventType; +} Hid_EventType; /** * @brief 同步事件编码。 @@ -137,7 +137,7 @@ typedef enum { HID_SYN_MT_REPORT = 2, /** 表示该事件被丢弃 */ HID_SYN_DROPPED = 3 -} HidSynEvent; +} Hid_SynEvent; /** * @brief 键值编码。 @@ -235,7 +235,7 @@ typedef enum { /** 键回车 */ HID_KEY_ENTER = 28, /** 键左shift */ - HID_KEY_LEFTSHIFT = 42, + HID_KEY_LEFT_SHIFT = 42, /** 键\ */ HID_KEY_BACKSLASH = 43, /** 键; */ @@ -251,7 +251,7 @@ typedef enum { /** 键. */ HID_KEY_PERIOD = 52, /** 键右shift */ - HID_KEY_RIGHTSHIFT = 54, + HID_KEY_RIGHT_SHIFT = 54, /** 数字键0 */ HID_KEY_NUMPAD_0 = 82, /** 数字键1 */ @@ -287,13 +287,13 @@ typedef enum { /** 键静音 */ HID_KEY_MUTE = 113, /** 键音量- */ - HID_KEY_VOLUMEDOWN = 114, + HID_KEY_VOLUME_DOWN = 114, /** 键音量+ */ - HID_KEY_VOLUMEUP = 115, + HID_KEY_VOLUME_UP = 115, /** 键亮度- */ - HID_KEY_BRIGHTNESSDOWN = 224, + HID_KEY_BRIGHTNESS_DOWN = 224, /** 键亮度+ */ - HID_KEY_BRIGHTNESSUP = 225, + HID_KEY_BRIGHTNESS_UP = 225, /** 按钮0 */ HID_BTN_0 = 0x100, /** 按钮1 */ @@ -327,7 +327,7 @@ typedef enum { /** 鼠标向前按键 */ HID_BTN_FORWARD = 0x115, /** 鼠标向后按键 */ - HID_BTN_BACK = 0x116, + HID_BTN_BACKWARD = 0x116, /** 鼠标任务按键 */ HID_BTN_TASK = 0x117, /** 画笔 */ @@ -347,7 +347,7 @@ typedef enum { /** 镜头 */ HID_BTN_TOOL_LENS = 0x147, /** 五指触控 */ - HID_BTN_TOOL_QUINTTAP = 0x148, + HID_BTN_TOOL_QUINT_TAP = 0x148, /** 手写笔3 */ HID_BTN_STYLUS3 = 0x149, /** 触摸 */ @@ -357,14 +357,14 @@ typedef enum { /** 手写笔2 */ HID_BTN_STYLUS2 = 0x14c, /** 二指触控 */ - HID_BTN_TOOL_DOUBLETAP = 0x14d, + HID_BTN_TOOL_DOUBLE_TAP = 0x14d, /** 三指触控 */ - HID_BTN_TOOL_TRIPLETAP = 0x14e, + HID_BTN_TOOL_TRIPLE_TAP = 0x14e, /** 四指触控 */ - HID_BTN_TOOL_QUADTAP = 0x14f, + HID_BTN_TOOL_QUAD_TAP = 0x14f, /** 滚轮 */ HID_BTN_WHEEL = 0x150 -} HidKeyCode; +} Hid_KeyCode; /** * @brief 绝对坐标编码。 @@ -425,7 +425,7 @@ typedef enum { HID_ABS_VOLUME = 0x20, /** 其它 */ HID_ABS_MISC = 0x28 -} HidAbsAxes; +} Hid_AbsAxes; /** * @brief 相对坐标编码。 @@ -460,7 +460,7 @@ typedef enum { HID_REL_WHEEL_HI_RES = 0x0b, /** 高分辨率水平滚轮 */ HID_REL_HWHEEL_HI_RES = 0x0c -} HidRelAxes; +} Hid_RelAxes; /** * @brief 不适合其它类型的输入事件编码。 @@ -472,7 +472,7 @@ typedef enum { /** 序列号 */ HID_MSC_SERIAL = 0x00, /** 脉冲 */ - HID_MSC_PULSELED = 0x01, + HID_MSC_PULSE_LED = 0x01, /** 手势 */ HID_MSC_GESTURE = 0x02, /** 开始事件 */ @@ -481,7 +481,7 @@ typedef enum { HID_MSC_SCAN = 0x04, /** 时间戳 */ HID_MSC_TIMESTAMP = 0x05 -} HidMscEvent; +} Hid_MscEvent; /** * @brief 事件类型编码数组。 @@ -489,12 +489,12 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef struct HidEventTypeArray { +typedef struct Hid_EventTypeArray { /** 事件类型编码 */ - HidEventType *hidEventType; + Hid_EventType *hidEventType; /** 数组长度 */ uint16_t length; -} HidEventTypeArray; +} Hid_EventTypeArray; /** * @brief 键值属性数组。 @@ -502,12 +502,12 @@ typedef struct HidEventTypeArray { * @since 11 * @version 1.0 */ -typedef struct HidKeyCodeArray { +typedef struct Hid_KeyCodeArray { /** 键值编码 */ - HidKeyCode *hidKeyCode; + Hid_KeyCode *hidKeyCode; /** 数组长度 */ uint16_t length; -} HidKeyCodeArray; +} Hid_KeyCodeArray; /** * @brief 绝对坐标属性数组。 @@ -515,12 +515,12 @@ typedef struct HidKeyCodeArray { * @since 11 * @version 1.0 */ -typedef struct HidAbsAxesArray { +typedef struct Hid_AbsAxesArray { /** 绝对坐标属性编码 */ - HidAbsAxes *hidAbsAxes; + Hid_AbsAxes *hidAbsAxes; /** 数组长度 */ uint16_t length; -} HidAbsAxesArray; +} Hid_AbsAxesArray; /** * @brief 相对坐标属性数组。 @@ -528,12 +528,12 @@ typedef struct HidAbsAxesArray { * @since 11 * @version 1.0 */ -typedef struct HidRelAxesArray { +typedef struct Hid_RelAxesArray { /** 相对坐标属性编码 */ - HidRelAxes *hidRelAxes; + Hid_RelAxes *hidRelAxes; /** 数组长度 */ uint16_t length; -} HidRelAxesArray; +} Hid_RelAxesArray; /** * @brief 其它特殊事件属性数组。 @@ -541,12 +541,12 @@ typedef struct HidRelAxesArray { * @since 11 * @version 1.0 */ -typedef struct HidMscEventArray { +typedef struct Hid_MscEventArray { /** 其它特殊事件属性编码 */ - HidMscEvent *hidMscEvent; + Hid_MscEvent *hidMscEvent; /** 数组长度 */ uint16_t length; -} HidMscEventArray; +} Hid_MscEventArray; /** * @brief 设备关注事件属性。 @@ -554,17 +554,17 @@ typedef struct HidMscEventArray { * @since 11 * @version 1.0 */ -typedef struct HidEventProperties { +typedef struct Hid_EventProperties { /** 事件类型属性编码数组 */ - struct HidEventTypeArray hidEventTypes; + struct Hid_EventTypeArray hidEventTypes; /** 键值属性编码数组 */ - struct HidKeyCodeArray hidKeys; + struct Hid_KeyCodeArray hidKeys; /** 绝对坐标属性编码数组 */ - struct HidAbsAxesArray hidAbs; + struct Hid_AbsAxesArray hidAbs; /** 相对坐标属性编码数组 */ - struct HidRelAxesArray hidRelBits; + struct Hid_RelAxesArray hidRelBits; /** 其它特殊事件属性编码数组 */ - struct HidMscEventArray hidMiscellaneous; + struct Hid_MscEventArray hidMiscellaneous; /** 绝对坐标属性最大值 */ int32_t hidAbsMax[64]; @@ -574,7 +574,7 @@ typedef struct HidEventProperties { int32_t hidAbsFuzz[64]; /** 绝对坐标属性固定值 */ int32_t hidAbsFlat[64]; -} HidEventProperties; +} Hid_EventProperties; /** * @brief HID DDK错误码定义。 @@ -586,7 +586,7 @@ typedef enum { /** 操作成功 */ HID_DDK_SUCCESS = 0, /** 操作失败 */ - HID_DDK_FAILED = -1, + HID_DDK_FAILURE = -1, /** 非法参数 */ HID_DDK_INVALID_PARAMETER = -2, /** 非法操作 */ @@ -597,7 +597,7 @@ typedef enum { HID_DDK_TIMEOUT = -5, /** 没有权限 */ HID_DDK_NO_PERM = -6 -} HidDdkErrCode; +} Hid_DdkErrCode; #ifdef __cplusplus } /** @} */ -- Gitee From 993820563ba2c240bd44f3341f2eb58eb2e99eb1 Mon Sep 17 00:00:00 2001 From: taoljt Date: Thu, 30 Nov 2023 09:31:03 +0000 Subject: [PATCH 0113/2135] update zh-cn/native_sdk/media/player/avplayer.h. Signed-off-by: taoljt --- zh-cn/native_sdk/media/player/avplayer.h | 292 ++++++++++------------- 1 file changed, 127 insertions(+), 165 deletions(-) diff --git a/zh-cn/native_sdk/media/player/avplayer.h b/zh-cn/native_sdk/media/player/avplayer.h index 32a883a5..0609107d 100644 --- a/zh-cn/native_sdk/media/player/avplayer.h +++ b/zh-cn/native_sdk/media/player/avplayer.h @@ -17,7 +17,7 @@ * @addtogroup AVPlayer * @{ * - * @brief Provides APIs of Playback capability for Media Source. + * @brief 为媒体源提供播放能力的API。 * * @Syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 @@ -27,8 +27,8 @@ /** * @file avplayer.h * - * @brief Defines the avplayer APIs. Uses the Native APIs provided by Media AVPlayer - * to play the media source. + * @brief定义avplayer接口。使用AVPlayer提供的Native API播放媒体源 + * * @library libavplayer.so * @since 11 @@ -48,20 +48,20 @@ extern "C" { #endif /** - * @brief Create a player + * @brief 创建播放器 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @return Returns a pointer to an OH_AVPlayer instance + * @return 返回指向OH_AVPlayer实例的指针 * @since 11 * @version 1.0 */ OH_AVPlayer *OH_AVPlayer_Create(void); /** - * @brief Sets the playback source for the player. The corresponding source can be http url + * @brief 设置播放器的播放源。对应的源可以是http url * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param url Indicates the playback source. - * @return Returns {@link AV_ERR_OK} if the url is set successfully; returns an error code defined + * @param player指向OH_AVPlayer实例的指针 + * @param url播放源 + * @return 如果url设置成功返回{@link AV_ERR_OK},否则返回{@link native_averrors.h}中定义的错误码 * in {@link native_averrors.h} otherwise. * @since 11 * @version 1.0 @@ -69,358 +69,320 @@ OH_AVPlayer *OH_AVPlayer_Create(void); OH_AVErrCode OH_AVPlayer_SetURLSource(OH_AVPlayer *player, const char *url); /** - * @brief Sets the playback media file descriptor source for the player. + * @brief 设置播放器的播放媒体文件描述符来源 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer 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 Returns {@link AV_ERR_OK} if the fd source is set successfully; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param fd媒体源的文件描述符 + * @param offset媒体源在文件描述符中的偏移量 + * @param size表示媒体源的大小 + * @return 如果fd设置成功返回{@link AV_ERR_OK},否则返回{@link native_averrors.h}中定义的错误码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_SetFDSource(OH_AVPlayer *player, int32_t fd, int64_t offset, int64_t size); /** - * @brief Prepares the playback environment and buffers media data asynchronous. + * @brief 准备播放环境,异步缓存媒体数据 * - * This function must be called after {@link SetSource}. + * 此函数必须在{@link SetSource}之后调用 * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns {@link AV_ERR_OK} if {@link Prepare} is successfully added to the task queue; - * returns an error code defined in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果成功将{@link准备}添加到任务队列中,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_Prepare(OH_AVPlayer *player); /** - * @brief Start playback. + * @brief 开始播放 * - * This function must be called after {@link Prepare}. If the player state is Prepared, - * this function is called to start playback. + *此函数必须在{@link Prepare}之后调用。如果播放器状态为。调用此函数开始播放。 * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns {@link AV_ERR_OK} if the playback is started; otherwise returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果开始播放,则返回{@link AV_ERR_OK},否则返回在{@link native_averrors.h}中定义的错误代码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_Play(OH_AVPlayer *player); /** - * @brief Pauses playback. + * @brief 暂停播放. * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns {@link AV_ERR_OK} if {@link Pause} is successfully added to the task queue; - * returns an error code defined in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果成功将{@link Pause}添加到任务队列中,否则返回在{@link native_averrors.h}中定义的错误代码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_Pause(OH_AVPlayer *player); /** - * @brief Stop playback. + * @brief 停止播放. * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns {@link AV_ERR_OK} if {@link Stop} is successfully added to the task queue; - * returns an error code defined in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果成功将{@link stop}添加到任务队列,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_Stop(OH_AVPlayer *player); /** - * @brief Restores the player to the initial state. + * @brief 将播放器恢复到初始状态 * - * After the function is called, add a playback source by calling {@link SetSource}, - * call {@link Play} to start playback again after {@link Prepare} is called. + *函数调用完成后,调用{@link SetSource}添加播放源。调用{@link Prepare}后,调用{@link Play}重新开始播放。 * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns {@link AV_ERR_OK} if {@link Reset} is successfully added to the task queue; - * returns an error code defined in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果成功将{@link reset}添加到任务队列,否则返回在{@link native_averrors.h}中定义的错误代码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_Reset(OH_AVPlayer *player); /** - * @brief Releases player resources async + * @brief 异步释放播放器资源 * - * Asynchronous release guarantees the performance - * but cannot ensure whether the surfacebuffer is released. - * The caller needs to ensure the life cycle security of the surface + *异步释放保证性能,但无法保证是否释放了surfacebuffer。调用者需要保证surface的生命周期安全 * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns {@link AV_ERR_OK} if {@link Release} is successfully added to the task queue; - * returns an error code defined in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果成功将{@link Release}添加到任务队列中,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_Release(OH_AVPlayer *player); /** - * @brief Releases player resources sync + * @brief 同步释放播放器资源 * - * Synchronous release ensures effective release of surfacebuffer - * but this interface will take a long time (when the engine is not idle state) - * requiring the caller to design an asynchronous mechanism by itself + *同步释放保证了surfacebuffer的有效释放,但这个界面会花费很长时间(发动机非怠速状态时),要求调用者自己设计异步机制 * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns {@link AV_ERR_OK} if the playback is released; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果播放被释放返回{@link AV_ERR_OK},否则返回在{@link native_averrors.h}中定义的错误代码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_ReleaseSync(OH_AVPlayer *player); /** - * @brief Sets the volume of the player. + * @brief 设置播放器的音量 * - * This function can be used during playback or pause. The value 0 indicates no sound, - * and 1 indicates the original volume. If no audio device is started or no audio - * stream exists, the value -1 is returned. + * 可以在播放或暂停的过程中使用。<0>表示无声音。,<1>为原始值。 + * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param leftVolume Indicates the target volume of the left audio channel to set, - * ranging from 0 to 1. each step is 0.01. - * @param rightVolume Indicates the target volume of the right audio channel to set, - * ranging from 0 to 1. each step is 0.01. - * @return Returns {@link AV_ERR_OK} if the volume is set; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param 要设置的左声道目标音量 + * @param 要设置的右声道目标音量 + * @return 如果设置了音量,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_SetVolume(OH_AVPlayer *player, float leftVolume, float rightVolume); /** - * @brief Changes the playback position. + * @brief 改变播放位置 * - * This function can be used during play or pause. + * 此函数可以在播放或暂停时使用. * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param mSeconds Indicates the target playback position, accurate to milliseconds. - * @param mode Indicates the player seek mode. For details, see {@link AVPlayerSeekMode}. - * @return Returns {@link AV_ERR_OK} if the seek is done; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param mSeconds播放目标位置,精确到毫秒 + * @param mode播放器的跳转模式。具体请参见{@link AVPlayerSeekMode} + * @return 如果完成跳转,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_Seek(OH_AVPlayer *player, int32_t mSeconds, AVPlayerSeekMode mode); /** - * @brief Obtains the playback position, accurate to millisecond. + * @brief 获取播放位置,精确到毫秒 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param currentTime Indicates the playback position. - * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param currentTime播放位置 + * @return 如果获取当前位置,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_GetCurrentTime(OH_AVPlayer *player, int32_t *currentTime); /** - * @brief get the video width. + * @brief 获取视频宽度 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param videoWidth The video width - * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param videoWidth视频宽度 + * @return 如果获取视频宽度,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_GetVideoWidth(OH_AVPlayer *player, int32_t *videoWidth); /** - * @brief get the video height. + * @brief 获取视频高度 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param videoHeight The video height - * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param videoHeights视频高度 + * @return 如果获取视频高度,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_GetVideoHeight(OH_AVPlayer *player, int32_t *videoHeight); /** - * @brief set the player playback rate + * @brief 设置播放器播放速率 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param speed the rate mode {@link AVPlaybackSpeed} which can set. - * @return Returns {@link AV_ERR_OK} if the playback rate is set successful; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param speed可以设置速率模式{@link AVPlaybackSpeed}。 + * @return 设置播放速率成功返回{@link AV_ERR_OK},否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_SetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed speed); /** - * @brief get the current player playback rate + * @brief 获取当前播放器播放速率 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param speed the rate mode {@link AVPlaybackSpeed} which can get. - * @return Returns {@link AV_ERR_OK} if the current player playback rate is get; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param speed 可以获取的速率模式{@link AVPlaybackSpeed} + * @return 获取播放速率成功返回{@link AV_ERR_OK},否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed *speed); /** - * @brief set the bit rate use for hls player + * @brief 设置hls播放器使用的码率 * - * the playback bitrate expressed in bits per second, expressed in bits per second, - * which is only valid for HLS protocol network flow. By default, - * the player will select the appropriate bit rate and speed according to the network connection. - * report the effective bit rate linked list by "INFO_TYPE_BITRATE_COLLECT" - * set and select the specified bit rate, and select the bit rate that is less than and closest - * to the specified bit rate for playback. When ready, read it to query the currently selected bit rate. + *播放比特率,以比特/秒为单位,以比特/秒为单位。 + *仅对HLS协议网络流有效。默认情况下, + *播放器会根据网络连接情况选择合适的码率和速度。 + *通过INFO_TYPE_BITRATE_COLLECT上报有效码率链表 + *设置并选择指定的码率,选择小于和最接近的码率 + *到指定的码率播放。准备好后,读取它以查询当前选择的比特率。 * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param bitRate the bit rate, The unit is bps. - * @return Returns {@link AV_ERR_OK} if the bit rate is set successfully; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param bitRate码率,单位为bps + * @return 设置码率成功返回{@link AV_ERR_OK},否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_SelectBitRate(OH_AVPlayer *player, uint32_t bitRate); /** - * @brief Method to set the surface. + * @brief 设置surface. * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow} - * @return Returns {@link AV_ERR_OK} if the surface is set; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param window指向OHNativeWindow实例的指针,参见{@link OHNativeWindow} + * @return 如果设置了surface,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_SetVideoSurface(OH_AVPlayer *player, OHNativeWindow *window); /** - * @brief Obtains the total duration of media files, accurate to milliseconds. + * @brief 获取媒体文件的总时长,精确到毫秒 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param duration Indicates the total duration of media files. - * @return Returns {@link AV_ERR_OK} if the current duration is get; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param duration媒体文件的总时长 + * @return 如果获取当前时长,则返回{@link AV_ERR_OK},否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_GetDuration(OH_AVPlayer *player, int32_t *duration); /** - * @brief get current playback state. + * @brief 获取当前播放状态 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param state the current playback state - * @return Returns {@link AV_ERR_OK} if the current duration is get; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param state 当前播放状态 + * @return 如果获取当前播放状态,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_GetState(OH_AVPlayer *player, AVPlayerState *state); /** - * @brief Checks whether the player is playing. + * @brief 判断播放器是否在播放 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns true if the playback is playing; false otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果正在播放,则返回true,否则返回false * @since 11 * @version 1.0 */ bool OH_AVPlayer_IsPlaying(OH_AVPlayer *player); /** - * @brief Returns the value whether single looping is enabled or not . + * @brief 判断是用循环播放 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @return Returns true if the playback is single looping; false otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @return 如果循环播放,则返回true,否则返回false。 * @since 11 * @version 1.0 */ bool OH_AVPlayer_IsLooping(OH_AVPlayer *player); /** - * @brief Enables single looping of the media playback. + * @brief 设置循环播放 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param loop The switch to set loop - * @return Returns {@link AV_ERR_OK} if the single looping is set; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param loop 循环播放开关 + * @return 如果设置了循环,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_SetLooping(OH_AVPlayer *player, bool loop); /** - * @brief Method to set player callback. + * @brief 设置播放器回调方法 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param callback object pointer. - * @return Returns {@link AV_ERR_OK} if the playercallback is set; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param callback 回调对象指针 + * @return 如果设置了播放器回调,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_SetPlayerCallback(OH_AVPlayer *player, AVPlayerCallback callback); /** - * @brief Select audio or subtitle track. + * @brief 选择音频或字幕轨道 * - * By default, the first audio stream with data is played, and the subtitle track is not played. - * After the settings take effect, the original track will become invalid. Please set subtitles - * in prepared/playing/paused/completed state and set audio tracks in prepared state. + *默认播放第一个带数据的音频流,不播放字幕轨迹。 + *设置生效后,原曲目将失效。请设置字幕 + *处于准备/播放/暂停/完成状态,并将音轨设置为准备状态。 * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param index Track index - * @return Returns {@link AV_ERR_OK} if selected successfully; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param index 索引 + * @return 如果成功选择返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_SelectTrack(OH_AVPlayer *player, int32_t index); /** - * @brief Deselect the current audio or subtitle track. - * - * After audio is deselected, the default track will be played, and after subtitles are deselected, - * they will not be played. Please set subtitles in prepared/playing/paused/completed state and set - * audio tracks in prepared state. - * + * @brief 取消选择当前音频或字幕轨道 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param index Track index - * @return Returns {@link AV_ERR_OK} if selected successfully; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param index 索引 + * @return 如果成功返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ OH_AVErrCode OH_AVPlayer_DeselectTrack(OH_AVPlayer *player, int32_t index); /** - * @brief Obtain the currently effective track index. + * @brief 获取当前有效的轨道索引 * - * Please get it in the prepared/playing/paused/completed state. + * 请将其设置为准备/正在播放/暂停/完成状态 * * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player Pointer to an OH_AVPlayer instance - * @param trackType Media type. - * @param index Track index - * @return Returns {@link AV_ERR_OK} if the track index is get; returns an error code defined - * in {@link native_averrors.h} otherwise. + * @param player指向OH_AVPlayer实例的指针 + * @param trackType 媒体类型 + * @param index 索引 + * @return 成功返回{@link AV_ERR_OK},否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ -- Gitee From fb2c9eb0378b6dfc821f02eca86ca36a5a59bc26 Mon Sep 17 00:00:00 2001 From: taoljt Date: Thu, 30 Nov 2023 09:46:06 +0000 Subject: [PATCH 0114/2135] update zh-cn/native_sdk/media/player/avplayer_base.h. Signed-off-by: taoljt --- zh-cn/native_sdk/media/player/avplayer_base.h | 87 +++++++------------ 1 file changed, 33 insertions(+), 54 deletions(-) diff --git a/zh-cn/native_sdk/media/player/avplayer_base.h b/zh-cn/native_sdk/media/player/avplayer_base.h index 3128b685..5a240de5 100644 --- a/zh-cn/native_sdk/media/player/avplayer_base.h +++ b/zh-cn/native_sdk/media/player/avplayer_base.h @@ -17,7 +17,7 @@ * @addtogroup AVPlayer * @{ * - * @brief Provides APIs of Playback capability for Media Source. + * @brief 为媒体源提供播放能力的API * * @Syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 @@ -27,7 +27,7 @@ /** * @file avplayer_base.h * - * @brief Defines the structure and enumeration for Media AVPlayer. + * @brief 定义AVPlayer的结构体和枚举 * * @library libavplayer.so * @since 11 @@ -45,138 +45,117 @@ typedef struct OH_AVPlayer OH_AVPlayer; typedef struct NativeWindow OHNativeWindow; /** - * @brief Player States + * @brief 播放状态 * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 * @version 1.0 */ typedef enum AVPlayerState { - /* idle states */ + /* 空闲 */ AV_IDLE = 0, - /* initialized states */ + /* 初始化 */ AV_INITIALIZED = 1, - /* prepared states */ + /* 准备 */ AV_PREPARED = 2, - /* playing states */ + /* 播放 */ AV_PLAYING = 3, - /* paused states */ + /* 暂停 */ AV_PAUSED = 4, - /* stopped states */ + /* 停止 */ AV_STOPPED = 5, - /* Play to the end states */ + /* 结束 */ AV_COMPLETED = 6, - /* released states */ + /* 释放 */ AV_RELEASED = 7, - /* error states */ + /* 错误 */ AV_ERROR = 8, } AVPlayerState; /** - * @brief Player Seek Mode + * @brief 跳转模式 * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 * @version 1.0 */ typedef enum AVPlayerSeekMode { - /* sync to keyframes after the time point. */ + /* 同步到时间点之后的关键帧 */ AV_SEEK_NEXT_SYNC = 0, - /* sync to keyframes before the time point. */ + /* 同步到时间点之前的关键帧 */ AV_SEEK_PREVIOUS_SYNC, } AVPlayerSeekMode; /** - * @brief Playback Speed + * @brief 播放速度 * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 * @version 1.0 */ typedef enum AVPlaybackSpeed { - /* Video playback at 0.75x normal speed */ + /* 0.75倍速播放 */ AV_SPEED_FORWARD_0_75_X, - /* Video playback at normal speed */ + /* 正常播放 */ AV_SPEED_FORWARD_1_00_X, - /* Video playback at 1.25x normal speed */ + /* 1.25倍速播放 */ AV_SPEED_FORWARD_1_25_X, - /* Video playback at 1.75x normal speed */ + /* 1.75倍速播放 */ AV_SPEED_FORWARD_1_75_X, - /* Video playback at 2.0x normal speed */ + /* 2.0倍速播放 */ AV_SPEED_FORWARD_2_00_X, } AVPlaybackSpeed; /** - * @brief Player OnInfo Type + * @brief OnInfo类型 * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 * @version 1.0 */ typedef enum AVPlayerOnInfoType { - /* return the message when seeking done. */ AV_INFO_TYPE_SEEKDONE = 0, - /* return the message when speeding done. */ AV_INFO_TYPE_SPEEDDONE = 1, - /* return the message when select bitrate done */ AV_INFO_TYPE_BITRATEDONE = 2, - /* return the message when playback is end of steam. */ AV_INFO_TYPE_EOS = 3, - /* return the message when PlayerStates changed. */ AV_INFO_TYPE_STATE_CHANGE = 4, - /* return the current posion of playback automatically. */ AV_INFO_TYPE_POSITION_UPDATE = 5, - /* return the playback message. */ AV_INFO_TYPE_MESSAGE = 6, - /* return the message when volume changed. */ AV_INFO_TYPE_VOLUME_CHANGE = 7, - /* return the message when video size is first known or updated. */ AV_INFO_TYPE_RESOLUTION_CHANGE = 8, - /* return multiqueue buffering time. */ AV_INFO_TYPE_BUFFERING_UPDATE = 9, - /* return hls bitrate. - Bitrate is to convert data into uint8_t array storage, - which needs to be forcibly converted to uint32_t through offset access. */ AV_INFO_TYPE_BITRATE_COLLECT = 10, - /* return the message when audio focus changed. */ AV_INFO_TYPE_INTERRUPT_EVENT = 11, - /* return the duration of playback. */ AV_INFO_TYPE_DURATION_UPDATE = 12, - /* return the playback is live stream. */ AV_INFO_TYPE_IS_LIVE_STREAM = 13, - /* return the message when track changes. */ AV_INFO_TYPE_TRACKCHANGE = 14, - /* return the message when subtitle track info updated. */ AV_INFO_TYPE_TRACK_INFO_UPDATE = 15, - /* return the subtitle of playback. */ AV_INFO_TYPE_SUBTITLE_UPDATE = 16, } AVPlayerOnInfoType; /** - * @brief Called when a player message or alarm is received. + * @brief 收到播放器消息时调用 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player The pointer to an OH_AVPlayer instance. - * @param type Indicates the information type. For details, see {@link AVPlayerOnInfoType}. - * @param extra Indicates other information, for example, the start time position of a playing file. + * @param player 指向OH_AVPlayer实例的指针 + * @param type 信息类型。具体请参见{@link AVPlayerOnInfoType} + * @param extra 其他信息,如播放文件的开始时间位置 * @since 11 * @version 1.0 */ typedef void (*OH_AVPlayerOnInfo)(OH_AVPlayer *player, AVPlayerOnInfoType type, int32_t extra); /** - * @brief Called when an error occurred for versions above api9 + * @brief 在api9以上的版本发生错误时调用 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param player The pointer to an OH_AVPlayer instance. - * @param errorCode Error code. - * @param errorMsg Error message. + * @param 指向OH_AVPlayer实例的指针 + * @param errorCode 错误码 + * @param errorMsg 错误消息 * @since 11 * @version 1.0 */ typedef void (*OH_AVPlayerOnError)(OH_AVPlayer *player, int32_t errorCode, const char *errorMsg); /** - * @brief A collection of all callback function pointers in OH_AVPlayer. Register an instance of this - * structure to the OH_AVPlayer instance, and process the information reported through the callback to ensure the - * normal operation of OH_AVPlayer. + * @brief OH_AVPlayer中所有回调函数指针的集合。注册此的实例结构体到OH_AVPlayer实例中,并对回调上报的信息进行处理,保证AVPlayer的正常运行。 * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @param onInfo Monitor OH_AVPlayer operation information, refer to {@link OH_AVPlayerOnInfo} - * @param onError Monitor OH_AVPlayer operation errors, refer to {@link OH_AVPlayerOnError} + * @param onInfo 监控AVPlayer过程信息,参考{@link OH_AVPlayerOnInfo} + * @param onError 监控AVPlayer操作错误,参考{@link OH_AVPlayerOnError} * @since 11 * @version 1.0 */ -- Gitee From b1fa5cac9000ce26eda1f2cfb9dc3b745f573554 Mon Sep 17 00:00:00 2001 From: l30053696 Date: Thu, 30 Nov 2023 12:40:55 +0000 Subject: [PATCH 0115/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-sensor,motion,vibrator,light?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn | 35 ++++ .../hdi/vibrator/v1_2/IVibratorInterface.idl | 106 ++++++++++++ .../hdi/vibrator/v1_2/VibratorTypes.idl | 153 ++++++++++++++++++ 3 files changed, 294 insertions(+) create mode 100644 zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn create mode 100644 zh-cn/device_api/hdi/vibrator/v1_2/IVibratorInterface.idl create mode 100644 zh-cn/device_api/hdi/vibrator/v1_2/VibratorTypes.idl diff --git a/zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn b/zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn new file mode 100644 index 00000000..468775d6 --- /dev/null +++ b/zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +HDF_CORE_PATH = "../../../hdf_core" +import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libvibrator_proxy_1.2") { + deps = [] + public_configs = [] + } +} else { + hdi("vibrator") { + module_name = "vibrator_service" + imports = [ "ohos.hdi.vibrator.v1_1:vibrator" ] + + sources = [ + "IVibratorInterface.idl", + "VibratorTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_vibrator" + } +} diff --git a/zh-cn/device_api/hdi/vibrator/v1_2/IVibratorInterface.idl b/zh-cn/device_api/hdi/vibrator/v1_2/IVibratorInterface.idl new file mode 100644 index 00000000..cfc73084 --- /dev/null +++ b/zh-cn/device_api/hdi/vibrator/v1_2/IVibratorInterface.idl @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Vibrator + * @{ + * + * @brief 马达驱动对马达服务提供通用的接口能力。 + * + * 模块提供马达服务对马达驱动访问的统一接口,服务获取驱动对象或者代理后,控制马达的单次振动、周期性振动、高清振动、停止振动、设置马达振幅与频率。 + * + * @since 4.1 + */ + +/** + * @file VibratorTypes.idl + * + * @brief 定义马达的通用API,可用于控制马达执行单次、周期性振动或高清振动、设置马达振幅与频率。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief 马达模块接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.vibrator.v1_2; + +import ohos.hdi.vibrator.v1_2.VibratorTypes; +import ohos.hdi.vibrator.v1_1.IVibratorInterface; + + /** + * @brief Vibrator模块向上层服务提供统一的接口。 + * + * 上层服务开发人员可根据Vibrator模块提供的统一接口,用于控制马达执行单次或周期性振动。 + * + * @since 4.1 + * @version 1.2 + */ +interface IVibratorInterface extends ohos.hdi.vibrator.v1_1.IVibratorInterface{ + /** + * @brief 高清振动数据下发。 + * + * @param pkg表示高清振动数据的数据包,是一个结构体,内部赋值具体振动参数。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.1 + * @version 1.2 + */ + PlayHapticPattern([in] struct HapticPaket pkg); + /** + * @brief 获取马达振动能力。 + * + * @param HapticCapacity表示振动能力数据包,属性包含是否高清振动,是否支持延时振动,是否支持预定义振动。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.1 + * @version 1.2 + */ + GetHapticCapacity([out] struct HapticCapacity HapticCapacity); + /** + * @brief 获取起振时间。 + * + * @param startUpTime表示从下达振动振动命令到马达振动起来的时间,mode为振动模式,按照模式去获取。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.1 + * @version 1.2 + */ + GetHapticStartUpTime([in] int mode, [out] int startUpTime); + /** + * @brief 停止马达振动。 + * + * 马达启动前,必须在任何模式下停止振动。此功能用在振动过程之后。 + * + * @param mode 表示振动模式,可以是单次或周期性或者HD的,详见{@link HdfVibratorModeV1_2}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.1 + * @version 1.2 + */ + StopV1_2([in] int mode); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/vibrator/v1_2/VibratorTypes.idl b/zh-cn/device_api/hdi/vibrator/v1_2/VibratorTypes.idl new file mode 100644 index 00000000..2936f3ba --- /dev/null +++ b/zh-cn/device_api/hdi/vibrator/v1_2/VibratorTypes.idl @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Vibrator + * @{ + * + * @brief 马达驱动对马达服务提供通用的接口能力。 + * + * 模块提供马达服务对马达驱动访问的统一接口,服务获取驱动对象或者代理后,控制马达的单次振动、周期性振动、高清振动、停止振动、设置马达振幅与频率。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file VibratorTypes.idl + * + * @brief 定义马达数据结构,包括马达振动模式和马达参数。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * + * @brief 马达模块的包路径。 + * + * @since 4.1 + * @version 1.2 + */ + +package ohos.hdi.vibrator.v1_2; + +import ohos.hdi.vibrator.v1_1.VibratorTypes; + +/** + * @brief 表示振动类型。 + * + * @since 4.1 + */ +enum EVENT_TYPE { + /**< 表示振动是连续的。 */ + CONTINUOUS = 0, + /**< 表示振动是瞬时的。 */ + TRANSIENT = 1, +}; + +/** + * @brief 表示StopV1_2接口可传入参数枚举。 + * + * @since 4.1 + */ +enum HdfVibratorModeV1_2 { + /**< 表示给定持续时间内的单次振动。 */ + HDF_VIBRATOR_MODE_ONCE, + /**< 表示具有预置效果的周期性振动。 */ + HDF_VIBRATOR_MODE_PRESET, + /**< 表示高清振动。 */ + HDF_VIBRATOR_MODE_HDHAPTIC, + /**< 表示效果模式无效。 */ + HDF_VIBRATOR_MODE_BUTT, +}; + +/** + * @brief 表示振动点。 + * + * 参数包含时间,强度和频率。 + * + * @since 4.1 + */ +struct CurvePoint { + /** 时间。 */ + int time; + /** 强度。 */ + int intensity; + /** 频率。 */ + int frequency; +}; + +/** + * @brief 表示振动事件。 + * + * 参数包含振动时间,强度,频率等等。 + * + * @since 4.1 + */ +struct HapticEvent { + /** I振动类型。 */ + enum EVENT_TYPE type; + /** 时间。 */ + int time; + /** 振动延时。 */ + int duration; + /** 振动强度。 */ + int intensity; + /** 振动频率。 */ + int frequency; + /** 马达id。表示振动的是哪个马达。 */ + int index; + /** 振动点数量。 */ + int pointNum; + /** 振动点数组。 */ + struct CurvePoint[] points; +}; + +/** + * @brief 高清振动数据包。 + * + * 参数包含具体的高清振动数据。 + * + * @since 4.1 + */ +struct HapticPaket { + /** 时间。 */ + int time; + /** 振动事件数量。 */ + int eventNum; + /** 振动事件数组。 */ + struct HapticEvent[] events; +}; + +/** + * @brief 振动能力数据包。 + * + * 信息包括不同类型的振动。 + * + * @since 4.1 + */ +struct HapticCapacity { + /** 是否支持高清振动。 */ + boolean isSupportHdHaptic; + /** 是否支持预定义振动。 */ + boolean isSupportPresetMapping; + /** 是否支持延时振动。 */ + boolean isSupportTimeDelay; + /** 预留参数. */ + boolean reserved0; + /** 预留参数. */ + int reserved1; +}; \ No newline at end of file -- Gitee From 4a1424118602b293b85712cbeae1fb5cacd0b8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Fri, 1 Dec 2023 01:27:31 +0000 Subject: [PATCH 0116/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- .../hdi/audio/v1_0/IAudioAdapter.idl | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl index c3ee24d5..494451c5 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl @@ -74,9 +74,9 @@ interface IAudioAdapter { /** * @brief 创建一个音频播放接口的对象。 * - * @param desc 待打开的音频设备描述符,详请参考{@Link AudioDeviceDescriptor}。 - * @param attrs 待打开的音频采样属性,详请参考{@Link AudioSampleAttributes}。 - * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@Link IAudioRender}。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@link IAudioRender}。 * * @return 成功返回值0,失败返回负值。 * @@ -105,9 +105,9 @@ interface IAudioAdapter { /** * @brief 创建一个音频录音接口的对象。 * - * @param desc 待打开的音频设备描述符,详请参考{@Link AudioDeviceDescriptor}。 - * @param attrs 待打开的音频采样属性,详请参考{@Link AudioSampleAttributes}。 - * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@Link IAudioCapture}。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@link IAudioCapture}。 * * @return 成功返回值0,失败返回负值。 * @@ -135,8 +135,8 @@ interface IAudioAdapter { /** * @brief 获取一个音频适配器的端口驱动的能力集。 * - * @param port 待获取的端口,详请参考{@Link AudioPort}。 - * @param capability 获取的端口能力保存到capability中,详请参考{@Link AudioPortCapability}。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param capability 获取的端口能力保存到capability中,详请参考{@link AudioPortCapability}。 * * @return 成功返回值0,失败返回负值。 * @@ -148,8 +148,8 @@ interface IAudioAdapter { /** * @brief 设置音频端口驱动的数据透传模式。 * - * @param port 待设置的端口,详请参考{@Link AudioPort}。 - * @param mode 待设置的传输模式,详请参考{@Link AudioPortPassthroughMode}。 + * @param port 待设置的端口,详请参考{@link AudioPort}。 + * @param mode 待设置的传输模式,详请参考{@link AudioPortPassthroughMode}。 * * @return 成功返回值0,失败返回负值。 * @@ -163,8 +163,8 @@ interface IAudioAdapter { /** * @brief 获取音频端口驱动的数据透传模式。 * - * @param port 待获取的端口,详请参考{@Link AudioPort}。 - * @param mode 获取的传输模式保存到mode中,详请参考{@Link AudioPortPassthroughMode}。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param mode 获取的传输模式保存到mode中,详请参考{@link AudioPortPassthroughMode}。 * * @return 成功返回值0,失败返回负值。 * @@ -178,7 +178,7 @@ interface IAudioAdapter { /** * @brief 获取一个音频适配器的设备状态。 * - * @param status 获取的设备状态保存到status中,详请参考{@Link AudioDeviceStatus}。 + * @param status 获取的设备状态保存到status中,详请参考{@link AudioDeviceStatus}。 * * @return 成功返回值0,失败返回负值。 * @@ -190,7 +190,7 @@ interface IAudioAdapter { /** * @brief 更新音频路由。 * - * @param route 待更新的路由,详请参考{@Link AudioRoute}。 + * @param route 待更新的路由,详请参考{@link AudioRoute}。 * @param routeHandle 更新后的音频路由句柄保存到routeHandle中。 * * @return 成功返回值0,失败返回负值。 @@ -257,7 +257,7 @@ interface IAudioAdapter { /** * @brief 根据指定的条件设置音频拓展参数。 * - * @param key 指定的扩展参数键类型,详请参考{@Link AudioExtParamKey}。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 * @param condition 指定的扩展参数查询条件。 * @param value 指定的扩展参数条件值。 * @@ -284,7 +284,7 @@ interface IAudioAdapter { /** * @brief 根据指定条件获取音频扩展参数的取值。 * - * @param key 指定的扩展参数键类型,详请参考{@Link AudioExtParamKey}。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 * @param condition 指定的扩展参数查询条件。 * @param value 待返回的指定扩展参数条件的当前值。 * @@ -311,7 +311,7 @@ interface IAudioAdapter { /** * @brief 注册扩展参数回调函数。 * - * @param audioCallback 待注册的回调函数,详请参考{@Link AudioCallback}。 + * @param audioCallback 待注册的回调函数,详请参考{@link IAudioCallback}。 * @param cookie 用于传递数据。 * * @return 成功返回值0,失败返回负值。 @@ -319,6 +319,6 @@ interface IAudioAdapter { * @since 3.2 * @version 1.0 */ - RegExtraParamObserver([in] AudioCallback audioCallback, [in] byte cookie); + RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); } /** @} */ -- Gitee From b1dd803db262dcf76b8a5b131d843cf39992a7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Fri, 1 Dec 2023 01:28:40 +0000 Subject: [PATCH 0117/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl index eb9dc4ca..1156becb 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl @@ -55,7 +55,7 @@ import ohos.hdi.audio.v1_0.AudioTypes; /** * @brief 放音回调函数。 * - * @param type 回调函数通知事件类型,详请参考{@Link AudioCallbackType}。 + * @param type 回调函数通知事件类型,详请参考{@link AudioCallbackType}。 * @param reserved 保留字段。 * @param cookie 用于传递数据。 * @@ -70,7 +70,7 @@ import ohos.hdi.audio.v1_0.AudioTypes; /** * @brief 音频扩展参数回调函数。 * - * @param key 扩展参数键类型,详请参考{@Link AudioExtParamKey}。 + * @param key 扩展参数键类型,详请参考{@link AudioExtParamKey}。 * @param condition 扩展参数条件。 * @param value 扩展参数条件的值 * @param reserved 保留字段。 -- Gitee From 774a9678faa6428410d21850bb0b6b7b9b3221b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Fri, 1 Dec 2023 01:29:06 +0000 Subject: [PATCH 0118/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl index f440cd1d..365f6bb7 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl @@ -71,7 +71,7 @@ interface IAudioCapture { * @brief 获取音频已输入的帧数。 * * @param frames 获取的音频帧数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@Link AudioTimeStamp}。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 * * @return 成功返回值0,失败返回负值。 * @@ -85,7 +85,7 @@ interface IAudioCapture { /** * @brief 判断某个音频场景能力是否支持。 * - * @param scene 待判断的音频场景描述符,详请参考{@Link AudioSceneDescriptor}。 + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 * * @return 成功返回值0,失败返回负值。 @@ -110,7 +110,7 @@ interface IAudioCapture { *
  • 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
  • * * - * @param scene 待设置的音频场景描述符,详请参考{@Link AudioSceneDescriptor}。 + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 * * @return 成功返回值0,失败返回负值。 * @@ -259,7 +259,7 @@ interface IAudioCapture { /** * @brief 设置音频采样的属性参数。 * - * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@Link AudioSampleAttributes}。 + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 * * @return 成功返回值0,失败返回负值。 * @@ -273,7 +273,7 @@ interface IAudioCapture { /** * @brief 获取音频采样的属性参数。 * - * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中,详请参考{@Link AudioSampleAttributes}。 + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中,详请参考{@link AudioSampleAttributes}。 * * @return 成功返回值0,失败返回负值。 * @@ -324,7 +324,7 @@ interface IAudioCapture { * @brief 请求mmap缓冲区。 * * @param reqSize 请求缓冲区的大小,单位:字节。 - * @param desc 缓冲区描述符,详请参考{@Link AudioMmapBufferDescripter}。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 * * @return 成功返回值0,失败返回负值。 * @@ -337,7 +337,7 @@ interface IAudioCapture { * @brief 获取当前mmap的读/写位置。 * * @param frames 获取的音频帧计数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@Link AudioTimeStamp}。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 * * @return 成功返回值0,失败返回负值。 * -- Gitee From 4eb824bff2e3406c91215789ffe9ef9d33198c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Fri, 1 Dec 2023 01:29:30 +0000 Subject: [PATCH 0119/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl index a39a2395..cb2c7374 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl @@ -60,7 +60,7 @@ interface IAudioManager { /** * @brief 获取音频驱动中支持的所有适配器的列表。 * - * @param descs 获取到的音频适配器列表保存到descs中,详请参考{@Link AudioAdapterDescriptor}。 + * @param descs 获取到的音频适配器列表保存到descs中,详请参考{@link AudioAdapterDescriptor}。 * * @return 成功返回值0,失败返回负值。 * @@ -76,8 +76,8 @@ interface IAudioManager { * * 加载一个具体的音频驱动,例如usb驱动,在具体实现中可能加载的是一个动态链接库(*.so)。 * - * @param desc 待加载的音频适配器描述符,详请参考{@Link AudioAdapterDescriptor}。 - * @param adapter 获取的音频适配器接口的对象实例保存到adapter中,详请参考{@Link IAudioAdapter}。 + * @param desc 待加载的音频适配器描述符,详请参考{@link AudioAdapterDescriptor}。 + * @param adapter 获取的音频适配器接口的对象实例保存到adapter中,详请参考{@link IAudioAdapter}。 * * @return 成功返回值0,失败返回负值。 * -- Gitee From cd8156dd784708a715615985db89fbcbd2406949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Fri, 1 Dec 2023 01:29:57 +0000 Subject: [PATCH 0120/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- .../hdi/audio/v1_0/IAudioRender.idl | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl index a40eab64..9dc6ad7c 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl @@ -82,7 +82,7 @@ interface IAudioRender { /** * @brief 获取音频已输出的帧数。 * - * @param frames 获取的音频帧数保存到frames中,详请参考{@Link AudioTimeStamp}。 + * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 * @param time 获取的关联时间戳保存到time中。 * * @return 成功返回值0,失败返回负值。 @@ -125,7 +125,7 @@ interface IAudioRender { /** * @brief 设置音频播放的通道模式。 * - * @param mode 待设置的通道模式,详请参考{@Link AudioChannelMode}。 + * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 * * @return 成功返回值0,失败返回负值。 * @@ -139,7 +139,7 @@ interface IAudioRender { /** * @brief 获取音频播放当前的通道模式。 * - * @param mode 获取的通道模式保存到mode中,详请参考{@Link AudioChannelMode}。 + * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 * * @return 成功返回值0,失败返回负值。 * @@ -153,7 +153,7 @@ interface IAudioRender { /** * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 * - * @param audioCallback 注册的回调函数,详请参考{@Link IAudioCallback}。 + * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 * @param cookie 回调函数的入参。 * * @return 成功返回值0,失败返回负值。 @@ -168,7 +168,7 @@ interface IAudioRender { /** * @brief 排空缓冲区中的数据。 * - * @param type 播放结束的类型,详请参考{@Link AudioDrainNotifyType}。 + * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 * * @return 成功返回值0,失败返回负值。 * @@ -193,7 +193,7 @@ interface IAudioRender { /** * @brief 是否支持某个音频场景的配置。 * - * @param scene 待判断的音频场景描述符,详请参考{@Link AudioSceneDescriptor}。 + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 * * @return 成功返回值0,失败返回负值。 @@ -218,7 +218,7 @@ interface IAudioRender { *
  • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
  • * * - * @param scene 待设置的音频场景描述符,详请参考{@Link AudioSceneDescriptor}。 + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 * * @return 成功返回值0,失败返回负值。 * @@ -369,7 +369,7 @@ interface IAudioRender { /** * @brief 设置音频采样的属性参数。 * - * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@Link AudioSampleAttributes}。 + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 * * @return 成功返回值0,失败返回负值。 * @@ -384,7 +384,7 @@ interface IAudioRender { * @brief 获取音频采样的属性参数。 * * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) - * 保存到attrs中,详请参考{@Link AudioSampleAttributes}。 + * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 * * @return 成功返回值0,失败返回负值。 * @@ -435,7 +435,7 @@ interface IAudioRender { * @brief 请求mmap缓冲区。 * * @param reqSize 请求缓冲区的大小。 - * @param desc 缓冲区描述符,详请参考{@Link AudioMmapBufferDescripter}。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 * * @return 成功返回值0,失败返回负值。 * @@ -448,7 +448,7 @@ interface IAudioRender { * @brief 获取当前mmap的读/写位置。 * * @param frames 获取的音频帧计数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@Link AudioTimeStamp}。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 * * @return 成功返回值0,失败返回负值。 * -- Gitee From b4fb9492ba973d06cc66196c1685be2e5e4144a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Fri, 1 Dec 2023 01:31:27 +0000 Subject: [PATCH 0121/2135] update zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- .../device_api/hdi/audio/v1_1/AudioTypes.idl | 132 +++++++++--------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl index 4c7d319b..5b63e5da 100644 --- a/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl +++ b/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl @@ -21,8 +21,8 @@ * * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ /** @@ -32,23 +32,23 @@ * * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ /** * @brief 音频接口的包路径。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ package ohos.hdi.audio.v1_1; /** * @brief 音频端口的类型。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioPortDirection { PORT_OUT = 1, /**< 音频输出端口。*/ @@ -59,8 +59,8 @@ enum AudioPortDirection { /** * @brief 音频端口上的Pin脚。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioPortPin { PIN_NONE = 0, /**< 无效端口。*/ @@ -88,8 +88,8 @@ enum AudioPortPin { /** * @brief 音频类型(场景)。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioCategory { AUDIO_IN_MEDIA = 0, /**< 媒体。 */ @@ -104,8 +104,8 @@ enum AudioCategory { /** * @brief 音频格式。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioFormat { AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8bit位宽PCM(Pulse Code Modulation)格式。*/ @@ -130,8 +130,8 @@ enum AudioFormat { * * 定义音频声道的位置掩码。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioChannelMask { AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。 */ @@ -143,8 +143,8 @@ enum AudioChannelMask { /** * @brief 音频采样频率掩码。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioSampleRatesMask { AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。 */ @@ -164,8 +164,8 @@ enum AudioSampleRatesMask { /** * @brief 音频端口的数据透传模式。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioPortPassthroughMode { PORT_PASSTHROUGH_LPCM = 1 << 0, /**< 立体声PCM。*/ @@ -177,8 +177,8 @@ enum AudioPortPassthroughMode { /** * @brief 原始音频样本格式。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioSampleFormat { AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ @@ -212,8 +212,8 @@ enum AudioSampleFormat { * * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioChannelMode { AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。 */ @@ -229,8 +229,8 @@ enum AudioChannelMode { /** * @brief 音频数据结束类型。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioDrainNotifyType { AUDIO_DRAIN_NORMAL_MODE = 0, /**< 曲目的所有数据播放完就结束。 */ @@ -240,8 +240,8 @@ enum AudioDrainNotifyType { /** * @brief 回调函数通知事件类型。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioCallbackType { AUDIO_NONBLOCK_WRITE_COMPELETED = 0, /**< 非阻塞式写完成。 */ @@ -254,8 +254,8 @@ enum AudioCallbackType { /** * @brief 音频端口角色。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioPortRole { AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。 */ @@ -266,8 +266,8 @@ enum AudioPortRole { /** * @brief 音频端口类型。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioPortType { AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。 */ @@ -279,8 +279,8 @@ enum AudioPortType { /** * @brief 端口会话类型。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ enum AudioSessionType { AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。 */ @@ -356,8 +356,8 @@ union SceneDesc { /** * @brief 音频端口。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioPort { enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。 */ @@ -371,8 +371,8 @@ struct AudioPort { * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioAdapterDescriptor { String adapterName; /**< 音频适配器的名称。 */ @@ -382,8 +382,8 @@ struct AudioAdapterDescriptor { /** * @brief 音频设备描述符。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioDeviceDescriptor { unsigned int portId; /**< 音频端口ID。 */ @@ -394,8 +394,8 @@ struct AudioDeviceDescriptor { /** * @brief 音频场景描述符。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioSceneDescriptor { union SceneDesc scene; /**< 音频场景描述,详情参考{@link SceneDesc}。 */ @@ -434,8 +434,8 @@ struct AudioOffloadInfo /** * @brief 音频采样属性。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioSampleAttributes { enum AudioCategory type; /**< 音频类型,详情参考{@link AudioCategory}。 */ @@ -460,8 +460,8 @@ struct AudioSampleAttributes { * * 时间定义,POSIX timespec的替代品。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioTimeStamp { long tvSec; /**< tvSec时间,单位:秒。 */ @@ -471,8 +471,8 @@ struct AudioTimeStamp { /** * @brief 音频子端口的支持能力。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioSubPortCapability { unsigned int portId; /**< 子端口ID。 */ @@ -483,8 +483,8 @@ struct AudioSubPortCapability { /** * @brief 音频端口的支持能力。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioPortCapability { unsigned int deviceType; /**< 设备输出、输入类型。 */ @@ -502,8 +502,8 @@ struct AudioPortCapability { /** * @brief mmap缓冲区描述符。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioMmapBufferDescripter { byte[] memoryAddress; /**< 指向mmap缓冲区的指针。 */ @@ -518,8 +518,8 @@ struct AudioMmapBufferDescripter { /** * @brief 音频设备拓展信息。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioDevExtInfo { int moduleId; /**< 音频流绑定的模块ID。 */ @@ -530,8 +530,8 @@ struct AudioDevExtInfo { /** * @brief 音轨拓展信息。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioMixExtInfo { int moduleId; /**< 流所属模块标识符。 */ @@ -541,8 +541,8 @@ struct AudioMixExtInfo { /** * @brief 会话拓展信息。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioSessionExtInfo { enum AudioSessionType sessionType; /**< 音频会话类型,详情参考{@link AudioSessionType}。 */ @@ -551,8 +551,8 @@ struct AudioSessionExtInfo { /** * @brief 音频端口特定信息。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioInfo { struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。 */ @@ -563,8 +563,8 @@ struct AudioInfo { /** * @brief 音频路由节点。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioRouteNode { int portId; /**< 音频端口ID。 */ @@ -576,8 +576,8 @@ struct AudioRouteNode { /** * @brief 音频路由信息。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioRoute { struct AudioRouteNode[] sources; /**< 发送端列表,详情参考{@link AudioRouteNode}。 */ @@ -587,8 +587,8 @@ struct AudioRoute { /** * @brief 音频事件。 * - * @since 3.2 - * @version 1.0 + * @since 4.1 + * @version 1.1 */ struct AudioEvent { unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。 */ -- Gitee From 33ca5d92693a9dc1ff7249f64617a1638f1d0774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Fri, 1 Dec 2023 01:34:12 +0000 Subject: [PATCH 0122/2135] update zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- .../hdi/audio/v1_1/IAudioAdapter.idl | 212 +++++++++--------- 1 file changed, 107 insertions(+), 105 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl index 014f3f94..22c45510 100644 --- a/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl +++ b/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl @@ -17,9 +17,9 @@ * @addtogroup HdiAudio * @{ * - * @brief Audioģӿڶ塣 + * @brief Audio模块接口定义。 * - * Ƶӿ漰͡ؽӿڡӿڡƵŽӿڡƵ¼ӿڵȡ + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 * * @since 4.1 * @version 1.1 @@ -28,12 +28,14 @@ /** * @file IAudioAdapter.idl * + * @brief Audio适配器的接口定义文件。 + * * @since 4.1 * @version 1.1 */ /** - * @brief Ƶӿڵİ· + * @brief 音频接口的包路径。 * * @since 4.1 * @version 1.1 @@ -46,9 +48,9 @@ import ohos.hdi.audio.v1_1.IAudioCapture; import ohos.hdi.audio.v1_1.IAudioCallback; /** - * @brief AudioAdapterƵӿڡ + * @brief AudioAdapter音频适配器接口。 * - * ṩƵֵ֧ʼ˿ڡ¼ȡ˿ȡ + * 提供音频适配器(声卡)对外支持的驱动能力,包括初始化端口、创建放音、创建录音、获取端口能力集等。 * * @see IAudioRender * @see IAudioCapture @@ -58,13 +60,13 @@ import ohos.hdi.audio.v1_1.IAudioCallback; */ interface IAudioAdapter { /** - * @brief ʼһƵеĶ˿ - * ƵУӿǰҪȵøýӿڼ˿ǷѾʼɣ˿ûгʼɣ - * Ҫȴһʱ䣨100ms½м飬ֱ˿ڳʼɺټ + * @brief 初始化一个音频适配器所有的端口驱动。 + * 在音频服务中,调用其他驱动接口前需要先调用该接口检查端口是否已经初始化完成,如果端口没有初始化完成, + * 则需要等待一段时间(例如100ms)后重新进行检查,直到端口初始化完成后再继续操作。 * - * @param adapter õǰAudioAdapterָ + * @param adapter 调用当前函数的AudioAdapter指针对象。 * - * @return ʼɷֵ0ʼʧܷظֵ + * @return 初始化完成返回值0,初始化失败返回负值。 * * @since 4.1 * @version 1.1 @@ -72,15 +74,15 @@ interface IAudioAdapter { InitAllPorts(); /** - * @brief һƵŽӿڵĶ + * @brief 创建一个音频播放接口的对象。 * - * @param adapter õǰAudioAdapterָ - * @param desc 򿪵Ƶ豸ο{@link AudioDeviceDescriptor} - * @param attrs 򿪵Ƶԣο{@link AudioSampleAttributes} - * @param render ȡƵŽӿڵĶʵ浽renderУο{@link IAudioRender} - * @param renderId ȡƵŽӿš + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@link IAudioRender}。 + * @param renderId 获取的音频播放接口序号。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @see GetPortCapability * @see DestroyRender @@ -92,14 +94,14 @@ interface IAudioAdapter { [out] IAudioRender render, [out] unsigned int renderId); /** - * @brief һƵŽӿڵĶ + * @brief 销毁一个音频播放接口的对象。 * - * @attention ƵŹУٸýӿڶ + * @attention 在音频播放过程中,不能销毁该接口对象。 * - * @param adapter õǰAudioAdapterָ - * @param renderId ٵƵŽӿڵ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param renderId 待销毁的音频播放接口的序号 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * @see CreateRender * * @since 4.1 @@ -108,14 +110,14 @@ interface IAudioAdapter { DestroyRender([in] unsigned int renderId); /** - * @brief һƵ¼ӿڵĶ - * - * @param adapter õǰAudioAdapterָ - * @param desc 򿪵Ƶ豸ο{@link AudioDeviceDescriptor} - * @param attrs 򿪵Ƶԣο{@link AudioSampleAttributes} - * @param capture ȡƵ¼ӿڵĶʵ浽captureУο{@link IAudioCapture} - * @param captureId ȡƵ¼ӿڵ - * @return ɹֵ0ʧܷظֵ + * @brief 创建一个音频录音接口的对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@link IAudioCapture}。 + * @param captureId 获取的音频录音接口的序号 + * @return 成功返回值0,失败返回负值。 * * @see GetPortCapability * @see DestroyCapture @@ -127,14 +129,14 @@ interface IAudioAdapter { [out] IAudioCapture capture, [out] unsigned int captureId); /** - * @brief һƵ¼ӿڵĶ + * @brief 销毁一个音频录音接口的对象。 * - * @attention Ƶ¼Уٸýӿڶ + * @attention 在音频录音过程中,不能销毁该接口对象。 * - * @param adapter õǰAudioAdapterָ - * @param captureId ٵƵ¼ӿڵ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param captureId 待销毁的音频录音接口的序号 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * @see CreateCapture * * @since 4.1 @@ -143,13 +145,13 @@ interface IAudioAdapter { DestroyCapture([in] unsigned int captureId); /** - * @brief ȡһƵĶ˿ + * @brief 获取一个音频适配器的端口驱动的能力集。 * - * @param adapter õǰAudioAdapterָ - * @param port ȡĶ˿ڣο{@link AudioPort} - * @param capability ȡĶ˿浽capabilityУο{@link AudioPortCapability} + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param capability 获取的端口能力保存到capability中,详请参考{@link AudioPortCapability}。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @since 4.1 * @version 1.1 @@ -157,12 +159,12 @@ interface IAudioAdapter { GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); /** - * @brief Ƶ˿͸ģʽ + * @brief 设置音频端口驱动的数据透传模式。 * - * @param adapter õǰAudioAdapterָ - * @param port õĶ˿ڣο{@link AudioPort} - * @param mode õĴģʽο{@link AudioPortPassthroughMode} - * @return ɹֵ0ʧܷظֵ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待设置的端口,详请参考{@link AudioPort}。 + * @param mode 待设置的传输模式,详请参考{@link AudioPortPassthroughMode}。 + * @return 成功返回值0,失败返回负值。 * @see GetPassthroughMode * * @since 4.1 @@ -171,12 +173,12 @@ interface IAudioAdapter { SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); /** - * @brief ȡƵ˿͸ģʽ + * @brief 获取音频端口驱动的数据透传模式。 * - * @param adapter õǰAudioAdapterָ - * @param port ȡĶ˿ڣο{@link AudioPort} - * @param mode ȡĴģʽ浽modeУο{@link AudioPortPassthroughMode} - * @return ɹֵ0ʧܷظֵ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param mode 获取的传输模式保存到mode中,详请参考{@link AudioPortPassthroughMode}。 + * @return 成功返回值0,失败返回负值。 * @see SetPassthroughMode * * @since 4.1 @@ -185,12 +187,12 @@ interface IAudioAdapter { GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); /** - * @brief ȡһƵ豸״̬ + * @brief 获取一个音频适配器的设备状态。 * - * @param adapter õǰAudioAdapterָ - * @param status ȡ豸״̬浽statusУο{@link AudioDeviceStatus} + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param status 获取的设备状态保存到status中,详请参考{@link AudioDeviceStatus}。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @since 4.1 * @version 1.1 @@ -198,13 +200,13 @@ interface IAudioAdapter { GetDeviceStatus([out] struct AudioDeviceStatus status); /** - * @brief Ƶ·ɡ + * @brief 更新音频路由。 * - * @param adapter õǰAudioAdapterָ - * @param route µ·ɣο{@link AudioRoute} - * @param routeHandle ºƵ·ɾ浽routeHandleС + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param route 待更新的路由,详请参考{@link AudioRoute}。 + * @param routeHandle 更新后的音频路由句柄保存到routeHandle中。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @since 4.1 * @version 1.1 @@ -212,12 +214,12 @@ interface IAudioAdapter { UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); /** - * @brief ͷƵ·ɡ + * @brief 释放音频路由。 * - * @param adapter õǰAudioAdapterָ - * @param routeHandle ͷŵƵ·ɾ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param routeHandle 待释放的音频路由句柄。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @since 4.1 * @version 1.1 @@ -225,12 +227,12 @@ interface IAudioAdapter { ReleaseAudioRoute([in] int routeHandle); /** - * @brief Ƶ + * @brief 设置音频静音。 * - * @param adapter õǰAudioAdapterָ - * @param mute ʾǷƵtrueʾfalseʾǾ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param mute 表示是否将音频静音,true表示静音,false表示非静音。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @see SetMicMute * @@ -240,12 +242,12 @@ interface IAudioAdapter { SetMicMute([in] boolean mute); /** - * @brief ȡƵ״̬ + * @brief 获取音频静音状态。 * - * @param adapter õǰAudioAdapterָ - * @param mute ȡľ״̬浽muteУtrueʾfalseʾǾ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param mute 获取的静音状态保存到mute中,true表示静音,false表示非静音。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @see GetMicMute * @@ -255,14 +257,14 @@ interface IAudioAdapter { GetMicMute([out] boolean mute); /** - * @brief е + * @brief 设置语音呼叫的音量。 * - * Χ0.01.0Ƶеˮƽ015ķΧڣ - * 0.0ʾƵ1.0ָʾ15 + * 音量范围从0.0到1.0。如果音频服务中的音量水平在0到15的范围内, + * 0.0表示音频静音,1.0指示最大音量级别(15)。 * - * @param adapter õǰAudioAdapterָ - * @param volume õֵΧΪ0.0-1.00.0ʾСֵ1.0ʾֵ - * @return ɹֵ0ʧܷظֵ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param volume 待设置的音量值,范围为(0.0-1.0),0.0表示最小音量值,1.0表示最大音量值。 + * @return 成功返回值0,失败返回负值。 * @see GetVolume * * @since 4.1 @@ -271,21 +273,21 @@ interface IAudioAdapter { SetVoiceVolume([in] float volume); /** - * @brief ָƵչ + * @brief 根据指定的条件设置音频拓展参数。 * - * @param adapter õǰAudioAdapterָ - * @param key ָչͣο{@link AudioExtParamKey} - * @param condition ָչѯ - * @param value ָչֵ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 指定的扩展参数查询条件。 + * @param value 指定的扩展参数条件值。 * - * conditionΪֵɵֵַֺ֮ͨŷָֵԵĸʽΪ"keytype=keyvalue" - * keyֵΪAudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUMEʱconditionĸʽΪ + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" - * EVENT_TYPE ʾ¼: 1ʾ, 4ʾþ - * VOLUME_GROUP_ID ʾõƵչص顣 - * AUDIO_VOLUME_TYPE ʾõƵչص͡ + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待设置的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待设置的音频扩展参数相关的音量类型。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @since 4.1 * @version 1.1 @@ -293,22 +295,22 @@ interface IAudioAdapter { SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); /** - * @brief ָȡƵչȡֵ + * @brief 根据指定条件获取音频扩展参数的取值。 * - * @param adapter õǰAudioAdapterָ - * @param key ָչͣο{@link AudioExtParamKey} - * @param condition ָչѯ - * @param value صָչĵǰֵ - * @param lenth valueij + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 指定的扩展参数查询条件。 + * @param value 待返回的指定扩展参数条件的当前值。 + * @param lenth value的长度 * - * conditionΪֵɵֵַֺ֮ͨŷָֵԵĸʽΪ"keytype=keyvalue" - * keyֵΪAudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUMEʱconditionĸʽΪ + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" - * EVENT_TYPE ʾ¼: 1ʾ, 4ʾþ - * VOLUME_GROUP_ID ʾѯƵչص顣 - * AUDIO_VOLUME_TYPE ʾѯƵչص͡ + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待查询的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待查询的音频扩展参数相关的音量类型。 * - * @return ɹֵ0ʧܷظֵ + * @return 成功返回值0,失败返回负值。 * * @since 4.1 * @version 1.1 @@ -316,12 +318,12 @@ interface IAudioAdapter { GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); /** - * @brief עչص + * @brief 注册扩展参数回调函数。 * - * @param adapter õǰAudioAdapterָ - * @param callback עĻصο{@link AudioCallback} - * @param cookie ڴݡ - * @return ɹֵ0ʧܷظֵ + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param callback 待注册的回调函数,详请参考{@link AudioCallback}。 + * @param cookie 用于传递数据。 + * @return 成功返回值0,失败返回负值。 * * @since 3.2 * @version 1.0 -- Gitee From a936f23156ca881c7f8b8eb9ff91106f7f4670f7 Mon Sep 17 00:00:00 2001 From: yangfan Date: Fri, 1 Dec 2023 10:25:25 +0800 Subject: [PATCH 0123/2135] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ImagePacker?= =?UTF-8?q?=E7=9A=84doc=E4=BB=93=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan --- .../native_sdk/media/image/image_packer_mdk.h | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 zh-cn/native_sdk/media/image/image_packer_mdk.h diff --git a/zh-cn/native_sdk/media/image/image_packer_mdk.h b/zh-cn/native_sdk/media/image/image_packer_mdk.h new file mode 100644 index 00000000..d7b267ef --- /dev/null +++ b/zh-cn/native_sdk/media/image/image_packer_mdk.h @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup image + * @{ + * + * @brief 提供用于图像数据编码的native接口。 + * + * image模块的图像数据编码部分。\n + * 可用于将像素数据信息编码到缓冲区或文件中。 + * + * @since 11 + * @version 4.1 + */ + +/** + * @file image_packer_mdk.h + * + * @brief 声明用于将图像编码到缓冲区或文件的api。 + * + * 可用于将像素数据编码到目标缓冲区或文件中。\n + * + * 编码过程如下:\n + * 通过OH_ImagePacker_Create方法创建编码器实例对象。\n + * 然后通过OH_ImagePacker_InitNative将编码器实例对象转换为编码器原生实例对象。\n + * 接下来用OH_ImagePacker_PackToData或者OH_ImagePacker_PackToFile将源以特定的编码选项编码进目标区域。\n + * 最后通过OH_ImagePacker_Release释放编码器实例对象。\n + * + * @library libimage_packer_ndk.z.so + * @syscap SystemCapability.Multimedia.Image + * @since 11 + * @version 4.1 + */ + +#ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PACKER_MDK_H_ +#define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PACKER_MDK_H_ +#include "napi/native_api.h" +#include "image_mdk_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct ImagePacker_Native_; + +/** + * @brief 为编码器方法定义native层编码器对象。 + * + * @since 11 + * @version 4.1 + */ +typedef struct ImagePacker_Native_ ImagePacker_Native; + +/** + * @brief 定义图像编码选项信息。 + * + * @since 11 + * @version 4.1 + */ +struct ImagePacker_Opts_ { + /** 编码格式 */ + const char* format; + /** 编码质量 */ + int quality; +}; + +/** + * @brief 定义图像编码选项的别名。 + * + * @since 11 + * @version 4.1 + */ +typedef struct ImagePacker_Opts_ ImagePacker_Opts; + +/** + * @brief 获取JavaScript native层API ImagePacker对象。 + * + * @param env 表明JNI环境的指针。 + * @param res 表明JavaScript native层API ImagePacker对象的指针。 + * @return 如果操作成功则返回{@link IRNdkErrCode}IMAGE_RESULT_SUCCESS;如果参数无效则返回IMAGE_RESULT_INVALID_PARAMETER。 + * + * @Syscap SystemCapability.Multimedia.Image + * @since 11 + * @version 4.1 + */ +int32_t OH_ImagePacker_Create(napi_env env, napi_value *res); + +/** + * @brief 从输入JavaScript native层API ImagePacker对象中,转换成ImagePacker_Native值。 + * + * @param env 表明JNI环境的指针。 + * @param packer 表明JavaScript native层API ImagePacker对象。 + * @return 如果操作成功则返回{@link ImagePacker_Native}指针,否则返回空指针。 + * @see OH_ImagePacker_Release + * @since 11 + * @version 4.1 + */ +ImagePacker_Native* OH_ImagePacker_InitNative(napi_env env, napi_value packer); + +/** + * @brief 通过一个给定的选项ImagePacker_Opts结构体,将输入JavaScript native层API PixelMap对象或者ImageSource对象编码并输出\n + * 到指定的缓存区outData中。 + * + * @param native 表明指向native层{@link ImagePacker}的指针。 + * @param source 表明待编码JavaScript native层API PixelMap对象或者ImageSource对象。 + * @param opts 表明位图编码的选项,查看{@link ImagePacker_Opts}。 + * @param outData 输出的指定缓存区。 + * @param size 输出的指定缓存区大小。 + * @return 如果操作成功返回{@link IRNdkErrCode} OHOS_IMAGE_RESULT_SUCCESS;\n + * returns 如果参数无效返回{@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER;\n + * returns 如果输出缓冲区异常返回{@link IRNdkErrCode} ERR_IMAGE_DATA_ABNORMAL;\n + * returns 如果格式不匹配返回{@link IRNdkErrCode} ERR_IMAGE_MISMATCHED_FORMAT;\n + * returns 如果malloc内部缓冲区错误返回{@link IRNdkErrCode} ERR_IMAGE_MALLOC_ABNORMAL;\n + * returns 如果init编解码器内部错误返回{@link IRNdkErrCode} ERR_IMAGE_DECODE_ABNORMAL;\n + * returns 如果编码器在编码过程中出现错误返回{@link IRNdkErrCode} ERR_IMAGE_ENCODE_FAILED。\n + * @see OH_ImagePacker_PackToFile + * @since 11 + * @version 4.1 + */ +int32_t OH_ImagePacker_PackToData(ImagePacker_Native* native, napi_value source, + ImagePacker_Opts* opts, uint8_t* outData, size_t* size); + +/** + * @brief 通过一个给定的选项ImagePacker_Opts结构体,将输入JavaScript native层API PixelMap对象或者ImageSource对象编码并输出\n + * 到指定的文件中。 + * + * @param native 表明指向native层{@link ImagePacker}的指针。 + * @param source 表明待编码JavaScript native层API PixelMap对象或者ImageSource对象。 + * @param opts 表明位图编码的选项,查看{@link ImagePacker_Opts}。 + * @param fd 输出的指定文件描述符。 + * @return 如果操作成功返回{@link IRNdkErrCode} OHOS_IMAGE_RESULT_SUCCESS;\n + * returns 如果参数无效返回{@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER;\n + * returns 如果输出缓冲区异常返回{@link IRNdkErrCode} ERR_IMAGE_DATA_ABNORMAL;\n + * returns 如果格式不匹配返回{@link IRNdkErrCode} ERR_IMAGE_MISMATCHED_FORMAT;\n + * returns 如果malloc内部缓冲区错误返回{@link IRNdkErrCode} ERR_IMAGE_MALLOC_ABNORMAL;\n + * returns 如果init编解码器内部错误返回{@link IRNdkErrCode} ERR_IMAGE_DECODE_ABNORMAL;\n + * returns 如果编码器在编码过程中出现错误返回{@link IRNdkErrCode} ERR_IMAGE_ENCODE_FAILED。\n + * @see OH_ImagePacker_PackToData + * @since 11 + * @version 4.1 + */ +int32_t OH_ImagePacker_PackToFile(ImagePacker_Native* native, napi_value source, + ImagePacker_Opts* opts, int fd); + + +/** + * @brief 释放native层编码器对象{@link ImagePacker_Native}。 + * 注: 此API不用于释放JavaScript原生API ImagePacker对象,它用于释放native层对象{@link ImagePacker_Native}。\n + * 通过调用{@link OH_ImagePacker_InitNative}解析。 + * + * @param native 表明native层{@link ImagePacker_Native}值的指针。 + * @return 如果操作成功则返回{@link IRNdkErrCode} IMAGE_RESULT_SUCCESS。 + * @see OH_ImagePacker_InitNative + * @since 11 + * @version 4.1 + */ +int32_t OH_ImagePacker_Release(ImagePacker_Native* native); +#ifdef __cplusplus +}; +#endif +/** @} */ +#endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PACKER_MDK_H_ \ No newline at end of file -- Gitee From fd213656bb47dc9fc920b1245be58b173decece8 Mon Sep 17 00:00:00 2001 From: l30053696 Date: Fri, 1 Dec 2023 02:46:32 +0000 Subject: [PATCH 0124/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-sensor,motion,vibrator,light?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- .idea/interface_native_header.iml | 8 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 84 ++++++++ zh-cn/device_api/hdi/motion/v1_1/BUILD.gn | 27 +++ .../hdi/motion/v1_1/IMotionInterface.idl | 71 +++++++ .../hdi/motion/v1_1/MotionTypes.idl | 95 +++++++++ zh-cn/device_api/hdi/sensor/sensor_if.h | 16 ++ zh-cn/device_api/hdi/sensor/sensor_type.h | 6 + zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn | 35 ++++ .../hdi/sensor/v1_1/ISensorCallback.idl | 67 ++++++ .../hdi/sensor/v1_1/ISensorInterface.idl | 190 ++++++++++++++++++ .../hdi/sensor/v1_1/SensorTypes.idl | 139 +++++++++++++ .../hdi/vibrator/v1_1/IVibratorInterface.idl | 38 ++++ .../hdi/vibrator/v1_2/IVibratorInterface.idl | 6 +- .../hdi/vibrator/v1_2/VibratorTypes.idl | 2 +- zh-cn/device_api/hdi/vibrator/vibrator_if.h | 74 +++++++ zh-cn/device_api/hdi/vibrator/vibrator_type.h | 181 +++++++++++++++++ 18 files changed, 1049 insertions(+), 4 deletions(-) create mode 100644 .idea/interface_native_header.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 zh-cn/device_api/hdi/motion/v1_1/BUILD.gn create mode 100644 zh-cn/device_api/hdi/motion/v1_1/IMotionInterface.idl create mode 100644 zh-cn/device_api/hdi/motion/v1_1/MotionTypes.idl create mode 100644 zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn create mode 100644 zh-cn/device_api/hdi/sensor/v1_1/ISensorCallback.idl create mode 100644 zh-cn/device_api/hdi/sensor/v1_1/ISensorInterface.idl create mode 100644 zh-cn/device_api/hdi/sensor/v1_1/SensorTypes.idl diff --git a/.idea/interface_native_header.iml b/.idea/interface_native_header.iml new file mode 100644 index 00000000..633cf01d --- /dev/null +++ b/.idea/interface_native_header.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..e2a25ce6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..c8397c94 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..859fc624 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1701347402345 + + + + + + + + + \ No newline at end of file diff --git a/zh-cn/device_api/hdi/motion/v1_1/BUILD.gn b/zh-cn/device_api/hdi/motion/v1_1/BUILD.gn new file mode 100644 index 00000000..cd9a1a93 --- /dev/null +++ b/zh-cn/device_api/hdi/motion/v1_1/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +HDF_CORE_PATH = "../../../hdf_core" +import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") +hdi("motion") { + module_name = "motion_service" + imports = [ "ohos.hdi.motion.v1_0:motion" ] + sources = [ + "IMotionInterface.idl", + "MotionTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_motion" +} diff --git a/zh-cn/device_api/hdi/motion/v1_1/IMotionInterface.idl b/zh-cn/device_api/hdi/motion/v1_1/IMotionInterface.idl new file mode 100644 index 00000000..a3b97cc8 --- /dev/null +++ b/zh-cn/device_api/hdi/motion/v1_1/IMotionInterface.idl @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Motion + * @{ + * + * @brief 手势识别设备驱动对硬件服务提供通用的接口能力。 + * + * 模块提供硬件服务对手势识别驱动模块访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现使能手势识别/ + * 去使能手势识别、订阅/取消订阅手势识别数据。 + * + * @since 4.0 + */ + +/** + * @file IMotionInterface.idl + * + * @brief 定义使能/去使能手势识别、订阅/取消订阅手势识别数据的接口。 + * + * 在实现拿起、翻转、摇一摇、旋转屏等手势识别功能时,需要调用此处定义的接口。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @brief 手势识别模块接口的包路径。 + * + * @since 4.0 + */ +package ohos.hdi.motion.v1_1; + +import ohos.hdi.motion.v1_0.IMotionCallback; +import ohos.hdi.motion.v1_0.IMotionInterface; +import ohos.hdi.motion.v1_1.MotionTypes; + +/** + * @brief 提供Motion设备基本控制操作接口。 + * + * 接口提供使能/去使能手势识别、订阅/取消订阅手势识别数据功能。 + */ +interface IMotionInterface extends ohos.hdi.motion.v1_0.IMotionInterface { + /** + * @brief 设置运动配置信息。 + * + * @param motionType 运动类型。有关详细信息,请参阅{@link HdfMotionTypeTag}。 + * @param data 一个技巧的运动波配置参数。有关详细信息,请参阅{@link WaveParam}。 + * @param len 数据长度。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.0 + * @version 1.1 + */ + SetMotionConfig([in] int motionType, [in] unsigned char[] data); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/motion/v1_1/MotionTypes.idl b/zh-cn/device_api/hdi/motion/v1_1/MotionTypes.idl new file mode 100644 index 00000000..2178da83 --- /dev/null +++ b/zh-cn/device_api/hdi/motion/v1_1/MotionTypes.idl @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Motion + * @{ + * + * @brief 手势识别设备驱动对硬件服务提供通用的接口能力。 + * + * 模块提供硬件服务对手势识别驱动模块访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现使能手势识别/ + * 去使能手势识别、订阅/取消订阅手势识别数据。 + * + * @since 4.0 + */ + +/** + * @file MotionTypes.idl + * + * @brief 定义手势识别模块用到的数据结构,包括手势识别类型、上报的手势识别数据结构。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @brief 手势识别模块接口的包路径。 + * + * @since 4.0 + */ +package ohos.hdi.motion.v1_1; + +/** + * @brief 定义运动波配置参数。 + * + * 运动波形配置参数包括波形频率、波形幅度、波形使用陀螺仪。 + * + * @since 4.0 + */ +struct WaveParam { + /** 波浪频率 */ + int waveFrequency; + /** 波幅 */ + int waveAmplitude; + /** 波动是使用陀螺仪 */ + boolean isUseGyroscope; +}; + +/** + * @brief 枚举运动类型。 + * + * @since 4.0 + */ +enum HdfMotionTypeTag { + /** 拾取 */ + HDF_MOTION_TYPE_PICKUP = 0, + /** 翻转 */ + HDF_MOTION_TYPE_FLIP, + /** 贴近耳朵 */ + HDF_MOTION_CLOSE_TO_EAR, + /** 抖动 */ + HDF_MOTION_TYPE_SHAKE, + /** 屏幕旋转 */ + HDF_MOTION_TYPE_ROTATION, + /** 口袋模式 */ + HDF_MOTION_TYPE_POCKET_MODE, + /** 远离耳朵 */ + HDF_MOTION_TYPE_LEAVE_EAR, + /** 手腕向上 */ + HDF_MOTION_TYPE_WRIST_UP, + /** 手腕向下 */ + HDF_MOTION_TYPE_WRIST_DOWN, + /** 波浪 */ + HDF_MOTION_TYPE_WAVE, + /** 步进计数器 */ + HDF_MOTION_TYPE_STEP_COUNTER, + /** 设备之间的接触 */ + HDF_MOTION_TYPE_TOUCH_LINK, + /** 预留字段 */ + HDF_MOTION_TYPE_RESERVED, + /** 最大运动类型 */ + HDF_MOTION_TYPE_MAX, +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/sensor/sensor_if.h b/zh-cn/device_api/hdi/sensor/sensor_if.h index 4e5a51c9..0b1d269f 100644 --- a/zh-cn/device_api/hdi/sensor/sensor_if.h +++ b/zh-cn/device_api/hdi/sensor/sensor_if.h @@ -167,6 +167,22 @@ struct SensorInterface { * @version 1.0 */ int32_t (*Unregister)([in] int32_t groupId, [in] RecordDataCallback cb); + + /** + * @brief 获取小系统中的传感器事件数据。 + * + * @param sensorId表示传感器ID。有关详细信息,请参阅{@link SensorTypeTag}。 + * @param event表示系统中传感器事件数据的矢量。 + * 传感器事件数据包括传感器ID、传感器算法版本、数据生成时间等,数据选项(如测量范围和精度)、数据报 + * 告模式、数据地址和数据长度。有关详细信息,请参阅{@link HdfSensorEvents}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + int32_t (*ReadData)(int32_t sensorId, struct SensorEvents *event); }; /** diff --git a/zh-cn/device_api/hdi/sensor/sensor_type.h b/zh-cn/device_api/hdi/sensor/sensor_type.h index f014e966..2952fd43 100644 --- a/zh-cn/device_api/hdi/sensor/sensor_type.h +++ b/zh-cn/device_api/hdi/sensor/sensor_type.h @@ -105,6 +105,12 @@ enum SensorTypeTag { SENSOR_TYPE_PROXIMITY = 12, /** 湿度传感器。 */ SENSOR_TYPE_HUMIDITY = 13, + /** 颜色传感器 */ + SENSOR_TYPE_COLOR = 14, + /** SAR传感器 */ + SENSOR_TYPE_SAR = 15, + /** 辅助环境光传感器 */ + SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /** 医疗传感器ID枚举值范围的开始。 */ SENSOR_TYPE_MEDICAL_BEGIN = 128, /** 医疗传感器ID枚举值范围的结束。 */ diff --git a/zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn b/zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn new file mode 100644 index 00000000..3a9092f0 --- /dev/null +++ b/zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +HDF_CORE_PATH = "../../../hdf_core" +import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libsensor_proxy_1.1") { + deps = [] + public_configs = [] + } +} else { + hdi("sensor") { + module_name = "sensor_service" + + sources = [ + "ISensorCallback.idl", + "ISensorInterface.idl", + "SensorTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_sensor" + } +} diff --git a/zh-cn/device_api/hdi/sensor/v1_1/ISensorCallback.idl b/zh-cn/device_api/hdi/sensor/v1_1/ISensorCallback.idl new file mode 100644 index 00000000..c2efe6e1 --- /dev/null +++ b/zh-cn/device_api/hdi/sensor/v1_1/ISensorCallback.idl @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiSensor + * @{ + * + * @brief 传感器设备驱动对传感器服务提供通用的接口能力。 + * + * 模块提供传感器服务对传感器驱动访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现获取传感器设备信息、订阅/取消订阅传感器数据、 + * 使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置等。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @file ISensorCallback.idl + * + * @brief Sensor模块为Sensor服务提供数据上报的回调函数。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @brief Sensor模块接口的包路径。 + * + * @since 2.2 + * @version 1.0 + */ + +package ohos.hdi.sensor.v1_1; + +import ohos.hdi.sensor.v1_1.SensorTypes; + +/** + * @brief 定义用于上报传感器数据的回调函数。 + * + * 传感器用户订阅传感器数据,只在使能传感器后,传感器数据订阅者才能接收传感器数据。详见{@link ISensorInterface}。 + * + * @since 4.0 + * @version 1.1 + */ +[callback] interface ISensorCallback { + /** + * @param event 上报的传感器数据,详见{@link HdfSensorEvents}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + */ + OnDataEvent([in] struct HdfSensorEvents event); +} diff --git a/zh-cn/device_api/hdi/sensor/v1_1/ISensorInterface.idl b/zh-cn/device_api/hdi/sensor/v1_1/ISensorInterface.idl new file mode 100644 index 00000000..4e6082cf --- /dev/null +++ b/zh-cn/device_api/hdi/sensor/v1_1/ISensorInterface.idl @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiSensor + * @{ + * + * @brief Provides unified APIs for sensor services to access sensor drivers. + * + * @brief 传感器设备驱动对传感器服务提供通用的接口能力。 + * + * 模块提供传感器服务对传感器驱动访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现获取传感器设备信息、订阅/取消订阅传感器数据、 + * 使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置等。 + * + * @since 4.0 + */ + +/** + * @file ISensorInterface.idl + * + * @brief Sensor模块对外通用的接口声明文件,提供获取传感器设备信息、订阅/取消订阅传感器数据、 + * 使能/去使能传感器、设置传感器模式、设置传感器精度,量程等可选配置接口定义。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @brief Sensor模块接口的包路径。 + * + * @since 4.0 + * @version 1.1 + */ +package ohos.hdi.sensor.v1_1; + +import ohos.hdi.sensor.v1_1.SensorTypes; +import ohos.hdi.sensor.v1_1.ISensorCallback; + +/** + * @brief 提供Sensor设备基本控制操作接口。 + * + * 操作包括获取传感器设备信息、订阅/取消订阅传感器数据、使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置接口定义。 + * + * @since 4.0 + * @version 1.1 + */ +interface ISensorInterface { + /** + * @brief 获取当前系统中所有类型的传感器信息。 + * + * @param info 输出系统中注册的所有传感器信息,一种类型传感器信息包括传感器名字、设备厂商、 + * 固件版本号、硬件版本号、传感器类型编号、传感器标识、最大量程、精度、功耗,详见{@link HdfSensorInformation}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + * @version 1.0 + */ + GetAllSensorInfo([out] struct HdfSensorInformation[] info); + + /** + * @brief 根据传感器设备类型标识使能传感器信息列表里存在的设备,只有数据订阅者使能传感器后,才能获取订阅的传感器数据。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + * @version 1.0 + */ + Enable([in] int sensorId); + + /** + * @brief 根据传感器设备类型标识去使能传感器信息列表里存在的设备。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + * @version 1.0 + */ + Disable([in] int sensorId); + + /** + * @brief 设置指定传感器的数据上报模式,不同的工作模式,上报数据的方式不同。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * @param samplingInterval 设置指定传感器的数据采样间隔,单位纳秒。 + * @param reportInterval 表示传感器数据上报间隔,单位纳秒。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + * @version 1.0 + */ + SetBatch([in] int sensorId,[in] long samplingInterval, [in] long reportInterval); + + /** + * @brief 设置指定传感器数据上报模式。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * @param mode 传感器的数据上报模式,详见{@link HdfSensorModeType}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + SetMode([in] int sensorId, [in] int mode); + + /** + * @brief 设置指定传感器量程、精度等可选配置。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * @param option 表示要设置的选项,如测量范围和精度。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + SetOption([in] int sensorId, [in] unsigned int option); + + /** + * @brief 订阅者注册传感器数据回调函数,系统会将获取到的传感器数据上报给订阅者。 + * + * @param groupId 传感器组ID。 + * groupId枚举值范围为128-160,表示已订阅医疗传感器服务,只需成功订阅一次,无需重复订阅。 + * groupId枚举值范围不在128-160之间,这意味着传统传感器已订阅,只需成功订阅一次,无需重复订阅。 + * @param callbackObj 要注册的回调函数,详见{@link ISensorCallback}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + Register([in] int groupId, [in] ISensorCallback callbackObj); + + /** + * @brief 订阅者取消注册传感器数据回调函数。 + * + * @param groupId 传感器组ID。 + * groupId枚举值范围为128-160,表示已订阅医疗传感器服务。只需成功取消订阅一次,无需重复取消订阅。 + * groupId枚举值范围不在128-160之间,这意味着传统传感器已订阅。并且成功取消订阅。 + * @param callbackObj 要取消注册的回调函数,详见{@link ISensorCallback}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + Unregister([in] int groupId, [in] ISensorCallback callbackObj); + + /** + * @brief 获取小系统中的传感器事件数据。 + * + * @param sensorId 表示传感器ID。有关详细信息,请参阅{@link SensorTypeTag}。 + * @param event 表示系统中传感器事件数据的矢量。 + * 传感器事件数据包括传感器ID、传感器算法版本、数据生成时间等,数据选项(如测量范围和精度)、数据报 + * 告模式、数据地址和数据长度。有关详细信息,请参阅{@link HdfSensorEvents}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 4.0 + * @version 1.1 + */ + ReadData([in] int sensorId, [out] struct HdfSensorEvents[] event); +} diff --git a/zh-cn/device_api/hdi/sensor/v1_1/SensorTypes.idl b/zh-cn/device_api/hdi/sensor/v1_1/SensorTypes.idl new file mode 100644 index 00000000..f65279a4 --- /dev/null +++ b/zh-cn/device_api/hdi/sensor/v1_1/SensorTypes.idl @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiSensor + * @{ + * + * @brief Provides unified APIs for sensor services to access sensor drivers. + * + * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to + * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information, + * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor, + * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range. + * + * @version 1.1 + */ + +/** + * @file SensorTypes.idl + * + * @brief Defines the data used by the sensor module, including the sensor information, + * and reported sensor data. + * + * @since 4.0 + * @version 1.1 + */ + +package ohos.hdi.sensor.v1_1; + +/** + * @brief Defines basic sensor information. + * + * Information about a sensor includes the sensor name, vendor, firmware version, hardware version, sensor type ID, + * sensor ID, maximum measurement range, accuracy, and power. + * + * @since 2.2 + */ +struct HdfSensorInformation { + String sensorName; /**< Sensor name */ + String vendorName; /**< Sensor vendor */ + String firmwareVersion; /**< Sensor firmware version */ + String hardwareVersion; /**< Sensor hardware version */ + int sensorTypeId; /**< Sensor type ID (described in {@link SensorTypeTag}) */ + int sensorId; /**< Sensor ID, defined by the sensor driver developer */ + float maxRange; /**< Maximum measurement range of the sensor */ + float accuracy; /**< Sensor accuracy */ + float power; /**< Sensor power */ + long minDelay; /**< Minimum sample period allowed in microseconds */ + long maxDelay; /**< Maxmum sample period allowed in microseconds */ +}; + +/** + * @brief Defines the data reported by the sensor. + * + * The reported sensor data includes the sensor ID, sensor algorithm version, data generation time, + * data options (such as the measurement range and accuracy), data reporting mode, data address, and data length. + * + * @since 2.2 + */ +struct HdfSensorEvents { + int sensorId; /**< Sensor ID */ + int version; /**< Sensor algorithm version */ + long timestamp; /**< Time when sensor data was generated */ + unsigned int option; /**< Sensor data options, including the measurement range and accuracy */ + int mode; /**< Sensor data reporting mode */ + unsigned char[] data; /**< Sensor data vector */ + unsigned int dataLen; /**< Sensor data length */ +}; + +/** + * @brief Enumerates sensor types. + * + * @since 4.0 + */ +enum HdfSensorTypeTag { + HDF_SENSOR_TYPE_NONE = 0, /**< None, for testing only */ + HDF_SENSOR_TYPE_ACCELEROMETER = 1, /**< Acceleration sensor */ + HDF_SENSOR_TYPE_GYROSCOPE = 2, /**< Gyroscope sensor */ + HDF_SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3, /**< Photoplethysmography sensor */ + HDF_SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, /**< Electrocardiogram (ECG) sensor */ + HDF_SENSOR_TYPE_AMBIENT_LIGHT = 5, /**< Ambient light sensor */ + HDF_SENSOR_TYPE_MAGNETIC_FIELD = 6, /**< Magnetic field sensor */ + HDF_SENSOR_TYPE_CAPACITIVE = 7, /**< Capacitive sensor */ + HDF_SENSOR_TYPE_BAROMETER = 8, /**< Barometric pressure sensor */ + HDF_SENSOR_TYPE_TEMPERATURE = 9, /**< Temperature sensor */ + HDF_SENSOR_TYPE_HALL = 10, /**< Hall effect sensor */ + HDF_SENSOR_TYPE_GESTURE = 11, /**< Gesture sensor */ + HDF_SENSOR_TYPE_PROXIMITY = 12, /**< Proximity sensor */ + HDF_SENSOR_TYPE_HUMIDITY = 13, /**< Humidity sensor */ + HDF_SENSOR_TYPE_COLOR = 14, /**< Color sensor */ + HDF_SENSOR_TYPE_SAR = 15, /**< SAR sensor */ + HDF_SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /**< Secondary ambient light sensor */ + HDF_SENSOR_TYPE_MEDICAL_BEGIN = 128, /**< The begin of medical sensorId enumeration value range */ + HDF_SENSOR_TYPE_MEDICAL_END = 160, /**< The end of medical sensorId enumeration value range */ + HDF_SENSOR_TYPE_PHYSICAL_MAX = 255, /**< Maximum type of a physical sensor */ + HDF_SENSOR_TYPE_ORIENTATION = 256, /**< Orientation sensor */ + HDF_SENSOR_TYPE_GRAVITY = 257, /**< Gravity sensor */ + HDF_SENSOR_TYPE_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ + HDF_SENSOR_TYPE_ROTATION_VECTOR = 259, /**< Rotation vector sensor */ + HDF_SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */ + HDF_SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */ + HDF_SENSOR_TYPE_GAME_ROTATION_VECTOR = 262, /**< Game rotation vector sensor */ + HDF_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, /**< Uncalibrated gyroscope sensor */ + HDF_SENSOR_TYPE_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */ + HDF_SENSOR_TYPE_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */ + HDF_SENSOR_TYPE_PEDOMETER = 266, /**< Pedometer sensor */ + HDF_SENSOR_TYPE_POSTURE = 267, /**< Posture sensor */ + HDF_SENSOR_TYPE_HEADPOSTURE = 268, /**< Headposture sensor */ + HDF_SENSOR_TYPE_DROP_DETECT = 269, /**< Drop detection sensor */ + HDF_SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, /**< Geomagnetic rotation vector sensor */ + HDF_SENSOR_TYPE_HEART_RATE = 278, /**< Heart rate sensor */ + HDF_SENSOR_TYPE_DEVICE_ORIENTATION = 279, /**< Device orientation sensor */ + HDF_SENSOR_TYPE_WEAR_DETECTION = 280, /**< Wear detection sensor */ + HDF_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ + HDF_SENSOR_TYPE_MAX, /**< Maximum number of sensor types */ +}; + +/** + * @brief Enumerates hardware service group for sensors + * + * @since 2.2 + */ +enum HdfSensorGroupType { + HDF_TRADITIONAL_SENSOR_TYPE = 0, /**< traditional sensor type, the sensorId enumeration value range is 128-160 */ + HDF_MEDICAL_SENSOR_TYPE = 1, /**< medical sensor type, the sensorId enumeration value range is not within 128-160 */ + HDF_SENSOR_GROUP_TYPE_MAX, /**< Maximum sensor group type*/ +}; diff --git a/zh-cn/device_api/hdi/vibrator/v1_1/IVibratorInterface.idl b/zh-cn/device_api/hdi/vibrator/v1_1/IVibratorInterface.idl index 182872be..1d67ba19 100755 --- a/zh-cn/device_api/hdi/vibrator/v1_1/IVibratorInterface.idl +++ b/zh-cn/device_api/hdi/vibrator/v1_1/IVibratorInterface.idl @@ -123,5 +123,43 @@ interface IVibratorInterface { * @version 1.1 */ EnableVibratorModulation([in] unsigned int duration, [in] int intensity, [in] int frequency); + /** + * @brief 控制可控震源以执行具有自定义复合效果的周期性振动。 + * + * @param effect表示指向自定义复合效果类型的指针。关于细节,请参阅{@link HdfCompositeEffect}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 3.2 + * @version 1.1 + */ + EnableCompositeEffect([in] struct HdfCompositeEffect effect); + /** + * @brief 获取指定效果类型的振动效果信息。 + * + * @param effectType指示指向预设效果类型的指针。建议最大长度为64字节。 + * + * @param effectInfo表示指向振动效果信息的指针。关于细节,请参阅{@link HdfEffectInfo}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 3.2 + * @version 1.1 + */ + GetEffectInfo([in] String effectType, [out] struct HdfEffectInfo effectInfo); + /** + * @brief 获取振动器当前是否正在振动。 + * + * @param state表示可控震源的当前振动状态。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 3.2 + * @version 1.1 + */ + IsVibratorRunning([out] boolean state); } /** @} */ diff --git a/zh-cn/device_api/hdi/vibrator/v1_2/IVibratorInterface.idl b/zh-cn/device_api/hdi/vibrator/v1_2/IVibratorInterface.idl index cfc73084..746fddd5 100644 --- a/zh-cn/device_api/hdi/vibrator/v1_2/IVibratorInterface.idl +++ b/zh-cn/device_api/hdi/vibrator/v1_2/IVibratorInterface.idl @@ -56,7 +56,7 @@ interface IVibratorInterface extends ohos.hdi.vibrator.v1_1.IVibratorInterface{ /** * @brief 高清振动数据下发。 * - * @param pkg表示高清振动数据的数据包,是一个结构体,内部赋值具体振动参数。 + * @param pkg 表示高清振动数据的数据包,是一个结构体,内部赋值具体振动参数。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -68,7 +68,7 @@ interface IVibratorInterface extends ohos.hdi.vibrator.v1_1.IVibratorInterface{ /** * @brief 获取马达振动能力。 * - * @param HapticCapacity表示振动能力数据包,属性包含是否高清振动,是否支持延时振动,是否支持预定义振动。 + * @param HapticCapacity 表示振动能力数据包,属性包含是否高清振动,是否支持延时振动,是否支持预定义振动。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 @@ -80,7 +80,7 @@ interface IVibratorInterface extends ohos.hdi.vibrator.v1_1.IVibratorInterface{ /** * @brief 获取起振时间。 * - * @param startUpTime表示从下达振动振动命令到马达振动起来的时间,mode为振动模式,按照模式去获取。 + * @param startUpTime 表示从下达振动振动命令到马达振动起来的时间,mode为振动模式,按照模式去获取。 * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 diff --git a/zh-cn/device_api/hdi/vibrator/v1_2/VibratorTypes.idl b/zh-cn/device_api/hdi/vibrator/v1_2/VibratorTypes.idl index 2936f3ba..a7320e3b 100644 --- a/zh-cn/device_api/hdi/vibrator/v1_2/VibratorTypes.idl +++ b/zh-cn/device_api/hdi/vibrator/v1_2/VibratorTypes.idl @@ -98,7 +98,7 @@ struct CurvePoint { * @since 4.1 */ struct HapticEvent { - /** I振动类型。 */ + /** 振动类型。 */ enum EVENT_TYPE type; /** 时间。 */ int time; diff --git a/zh-cn/device_api/hdi/vibrator/vibrator_if.h b/zh-cn/device_api/hdi/vibrator/vibrator_if.h index 0b73cbb1..215a4c9a 100644 --- a/zh-cn/device_api/hdi/vibrator/vibrator_if.h +++ b/zh-cn/device_api/hdi/vibrator/vibrator_if.h @@ -126,6 +126,80 @@ struct VibratorInterface { * @version 1.1 */ int32_t (*EnableVibratorModulation)(uint32_t duration, int32_t intensity, int32_t frequency); + /** + * @brief 控制可控震源以执行具有自定义复合效果的周期性振动。 + * + * @param effect表示指向自定义复合效果类型的指针。关于细节,请参阅{@link HdfCompositeEffect}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 3.2 + * @version 1.1 + */ + int32_t (*EnableCompositeEffect)(struct CompositeEffect *effect); + /** + * @brief 获取指定效果类型的振动效果信息。 + * + * @param effectType指示指向预设效果类型的指针。建议最大长度为64字节。 + * + * @param effectInfo表示指向振动效果信息的指针。关于细节,请参阅{@link HdfEffectInfo}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 3.2 + * @version 1.1 + */ + int32_t (*GetEffectInfo)(const char *effectType, struct EffectInfo *effectInfo); + /** + * @brief 获取振动器当前是否正在振动。 + * + * @param state表示可控震源的当前振动状态。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 3.2 + * @version 1.1 + */ + int32_t (*IsVibratorRunning)(bool state); + /** + * @brief 高清振动数据下发。 + * + * @param pkg表示高清振动数据的数据包,是一个结构体,内部赋值具体振动参数。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.1 + * @version 1.2 + */ + int32_t (*PlayHapticPattern)(struct HapticPaket *pkg); + /** + * @brief 获取马达振动能力。 + * + * @param HapticCapacity表示振动能力数据包,属性包含是否高清振动,是否支持延时振动,是否支持预定义振动。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.1 + * @version 1.2 + */ + int32_t (*GetHapticCapacity)(struct HapticCapacity *hapticCapacity); + /** + * @brief 获取起振时间。 + * + * @param startUpTime表示从下达振动振动命令到马达振动起来的时间,mode为振动模式,按照模式去获取。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 4.1 + * @version 1.2 + */ + int32_t (*GetHapticStartUpTime)(int32_t mode, int32_t *startUpTime); }; /** diff --git a/zh-cn/device_api/hdi/vibrator/vibrator_type.h b/zh-cn/device_api/hdi/vibrator/vibrator_type.h index a11dc32d..bd034df5 100644 --- a/zh-cn/device_api/hdi/vibrator/vibrator_type.h +++ b/zh-cn/device_api/hdi/vibrator/vibrator_type.h @@ -73,10 +73,38 @@ enum VibratorMode { VIBRATOR_MODE_ONCE = 0, /** 表示具有预置效果的周期性振动。 */ VIBRATOR_MODE_PRESET = 1, + /**< 表示高清振动。 */ + VIBRATOR_MODE_HDHAPTIC = 2, /** 表示效果模式无效。 */ VIBRATOR_MODE_BUTT }; +/** + * @brief 枚举复合效果的效果类型。 + * + * @since 3.2 + */ +enum EffectType { + /**< 表示给定时间序列的时间效果类型。 */ + EFFECT_TYPE_TIME, + /**< 表示给定基本振动序列的基本振动效果类型。 */ + EFFECT_TYPE_PRIMITIVE, + /**< 表示效果类型无效。 */ + EFFECT_TYPE_BUTT, +}; + +/** + * @brief 枚举事件类型。 + * + * @since 4.1 + */ +enum EVENT_TYPE { + /**< 表示振动是连续的。 */ + CONTINUOUS = 0, + /**< 表示振动是瞬时的。 */ + TRANSIENT = 1, +}; + /** * @brief 定义马达参数。 * @@ -99,6 +127,159 @@ struct VibratorInfo { int32_t frequencyMinValue; }; +/** + * @brief 定义时间效果参数。 + * + * 参数包括振动的延迟、时间、强度和频率。 + * + * @since 3.2 + */ +struct TimeEffect { + /** 等待时间。 */ + int32_t delay; + /** 振动时间。 */ + int32_t time; + /** 振动强度。 */ + uint16_t intensity; + /** 振动频率(Hz)。 */ + int16_t frequency; +}; + +/** + * @brief 定义基本效果参数。 + * + * 参数包括延迟、效应id和振动强度。 + * + * @since 3.2 + */ +struct PrimitiveEffect { + /** 等待时间。 */ + int32_t delay; + /** 效果id。 */ + int32_t effectId; + /** 振动强度。 */ + uint16_t intensity; +}; + +/** + * @brief 自定义复合效果定义两种效果。 + * + * 参数包括时间效果和预定义效果。 + * + * @since 3.2 + */ +union Effect { + struct TimeEffect timeEffect; /** 时间效果,请参阅{@link TimeEffect} */ + struct PrimitiveEffect primitiveEffect; /** 预定义效果,请参见{@link PrimitiveEffect} */ +}; + +/** + * @brief 定义复合振动效果参数。 + * + * 参数包括复合效果的类型和顺序。 + * + * @since 3.2 + */ +struct CompositeEffect { + /** 复合效果的类型,请参见{@link union HdfEffectType}。 */ + int32_t type; + /** 合成效果的序列,请参见{@link union Effect}。 */ + union Effect effects[]; +}; + +/** + * @brief 定义振动效果信息。 + * + * 该信息包括设置效果的能力和效果的振动持续时间。 + * + * @since 3.2 + */ +struct EffectInfo { + /** 效果的振动持续时间,以毫秒为单位。 */ + int32_t duration; + /** 设置效果能力。1表示支持,0表示不支持。 */ + bool isSupportEffect; +}; + + +/** + * @brief 表示振动点。 + * + * 参数包含时间,强度和频率。 + * + * @since 4.1 + */ +struct CurvePoint { + /** 时间。 */ + int32_t time; + /** 强度。 */ + int32_t intensity; + /** 频率。 */ + int32_t frequency; +}; + +/** + * @brief 表示振动事件。 + * + * 参数包含振动时间,强度,频率等等。 + * + * @since 4.1 + */ +struct HapticEvent { + /** 振动类型。 */ + enum EVENT_TYPE type; + /** 时间。 */ + int32_t time; + /** 振动延时。 */ + int32_t duration; + /** 振动强度。 */ + int32_t intensity; + /** 振动频率。 */ + int32_t frequency; + /** 马达id。表示振动的是哪个马达。 */ + int32_t index; + /** 振动点数量。 */ + int32_t pointNum; + /** 振动点数组。 */ + struct CurvePoint points[]; +}; + +/** + * @brief 高清振动数据包。 + * + * 参数包含具体的高清振动数据。 + * + * @since 4.1 + */ +struct HapticPaket { + /** 时间。 */ + int32_t time; + /** 振动事件数量。 */ + int32_t eventNum; + /** 振动事件数组。 */ + struct HapticEvent events[]; +}; + +/** + * @brief 振动能力数据包。 + * + * 信息包括不同类型的振动。 + * + * @since 4.1 + */ +struct HapticCapacity { + /** 是否支持高清振动。 */ + bool isSupportHdHaptic; + /** 是否支持预定义振动。 */ + bool isSupportPresetMapping; + /** 是否支持延时振动。 */ + bool isSupportTimeDelay; + /** 预留参数. */ + bool reserved0; + /** 预留参数. */ + int32_t reserved1; +}; + #ifdef __cplusplus #if __cplusplus } -- Gitee From 878c5878ccf7cbd02b57e8220a5a049e04d38ad3 Mon Sep 17 00:00:00 2001 From: l30053696 Date: Fri, 1 Dec 2023 02:48:20 +0000 Subject: [PATCH 0125/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-sensor,motion,vibrator,light?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- .idea/interface_native_header.iml | 8 --- .idea/modules.xml | 8 --- .idea/vcs.xml | 6 --- .idea/workspace.xml | 84 ------------------------------- 4 files changed, 106 deletions(-) delete mode 100644 .idea/interface_native_header.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml diff --git a/.idea/interface_native_header.iml b/.idea/interface_native_header.iml deleted file mode 100644 index 633cf01d..00000000 --- a/.idea/interface_native_header.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index e2a25ce6..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index c8397c94..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 859fc624..00000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1701347402345 - - - - - - - - - \ No newline at end of file -- Gitee From bf49f89f9e2ca710056fdc58dfa4a74c8d5b839c Mon Sep 17 00:00:00 2001 From: l30053696 Date: Fri, 1 Dec 2023 02:49:25 +0000 Subject: [PATCH 0126/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-sensor,motion,vibrator,light?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- zh-cn/device_api/hdi/motion/v1_1/BUILD.gn | 27 ---------------- zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn | 35 --------------------- zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn | 35 --------------------- 3 files changed, 97 deletions(-) delete mode 100644 zh-cn/device_api/hdi/motion/v1_1/BUILD.gn delete mode 100644 zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn delete mode 100644 zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn diff --git a/zh-cn/device_api/hdi/motion/v1_1/BUILD.gn b/zh-cn/device_api/hdi/motion/v1_1/BUILD.gn deleted file mode 100644 index cd9a1a93..00000000 --- a/zh-cn/device_api/hdi/motion/v1_1/BUILD.gn +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -HDF_CORE_PATH = "../../../hdf_core" -import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") -hdi("motion") { - module_name = "motion_service" - imports = [ "ohos.hdi.motion.v1_0:motion" ] - sources = [ - "IMotionInterface.idl", - "MotionTypes.idl", - ] - - language = "cpp" - subsystem_name = "hdf" - part_name = "drivers_interface_motion" -} diff --git a/zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn b/zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn deleted file mode 100644 index 3a9092f0..00000000 --- a/zh-cn/device_api/hdi/sensor/v1_1/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -HDF_CORE_PATH = "../../../hdf_core" -import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") -if (defined(ohos_lite)) { - group("libsensor_proxy_1.1") { - deps = [] - public_configs = [] - } -} else { - hdi("sensor") { - module_name = "sensor_service" - - sources = [ - "ISensorCallback.idl", - "ISensorInterface.idl", - "SensorTypes.idl", - ] - - language = "cpp" - subsystem_name = "hdf" - part_name = "drivers_interface_sensor" - } -} diff --git a/zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn b/zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn deleted file mode 100644 index 468775d6..00000000 --- a/zh-cn/device_api/hdi/vibrator/v1_2/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -HDF_CORE_PATH = "../../../hdf_core" -import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") -if (defined(ohos_lite)) { - group("libvibrator_proxy_1.2") { - deps = [] - public_configs = [] - } -} else { - hdi("vibrator") { - module_name = "vibrator_service" - imports = [ "ohos.hdi.vibrator.v1_1:vibrator" ] - - sources = [ - "IVibratorInterface.idl", - "VibratorTypes.idl", - ] - - language = "cpp" - subsystem_name = "hdf" - part_name = "drivers_interface_vibrator" - } -} -- Gitee From 72bb669d9648f0617ade67d790c442fe19d53c3a Mon Sep 17 00:00:00 2001 From: l30053696 Date: Fri, 1 Dec 2023 02:56:16 +0000 Subject: [PATCH 0127/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-sensor,motion,vibrator,light?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- .../hdi/sensor/v1_1/SensorTypes.idl | 150 +++++++++--------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/zh-cn/device_api/hdi/sensor/v1_1/SensorTypes.idl b/zh-cn/device_api/hdi/sensor/v1_1/SensorTypes.idl index f65279a4..a1150456 100644 --- a/zh-cn/device_api/hdi/sensor/v1_1/SensorTypes.idl +++ b/zh-cn/device_api/hdi/sensor/v1_1/SensorTypes.idl @@ -17,12 +17,11 @@ * @addtogroup HdiSensor * @{ * - * @brief Provides unified APIs for sensor services to access sensor drivers. + * @brief 传感器设备驱动对传感器服务提供通用的接口能力。 * - * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to - * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information, - * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor, - * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range. + * 模块提供传感器服务对传感器驱动访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法, + * 以传感器ID区分访问不同类型传感器设备,实现获取传感器设备信息、订阅/取消订阅传感器数据、 + * 使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置等。 * * @version 1.1 */ @@ -30,53 +29,57 @@ /** * @file SensorTypes.idl * - * @brief Defines the data used by the sensor module, including the sensor information, - * and reported sensor data. + * @brief 定义传感器模块所使用的传感器类型,传感器信息,传感器数据结构等数据类型。 * * @since 4.0 * @version 1.1 */ +/** + * @brief Sensor模块接口的包路径。 + * + * @since 4.0 + * @version 1.1 + */ package ohos.hdi.sensor.v1_1; /** - * @brief Defines basic sensor information. + * @brief 定义传感器的基本信息。 * - * Information about a sensor includes the sensor name, vendor, firmware version, hardware version, sensor type ID, - * sensor ID, maximum measurement range, accuracy, and power. + * 传感器的信息包括传感器名称、供应商、固件版本、硬件版本、传感器类型ID、传感器ID、最大测量范围、精度和功率。 * * @since 2.2 */ struct HdfSensorInformation { - String sensorName; /**< Sensor name */ - String vendorName; /**< Sensor vendor */ - String firmwareVersion; /**< Sensor firmware version */ - String hardwareVersion; /**< Sensor hardware version */ - int sensorTypeId; /**< Sensor type ID (described in {@link SensorTypeTag}) */ - int sensorId; /**< Sensor ID, defined by the sensor driver developer */ - float maxRange; /**< Maximum measurement range of the sensor */ - float accuracy; /**< Sensor accuracy */ - float power; /**< Sensor power */ - long minDelay; /**< Minimum sample period allowed in microseconds */ - long maxDelay; /**< Maxmum sample period allowed in microseconds */ + String sensorName; /**< 传感器名称。 */ + String vendorName; /**< 传感器供应商。 */ + String firmwareVersion; /**< 传感器固件版本。 */ + String hardwareVersion; /**< 传感器硬件版本。 */ + int sensorTypeId; /**< 传感器类型ID(在{@link HdfSensorTypeTag}中描述)。 */ + int sensorId; /**< 传感器ID,由传感器驱动程序开发人员定义。 */ + float maxRange; /**< 传感器的最大测量范围。 */ + float accuracy; /**< 传感器精度。 */ + float power; /**< 传感器功率。 */ + long minDelay; /**< 允许的最小采样周期(微秒) */ + long maxDelay; /**< 允许的最大采样周期(微秒) */ }; /** - * @brief Defines the data reported by the sensor. + * @brief 定义传感器上报的数据。 * - * The reported sensor data includes the sensor ID, sensor algorithm version, data generation time, - * data options (such as the measurement range and accuracy), data reporting mode, data address, and data length. + * 上报的传感器数据包括传感器ID、传感器算法版本号、数据生成时间、传感器类型ID、 + * 数据选项(如测量范围和精度)、数据上报模式、数据地址、数据长度。 * * @since 2.2 */ struct HdfSensorEvents { - int sensorId; /**< Sensor ID */ - int version; /**< Sensor algorithm version */ - long timestamp; /**< Time when sensor data was generated */ - unsigned int option; /**< Sensor data options, including the measurement range and accuracy */ - int mode; /**< Sensor data reporting mode */ - unsigned char[] data; /**< Sensor data vector */ - unsigned int dataLen; /**< Sensor data length */ + int sensorId; /**< 传感器ID。 */ + int version; /**< 传感器算法版本号。 */ + long timestamp; /**< 传感器数据生成时间。 */ + unsigned int option; /**< 传感器数据选项,包括测量范围和精度。 */ + int mode; /**< 传感器数据上报模式。 */ + unsigned char[] data; /**< 传感器数据地址。 */ + unsigned int dataLen; /**< 传感器数据长度。 */ }; /** @@ -85,55 +88,52 @@ struct HdfSensorEvents { * @since 4.0 */ enum HdfSensorTypeTag { - HDF_SENSOR_TYPE_NONE = 0, /**< None, for testing only */ - HDF_SENSOR_TYPE_ACCELEROMETER = 1, /**< Acceleration sensor */ - HDF_SENSOR_TYPE_GYROSCOPE = 2, /**< Gyroscope sensor */ - HDF_SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3, /**< Photoplethysmography sensor */ - HDF_SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, /**< Electrocardiogram (ECG) sensor */ - HDF_SENSOR_TYPE_AMBIENT_LIGHT = 5, /**< Ambient light sensor */ - HDF_SENSOR_TYPE_MAGNETIC_FIELD = 6, /**< Magnetic field sensor */ - HDF_SENSOR_TYPE_CAPACITIVE = 7, /**< Capacitive sensor */ - HDF_SENSOR_TYPE_BAROMETER = 8, /**< Barometric pressure sensor */ - HDF_SENSOR_TYPE_TEMPERATURE = 9, /**< Temperature sensor */ - HDF_SENSOR_TYPE_HALL = 10, /**< Hall effect sensor */ - HDF_SENSOR_TYPE_GESTURE = 11, /**< Gesture sensor */ - HDF_SENSOR_TYPE_PROXIMITY = 12, /**< Proximity sensor */ - HDF_SENSOR_TYPE_HUMIDITY = 13, /**< Humidity sensor */ - HDF_SENSOR_TYPE_COLOR = 14, /**< Color sensor */ - HDF_SENSOR_TYPE_SAR = 15, /**< SAR sensor */ - HDF_SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /**< Secondary ambient light sensor */ - HDF_SENSOR_TYPE_MEDICAL_BEGIN = 128, /**< The begin of medical sensorId enumeration value range */ - HDF_SENSOR_TYPE_MEDICAL_END = 160, /**< The end of medical sensorId enumeration value range */ - HDF_SENSOR_TYPE_PHYSICAL_MAX = 255, /**< Maximum type of a physical sensor */ - HDF_SENSOR_TYPE_ORIENTATION = 256, /**< Orientation sensor */ - HDF_SENSOR_TYPE_GRAVITY = 257, /**< Gravity sensor */ - HDF_SENSOR_TYPE_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ - HDF_SENSOR_TYPE_ROTATION_VECTOR = 259, /**< Rotation vector sensor */ - HDF_SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */ - HDF_SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */ - HDF_SENSOR_TYPE_GAME_ROTATION_VECTOR = 262, /**< Game rotation vector sensor */ - HDF_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, /**< Uncalibrated gyroscope sensor */ - HDF_SENSOR_TYPE_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */ - HDF_SENSOR_TYPE_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */ - HDF_SENSOR_TYPE_PEDOMETER = 266, /**< Pedometer sensor */ - HDF_SENSOR_TYPE_POSTURE = 267, /**< Posture sensor */ - HDF_SENSOR_TYPE_HEADPOSTURE = 268, /**< Headposture sensor */ - HDF_SENSOR_TYPE_DROP_DETECT = 269, /**< Drop detection sensor */ - HDF_SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, /**< Geomagnetic rotation vector sensor */ - HDF_SENSOR_TYPE_HEART_RATE = 278, /**< Heart rate sensor */ - HDF_SENSOR_TYPE_DEVICE_ORIENTATION = 279, /**< Device orientation sensor */ - HDF_SENSOR_TYPE_WEAR_DETECTION = 280, /**< Wear detection sensor */ - HDF_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ - HDF_SENSOR_TYPE_MAX, /**< Maximum number of sensor types */ + HDF_SENSOR_TYPE_NONE = 0, /**< 空传感器类型,用于测试。 */ + HDF_SENSOR_TYPE_ACCELEROMETER = 1, /**< 加速度传感器。 */ + HDF_SENSOR_TYPE_GYROSCOPE = 2, /**< 陀螺仪传感器。 */ + HDF_SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3, /**< 心率传感器。 */ + HDF_SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, /**< 心电传感器。 */ + HDF_SENSOR_TYPE_AMBIENT_LIGHT = 5, /**< 环境光传感器。 */ + HDF_SENSOR_TYPE_MAGNETIC_FIELD = 6, /**< 地磁传感器。 */ + HDF_SENSOR_TYPE_CAPACITIVE = 7, /**< 电容传感器。 */ + HDF_SENSOR_TYPE_BAROMETER = 8, /**< 气压计传感器。 */ + HDF_SENSOR_TYPE_TEMPERATURE = 9, /**< 温度传感器。 */ + HDF_SENSOR_TYPE_HALL = 10, /**< 霍尔传感器。 */ + HDF_SENSOR_TYPE_GESTURE = 11, /**< 手势传感器。 */ + HDF_SENSOR_TYPE_PROXIMITY = 12, /**< 接近光传感器。 */ + HDF_SENSOR_TYPE_HUMIDITY = 13, /**< 湿度传感器。 */ + HDF_SENSOR_TYPE_COLOR = 14, /**< 颜色传感器。 */ + HDF_SENSOR_TYPE_SAR = 15, /**< SAR传感器。 */ + HDF_SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /**< 辅助环境光传感器。 */ + HDF_SENSOR_TYPE_MEDICAL_BEGIN = 128, /**< 医疗传感器ID枚举值范围的开始。 */ + HDF_SENSOR_TYPE_MEDICAL_END = 160, /**< 医疗传感器ID枚举值范围的结束。 */ + HDF_SENSOR_TYPE_PHYSICAL_MAX = 255, /**< 物理传感器最大类型。 */ + HDF_SENSOR_TYPE_ORIENTATION = 256, /**< 方向传感器。 */ + HDF_SENSOR_TYPE_GRAVITY = 257, /**< 重力传感器。 */ + HDF_SENSOR_TYPE_LINEAR_ACCELERATION = 258, /**< 线性加速度传感器。 */ + HDF_SENSOR_TYPE_ROTATION_VECTOR = 259, /**< 旋转矢量传感器。 */ + HDF_SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, /**< 环境温度传感器。 */ + HDF_SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< 未校准磁场传感器。 */ + HDF_SENSOR_TYPE_GAME_ROTATION_VECTOR = 262, /**< 游戏旋转矢量传感器。 */ + HDF_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, /**< 未校准陀螺仪传感器。 */ + HDF_SENSOR_TYPE_SIGNIFICANT_MOTION = 264, /**< 大幅度动作传感器。 */ + HDF_SENSOR_TYPE_PEDOMETER_DETECTION = 265, /**< 计步器检测传感器。 */ + HDF_SENSOR_TYPE_PEDOMETER = 266, /**< 计步器传感器。 */ + HDF_SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, /**< 地磁旋转矢量传感器。 */ + HDF_SENSOR_TYPE_HEART_RATE = 278, /**< 心率传感器。 */ + HDF_SENSOR_TYPE_DEVICE_ORIENTATION = 279, /**< 设备方向传感器。 */ + HDF_SENSOR_TYPE_WEAR_DETECTION = 280, /**< 佩戴检测传感器。 */ + HDF_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, /**< 未校准加速度传感器。 */ + HDF_SENSOR_TYPE_MAX, /**< 传感器类型最大个数标识。 */ }; /** - * @brief Enumerates hardware service group for sensors + * @brief 枚举传感器的硬件服务组。 * * @since 2.2 */ enum HdfSensorGroupType { - HDF_TRADITIONAL_SENSOR_TYPE = 0, /**< traditional sensor type, the sensorId enumeration value range is 128-160 */ - HDF_MEDICAL_SENSOR_TYPE = 1, /**< medical sensor type, the sensorId enumeration value range is not within 128-160 */ - HDF_SENSOR_GROUP_TYPE_MAX, /**< Maximum sensor group type*/ + HDF_TRADITIONAL_SENSOR_TYPE = 0, /**< 传统传感器类型,传感器ID枚举值范围不在128-160之间。 */ + HDF_MEDICAL_SENSOR_TYPE = 1, /**< 医疗传感器类型,传感器ID枚举值范围在128-160之间。 */ + HDF_SENSOR_GROUP_TYPE_MAX, /**< 最大传感器类型。 */ }; -- Gitee From d8a10677415cb275db1ad099109c109d94b476b9 Mon Sep 17 00:00:00 2001 From: l30053696 Date: Fri, 1 Dec 2023 03:08:59 +0000 Subject: [PATCH 0128/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-sensor,motion,vibrator,light?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- zh-cn/device_api/hdi/sensor/sensor_if.h | 4 ++-- zh-cn/device_api/hdi/vibrator/vibrator_if.h | 4 ++-- zh-cn/device_api/hdi/vibrator/vibrator_type.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zh-cn/device_api/hdi/sensor/sensor_if.h b/zh-cn/device_api/hdi/sensor/sensor_if.h index 0b1d269f..39e6742e 100644 --- a/zh-cn/device_api/hdi/sensor/sensor_if.h +++ b/zh-cn/device_api/hdi/sensor/sensor_if.h @@ -140,8 +140,8 @@ struct SensorInterface { * @brief 订阅者注册传感器数据回调函数,系统会将获取到的传感器数据上报给订阅者。 * * @param groupId 传感器组ID。 - * sensorId枚举值范围为128-160,表示已订阅医疗传感器服务,只需成功订阅一次,无需重复订阅。 - * sensorId枚举值范围不在128-160之间,这意味着传统传感器已订阅,只需成功订阅一次,无需重复订阅。 + * sensorId 枚举值范围为128-160,表示已订阅医疗传感器服务,只需成功订阅一次,无需重复订阅。 + * sensorId 枚举值范围不在128-160之间,这意味着传统传感器已订阅,只需成功订阅一次,无需重复订阅。 * @param cb 要注册的回调函数,详见{@link RecordDataCallback}。 * * @return 如果注册回调函数成功,则返回0。 diff --git a/zh-cn/device_api/hdi/vibrator/vibrator_if.h b/zh-cn/device_api/hdi/vibrator/vibrator_if.h index 215a4c9a..f6655203 100644 --- a/zh-cn/device_api/hdi/vibrator/vibrator_if.h +++ b/zh-cn/device_api/hdi/vibrator/vibrator_if.h @@ -129,8 +129,8 @@ struct VibratorInterface { /** * @brief 控制可控震源以执行具有自定义复合效果的周期性振动。 * - * @param effect表示指向自定义复合效果类型的指针。关于细节,请参阅{@link HdfCompositeEffect}。 - * + * @param effect 表示指向自定义复合效果类型的指针。关于细节,请参阅{@link HdfCompositeEffect}。 + * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负值。 * diff --git a/zh-cn/device_api/hdi/vibrator/vibrator_type.h b/zh-cn/device_api/hdi/vibrator/vibrator_type.h index bd034df5..fcfb2465 100644 --- a/zh-cn/device_api/hdi/vibrator/vibrator_type.h +++ b/zh-cn/device_api/hdi/vibrator/vibrator_type.h @@ -175,7 +175,7 @@ union Effect { /** * @brief 定义复合振动效果参数。 - * + * * 参数包括复合效果的类型和顺序。 * * @since 3.2 -- Gitee From 365c62cf0ab5af0459295fe831a1ba10b18035f3 Mon Sep 17 00:00:00 2001 From: l30053696 Date: Fri, 1 Dec 2023 03:14:08 +0000 Subject: [PATCH 0129/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-sensor,motion,vibrator,light?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- zh-cn/device_api/hdi/sensor/sensor_if.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/device_api/hdi/sensor/sensor_if.h b/zh-cn/device_api/hdi/sensor/sensor_if.h index 39e6742e..8a0713c5 100644 --- a/zh-cn/device_api/hdi/sensor/sensor_if.h +++ b/zh-cn/device_api/hdi/sensor/sensor_if.h @@ -175,7 +175,7 @@ struct SensorInterface { * @param event表示系统中传感器事件数据的矢量。 * 传感器事件数据包括传感器ID、传感器算法版本、数据生成时间等,数据选项(如测量范围和精度)、数据报 * 告模式、数据地址和数据长度。有关详细信息,请参阅{@link HdfSensorEvents}。 - * + * * @return 如果操作成功,则返回0。 * @return 如果操作失败,则返回负数。 * -- Gitee From 8d8f87b332fdd290a0d01ec87a3bd6fd02aa3ce7 Mon Sep 17 00:00:00 2001 From: chunsen Date: Fri, 1 Dec 2023 15:03:14 +0800 Subject: [PATCH 0130/2135] add power_manager IDL translation Signed-off-by: chunsen --- .../hdi/battery/v1_1/IBatteryInterface.idl | 2 +- zh-cn/device_api/hdi/battery/v1_2/Types.idl | 2 +- .../hdi/battery/v2_0/IBatteryCallback.idl | 2 +- zh-cn/device_api/hdi/battery/v2_0/Types.idl | 12 +++++---- .../hdi/power/v1_1/IPowerInterface.idl | 26 +++++++++---------- .../device_api/hdi/power/v1_1/PowerTypes.idl | 4 +-- .../hdi/power/v1_1/RunningLockTypes.idl | 20 +++++++------- .../hdi/thermal/v1_1/IFanCallback.idl | 2 +- .../hdi/thermal/v1_1/IThermalInterface.idl | 18 ++++++------- .../hdi/thermal/v1_1/ThermalTypes.idl | 2 +- 10 files changed, 46 insertions(+), 44 deletions(-) diff --git a/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl index 8dc02a55..bd27ecf0 100644 --- a/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl +++ b/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl @@ -230,7 +230,7 @@ interface IBatteryInterface { /** * @brief 设置电池充电电流或电压限制。 * - * @param ChargingLimit 输出参数,对电池充电电流或电压的限制。 + * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 * * @return HDF_SUCCESS 表示注册成功。 * diff --git a/zh-cn/device_api/hdi/battery/v1_2/Types.idl b/zh-cn/device_api/hdi/battery/v1_2/Types.idl index 46ed723e..d4f25b1d 100644 --- a/zh-cn/device_api/hdi/battery/v1_2/Types.idl +++ b/zh-cn/device_api/hdi/battery/v1_2/Types.idl @@ -36,7 +36,7 @@ * @since 3.2 * @version 1.1 */ -package ohos.hdi.battery.v1_1; +package ohos.hdi.battery.v1_2; /** diff --git a/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl index 8eb4e787..c234566e 100644 --- a/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl +++ b/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl @@ -45,7 +45,7 @@ import ohos.hdi.battery.v2_0.Types; * @brief 表示电池信息的回调。 * * 创建回调对象后,电池服务可调用 {@link IBatteryInterface} 接口注册回调,订阅电池信息变更。 - * subscribe to battery information changes. + * * * @since 3.1 */ diff --git a/zh-cn/device_api/hdi/battery/v2_0/Types.idl b/zh-cn/device_api/hdi/battery/v2_0/Types.idl index dec198d2..9458fb85 100644 --- a/zh-cn/device_api/hdi/battery/v2_0/Types.idl +++ b/zh-cn/device_api/hdi/battery/v2_0/Types.idl @@ -112,15 +112,15 @@ struct BatteryInfo { int voltage; /** 表示电池的温度 */ int temperature; - /** 表示电池的健康状态。 */ + /** 表示电池的健康状态,{@link BatteryHealthState}。 */ int healthState; - /** 表示电池的充电设备类型。 */ + /** 表示电池的充电设备类型,{@link BatteryPluggedType}。 */ int pluggedType; /** 表示电池的最大充电电流。 */ int pluggedMaxCurrent; /** 表示电池的最大充电电压。 */ int pluggedMaxVoltage; - /** 表示电池的充电状态。 */ + /** 表示电池的充电状态,{@link BatteryChargeState}。 */ int chargeState; /** 表示电池的充电次数。 */ int chargeCounter; @@ -147,9 +147,9 @@ struct BatteryInfo { */ enum ChargingLimitType { - /** Limit type: charging current */ + /** 限制类型:充电电流 */ TYPE_CURRENT = 0, - /** Limit type: charging voltage */ + /** 限制类型:充电电压 */ TYPE_VOLTAGE, }; @@ -161,7 +161,9 @@ enum ChargingLimitType struct ChargingLimit { enum ChargingLimitType type; + /** 限制协议描述 */ String protocol; + /** 选择限制类型,0-电流,1-电压 */ int value; }; diff --git a/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl b/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl index 46ba8b9f..6b88f21d 100644 --- a/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl +++ b/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl @@ -55,7 +55,7 @@ interface IPowerInterface { * * @param ipowerHdiCallback 输入参数,服务注册的回调。 * - * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_SUCCESS 表示注册成功,HDF_FAILED 表示失败。 * @see IPowerHdiCallback * * @since 3.1 @@ -65,7 +65,7 @@ interface IPowerInterface { /** * @brief 执行设备休眠操作。 * - * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 * * @since 3.1 */ @@ -74,7 +74,7 @@ interface IPowerInterface { /** * @brief 执行设备唤醒操作。 * - * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 * * @since 3.1 */ @@ -83,7 +83,7 @@ interface IPowerInterface { /** * @brief 执行设备强制休眠操作。 * - * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 * * @since 3.1 */ @@ -94,10 +94,10 @@ interface IPowerInterface { * * @param name 输入参数,运行锁的名称。 * - * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 * * @since 3.1 - * @deprecated + * @deprecated 从4.0版本起废弃,使用{@link WriteWakeCount}替代。 */ SuspendBlock([in] String name); @@ -106,10 +106,10 @@ interface IPowerInterface { * * @param name 输入参数,运行锁的名称。 * - * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 * * @since 3.1 - * @deprecated + * @deprecated 从4.0版本起废弃,使用{@link WriteWakeCount}替代。 */ SuspendUnblock([in] String name); @@ -118,7 +118,7 @@ interface IPowerInterface { * * @param info 输出参数,电源的Dump信息。 * - * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 * * @since 3.1 */ @@ -127,9 +127,9 @@ interface IPowerInterface { /** * @brief 持有运行锁,阻止设备休眠。 * - * @param info 输出参数,运行锁信息。 + * @param info 输入参数,运行锁信息。 * - * @return 成功返回 HDF_SUCCESS; 运行锁与当前锁冲突返回 HDF_FAILED。 + * @return 成功返回 HDF_SUCCESS,失败返回 HDF_FAILED。 * * @since 4.0 */ @@ -138,9 +138,9 @@ interface IPowerInterface { /** * @brief 解除运行锁,解除设备休眠。 * - * @param info 输出参数,运行锁信息。 + * @param info 输入参数,运行锁信息。 * - * @return 成功返回 HDF_SUCCESS。 + * @return 成功返回 HDF_SUCCESS,失败返回 HDF_FAILED。 * * @since 4.0 */ diff --git a/zh-cn/device_api/hdi/power/v1_1/PowerTypes.idl b/zh-cn/device_api/hdi/power/v1_1/PowerTypes.idl index fc1d5780..71940718 100644 --- a/zh-cn/device_api/hdi/power/v1_1/PowerTypes.idl +++ b/zh-cn/device_api/hdi/power/v1_1/PowerTypes.idl @@ -43,7 +43,7 @@ package ohos.hdi.power.v1_1; * @brief 枚举电源命令的参数。 * * @since 3.1 - * @deprecated + * @deprecated 从4.0版本起废弃。 */ enum PowerHdfCmd { /** 订阅状态的命令参数 */ @@ -66,7 +66,7 @@ enum PowerHdfCmd { * @brief 枚举电源状态回调的参数。 * * @since 3.1 - * @deprecated + * @deprecated 从4.0版本起废弃 */ enum PowerHdfCallbackCmd { /** 休眠回调的命令参数。 */ diff --git a/zh-cn/device_api/hdi/power/v1_1/RunningLockTypes.idl b/zh-cn/device_api/hdi/power/v1_1/RunningLockTypes.idl index 185bf286..99c899e6 100644 --- a/zh-cn/device_api/hdi/power/v1_1/RunningLockTypes.idl +++ b/zh-cn/device_api/hdi/power/v1_1/RunningLockTypes.idl @@ -46,11 +46,11 @@ package ohos.hdi.power.v1_1; */ enum BaseRunningLockType { /** - * 用于保持屏幕开启。 + * 用于保持屏幕处于开启状态。 */ RUNNINGLOCK_SCREEN = 0, /** - * 用于保持 CPU 处于运行状态,以完成后台任务。 + * 用于保持 CPU 处于运行状态,锁屏状态下继续完成后台任务。 */ RUNNINGLOCK_BACKGROUND = 1, /** @@ -96,20 +96,20 @@ enum RunningLockType { }; /** - * @brief 定义运行中的锁的信息。 + * @brief 定义运行锁的信息。 * * @since 4.0 */ struct RunningLockInfo { - /** 运行锁的名称。不能为空或空值 */ + /** 运行锁的名称。不能为空 */ String name; - /** 运行锁类型 */ - enum RunningLockType type; // The default value is RUNNINGLOCK_BACKGROUND_TASK. - /** 运行锁的超时时间,毫秒。值小于 0 表示没有超时。 */ - int timeoutMs; // The default value is 3000. - /** PID */ + /** 运行锁类型,默认值为RUNNINGLOCK_BACKGROUND_TASK */ + enum RunningLockType type; + /** 运行锁的超时时间,单位毫秒。值小于 0 表示没有超时。默认为3000 */ + int timeoutMs; + /** 进程ID */ int pid; - /** UID */ + /** 用户ID */ int uid; }; /** @} */ diff --git a/zh-cn/device_api/hdi/thermal/v1_1/IFanCallback.idl b/zh-cn/device_api/hdi/thermal/v1_1/IFanCallback.idl index d7290b43..2b2e10a9 100644 --- a/zh-cn/device_api/hdi/thermal/v1_1/IFanCallback.idl +++ b/zh-cn/device_api/hdi/thermal/v1_1/IFanCallback.idl @@ -55,7 +55,7 @@ import ohos.hdi.thermal.v1_1.ThermalTypes; * @param event 输入参数,设备的风扇信息,包括设备温度和风扇速度。 * @see HdfThermalCallbackInfo * - * @since4.0 + * @since 4.0 */ OnFanDataEvent([in] struct HdfThermalCallbackInfo event); } diff --git a/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl b/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl index c72076a7..32932564 100644 --- a/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl +++ b/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl @@ -56,7 +56,7 @@ interface IThermalInterface { * * @param freq 输入参数,设置CPU频率的值。 * - * @return HDF_SUCCESS 表示设置成功。 + * @return HDF_SUCCESS 表示设置成功,HDF_FAILED 表示设置失败。 * * @since 3.1 */ @@ -67,7 +67,7 @@ interface IThermalInterface { * * @param freq 输入参数,设置GPU频率的值。 * - * @return HDF_SUCCESS 表示设置成功。 + * @return HDF_SUCCESS 表示设置成功,HDF_FAILED 表示设置失败。 * * @since 3.1 */ @@ -78,7 +78,7 @@ interface IThermalInterface { * * @param current 输入参数,充电电流,单位毫安。 * - * @return HDF_SUCCESS 表示设置成功 + * @return HDF_SUCCESS 表示设置成功,HDF_FAILED 表示设置失败。 * * @since 3.1 */ @@ -89,7 +89,7 @@ interface IThermalInterface { * * @param event 输出参数,设备发热信息,包括器件类型、器件温度。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 * @see HdfThermalCallbackInfo * * @since 3.1 @@ -101,7 +101,7 @@ interface IThermalInterface { * * @param num 输入参数,CPU内核编号。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 * * @since 4.0 */ @@ -112,7 +112,7 @@ interface IThermalInterface { * * @param callbackObj 输入参数,要注册的回调函数。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 * @see IThermalCallback * * @since 3.1 @@ -122,7 +122,7 @@ interface IThermalInterface { /** * @brief 注册设备热状态回调。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 * * @since 3.1 */ @@ -133,7 +133,7 @@ interface IThermalInterface { * * @param callbackObj 输入参数,要注册的回调函数。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 * @see IFanCallback * * @since 4.0 @@ -143,7 +143,7 @@ interface IThermalInterface { /** * @brief 取消注册风扇故障检测的回调。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 * * @since 4.0 */ diff --git a/zh-cn/device_api/hdi/thermal/v1_1/ThermalTypes.idl b/zh-cn/device_api/hdi/thermal/v1_1/ThermalTypes.idl index fe2d6ebc..acfb4416 100644 --- a/zh-cn/device_api/hdi/thermal/v1_1/ThermalTypes.idl +++ b/zh-cn/device_api/hdi/thermal/v1_1/ThermalTypes.idl @@ -45,7 +45,7 @@ package ohos.hdi.thermal.v1_1; * @since 3.1 */ struct ThermalZoneInfo { - /** 发热器件的类型。 */ + /** 发热器件的类型,不同设备支持的类型不同,可参考厂商提供的详细说明。 */ String type; /** 器件的温度值。 */ int temp; -- Gitee From c6a3c0c294d5bc9844f1e3ca7a58664d5fa8fc99 Mon Sep 17 00:00:00 2001 From: chunsen Date: Fri, 1 Dec 2023 16:02:02 +0800 Subject: [PATCH 0131/2135] add power_manager IDL translation Signed-off-by: chunsen --- .../hdi/battery/v2_0/IBatteryInterface.idl | 21 ++++++++++++++ zh-cn/device_api/hdi/battery/v2_0/Types.idl | 7 +++-- .../hdi/power/v1_1/IPowerInterface.idl | 28 +++++++++++++------ .../hdi/thermal/v1_1/IThermalInterface.idl | 28 +++++++++++++------ 4 files changed, 63 insertions(+), 21 deletions(-) diff --git a/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface.idl index d436f4dd..9f5ca5a0 100644 --- a/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface.idl +++ b/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface.idl @@ -55,6 +55,7 @@ interface IBatteryInterface { * @param 注册事件的回调。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -64,6 +65,7 @@ interface IBatteryInterface { * @brief 取消注册电池信息的回调。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -75,6 +77,7 @@ interface IBatteryInterface { * @param path 输入参数,电池信息节点的路径。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -86,6 +89,7 @@ interface IBatteryInterface { * @param capacity 输出参数,表示电量的百分比值 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -97,6 +101,7 @@ interface IBatteryInterface { * @param voltage 输出参数,表示电池的电压。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -108,6 +113,7 @@ interface IBatteryInterface { * @param temperature 输出参数,表示电池温度。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -119,6 +125,7 @@ interface IBatteryInterface { * @param healthState 输出参数,表示电池健康状态。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryHealthState * * @since 3.1 @@ -131,6 +138,7 @@ interface IBatteryInterface { * @param pluggedType 输出参数,表示充电设备类型。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryPluggedType * * @since 3.1 @@ -143,6 +151,7 @@ interface IBatteryInterface { * @param chargeState 输出参数,表示充电状态。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryChargeState * * @since 3.1 @@ -155,6 +164,7 @@ interface IBatteryInterface { * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -166,6 +176,7 @@ interface IBatteryInterface { * @param technology 输出参数,当前电池技术型号。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -177,6 +188,7 @@ interface IBatteryInterface { * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -188,6 +200,7 @@ interface IBatteryInterface { * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -199,6 +212,7 @@ interface IBatteryInterface { * @param curNow 输出参数,表示电池的实时电流,单位毫安 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -210,6 +224,7 @@ interface IBatteryInterface { * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -221,6 +236,7 @@ interface IBatteryInterface { * @param info 输出参数,电池的全部信息。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryInfo * * @since 3.1 @@ -233,6 +249,7 @@ interface IBatteryInterface { * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.2 */ @@ -244,6 +261,7 @@ interface IBatteryInterface { * @param type 输出参数,充电器类型。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 4.0 */ @@ -257,6 +275,7 @@ interface IBatteryInterface { * @param value 输出参数,电池组配置值。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 4.1 */ @@ -270,6 +289,7 @@ interface IBatteryInterface { * @param value 输出参数,电池组配置值。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 4.1 */ @@ -283,6 +303,7 @@ interface IBatteryInterface { * @param value 输出参数,电池配置是否启用。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 4.1 */ diff --git a/zh-cn/device_api/hdi/battery/v2_0/Types.idl b/zh-cn/device_api/hdi/battery/v2_0/Types.idl index 9458fb85..62aa469e 100644 --- a/zh-cn/device_api/hdi/battery/v2_0/Types.idl +++ b/zh-cn/device_api/hdi/battery/v2_0/Types.idl @@ -112,15 +112,15 @@ struct BatteryInfo { int voltage; /** 表示电池的温度 */ int temperature; - /** 表示电池的健康状态,{@link BatteryHealthState}。 */ + /** 表示电池的健康状态,详情可参考{@link BatteryHealthState}。 */ int healthState; - /** 表示电池的充电设备类型,{@link BatteryPluggedType}。 */ + /** 表示电池的充电设备类型,详情可参考{@link BatteryPluggedType}。 */ int pluggedType; /** 表示电池的最大充电电流。 */ int pluggedMaxCurrent; /** 表示电池的最大充电电压。 */ int pluggedMaxVoltage; - /** 表示电池的充电状态,{@link BatteryChargeState}。 */ + /** 表示电池的充电状态,详情可参考{@link BatteryChargeState}。 */ int chargeState; /** 表示电池的充电次数。 */ int chargeCounter; @@ -160,6 +160,7 @@ enum ChargingLimitType */ struct ChargingLimit { + /** 定义电池充电限制类型 */ enum ChargingLimitType type; /** 限制协议描述 */ String protocol; diff --git a/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl b/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl index 6b88f21d..d7df519a 100644 --- a/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl +++ b/zh-cn/device_api/hdi/power/v1_1/IPowerInterface.idl @@ -55,7 +55,9 @@ interface IPowerInterface { * * @param ipowerHdiCallback 输入参数,服务注册的回调。 * - * @return HDF_SUCCESS 表示注册成功,HDF_FAILED 表示失败。 + * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 + * * @see IPowerHdiCallback * * @since 3.1 @@ -65,7 +67,8 @@ interface IPowerInterface { /** * @brief 执行设备休眠操作。 * - * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -74,7 +77,8 @@ interface IPowerInterface { /** * @brief 执行设备唤醒操作。 * - * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -83,7 +87,8 @@ interface IPowerInterface { /** * @brief 执行设备强制休眠操作。 * - * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -94,7 +99,8 @@ interface IPowerInterface { * * @param name 输入参数,运行锁的名称。 * - * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 * @deprecated 从4.0版本起废弃,使用{@link WriteWakeCount}替代。 @@ -106,7 +112,8 @@ interface IPowerInterface { * * @param name 输入参数,运行锁的名称。 * - * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 * @deprecated 从4.0版本起废弃,使用{@link WriteWakeCount}替代。 @@ -118,7 +125,8 @@ interface IPowerInterface { * * @param info 输出参数,电源的Dump信息。 * - * @return HDF_SUCCESS 表示操作成功,HDF_FAILED 表示失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -129,7 +137,8 @@ interface IPowerInterface { * * @param info 输入参数,运行锁信息。 * - * @return 成功返回 HDF_SUCCESS,失败返回 HDF_FAILED。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 4.0 */ @@ -140,7 +149,8 @@ interface IPowerInterface { * * @param info 输入参数,运行锁信息。 * - * @return 成功返回 HDF_SUCCESS,失败返回 HDF_FAILED。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 4.0 */ diff --git a/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl b/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl index 32932564..0c472157 100644 --- a/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl +++ b/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl @@ -56,7 +56,8 @@ interface IThermalInterface { * * @param freq 输入参数,设置CPU频率的值。 * - * @return HDF_SUCCESS 表示设置成功,HDF_FAILED 表示设置失败。 + * @return HDF_SUCCESS 表示设置成功。 + * @return HDF_FAILED 表示设置失败。 * * @since 3.1 */ @@ -67,7 +68,8 @@ interface IThermalInterface { * * @param freq 输入参数,设置GPU频率的值。 * - * @return HDF_SUCCESS 表示设置成功,HDF_FAILED 表示设置失败。 + * @return HDF_SUCCESS 表示设置成功。 + * @return HDF_FAILED 表示设置失败。 * * @since 3.1 */ @@ -78,7 +80,8 @@ interface IThermalInterface { * * @param current 输入参数,充电电流,单位毫安。 * - * @return HDF_SUCCESS 表示设置成功,HDF_FAILED 表示设置失败。 + * @return HDF_SUCCESS 表示设置成功。 + * @return HDF_FAILED 表示设置失败。 * * @since 3.1 */ @@ -89,7 +92,8 @@ interface IThermalInterface { * * @param event 输出参数,设备发热信息,包括器件类型、器件温度。 * - * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_FAILED 表示获取失败。 * @see HdfThermalCallbackInfo * * @since 3.1 @@ -101,7 +105,8 @@ interface IThermalInterface { * * @param num 输入参数,CPU内核编号。 * - * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_FAILED 表示获取失败。 * * @since 4.0 */ @@ -112,7 +117,9 @@ interface IThermalInterface { * * @param callbackObj 输入参数,要注册的回调函数。 * - * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_FAILED 表示获取失败。 + * * @see IThermalCallback * * @since 3.1 @@ -122,7 +129,8 @@ interface IThermalInterface { /** * @brief 注册设备热状态回调。 * - * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_FAILED 表示获取失败。 * * @since 3.1 */ @@ -133,7 +141,8 @@ interface IThermalInterface { * * @param callbackObj 输入参数,要注册的回调函数。 * - * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_FAILED 表示获取失败。 * @see IFanCallback * * @since 4.0 @@ -143,7 +152,8 @@ interface IThermalInterface { /** * @brief 取消注册风扇故障检测的回调。 * - * @return HDF_SUCCESS 表示获取成功,HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_FAILED 表示获取失败。 * * @since 4.0 */ -- Gitee From 4e37f62797e47f304dbc4933e1cf9f3f497bfc68 Mon Sep 17 00:00:00 2001 From: chunsen Date: Fri, 1 Dec 2023 16:27:11 +0800 Subject: [PATCH 0132/2135] add power_manager IDL translation Signed-off-by: chunsen --- .../hdi/battery/v1_1/IBatteryInterface.idl | 17 +++++++++++++++ zh-cn/device_api/hdi/battery/v1_1/Types.idl | 9 +++++--- .../hdi/battery/v1_2/IBatteryInterface.idl | 21 +++++++++++++++++++ zh-cn/device_api/hdi/battery/v1_2/Types.idl | 9 +++++--- 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl index bd27ecf0..0a161640 100644 --- a/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl +++ b/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl @@ -55,6 +55,7 @@ interface IBatteryInterface { * @param 注册事件的回调。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -64,6 +65,7 @@ interface IBatteryInterface { * @brief 取消注册电池信息的回调。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -75,6 +77,7 @@ interface IBatteryInterface { * @param path 输入参数,电池信息节点的路径。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -86,6 +89,7 @@ interface IBatteryInterface { * @param capacity 输出参数,表示电量的百分比值 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -97,6 +101,7 @@ interface IBatteryInterface { * @param voltage 输出参数,表示电池的电压。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -108,6 +113,7 @@ interface IBatteryInterface { * @param temperature 输出参数,表示电池温度 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -119,6 +125,7 @@ interface IBatteryInterface { * @param healthState 输出参数,表示电池健康状态。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryHealthState * * @since 3.1 @@ -131,6 +138,7 @@ interface IBatteryInterface { * @param pluggedType 输出参数,表示充电设备类型。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryPluggedType * * @since 3.1 @@ -143,6 +151,7 @@ interface IBatteryInterface { * @param chargeState 输出参数,表示充电状态。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryChargeState * * @since 3.1 @@ -155,6 +164,7 @@ interface IBatteryInterface { * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -166,6 +176,7 @@ interface IBatteryInterface { * @param technology 输出参数,当前电池技术型号。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -177,6 +188,7 @@ interface IBatteryInterface { * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -188,6 +200,7 @@ interface IBatteryInterface { * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -199,6 +212,7 @@ interface IBatteryInterface { * @param curNow 输出参数,表示电池的实时电流,单位毫安 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -210,6 +224,7 @@ interface IBatteryInterface { * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -221,6 +236,7 @@ interface IBatteryInterface { * @param info 输出参数,电池的全部信息。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryInfo * * @since 3.1 @@ -233,6 +249,7 @@ interface IBatteryInterface { * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.2 */ diff --git a/zh-cn/device_api/hdi/battery/v1_1/Types.idl b/zh-cn/device_api/hdi/battery/v1_1/Types.idl index 40381095..cad4d917 100644 --- a/zh-cn/device_api/hdi/battery/v1_1/Types.idl +++ b/zh-cn/device_api/hdi/battery/v1_1/Types.idl @@ -112,15 +112,15 @@ struct BatteryInfo { int voltage; /** 表示电池的温度 */ int temperature; - /** 表示电池的健康状态。 */ + /** 表示电池的健康状态,详情可参考{@link BatteryHealthState}。 */ int healthState; - /** 表示电池的充电设备类型。 */ + /** 表示电池的充电设备类型,详情可参考{@link BatteryPluggedType}。 */ int pluggedType; /** 表示电池的最大充电电流。 */ int pluggedMaxCurrent; /** 表示电池的最大充电电压。 */ int pluggedMaxVoltage; - /** 表示电池的充电状态。 */ + /** 表示电池的充电状态,详情可参考{@link BatteryChargeState}。 */ int chargeState; /** 表示电池的充电次数。 */ int chargeCounter; @@ -158,8 +158,11 @@ enum ChargingLimitType */ struct ChargingLimit { + /** 定义电池充电限制类型 */ enum ChargingLimitType type; + /** 限制协议描述 */ String protocol; + /** 选择限制类型,0-电流,1-电压 */ int value; }; /** @} */ diff --git a/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl index 5541ecab..6a212894 100644 --- a/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl +++ b/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl @@ -55,6 +55,7 @@ interface IBatteryInterface { * @param 注册事件的回调。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -64,6 +65,7 @@ interface IBatteryInterface { * @brief 取消注册电池信息的回调。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -75,6 +77,7 @@ interface IBatteryInterface { * @param path 输入参数,电池信息节点的路径。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -86,6 +89,7 @@ interface IBatteryInterface { * @param capacity 输出参数,表示电量的百分比值 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -97,6 +101,7 @@ interface IBatteryInterface { * @param voltage 输出参数,表示电池的电压。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -108,6 +113,7 @@ interface IBatteryInterface { * @param temperature 输出参数,表示电池温度 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -119,6 +125,7 @@ interface IBatteryInterface { * @param healthState 输出参数,表示电池健康状态。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryHealthState * * @since 3.1 @@ -131,6 +138,7 @@ interface IBatteryInterface { * @param pluggedType 输出参数,表示充电设备类型。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryPluggedType * * @since 3.1 @@ -143,6 +151,7 @@ interface IBatteryInterface { * @param chargeState 输出参数,表示充电状态。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryChargeState * * @since 3.1 @@ -155,6 +164,7 @@ interface IBatteryInterface { * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -166,6 +176,7 @@ interface IBatteryInterface { * @param technology 输出参数,当前电池技术型号。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -177,6 +188,7 @@ interface IBatteryInterface { * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -188,6 +200,7 @@ interface IBatteryInterface { * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -199,6 +212,7 @@ interface IBatteryInterface { * @param curNow 输出参数,表示电池的实时电流,单位毫安 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -210,6 +224,7 @@ interface IBatteryInterface { * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.1 */ @@ -221,6 +236,7 @@ interface IBatteryInterface { * @param info 输出参数,电池的全部信息。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * @see BatteryInfo * * @since 3.1 @@ -233,6 +249,7 @@ interface IBatteryInterface { * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 3.2 */ @@ -244,6 +261,7 @@ interface IBatteryInterface { * @param type 输出参数,充电器类型。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 4.0 */ @@ -257,6 +275,7 @@ interface IBatteryInterface { * @param value 输入参数,电池组配置值。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 4.1 */ @@ -270,6 +289,7 @@ interface IBatteryInterface { * @param value 输出参数,电池组配置值。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 4.1 */ @@ -283,6 +303,7 @@ interface IBatteryInterface { * @param value 输出参数,电源配置是否启用。 * * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_FAILED 表示注册失败。 * * @since 4.1 */ diff --git a/zh-cn/device_api/hdi/battery/v1_2/Types.idl b/zh-cn/device_api/hdi/battery/v1_2/Types.idl index d4f25b1d..d66f7a7c 100644 --- a/zh-cn/device_api/hdi/battery/v1_2/Types.idl +++ b/zh-cn/device_api/hdi/battery/v1_2/Types.idl @@ -112,15 +112,15 @@ struct BatteryInfo { int voltage; /** 表示电池的温度 */ int temperature; - /** 表示电池的健康状态。 */ + /** 表示电池的健康状态,详情可参考{@link BatteryHealthState}。 */ int healthState; - /** 表示电池的充电设备类型。 */ + /** 表示电池的充电设备类型,详情可参考{@link BatteryPluggedType}。 */ int pluggedType; /** 表示电池的最大充电电流。 */ int pluggedMaxCurrent; /** 表示电池的最大充电电压。 */ int pluggedMaxVoltage; - /** 表示电池的充电状态。 */ + /** 表示电池的充电状态,详情可参考{@link BatteryChargeState}。 */ int chargeState; /** 表示电池的充电次数。 */ int chargeCounter; @@ -158,8 +158,11 @@ enum ChargingLimitType */ struct ChargingLimit { + /** 定义电池充电限制类型 */ enum ChargingLimitType type; + /** 限制协议描述 */ String protocol; + /** 选择限制类型,0-电流,1-电压 */ int value; }; -- Gitee From cbc4954b25db2da01a80320ad614d46d1015935c Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Fri, 1 Dec 2023 17:03:13 +0800 Subject: [PATCH 0133/2135] update hdi audio interface Signed-off-by: xuxuehai --- .../device_api/hdi/audio/v1.1/AudioTypes.idl | 597 +++++++++++++++++ .../hdi/audio/v1.1/IAudioAdapter.idl | 333 ++++++++++ .../hdi/audio/v1.1/IAudioCallback.idl | 88 +++ .../hdi/audio/v1.1/IAudioCapture.idl | 479 ++++++++++++++ .../hdi/audio/v1.1/IAudioManager.idl | 114 ++++ .../hdi/audio/v1.1/IAudioRender.idl | 602 ++++++++++++++++++ 6 files changed, 2213 insertions(+) create mode 100644 zh-cn/device_api/hdi/audio/v1.1/AudioTypes.idl create mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioAdapter.idl create mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioCallback.idl create mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioCapture.idl create mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioManager.idl create mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl diff --git a/zh-cn/device_api/hdi/audio/v1.1/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1.1/AudioTypes.idl new file mode 100644 index 00000000..5b63e5da --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1.1/AudioTypes.idl @@ -0,0 +1,597 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file AudioTypes.idl + * + * @brief Audio模块接口定义中使用的数据类型。 + * + * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_1; + +/** + * @brief 音频端口的类型。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioPortDirection { + PORT_OUT = 1, /**< 音频输出端口。*/ + PORT_IN = 2, /**< 音频输入端口。 */ + PORT_OUT_IN = 3, /**< 音频输出输入端口。 */ +}; + +/** + * @brief 音频端口上的Pin脚。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioPortPin { + PIN_NONE = 0, /**< 无效端口。*/ + PIN_OUT_SPEAKER = 1 << 0, /**< 喇叭输出。 */ + PIN_OUT_HEADSET = 1 << 1, /**< 有线耳机输出。 */ + PIN_OUT_LINEOUT = 1 << 2, /**< Lineout输出。 */ + PIN_OUT_HDMI = 1 << 3, /**< HDMI输出。 */ + PIN_OUT_USB = 1 << 4, /**< USB输出。*/ + PIN_OUT_USB_EXT = 1 << 5, /**< USB外部声卡输出。*/ + PIN_OUT_EARPIECE = 1 << 5 | 1 << 4, /**< 有线耳机输出。 */ + PIN_OUT_BLUETOOTH_SCO = 1 << 6, /**< 蓝牙SCO输出 */ + PIN_OUT_DAUDIO_DEFAULT = 1 << 7, /**< 音频默认输出 */ + PIN_OUT_HEADPHONE = 1 << 8, /**< 有线耳机输出。*/ + PIN_OUT_USB_HEADSET = 1 << 9, /**< ARM USB输出 */ + PIN_OUT_BLUETOOTH_A2DP = 1 << 10, /**< 蓝牙A2DP输出 */ + PIN_IN_MIC = 1 << 27 | 1 << 0, /**< 麦克风输入 */ + PIN_IN_HS_MIC = 1 << 27 | 1 << 1, /**< 耳机麦克风输入 */ + PIN_IN_LINEIN = 1 << 27 | 1 << 2, /**< Linein输入。 */ + PIN_IN_USB_EXT = 1 << 27 | 1 << 3, /**< USB外部声卡输入。*/ + PIN_IN_BLUETOOTH_SCO_HEADSET = 1 << 27 | 1 << 4, /**< 蓝牙SCO耳机输入 */ + PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5, /**< 音频默认输入 */ + PIN_IN_USB_HEADSET = 1 << 27 | 1 << 6, /**< ARM USB输入 */ +}; + +/** + * @brief 音频类型(场景)。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioCategory { + AUDIO_IN_MEDIA = 0, /**< 媒体。 */ + AUDIO_IN_COMMUNICATION = 1, /**< 通信。 */ + AUDIO_IN_RINGTONE = 2, /**< 电话铃声。 */ + AUDIO_IN_CALL = 3, /**< 呼叫。 */ + AUDIO_MMAP_NOIRQ = 4, /**< Mmap模式 */ + AUDIO_OFFLOAD = 5, /**< 低功耗 */ + AUDIO_MULTI_CHANNEL = 6, /**< 多声道 */ +}; + +/** + * @brief 音频格式。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioFormat { + AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8bit位宽PCM(Pulse Code Modulation)格式。*/ + AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16bit位宽PCM格式。 */ + AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24bit位宽PCM格式。 */ + AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32bit位宽PCM格式。*/ + AUDIO_FORMAT_TYPE_PCM_FLOAT = 1 << 2 | 1 << 0, /**< PCM浮点格式 */ + AUDIO_FORMAT_TYPE_MP3 = 1 << 24, /**< MP3格式 */ + AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main格式 */ + AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC格式 */ + AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD格式 */ + AUDIO_FORMAT_TYPE_AAC_ELD = 1 << 24 | 1 << 2, /**< AAC ELD格式 */ + AUDIO_FORMAT_TYPE_AAC_HE_V1 = 1 << 24 | 1 << 2 | 1 << 0, /**< AAC HE_V1格式 */ + AUDIO_FORMAT_TYPE_AAC_HE_V2 = 1 << 24 | 1 << 2 | 1 << 1, /**< AAC HE_V2格式 */ + AUDIO_FORMAT_TYPE_G711A = 1 << 25 | 1 << 0, /**< PCM G711A格式 */ + AUDIO_FORMAT_TYPE_G711U = 1 << 25 | 1 << 1, /**< PCM G711u格式 */ + AUDIO_FORMAT_TYPE_G726 = 1 << 25 | 1 << 1 | 1 << 0, /**< PCM G726格式 */ +}; + +/** + *@brief 音频通道掩码。 + * + * 定义音频声道的位置掩码。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioChannelMask { + AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。 */ + AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< 声道布局前右。*/ + AUDIO_CHANNEL_MONO = 1, /**< 单声道。 */ + AUDIO_CHANNEL_STEREO = 3, /**< 立体声,由左右声道组成。 */ +}; + +/** + * @brief 音频采样频率掩码。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioSampleRatesMask { + AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< 无效的采样频率。 */ +}; + +/** + * @brief 音频端口的数据透传模式。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioPortPassthroughMode { + PORT_PASSTHROUGH_LPCM = 1 << 0, /**< 立体声PCM。*/ + PORT_PASSTHROUGH_RAW = 1 << 1, /**< HDMI透传。 */ + PORT_PASSTHROUGH_HBR2LBR = 1 << 2, /**< 蓝光次世代音频降规格输出。 */ + PORT_PASSTHROUGH_AUTO = 1 << 3, /**< 根据HDMI EDID能力自动匹配。 */ +}; + +/** + * @brief 原始音频样本格式。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioSampleFormat { + AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 32bit位宽浮点型非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F64P = 23, /**< 64bit位宽双精度浮点型非交织样本。 **/ +}; + +/** + * @brief 音频播放的通道模式。 + * + * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioChannelMode { + AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。 */ + AUDIO_CHANNEL_BOTH_LEFT = 1, /**< 两个声道全部为左声道声音。 */ + AUDIO_CHANNEL_BOTH_RIGHT = 2, /**< 两个声道全部为右声道声音。 */ + AUDIO_CHANNEL_EXCHANGE = 3, /**< 左右声道数据互换,左声道为右声道声音,右声道为左声道声音。*/ + AUDIO_CHANNEL_MIX = 4, /**< 左右两个声道输出为左右声道相加(混音)。 */ + AUDIO_CHANNEL_LEFT_MUTE = 5, /**< 左声道静音,右声道播放原右声道声音。 */ + AUDIO_CHANNEL_RIGHT_MUTE = 6, /**< 右声道静音,左声道播放原左声道声音。 */ + AUDIO_CHANNEL_BOTH_MUTE = 7, /**< 左右声道均静音。*/ +}; + +/** + * @brief 音频数据结束类型。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioDrainNotifyType { + AUDIO_DRAIN_NORMAL_MODE = 0, /**< 曲目的所有数据播放完就结束。 */ + AUDIO_DRAIN_EARLY_MODE = 1, /**< 曲目的所有数据未播放完就结束,以便给音频服务做连续性曲目切换留出时间。 */ +}; + +/** + * @brief 回调函数通知事件类型。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioCallbackType { + AUDIO_NONBLOCK_WRITE_COMPELETED = 0, /**< 非阻塞式写完成。 */ + AUDIO_DRAIN_COMPELETED = 1, /**< DrainBuffer完成,详情参考{@link DrainBuffer}。 */ + AUDIO_FLUSH_COMPLETED = 2, /**< Flush完成,详情参考{@link Flush}。 */ + AUDIO_RENDER_FULL = 3, /**< 录音缓冲区已满。 */ + AUDIO_ERROR_OCCUR = 4, /**< 发生了错误。 */ +}; + +/** + * @brief 音频端口角色。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioPortRole { + AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。 */ + AUDIO_PORT_SOURCE_ROLE = 1, /**< 指定端口为发送端角色。 */ + AUDIO_PORT_SINK_ROLE = 2, /**< 指定端口为接受端角色。 */ +}; + +/** + * @brief 音频端口类型。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioPortType { + AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。 */ + AUDIO_PORT_DEVICE_TYPE = 1, /**< 指定端口为设备类型。 */ + AUDIO_PORT_MIX_TYPE = 2, /**< 指定端口为复合类型。 */ + AUDIO_PORT_SESSION_TYPE = 3, /**< 指定端口为会话类型。 */ +}; + +/** + * @brief 端口会话类型。 + * + * @since 4.1 + * @version 1.1 + */ +enum AudioSessionType { + AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。 */ + AUDIO_OUTPUT_MIX_SESSION = 1, /**< 会话绑定到特定音轨。 */ + AUDIO_ALLOCATE_SESSION = 2, /**< 会话ID需重新申请。 */ + AUDIO_INVALID_SESSION = 3, /**< 无效会话类型。 */ +}; + +/** + * @brief 音频设备类型。 + */ +enum AudioDeviceType { + AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。 */ + AUDIO_HEADPHONE = 1 << 1, /**< 耳机。 */ + AUDIO_HEADSET = 1 << 2, /**< 头戴式耳机。 */ + AUDIO_USB_HEADSET = 1 << 3, /**< USB头戴式耳机。 */ + AUDIO_USB_HEADPHONE = 1 << 4, /**< USB耳机。 */ + AUDIO_USBA_HEADSET = 1 << 5, /**< USB模拟头戴式耳机。 */ + AUDIO_USBA_HEADPHONE = 1 << 6, /**< USB模拟耳机。 */ + AUDIO_PRIMARY_DEVICE = 1 << 7, /**< 主音频设备。 */ + AUDIO_USB_DEVICE = 1 << 8, /**< USB音频设备。 */ + AUDIO_A2DP_DEVICE = 1 << 9, /**< 蓝牙音频设备。 */ + AUDIO_HDMI_DEVICE = 1 << 10, /**< HDMI音频设备 */ + AUDIO_ADAPTER_DEVICE = 1 << 11, /**< 声卡设备 */ + AUDIO_DEVICE_UNKNOWN, /**< 未知设备。 */ +}; + +/** + * @brief 音频事件类型。 + */ +enum AudioEventType { + AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。 */ + AUDIO_DEVICE_REMOVE = 2, /**< 音频设备移除。 */ + AUDIO_LOAD_SUCCESS = 3, /**< 声卡加载成功。 */ + AUDIO_LOAD_FAILURE = 4, /**< 声卡加载失败。 */ + AUDIO_UNLOAD = 5, /**< 声卡卸载。 */ + AUDIO_SERVICE_VALID = 7, /**< 音频服务可用。 */ + AUDIO_SERVICE_INVALID = 8, /**< 音频服务不可用。 */ + AUDIO_CAPTURE_THRESHOLD = 9, /**< 录音阈值上报。 */ + AUDIO_EVENT_UNKNOWN = 10, /**< 未知事件。 */ +}; + +/** + * @brief 音频扩展参数键类型。 + */ +enum AudioExtParamKey { + AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。 */ + AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< 分布式音频-音量事件。 */ + AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< 分布式音频-焦点事件。 */ + AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< 分布式音频-媒体按钮事件。 */ + AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< 分布式音频-音频效果事件。 */ + AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< 分布式音频-设备状态事件。 */ + AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< USB设备类型( ARM 或 HIFI)*/ + AUDIO_EXT_PARAM_KEY_PERF_INFO = 201, /**< 分布式音频-dsp加载事件。 */ + AUDIO_EXT_PARAM_KEY_MMI = 301, /**< 分布式音频-主机接口测试。 */ + AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< 低电量事件。 */ +}; + +/** + * @brief 音频设备状态。 + */ +struct AudioDeviceStatus { + unsigned int pnpStatus; /**< PnP设备状态,详情参考{@link AudioDeviceType},{@link AudioEventType}。 */ +}; + +/** + * @brief 音频场景描述。 + */ +union SceneDesc { + unsigned int id; /**< 音频场景的ID,详情参考{@link AudioCategory}。*/ +}; + +/** + * @brief 音频端口。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioPort { + enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。 */ + unsigned int portId; /**< 音频端口的ID。 */ + String portName; /**< 音频端口的名称。 */ +}; + +/** + * @brief 音频适配器描述符。 + * + * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, + * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioAdapterDescriptor { + String adapterName; /**< 音频适配器的名称。 */ + struct AudioPort[] ports; /**< 一个音频适配器支持的端口列表,详情参考{@link AudioPort}。 */ +}; + +/** + * @brief 音频设备描述符。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioDeviceDescriptor { + unsigned int portId; /**< 音频端口ID。 */ + enum AudioPortPin pins; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ + String desc; /**< 以字符串命名的音频设备。 */ +}; + +/** + * @brief 音频场景描述符。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioSceneDescriptor { + union SceneDesc scene; /**< 音频场景描述,详情参考{@link SceneDesc}。 */ + struct AudioDeviceDescriptor desc; /**< 音频设备描述符,详情参考{@link AudioDeviceDescriptor}。 */ +}; + +/** + * @brief 音频输入类型. + */ +enum AudioInputType { + AUDIO_INPUT_DEFAULT_TYPE = 0, /**< 默认输入 */ + AUDIO_INPUT_MIC_TYPE = 1 << 0, /**< 麦克风输入 */ + AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, /**< 语音唤醒输入 */ + AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, /**< 通话 */ + AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< 声音识别 */ + AUDIO_INPUT_VOICE_UPLINK_TYPE = 1 << 4, /**< 上行输入 */ + AUDIO_INPUT_VOICE_DOWNLINK_TYPE = 1 << 5, /**< 下行输入 */ + AUDIO_INPUT_VOICE_CALL_TYPE = 1 << 6, /**< 电话 */ + AUDIO_INPUT_CAMCORDER_TYPE = 1 << 7, /**< 摄像机输入 */ +}; + +/** + * @brief 音频低功耗属性 + */ +struct AudioOffloadInfo +{ + unsigned int sampleRate; /**< 采样率 */ + unsigned int channelCount; /**< 声道数 */ + unsigned int bitRate; /**< 比特率 */ + unsigned int bitWidth; /**< 比特位宽 */ + enum AudioFormat format; /**< 音频格式 */ + unsigned int offloadBufferSize; /**< 音频数据缓存长度 */ + unsigned long duration; /** 音频持续时间,单位纳秒*/ +}; + +/** + * @brief 音频采样属性。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioSampleAttributes { + enum AudioCategory type; /**< 音频类型,详情参考{@link AudioCategory}。 */ + boolean interleaved; /**< 音频数据交织的标记。 */ + enum AudioFormat format; /**< 音频数据格式,详情参考{@link AudioFormat}。 */ + unsigned int sampleRate; /**< 音频采样频率。 */ + unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。*/ + unsigned int period; /**< 音频采样周期,单位赫兹。 */ + unsigned int frameSize; /**< 音频数据的帧大小。 */ + boolean isBigEndian; /**< 音频数据的大端标志。 */ + boolean isSignedData; /**< 音频数据有符号或无符号标志。 */ + unsigned int startThreshold; /**< 音频播放起始阈值。 */ + unsigned int stopThreshold; /**< 音频播放停止阈值。 */ + unsigned int silenceThreshold; /**< 录音缓冲区阈值。 */ + int streamId; /**< 录音或播放的标识符。 */ + int sourceType; /**< 播放或录音的音源类型 */ + struct AudioOffloadInfo offloadInfo; /**< offload流信息 */ +}; + +/** + * @brief 音频时间戳。 + * + * 时间定义,POSIX timespec的替代品。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioTimeStamp { + long tvSec; /**< tvSec时间,单位:秒。 */ + long tvNSec; /**< tvNSec时间,单位:纳秒。 */ +}; + +/** + * @brief 音频子端口的支持能力。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioSubPortCapability { + unsigned int portId; /**< 子端口ID。 */ + String desc; /**< 以字符串命名的子端口。 */ + enum AudioPortPassthroughMode mask; /**< 数据透传模式,详情参考{@link AudioPortPassthroughMode}。 */ +}; + +/** + * @brief 音频端口的支持能力。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioPortCapability { + unsigned int deviceType; /**< 设备输出、输入类型。 */ + unsigned int deviceId; /**< 设备ID,唯一的设备识别符。 */ + boolean hardwareMode; /**< 是否支持设备绑定处理。 */ + unsigned int formatNum; /**< 支持的音频格式数目。 */ + enum AudioFormat[] formats; /**< 支持的音频格式,详情参考{@link AudioFormat}。 */ + unsigned int sampleRateMasks; /**< 支持的音频采样频率(8k、16k、32k、48k)。 */ + enum AudioChannelMask channelMasks; /**< 设备的声道布局掩码,详情参考{@link AudioChannelMask}。 */ + unsigned int channelCount; /**< 最大支持的声道总数。 */ + struct AudioSubPortCapability[] subPorts; /**< 支持的子端口列表,详情参考{@link AudioSubPortCapability}。 */ + enum AudioSampleFormat[] supportSampleFormats; /**< 支持的采样率列表,详情参考{@link AudioSampleFormat}。 */ +}; + +/** + * @brief mmap缓冲区描述符。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioMmapBufferDescripter { + byte[] memoryAddress; /**< 指向mmap缓冲区的指针。 */ + FileDescriptor memoryFd; /**< mmap缓冲区的文件描述符。 */ + int totalBufferFrames; /**< 缓冲区总大小,单位:帧。 */ + int transferFrameSize; /**< 传输大小,单位:帧。 */ + int isShareable; /**< mmap缓冲区是否可以在进程间共享。 */ + unsigned int offset; /**< 文件偏移。 */ + String filePath; /**< mmap文件路径。 */ +}; + +/** + * @brief 音频设备拓展信息。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioDevExtInfo { + int moduleId; /**< 音频流绑定的模块ID。 */ + enum AudioPortPin type; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ + String desc; /**< 地址描述。 */ +}; + +/** + * @brief 音轨拓展信息。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioMixExtInfo { + int moduleId; /**< 流所属模块标识符。 */ + int streamId; /**< 由调用者传递的Render或Capture标识符。 */ +}; + +/** + * @brief 会话拓展信息。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioSessionExtInfo { + enum AudioSessionType sessionType; /**< 音频会话类型,详情参考{@link AudioSessionType}。 */ +}; + +/** + * @brief 音频端口特定信息。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioInfo { + struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。 */ + struct AudioMixExtInfo mix; /**< 音轨特定信息,详情参考{@link AudioMixExtInfo}。 */ + struct AudioSessionExtInfo session; /**< 会话特定信息,详情参考{@link AudioSessionExtInfo}。 */ +}; + +/** + * @brief 音频路由节点。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioRouteNode { + int portId; /**< 音频端口ID。 */ + enum AudioPortRole role; /**< 指定端口角色为发送端或接收端,详情参考{@link AudioPortRole}。 */ + enum AudioPortType type; /**< 指定端口类型可以为设备类型、复合类型、绘画类型,详情参考{@link AudioPortType}。 */ + struct AudioInfo ext; /**< 音频端口特定信息,详情参考{@link AudioInfo}。 */ +}; + +/** + * @brief 音频路由信息。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioRoute { + struct AudioRouteNode[] sources; /**< 发送端列表,详情参考{@link AudioRouteNode}。 */ + struct AudioRouteNode[] sinks; /**< 接受端列表,详情参考{@link AudioRouteNode}。 */ +}; + +/** + * @brief 音频事件。 + * + * @since 4.1 + * @version 1.1 + */ +struct AudioEvent { + unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。 */ + unsigned int deviceType; /**< 设备类型,详情参考{@link enum AudioDeviceType}。 */ +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioAdapter.idl new file mode 100644 index 00000000..22c45510 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1.1/IAudioAdapter.idl @@ -0,0 +1,333 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioAdapter.idl + * + * @brief Audio适配器的接口定义文件。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_1; + +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioRender; +import ohos.hdi.audio.v1_1.IAudioCapture; +import ohos.hdi.audio.v1_1.IAudioCallback; + +/** + * @brief AudioAdapter音频适配器接口。 + * + * 提供音频适配器(声卡)对外支持的驱动能力,包括初始化端口、创建放音、创建录音、获取端口能力集等。 + * + * @see IAudioRender + * @see IAudioCapture + * + * @since 4.1 + * @version 1.1 + */ +interface IAudioAdapter { + /** + * @brief 初始化一个音频适配器所有的端口驱动。 + * 在音频服务中,调用其他驱动接口前需要先调用该接口检查端口是否已经初始化完成,如果端口没有初始化完成, + * 则需要等待一段时间(例如100ms)后重新进行检查,直到端口初始化完成后再继续操作。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * + * @return 初始化完成返回值0,初始化失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + InitAllPorts(); + + /** + * @brief 创建一个音频播放接口的对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@link IAudioRender}。 + * @param renderId 获取的音频播放接口序号。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetPortCapability + * @see DestroyRender + * + * @since 4.1 + * @version 1.1 + */ + CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioRender render, [out] unsigned int renderId); + + /** + * @brief 销毁一个音频播放接口的对象。 + * + * @attention 在音频播放过程中,不能销毁该接口对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param renderId 待销毁的音频播放接口的序号 + * + * @return 成功返回值0,失败返回负值。 + * @see CreateRender + * + * @since 4.1 + * @version 1.1 + */ + DestroyRender([in] unsigned int renderId); + + /** + * @brief 创建一个音频录音接口的对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@link IAudioCapture}。 + * @param captureId 获取的音频录音接口的序号 + * @return 成功返回值0,失败返回负值。 + * + * @see GetPortCapability + * @see DestroyCapture + + * @since 4.1 + * @version 1.1 + */ + CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioCapture capture, [out] unsigned int captureId); + + /** + * @brief 销毁一个音频录音接口的对象。 + * + * @attention 在音频录音过程中,不能销毁该接口对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param captureId 待销毁的音频录音接口的序号 + * + * @return 成功返回值0,失败返回负值。 + * @see CreateCapture + * + * @since 4.1 + * @version 1.1 + */ + DestroyCapture([in] unsigned int captureId); + + /** + * @brief 获取一个音频适配器的端口驱动的能力集。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param capability 获取的端口能力保存到capability中,详请参考{@link AudioPortCapability}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); + + /** + * @brief 设置音频端口驱动的数据透传模式。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待设置的端口,详请参考{@link AudioPort}。 + * @param mode 待设置的传输模式,详请参考{@link AudioPortPassthroughMode}。 + * @return 成功返回值0,失败返回负值。 + * @see GetPassthroughMode + * + * @since 4.1 + * @version 1.1 + */ + SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); + + /** + * @brief 获取音频端口驱动的数据透传模式。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param mode 获取的传输模式保存到mode中,详请参考{@link AudioPortPassthroughMode}。 + * @return 成功返回值0,失败返回负值。 + * @see SetPassthroughMode + * + * @since 4.1 + * @version 1.1 + */ + GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); + + /** + * @brief 获取一个音频适配器的设备状态。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param status 获取的设备状态保存到status中,详请参考{@link AudioDeviceStatus}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetDeviceStatus([out] struct AudioDeviceStatus status); + + /** + * @brief 更新音频路由。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param route 待更新的路由,详请参考{@link AudioRoute}。 + * @param routeHandle 更新后的音频路由句柄保存到routeHandle中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); + + /** + * @brief 释放音频路由。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param routeHandle 待释放的音频路由句柄。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + ReleaseAudioRoute([in] int routeHandle); + + /** + * @brief 设置音频静音。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param mute 表示是否将音频静音,true表示静音,false表示非静音。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMicMute + * + * @since 4.1 + * @version 1.1 + */ + SetMicMute([in] boolean mute); + + /** + * @brief 获取音频静音状态。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param mute 获取的静音状态保存到mute中,true表示静音,false表示非静音。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMicMute + * + * @since 4.1 + * @version 1.1 + */ + GetMicMute([out] boolean mute); + + /** + * @brief 设置语音呼叫的音量。 + * + * 音量范围从0.0到1.0。如果音频服务中的音量水平在0到15的范围内, + * 0.0表示音频静音,1.0指示最大音量级别(15)。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param volume 待设置的音量值,范围为(0.0-1.0),0.0表示最小音量值,1.0表示最大音量值。 + * @return 成功返回值0,失败返回负值。 + * @see GetVolume + * + * @since 4.1 + * @version 1.1 + */ + SetVoiceVolume([in] float volume); + + /** + * @brief 根据指定的条件设置音频拓展参数。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 指定的扩展参数查询条件。 + * @param value 指定的扩展参数条件值。 + * + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待设置的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待设置的音频扩展参数相关的音量类型。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); + + /** + * @brief 根据指定条件获取音频扩展参数的取值。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 指定的扩展参数查询条件。 + * @param value 待返回的指定扩展参数条件的当前值。 + * @param lenth value的长度 + * + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待查询的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待查询的音频扩展参数相关的音量类型。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); + + /** + * @brief 注册扩展参数回调函数。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param callback 待注册的回调函数,详请参考{@link AudioCallback}。 + * @param cookie 用于传递数据。 + * @return 成功返回值0,失败返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioCallback.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioCallback.idl new file mode 100644 index 00000000..f0386451 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1.1/IAudioCallback.idl @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioCallback.idl + * + * @brief Audio播放的回调函数定义文件。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_1; + +import ohos.hdi.audio.v1_1.AudioTypes; + +/** + * @brief Audio回调接口。 + * + * @since 4.1 + * @version 1.1 + */ +[callback] interface IAudioCallback { + + /** + * @brief 放音回调函数。 + * + * @param type 回调函数通知事件类型,详请参考{@link AudioCallbackType}。 + * @param reserved 保留字段。 + * @param cookie 用于传递数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 1.1 + */ + RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); + /** + * @brief 音频扩展参数回调函数。 + * + * @param key 扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 扩展参数条件。 + * @param value 扩展参数条件的值 + * @param reserved 保留字段。 + * @param cookie 用于传递数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see ParamCallback + * + * @since 4.1 + * @version 1.1 + */ + ParamCallback([in] enum AudioExtParamKey key, [in] byte condition, [in] byte value, [out] byte reserved, [out] byte cookie); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioCapture.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioCapture.idl new file mode 100644 index 00000000..99fec85d --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1.1/IAudioCapture.idl @@ -0,0 +1,479 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioCapture.idl + * + * @brief Audio录音的接口定义文件。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_0; + +import ohos.hdi.audio.v1_1.AudioTypes; + + +/** + * @brief AudioCapture音频录音接口。 + * + * 提供音频录音支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、录制音频帧数据等。 + * + * @since 4.1 + * @version 1.1 + */ +interface IAudioCapture { + /** + * @brief 从音频驱动中录制一帧输入数据(录音,音频上行数据)。 + * + * @param capture 调用当前函数的IAudioCapture指针对象 + * @param frame 待存放输入数据的音频frame。 + * @param requestBytes 待存放输入数据的音频frame大小(字节数)。 + * @param replyBytes 指向要读取的音频数据的实际长度(以字节为单位)的指针。 + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief Obtains the last number of input audio frames. + * + * @param capture 调用当前函数的IAudioCapture指针对象 + * @param frames 获取的音频帧数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * @return 成功返回值0,失败返回负值。 + * @see CaptureFrame + * + * @since 4.1 + * @version 1.1 + */ + GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 判断某个音频场景能力是否支持。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.1 + * @version 1.1 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
      + *
    • 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
        + *
      • 在媒体播放场景中,scene为media_speaker。
      • + *
      • 在语音通话免提场景中,scene为voice_speaker。
      • + *
      + *
    • 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • + *
    • 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • + *
    + * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.1 + * @version 1.1 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.1 + * @version 1.1 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.1 + * @version 1.1 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级范围是0 ~ 15, + * 则音量的映射关系为0.0(或0)表示静音,1.0(或15)表示最大音量等级。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.1 + * @version 1.1 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
      + *
    • 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • + *
    • 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音(-50db),1.0表示最大增益(6db)。
    • + *
    + * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.1 + * @version 1.1 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.1 + * @version 1.1 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.1 + * @version 1.1 + */ + SetGain([in] float gain); + + /** + * @brief 获取一帧音频数据的长度(字节数)大小。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.1 + * @version 1.1 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.1 + * @version 1.1 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小,单位:字节。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); + + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.1 + * @version 1.1 + */ + Start(); + + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.1 + * @version 1.1 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.1 + * @version 1.1 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.1 + * @version 1.1 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,再次执行后去设置待机模式成功返回正值,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + TurnStandbyMode(); + + /** + * @brief 保存音频设备信息。 + * + * @param range 需要保存的信息范围(3 ~ 5),分为简要信息(3)、一般信息(4)、全量信息(5)。 + * @param fd 保存到指定的目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频录制的暂停和恢复功能。 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioManager.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioManager.idl new file mode 100644 index 00000000..18e0b730 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1.1/IAudioManager.idl @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioManager.idl + * + * @brief Audio适配器管理及加载的接口定义文件。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_0; + +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioAdapter; + +/** + * @brief AudioManager音频适配器管理接口。 + * + * 按照音频服务下发的音频适配器(声卡)描述符加载一个具体的音频适配器驱动程序。 + * + * @see IAudioAdapter + * + * @since 4.1 + * @version 1.1 + */ +interface IAudioManager { + + /** + * @brief 获取音频驱动中支持的所有适配器的列表。 + * + * @param descs 获取到的音频适配器列表保存到descs中,详请参考{@link AudioAdapterDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see LoadAdapter + * + * @since 4.1 + * @version 1.1 + */ + GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); + + /** + * @brief 加载一个音频适配器(声卡)的驱动。 + * + * 加载一个具体的音频驱动,例如usb驱动,在具体实现中可能加载的是一个动态链接库(*.so)。 + * + * @param desc 待加载的音频适配器描述符,详请参考{@link AudioAdapterDescriptor}。 + * @param adapter 获取的音频适配器接口的对象实例保存到adapter中,详请参考{@link IAudioAdapter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetAllAdapters + * @see UnloadAdapter + * + * @since 4.1 + * @version 1.1 + */ + LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); + + /** + * @brief 卸载音频适配器(声卡)的驱动。 + * + * @param adapterName 待卸载的音频适配器接口的对象名称。 + * + * @see LoadAdapter + * + * @since 4.1 + * @version 1.1 + */ + UnloadAdapter([in] String adapterName); + + /** + * @brief 释放音频管理接口对象。 + * + * @return 功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + ReleaseAudioManagerObject(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl new file mode 100644 index 00000000..f4c4acf5 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl @@ -0,0 +1,602 @@ +/* + * 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. + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_1; + +/** + * @addtogroup Audio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IAudioRender.idl + * + * @brief Audio播放的接口定义文件。 + * + * @since 4.1 + * @version 1.1 + */ + +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioCallback; + +/** + * @brief AudioRender音频播放接口。 + * + * 提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据等。 + * + * @since 4.1 + * @version 1.1 + */ +interface IAudioRender { + /** + * @brief 获取音频硬件驱动的延迟时间。 + * + * @param ms 获取的延迟时间(单位:毫秒)保存到ms中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetLatency([out] unsigned int ms); + + /** + * @brief 向音频驱动中播放一帧输出数据(放音,音频下行数据)。 + * + * @param frame 待写入的输出数据的音频frame。 + * @param replyBytes 实际写入的音频数据长度(字节数),获取后保存到replyBytes中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief 获取音频已输出的帧数。 + * + * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 + * @param time 获取的关联时间戳保存到time中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RenderFrame + * + * @since 4.1 + * @version 1.1 + */ + GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 设置一个音频的播放速度。 + * + * @param speed 待设置的播放速度(倍速),例0.5、0.75、1.0、1.25、1.5、2.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetRenderSpeed + * + * @since 4.1 + * @version 1.1 + */ + SetRenderSpeed([in] float speed); + + /** + * @brief 获取一个音频当前的播放速度。 + * + * @param speed 获取的播放速度保存到speed中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetRenderSpeed + * + * @since 4.1 + * @version 1.1 + */ + GetRenderSpeed([out] float speed); + + /** + * @brief 设置音频播放的通道模式。 + * + * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetChannelMode + * + * @since 4.1 + * @version 1.1 + */ + SetChannelMode([in] enum AudioChannelMode mode); + + /** + * @brief 获取音频播放当前的通道模式。 + * + * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetChannelMode + * + * @since 4.1 + * @version 1.1 + */ + GetChannelMode([out] enum AudioChannelMode mode); + + /** + * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 + * + * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 + * @param cookie 回调函数的入参。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 1.1 + */ + RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); + + /** + * @brief 排空缓冲区中的数据。 + * + * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 1.1 + */ + DrainBuffer([out] enum AudioDrainNotifyType type); + + /** + * @brief 判断是否支持清空缓冲区数据的功能。 + * + * @param support 是否支持的状态保存到support中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + IsSupportsDrain([out] boolean support); + /** + * @brief 是否支持某个音频场景的配置。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.1 + * @version 1.1 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
      + *
    • 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
        + *
      • 在媒体播放场景scene为media_speaker。
      • + *
      • 在语音通话免提场景scene为voice_speaker。
      • + *
      + *
    • 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • + *
    • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • + *
    + * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.1 + * @version 1.1 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.1 + * @version 1.1 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.1 + * @version 1.1 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), + * 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15)。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.1 + * @version 1.1 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
      + *
    • 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • + *
    • 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db)。
    • + *
    + * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.1 + * @version 1.1 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.1 + * @version 1.1 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.1 + * @version 1.1 + */ + SetGain([in] float gain); + + /** + * @brief 获取音频帧的大小。 + * + * 获取一帧音频数据的长度(字节数)。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.1 + * @version 1.1 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) + * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.1 + * @version 1.1 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + ReqMmapBuffer([in] int reqSize, [in] struct AudioMmapBufferDescripter desc); + + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.1 + * @version 1.1 + */ + Start(); + + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.1 + * @version 1.1 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.1 + * @version 1.1 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.1 + * @version 1.1 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,失败返回负值;设置取消设备待机模式成功返回正值,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + TurnStandbyMode(); + + /** + * @brief Dump音频设备信息。 + * + * @param range Dump信息范围,分为简要信息、全量信息。 + * @param fd 指定Dump目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频播放的暂停和恢复功能 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); + + /** + * @brief 设置低功耗模式缓存长度。 + * + * @param size 包含音频数据的缓存长度。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.1 + */ + SetBufferSize([in] unsigned int size); +} +/** @} */ -- Gitee From fd56149a209a461e257c912727b1a892476ef4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Fri, 1 Dec 2023 09:10:13 +0000 Subject: [PATCH 0134/2135] update zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl index f4c4acf5..acdea6d0 100644 --- a/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl +++ b/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl @@ -13,14 +13,6 @@ * limitations under the License. */ -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - /** * @addtogroup Audio * @{ @@ -42,6 +34,14 @@ package ohos.hdi.audio.v1_1; * @version 1.1 */ +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.audio.v1_1; + import ohos.hdi.audio.v1_1.AudioTypes; import ohos.hdi.audio.v1_1.IAudioCallback; -- Gitee From 3d9bad9a0c3727ff05203a6d2d0b020602db7ed3 Mon Sep 17 00:00:00 2001 From: chunsen Date: Fri, 1 Dec 2023 17:32:16 +0800 Subject: [PATCH 0135/2135] add power_manager IDL translation Signed-off-by: chunsen --- .../hdi/battery/v1_0/IBatteryInterface.idl | 48 ++- .../hdi/battery/v1_1/IBatteryInterface.idl | 68 ++-- .../hdi/battery/v1_2/IBatteryCallback.idl | 2 +- .../hdi/battery/v1_2/IBatteryInterface.idl | 84 ++--- .../hdi/battery/v2_0/IBatteryCallback.idl | 2 +- .../battery/v2_0/IBatteryInterface copy.idl | 312 ++++++++++++++++++ .../hdi/power/v1_0/IPowerInterface.idl | 9 +- .../hdi/thermal/v1_0/IThermalInterface.idl | 18 +- .../hdi/thermal/v1_1/IThermalInterface.idl | 36 +- 9 files changed, 460 insertions(+), 119 deletions(-) create mode 100644 zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface copy.idl diff --git a/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl index 873cca92..2ba0e4e5 100644 --- a/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl +++ b/zh-cn/device_api/hdi/battery/v1_0/IBatteryInterface.idl @@ -54,7 +54,8 @@ interface IBatteryInterface { * * @param event 输入参数,服务注册的回调。 * - * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -63,7 +64,8 @@ interface IBatteryInterface { /** * @brief 取消注册电池信息的回调。 * - * @return HDF_SUCCESS 表示取消注册成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -74,7 +76,8 @@ interface IBatteryInterface { * * @param path 输入参数,电池信息节点的路径。 * - * @return HDF_SUCCESS 表示路径设置成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -85,7 +88,8 @@ interface IBatteryInterface { * * @param capacity 输出参数,表示电量的百分比值。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -96,7 +100,8 @@ interface IBatteryInterface { * * @param voltage 输出参数,表示电池的电压。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -107,7 +112,8 @@ interface IBatteryInterface { * * @param temperature 输出参数,表示电池温度。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -118,7 +124,8 @@ interface IBatteryInterface { * * @param healthState 输出参数,表示电池健康状态。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryHealthState * * @since 3.1 @@ -130,7 +137,8 @@ interface IBatteryInterface { * * @param pluggedType 输出参数,表示充电设备类型。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryPluggedType * * @since 3.1 @@ -142,7 +150,8 @@ interface IBatteryInterface { * * @param chargeState 输出参数,表示充电状态。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryChargeState * * @since 3.1 @@ -154,7 +163,8 @@ interface IBatteryInterface { * * @param present 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -165,7 +175,8 @@ interface IBatteryInterface { * * @param technology 输出参数,当前电池技术型号。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -176,7 +187,8 @@ interface IBatteryInterface { * * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -187,7 +199,8 @@ interface IBatteryInterface { * * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -198,7 +211,8 @@ interface IBatteryInterface { * * @param curNow 输出参数,表示电池的实时电流,单位毫安。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -209,7 +223,8 @@ interface IBatteryInterface { * * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -220,7 +235,8 @@ interface IBatteryInterface { * * @param info 输出参数,电池的全部信息。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryInfo * * @since 3.1 diff --git a/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl index 0a161640..07a8a4f2 100644 --- a/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl +++ b/zh-cn/device_api/hdi/battery/v1_1/IBatteryInterface.idl @@ -54,8 +54,8 @@ interface IBatteryInterface { * * @param 注册事件的回调。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -64,8 +64,8 @@ interface IBatteryInterface { /** * @brief 取消注册电池信息的回调。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -76,8 +76,8 @@ interface IBatteryInterface { * * @param path 输入参数,电池信息节点的路径。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -88,8 +88,8 @@ interface IBatteryInterface { * * @param capacity 输出参数,表示电量的百分比值 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -100,8 +100,8 @@ interface IBatteryInterface { * * @param voltage 输出参数,表示电池的电压。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -112,8 +112,8 @@ interface IBatteryInterface { * * @param temperature 输出参数,表示电池温度 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -124,8 +124,8 @@ interface IBatteryInterface { * * @param healthState 输出参数,表示电池健康状态。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryHealthState * * @since 3.1 @@ -137,8 +137,8 @@ interface IBatteryInterface { * * @param pluggedType 输出参数,表示充电设备类型。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryPluggedType * * @since 3.1 @@ -150,8 +150,8 @@ interface IBatteryInterface { * * @param chargeState 输出参数,表示充电状态。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryChargeState * * @since 3.1 @@ -163,8 +163,8 @@ interface IBatteryInterface { * * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -175,8 +175,8 @@ interface IBatteryInterface { * * @param technology 输出参数,当前电池技术型号。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -187,8 +187,8 @@ interface IBatteryInterface { * * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -199,8 +199,8 @@ interface IBatteryInterface { * * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -211,8 +211,8 @@ interface IBatteryInterface { * * @param curNow 输出参数,表示电池的实时电流,单位毫安 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -223,8 +223,8 @@ interface IBatteryInterface { * * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -235,8 +235,8 @@ interface IBatteryInterface { * * @param info 输出参数,电池的全部信息。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryInfo * * @since 3.1 @@ -248,8 +248,8 @@ interface IBatteryInterface { * * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.2 */ diff --git a/zh-cn/device_api/hdi/battery/v1_2/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v1_2/IBatteryCallback.idl index 3838584b..61e8613d 100644 --- a/zh-cn/device_api/hdi/battery/v1_2/IBatteryCallback.idl +++ b/zh-cn/device_api/hdi/battery/v1_2/IBatteryCallback.idl @@ -57,7 +57,7 @@ import ohos.hdi.battery.v1_2.Types; * * * @param 输入参数,事件 电池信息,如电池电量、电压和健康状态。 - * @see 电池信息。 + * @see BatteryInfo * * @since 3.1 */ diff --git a/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl b/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl index 6a212894..cf958a32 100644 --- a/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl +++ b/zh-cn/device_api/hdi/battery/v1_2/IBatteryInterface.idl @@ -54,8 +54,8 @@ interface IBatteryInterface { * * @param 注册事件的回调。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -64,8 +64,8 @@ interface IBatteryInterface { /** * @brief 取消注册电池信息的回调。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -76,8 +76,8 @@ interface IBatteryInterface { * * @param path 输入参数,电池信息节点的路径。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -88,8 +88,8 @@ interface IBatteryInterface { * * @param capacity 输出参数,表示电量的百分比值 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -100,8 +100,8 @@ interface IBatteryInterface { * * @param voltage 输出参数,表示电池的电压。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -112,8 +112,8 @@ interface IBatteryInterface { * * @param temperature 输出参数,表示电池温度 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -124,8 +124,8 @@ interface IBatteryInterface { * * @param healthState 输出参数,表示电池健康状态。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryHealthState * * @since 3.1 @@ -137,8 +137,8 @@ interface IBatteryInterface { * * @param pluggedType 输出参数,表示充电设备类型。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryPluggedType * * @since 3.1 @@ -150,8 +150,8 @@ interface IBatteryInterface { * * @param chargeState 输出参数,表示充电状态。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryChargeState * * @since 3.1 @@ -163,8 +163,8 @@ interface IBatteryInterface { * * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -175,8 +175,8 @@ interface IBatteryInterface { * * @param technology 输出参数,当前电池技术型号。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -187,8 +187,8 @@ interface IBatteryInterface { * * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -199,8 +199,8 @@ interface IBatteryInterface { * * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -211,8 +211,8 @@ interface IBatteryInterface { * * @param curNow 输出参数,表示电池的实时电流,单位毫安 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -223,8 +223,8 @@ interface IBatteryInterface { * * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -235,8 +235,8 @@ interface IBatteryInterface { * * @param info 输出参数,电池的全部信息。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see BatteryInfo * * @since 3.1 @@ -248,8 +248,8 @@ interface IBatteryInterface { * * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.2 */ @@ -260,8 +260,8 @@ interface IBatteryInterface { * * @param type 输出参数,充电器类型。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 4.0 */ @@ -274,8 +274,8 @@ interface IBatteryInterface { * * @param value 输入参数,电池组配置值。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 4.1 */ @@ -288,8 +288,8 @@ interface IBatteryInterface { * * @param value 输出参数,电池组配置值。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 4.1 */ @@ -302,8 +302,8 @@ interface IBatteryInterface { * * @param value 输出参数,电源配置是否启用。 * - * @return HDF_SUCCESS 表示注册成功。 - * @return HDF_FAILED 表示注册失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 4.1 */ diff --git a/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl index c234566e..e64fd21c 100644 --- a/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl +++ b/zh-cn/device_api/hdi/battery/v2_0/IBatteryCallback.idl @@ -57,7 +57,7 @@ import ohos.hdi.battery.v2_0.Types; * * * @param 事件 电池信息,如电池电量、电压和健康状态。 - * @see 电池信息。 + * @see BatteryInfo * * @since 3.1 */ diff --git a/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface copy.idl b/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface copy.idl new file mode 100644 index 00000000..cf958a32 --- /dev/null +++ b/zh-cn/device_api/hdi/battery/v2_0/IBatteryInterface copy.idl @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup battery + * @{ + * + * @brief 提供获取、订阅电池信息的接口。 + * + * 电池模块为电池服务提供的获取、订阅电池信息的接口。 + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file IBatteryInterface.idl + * + * @brief 获取、订阅电池信息的接口。 + * + * 服务获取此模块的对象或代理后,可以调用相关的接口获取、订阅电池信息。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.battery.v1_2; + +import ohos.hdi.battery.v1_2.Types; +import ohos.hdi.battery.v1_2.IBatteryCallback; + +/** + * @brief 获取、订阅电池信息的接口。 + * + * + * + * @since 3.1 + */ +interface IBatteryInterface { + /** + * @brief 注册电池信息的回调。 + * + * @param 注册事件的回调。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + Register([in] IBatteryCallback event); + + /** + * @brief 取消注册电池信息的回调。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + UnRegister(); + + /** + * @brief 设置电池信息节点的路径。 + * + * @param path 输入参数,电池信息节点的路径。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + ChangePath([in] String path); + + /** + * @brief 获取电池的电量百分比。 + * + * @param capacity 输出参数,表示电量的百分比值 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetCapacity([out] int capacity); + + /** + * @brief 获取电池的电压。 + * + * @param voltage 输出参数,表示电池的电压。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetVoltage([out] int voltage); + + /** + * @brief 获取电池的充电温度,单位0.1摄氏度。 + * + * @param temperature 输出参数,表示电池温度 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetTemperature([out] int temperature); + + /** + * @brief 获取电池的健康状态。 + * + * @param healthState 输出参数,表示电池健康状态。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * @see BatteryHealthState + * + * @since 3.1 + */ + GetHealthState([out] enum BatteryHealthState healthState); + + /** + * @brief 获取充电设备类型。 + * + * @param pluggedType 输出参数,表示充电设备类型。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * @see BatteryPluggedType + * + * @since 3.1 + */ + GetPluggedType([out] enum BatteryPluggedType pluggedType); + + /** + * @brief 获取充电状态。 + * + * @param chargeState 输出参数,表示充电状态。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * @see BatteryChargeState + * + * @since 3.1 + */ + GetChargeState([out] enum BatteryChargeState chargeState); + + /** + * @brief 获取是否支持电池或者电池是否在位。 + * + * @param 输出参数,表示是否支持电池或者电池是否在位。true表示支持或在位,false表示不支持或不在位。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetPresent([out] boolean present); + + /** + * @brief 获取电池的技术型号。 + * + * @param technology 输出参数,当前电池技术型号。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetTechnology([out] String technology); + + /** + * @brief 获取电池的总容量。 + * + * @param totalEnergy 输出参数,表示电池的总容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetTotalEnergy([out] int totalEnergy); + + /** + * @brief 获取电池的平均电流。 + * + * @param totalEnergy 输出参数,表示电池的平均电流,单位毫安。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetCurrentAverage([out] int curAverage); + + /** + * @brief 获取电池的实时电流。 + * + * @param curNow 输出参数,表示电池的实时电流,单位毫安 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetCurrentNow([out] int curNow); + + /** + * @brief 获取电池的剩余容量。 + * + * @param remainEnergy 输出参数,表示电池的剩余容量,单位毫安时。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.1 + */ + GetRemainEnergy([out] int remainEnergy); + + /** + * @brief 获取电池的全部信息。 + * + * @param info 输出参数,电池的全部信息。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * @see BatteryInfo + * + * @since 3.1 + */ + GetBatteryInfo([out] struct BatteryInfo info); + + /** + * @brief 设置电池充电电流或电压限制。 + * + * @param ChargingLimit 输入参数,对电池充电电流或电压的限制。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 3.2 + */ + SetChargingLimit([in] struct ChargingLimit[] chargingLimit); + + /** + * @brief 获取插入的充电器类型。 + * + * @param type 输出参数,充电器类型。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 4.0 + */ + GetChargeType([out] enum ChargeType type); + + /** + * @brief 根据场景名称设置电池配置 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输入参数,电池组配置值。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 4.1 + */ + SetBatteryConfig([in] String sceneName, [in] String value); + + /** + * @brief 根据场景名称获取电池配置 。 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输出参数,电池组配置值。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 4.1 + */ + GetBatteryConfig([in] String sceneName, [out] String value); + + /** + * @brief 通过场景名称检查电池配置是否启用 + * + * @param sceneName 输入参数,电池充电场景名称。 + * + * @param value 输出参数,电源配置是否启用。 + * + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 + * + * @since 4.1 + */ + IsBatteryConfigSupported([in] String sceneName, [out] boolean value); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl b/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl index 85e53088..5a2b130f 100644 --- a/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl +++ b/zh-cn/device_api/hdi/power/v1_0/IPowerInterface.idl @@ -55,7 +55,8 @@ interface IPowerInterface { * * @param ipowerHdiCallback 输入参数,服务注册的回调。 * - * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see IPowerHdiCallback * * @since 3.1 @@ -66,6 +67,7 @@ interface IPowerInterface { * @brief 执行设备休眠操作。 * * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -75,6 +77,7 @@ interface IPowerInterface { * @brief 执行设备唤醒操作。 * * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -84,6 +87,7 @@ interface IPowerInterface { * @brief 执行设备强制休眠操作。 * * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -95,6 +99,7 @@ interface IPowerInterface { * @param name 输入参数,运行锁的名称。 * * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -106,6 +111,7 @@ interface IPowerInterface { * @param name 输入参数,运行锁的名称。 * * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -117,6 +123,7 @@ interface IPowerInterface { * @param info 输出参数,电源的Dump信息。 * * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ diff --git a/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl b/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl index d06046e8..0ce31289 100644 --- a/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl +++ b/zh-cn/device_api/hdi/thermal/v1_0/IThermalInterface.idl @@ -55,7 +55,8 @@ interface IThermalInterface { * * @param freq 输入参数,设置CPU频率的值。 * - * @return HDF_SUCCESS 表示设置成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -66,7 +67,8 @@ interface IThermalInterface { * * @param freq 输入参数,设置GPU频率的值。 * - * @return HDF_SUCCESS 表示设置成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -77,7 +79,8 @@ interface IThermalInterface { * * @param current 输入参数,充电电流,单位毫安。 * - * @return HDF_SUCCESS 表示设置成功 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -88,7 +91,8 @@ interface IThermalInterface { * * @param event 输出参数,设备发热信息,包括器件类型、器件温度。 * - * @return HDF_SUCCESS 表示获取成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see HdfThermalCallbackInfo * * @since 3.1 @@ -100,7 +104,8 @@ interface IThermalInterface { * * @param callbackObj 输入参数,服务注册的回调。 * - * @return HDF_SUCCESS 表示注册成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see IThermalCallback * * @since 3.1 @@ -110,7 +115,8 @@ interface IThermalInterface { /** * @brief 取消注册设备发热状态的回调。 * - * @return HDF_SUCCESS 表示取消注册成功。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ diff --git a/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl b/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl index 0c472157..4a8b527c 100644 --- a/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl +++ b/zh-cn/device_api/hdi/thermal/v1_1/IThermalInterface.idl @@ -56,8 +56,8 @@ interface IThermalInterface { * * @param freq 输入参数,设置CPU频率的值。 * - * @return HDF_SUCCESS 表示设置成功。 - * @return HDF_FAILED 表示设置失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -68,8 +68,8 @@ interface IThermalInterface { * * @param freq 输入参数,设置GPU频率的值。 * - * @return HDF_SUCCESS 表示设置成功。 - * @return HDF_FAILED 表示设置失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -80,8 +80,8 @@ interface IThermalInterface { * * @param current 输入参数,充电电流,单位毫安。 * - * @return HDF_SUCCESS 表示设置成功。 - * @return HDF_FAILED 表示设置失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -92,8 +92,8 @@ interface IThermalInterface { * * @param event 输出参数,设备发热信息,包括器件类型、器件温度。 * - * @return HDF_SUCCESS 表示获取成功。 - * @return HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see HdfThermalCallbackInfo * * @since 3.1 @@ -105,8 +105,8 @@ interface IThermalInterface { * * @param num 输入参数,CPU内核编号。 * - * @return HDF_SUCCESS 表示获取成功。 - * @return HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 4.0 */ @@ -117,8 +117,8 @@ interface IThermalInterface { * * @param callbackObj 输入参数,要注册的回调函数。 * - * @return HDF_SUCCESS 表示获取成功。 - * @return HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @see IThermalCallback * @@ -129,8 +129,8 @@ interface IThermalInterface { /** * @brief 注册设备热状态回调。 * - * @return HDF_SUCCESS 表示获取成功。 - * @return HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 3.1 */ @@ -141,8 +141,8 @@ interface IThermalInterface { * * @param callbackObj 输入参数,要注册的回调函数。 * - * @return HDF_SUCCESS 表示获取成功。 - * @return HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * @see IFanCallback * * @since 4.0 @@ -152,8 +152,8 @@ interface IThermalInterface { /** * @brief 取消注册风扇故障检测的回调。 * - * @return HDF_SUCCESS 表示获取成功。 - * @return HDF_FAILED 表示获取失败。 + * @return HDF_SUCCESS 表示操作成功。 + * @return HDF_FAILED 表示操作失败。 * * @since 4.0 */ -- Gitee From b6972fa22f9fb0dd8f4c20fbff1e801f6fcb004f Mon Sep 17 00:00:00 2001 From: abonadon-hk Date: Fri, 1 Dec 2023 09:41:43 +0000 Subject: [PATCH 0136/2135] fix : fix finger hdi annotation Signed-off-by: abonadon-hk --- .../hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl | 4 ++-- zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl | 4 ++-- .../hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl | 4 ++-- zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl | 6 ++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl index 0367ffd2..6bd14fdb 100644 --- a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl @@ -90,7 +90,7 @@ enum CommandId : int { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link FingerprintTipsCode}接口替代。 */ enum FingerprintTipsCode : int { FINGERPRINT_AUTH_TIP_GOOD = 0, /**< 获取的指纹图像是完整的。 */ @@ -124,7 +124,7 @@ struct ExecutorInfo { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link Property}接口替代。 */ struct TemplateInfo { unsigned int executorType; /**< 执行器类型,根据执行器支持的能力进行分类。 */ diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl index 475e8707..50522b41 100644 --- a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl @@ -66,7 +66,7 @@ interface IExecutor { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link SetCachedTemplates}接口替代。 */ GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo); /** @@ -105,7 +105,7 @@ interface IExecutor { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link AuthenticateV1_1}接口替代。 */ Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); /** diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl index 496a0324..e5e61ac2 100644 --- a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl @@ -48,8 +48,8 @@ enum FingerprintTipsCode : int { FINGERPRINT_AUTH_TIP_PARTIAL = 3, /**< 仅检测到部分指纹图像。 */ FINGERPRINT_AUTH_TIP_TOO_FAST = 4, /**< 指纹图像由于快速移动而不完整。 */ FINGERPRINT_AUTH_TIP_TOO_SLOW = 5, /**< 指纹图像由于没有移动而无法读取。 */ - FINGERPRINT_AUTH_TIP_FINGER_DOWN = 6, /**< 按下手指。 */ - FINGERPRINT_AUTH_TIP_FINGER_UP = 7, /**< 抬起手指。 */ + FINGERPRINT_AUTH_TIP_FINGER_DOWN = 6, /**< 按下手指。 从4.0版本开始支持使用。*/ + FINGERPRINT_AUTH_TIP_FINGER_UP = 7, /**< 抬起手指。 从4.0版本开始支持使用。*/ VENDOR_FINGERPRINT_AUTH_TIP_BEGIN = 10000 /**< 用于厂商自定义提示信息。 */ }; diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl index 49631bd2..3fc136a9 100644 --- a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl @@ -52,9 +52,11 @@ interface IExecutor extends ohos.hdi.fingerprint_auth.v1_0.IExecutor { * @brief 指纹识别。 * * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * @param para 指纹识别参数,见{@link AuthenticateParam}。 + * @param templateIdList 指定要认证的模版ID列表。 + * @param endAfterFirstFail 第一次认证失败后结束认证。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 * @param callbackObj 回调对象{@link IExecutorCallback}。 - * + * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * -- Gitee From 6664437862b6a802b2ea8d7c10740d07c3c9303e Mon Sep 17 00:00:00 2001 From: taoljt Date: Sat, 2 Dec 2023 08:03:28 +0000 Subject: [PATCH 0137/2135] =?UTF-8?q?update=20zh-cn/native=5Fsdk/media/pla?= =?UTF-8?q?yer/avplayer.h.=20=E9=83=A8=E5=88=86=E6=B3=A8=E9=87=8A*?= =?UTF-8?q?=E5=90=8E=E6=96=B0=E5=A2=9E=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: taoljt --- zh-cn/native_sdk/media/player/avplayer.h | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/zh-cn/native_sdk/media/player/avplayer.h b/zh-cn/native_sdk/media/player/avplayer.h index 0609107d..77d640e6 100644 --- a/zh-cn/native_sdk/media/player/avplayer.h +++ b/zh-cn/native_sdk/media/player/avplayer.h @@ -97,7 +97,7 @@ OH_AVErrCode OH_AVPlayer_Prepare(OH_AVPlayer *player); /** * @brief 开始播放 * - *此函数必须在{@link Prepare}之后调用。如果播放器状态为。调用此函数开始播放。 + * 此函数必须在{@link Prepare}之后调用。如果播放器状态为。调用此函数开始播放。 * * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 @@ -130,7 +130,7 @@ OH_AVErrCode OH_AVPlayer_Stop(OH_AVPlayer *player); /** * @brief 将播放器恢复到初始状态 * - *函数调用完成后,调用{@link SetSource}添加播放源。调用{@link Prepare}后,调用{@link Play}重新开始播放。 + * 函数调用完成后,调用{@link SetSource}添加播放源。调用{@link Prepare}后,调用{@link Play}重新开始播放。 * * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 @@ -143,7 +143,7 @@ OH_AVErrCode OH_AVPlayer_Reset(OH_AVPlayer *player); /** * @brief 异步释放播放器资源 * - *异步释放保证性能,但无法保证是否释放了surfacebuffer。调用者需要保证surface的生命周期安全 + * 异步释放保证性能,但无法保证是否释放了surfacebuffer。调用者需要保证surface的生命周期安全 * * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 @@ -156,7 +156,7 @@ OH_AVErrCode OH_AVPlayer_Release(OH_AVPlayer *player); /** * @brief 同步释放播放器资源 * - *同步释放保证了surfacebuffer的有效释放,但这个界面会花费很长时间(发动机非怠速状态时),要求调用者自己设计异步机制 + * 同步释放保证了surfacebuffer的有效释放,但这个界面会花费很长时间(发动机非怠速状态时),要求调用者自己设计异步机制 * * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 @@ -255,12 +255,12 @@ OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed * /** * @brief 设置hls播放器使用的码率 * - *播放比特率,以比特/秒为单位,以比特/秒为单位。 - *仅对HLS协议网络流有效。默认情况下, - *播放器会根据网络连接情况选择合适的码率和速度。 - *通过INFO_TYPE_BITRATE_COLLECT上报有效码率链表 - *设置并选择指定的码率,选择小于和最接近的码率 - *到指定的码率播放。准备好后,读取它以查询当前选择的比特率。 + * 播放比特率,以比特/秒为单位,以比特/秒为单位。 + * 仅对HLS协议网络流有效。默认情况下, + * 播放器会根据网络连接情况选择合适的码率和速度。 + * 通过INFO_TYPE_BITRATE_COLLECT上报有效码率链表 + * 设置并选择指定的码率,选择小于和最接近的码率 + * 到指定的码率播放。准备好后,读取它以查询当前选择的比特率。 * * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 @@ -349,9 +349,9 @@ OH_AVErrCode OH_AVPlayer_SetPlayerCallback(OH_AVPlayer *player, AVPlayerCallback /** * @brief 选择音频或字幕轨道 * - *默认播放第一个带数据的音频流,不播放字幕轨迹。 - *设置生效后,原曲目将失效。请设置字幕 - *处于准备/播放/暂停/完成状态,并将音轨设置为准备状态。 + * 默认播放第一个带数据的音频流,不播放字幕轨迹。 + * 设置生效后,原曲目将失效。请设置字幕 + * 处于准备/播放/暂停/完成状态,并将音轨设置为准备状态。 * * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 -- Gitee From cc1b5f3e7d21d8bcbbd1d2e3fa59bc498bfcde0d Mon Sep 17 00:00:00 2001 From: taoljt Date: Sat, 2 Dec 2023 08:15:39 +0000 Subject: [PATCH 0138/2135] =?UTF-8?q?update=20zh-cn/native=5Fsdk/media/pla?= =?UTF-8?q?yer/avplayer.h.=20surface=E7=9B=B8=E5=85=B3=E6=9C=AF=E8=AF=AD?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=92=AD=E6=94=BE=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=9A=84=E4=B8=AD=E6=96=87=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: taoljt --- zh-cn/native_sdk/media/player/avplayer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/media/player/avplayer.h b/zh-cn/native_sdk/media/player/avplayer.h index 77d640e6..4ffcb262 100644 --- a/zh-cn/native_sdk/media/player/avplayer.h +++ b/zh-cn/native_sdk/media/player/avplayer.h @@ -143,7 +143,7 @@ OH_AVErrCode OH_AVPlayer_Reset(OH_AVPlayer *player); /** * @brief 异步释放播放器资源 * - * 异步释放保证性能,但无法保证是否释放了surfacebuffer。调用者需要保证surface的生命周期安全 + * 异步释放保证性能,但无法保证是否释放了播放画面的surfacebuffer。调用者需要保证播放画面窗口的生命周期安全 * * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 @@ -156,7 +156,7 @@ OH_AVErrCode OH_AVPlayer_Release(OH_AVPlayer *player); /** * @brief 同步释放播放器资源 * - * 同步释放保证了surfacebuffer的有效释放,但这个界面会花费很长时间(发动机非怠速状态时),要求调用者自己设计异步机制 + * 同步过程保证了播放画面的surfacebuffer释放,但这个界面会花费很长时间(发动机非怠速状态时),要求调用者自己设计异步机制 * * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 @@ -272,11 +272,11 @@ OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed(OH_AVPlayer *player, AVPlaybackSpeed * OH_AVErrCode OH_AVPlayer_SelectBitRate(OH_AVPlayer *player, uint32_t bitRate); /** - * @brief 设置surface. + * @brief 设置播放画面窗口. * @syscap SystemCapability.Multimedia.Media.AVPlayer * @param player指向OH_AVPlayer实例的指针 * @param window指向OHNativeWindow实例的指针,参见{@link OHNativeWindow} - * @return 如果设置了surface,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 + * @return 如果设置播放画面窗口成功,则返回{@link AV_ERR_OK};否则返回在{@link native_averrors.h}中定义的错误代码。 * @since 11 * @version 1.0 */ -- Gitee From ce22a666431c1cacfe7a46b5f3263bf10f3defb6 Mon Sep 17 00:00:00 2001 From: abonadon-hk Date: Mon, 4 Dec 2023 02:07:53 +0000 Subject: [PATCH 0139/2135] fix : fix finger hdi interface annotation Signed-off-by: abonadon-hk --- .../hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl | 4 ++-- zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl | 4 ++-- .../hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl | 4 ++-- zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl | 6 ++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl index 0367ffd2..6bd14fdb 100644 --- a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/FingerprintAuthTypes.idl @@ -90,7 +90,7 @@ enum CommandId : int { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link FingerprintTipsCode}接口替代。 */ enum FingerprintTipsCode : int { FINGERPRINT_AUTH_TIP_GOOD = 0, /**< 获取的指纹图像是完整的。 */ @@ -124,7 +124,7 @@ struct ExecutorInfo { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link Property}接口替代。 */ struct TemplateInfo { unsigned int executorType; /**< 执行器类型,根据执行器支持的能力进行分类。 */ diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl index 475e8707..e26d3e07 100644 --- a/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_0/IExecutor.idl @@ -66,7 +66,7 @@ interface IExecutor { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link GetProperty}接口替代。 */ GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo); /** @@ -105,7 +105,7 @@ interface IExecutor { * @since 3.2 * @version 1.0 * - * @deprecated + * @deprecated 从4.0版本开始废弃,使用{@link AuthenticateV1_1}接口替代。 */ Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); /** diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl index 496a0324..e5e61ac2 100644 --- a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/FingerprintAuthTypes.idl @@ -48,8 +48,8 @@ enum FingerprintTipsCode : int { FINGERPRINT_AUTH_TIP_PARTIAL = 3, /**< 仅检测到部分指纹图像。 */ FINGERPRINT_AUTH_TIP_TOO_FAST = 4, /**< 指纹图像由于快速移动而不完整。 */ FINGERPRINT_AUTH_TIP_TOO_SLOW = 5, /**< 指纹图像由于没有移动而无法读取。 */ - FINGERPRINT_AUTH_TIP_FINGER_DOWN = 6, /**< 按下手指。 */ - FINGERPRINT_AUTH_TIP_FINGER_UP = 7, /**< 抬起手指。 */ + FINGERPRINT_AUTH_TIP_FINGER_DOWN = 6, /**< 按下手指。 从4.0版本开始支持使用。*/ + FINGERPRINT_AUTH_TIP_FINGER_UP = 7, /**< 抬起手指。 从4.0版本开始支持使用。*/ VENDOR_FINGERPRINT_AUTH_TIP_BEGIN = 10000 /**< 用于厂商自定义提示信息。 */ }; diff --git a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl index 49631bd2..3fc136a9 100644 --- a/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl +++ b/zh-cn/device_api/hdi/fingerprint_auth/v1_1/IExecutor.idl @@ -52,9 +52,11 @@ interface IExecutor extends ohos.hdi.fingerprint_auth.v1_0.IExecutor { * @brief 指纹识别。 * * @param scheduleId 调度ID,用于标识一次操作请求的调度过程。 - * @param para 指纹识别参数,见{@link AuthenticateParam}。 + * @param templateIdList 指定要认证的模版ID列表。 + * @param endAfterFirstFail 第一次认证失败后结束认证。 + * @param extraInfo 其他相关信息,用于支持信息扩展。 * @param callbackObj 回调对象{@link IExecutorCallback}。 - * + * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 * -- Gitee From 2941b191142b962dad045cbbcbbdac5fdc58a4e3 Mon Sep 17 00:00:00 2001 From: zwx1283032 Date: Mon, 4 Dec 2023 02:17:33 +0000 Subject: [PATCH 0140/2135] =?UTF-8?q?usb=20HDI=E6=8E=A5=E5=8F=A3=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zwx1283032 --- zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl | 30 +++++++++---------- .../hdi/usb/ddk/v1_0/UsbDdkTypes.idl | 6 ++-- .../gadget/mtp/v1_0/IUsbfnMtpInterface.idl | 24 +++++++-------- .../hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl | 4 +-- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl b/zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl index 0fb5f823..2d94a083 100644 --- a/zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl +++ b/zh-cn/device_api/hdi/usb/ddk/v1_0/IUsbDdk.idl @@ -13,7 +13,7 @@ * limitations under the License. */ -/* * +/** * @addtogroup HdiUsbDdk * @{ * @@ -25,7 +25,7 @@ * @version 1.0 */ -/* * +/** * @file IUsbDdk.idl * * @brief 声明USB主机用于访问USB设备的USB DDK API。 @@ -38,7 +38,7 @@ package ohos.hdi.usb.ddk.v1_0; import ohos.hdi.usb.ddk.v1_0.UsbDdkTypes; -/* * +/** * @brief 声明USB主机用于访问USB设备的USB DDK API。 * * 上层USB服务调用相关功能接口,可以打开/关闭设备,获取设备描述符,批量读取/写入数据等。 @@ -49,7 +49,7 @@ import ohos.hdi.usb.ddk.v1_0.UsbDdkTypes; interface IUsbDdk { - /* * + /** * @brief 初始化DDK。 * * @return 0 表示操作成功。 @@ -60,7 +60,7 @@ interface IUsbDdk */ Init(); - /* * + /** * @brief 在停止数据传输后关闭占用的USB设备接口,并释放相关资源。 * * @return 0 表示操作成功。 @@ -71,7 +71,7 @@ interface IUsbDdk */ Release(); - /* * + /** * @brief 获取USB设备描述符。 * * @param deviceId 要获取其描述符的设备的设备Id。 @@ -85,7 +85,7 @@ interface IUsbDdk */ GetDeviceDescriptor([in] unsigned long deviceId, [out] struct UsbDeviceDescriptor desc); - /* * + /** * @brief 获取配置描述符。 * * @param deviceId 要获取其描述符的设备的设备Id。 @@ -100,7 +100,7 @@ interface IUsbDdk */ GetConfigDescriptor([in] unsigned long deviceId, [in] unsigned char configIndex, [out] List configDesc); - /* * + /** * @brief 声明USB接口。 * * @param deviceId 要操作的设备的ID。 @@ -115,7 +115,7 @@ interface IUsbDdk */ ClaimInterface([in] unsigned long deviceId, [in] unsigned char interfaceIndex, [out] unsigned long interfaceHandle); - /* * + /** * @brief 在停止数据传输后关闭占用的USB设备接口,并释放相关资源。 * * @param interfaceHandle 接口操作处理。 @@ -128,7 +128,7 @@ interface IUsbDdk */ ReleaseInterface([in] unsigned long interfaceHandle); - /* * + /** * @brief 激活USB接口的备用设置。 * * @param interfaceHandle 接口操作处理。 @@ -142,7 +142,7 @@ interface IUsbDdk */ SelectInterfaceSetting([in] unsigned long interfaceHandle, [in] unsigned char settingIndex); - /* * + /** * @brief 获取USB接口的激活备用设置。 * * @param interfaceHandle 接口操作处理。 @@ -156,7 +156,7 @@ interface IUsbDdk */ GetCurrentInterfaceSetting([in] unsigned long interfaceHandle, [out] unsigned char settingIndex); - /* * + /** * @brief 发送控制读取传输请求。此API以同步方式工作。 * * @param interfaceHandle 接口操作处理。 @@ -172,7 +172,7 @@ interface IUsbDdk */ SendControlReadRequest([in] unsigned long interfaceHandle, [in] struct UsbControlRequestSetup setup, [in] unsigned int timeout, [out] List data); - /* * + /** * @brief 发送控制写入传输请求。此API以同步方式工作。 * * @param interfaceHandle 接口操作处理。 @@ -188,7 +188,7 @@ interface IUsbDdk */ SendControlWriteRequest([in] unsigned long interfaceHandle, [in] struct UsbControlRequestSetup setup, [in] unsigned int timeout, [in] List data); - /* * + /** * @brief 发送管道请求。此API以同步方式工作。此API适用于中断传输和批量传输。 * * @param 管道用于传输数据的管道。 @@ -205,7 +205,7 @@ interface IUsbDdk */ SendPipeRequest([in] struct UsbRequestPipe pipe, [in] unsigned int size, [in] unsigned int offset, [in] unsigned int length, [out] unsigned int transferedLength); - /* * + /** * @brief 获取内存映射的文件描述符。 * * @param deviceId 待操作设备的ID。 diff --git a/zh-cn/device_api/hdi/usb/ddk/v1_0/UsbDdkTypes.idl b/zh-cn/device_api/hdi/usb/ddk/v1_0/UsbDdkTypes.idl index 54eeb298..a5224f1b 100644 --- a/zh-cn/device_api/hdi/usb/ddk/v1_0/UsbDdkTypes.idl +++ b/zh-cn/device_api/hdi/usb/ddk/v1_0/UsbDdkTypes.idl @@ -13,7 +13,7 @@ * limitations under the License. */ -/* * +/** * @addtogroup HdiUsbDdk * @{ * @@ -34,7 +34,7 @@ package ohos.hdi.usb.ddk.v1_0; -/* * +/** * @brief 控制传输的设置数据。它对应于USB协议中的Setup Data。 * * @since 4.0 @@ -53,7 +53,7 @@ struct UsbControlRequestSetup { unsigned short length; }; -/* * +/** * @brief 标准设备描述符,对应于USB协议中的标准设备描述符。 * * @since 4.0 diff --git a/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/IUsbfnMtpInterface.idl b/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/IUsbfnMtpInterface.idl index 807e90b8..053cb109 100644 --- a/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/IUsbfnMtpInterface.idl +++ b/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/IUsbfnMtpInterface.idl @@ -13,7 +13,7 @@ * limitations under the License. */ -/* * +/** * @addtogroup HdiUsbfnMtp * @{ * @@ -25,7 +25,7 @@ * @version 1.0 */ -/* * +/** * @file IUsbfnMtpInterface.idl * * @brief 声明usb模块提供的API,用于获取usb信息、订阅或取消订阅usb数据、启用或禁用usb、设置usb数据报告模式以及设置准确性和测量范围等usb选项。 @@ -38,7 +38,7 @@ package ohos.hdi.usb.gadget.mtp.v1_0; import ohos.hdi.usb.gadget.mtp.v1_0.UsbfnMtpTypes; -/* * +/** * @brief 定义在usb上执行基本操作的函数。 * * 操作包括获取usb信息、订阅或取消订阅usb数据、启用或禁用usb、设置usb数据报告模式以及设置准确性和测量范围等usb选项。 @@ -48,7 +48,7 @@ import ohos.hdi.usb.gadget.mtp.v1_0.UsbfnMtpTypes; */ interface IUsbfnMtpInterface { - /* * + /** * @brief 打开USB MTP/PTP驱动程序。 * * @param 无需参数。 @@ -61,7 +61,7 @@ interface IUsbfnMtpInterface { */ Start(); - /* * + /** * @brief 关闭USB MTP/PTP驱动程序。 * * @param 无需参数。 @@ -74,7 +74,7 @@ interface IUsbfnMtpInterface { */ Stop(); - /* * + /** * @brief 通过USB MTP/PTP驱动程序读取数据。 * * @param data表示USB MTP/PTP驱动程序读取的数据。 @@ -86,7 +86,7 @@ interface IUsbfnMtpInterface { */ Read([out] unsigned char[] data); - /* * + /** * @brief 通过USB MTP/PTP驱动程序写入数据。 * * @param 通过USB MTP/PTP驱动程序写入数据。data表示数据写入USB MTP/PT驱动程序。 @@ -98,7 +98,7 @@ interface IUsbfnMtpInterface { */ Write([in] unsigned char[] data); - /* * + /** * @brief 通过USB MTP/PTP驱动程序接收文件。 * 代理处理文件管理,包括fopen/fclose/feek/fread/fwrite和偏移量信息,Stub负责数据处理。 * @@ -111,7 +111,7 @@ interface IUsbfnMtpInterface { */ ReceiveFile([in] struct UsbFnMtpFileSlice mfs); - /* * + /** * @brief 通过USB MTP/PTP驱动程序发送文件。 * 代理处理文件管理,包括fopen/fclose/feek/fread/fwrite和偏移量信息,Stub负责数据处理。 * @@ -124,7 +124,7 @@ interface IUsbfnMtpInterface { */ SendFile([in] struct UsbFnMtpFileSlice mfs); - /* * + /** * @brief 通过USB MTP/PTP驱动程序发送事件数据。 * * @param data 指示事件数据写入USB MTP/PTP驱动程序。 @@ -136,7 +136,7 @@ interface IUsbfnMtpInterface { */ SendEvent([in] unsigned char[] eventData); - /* * + /** * @brief 初始化USB MTP/PTP驱动程序。由usb_host使用。 * * @param 无需参数。 @@ -149,7 +149,7 @@ interface IUsbfnMtpInterface { */ Init(); - /* * + /** * @brief 释放USB MTP/PTP驱动程序。由usb_host使用。 * * @param 无需参数。 diff --git a/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl b/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl index d9bf0475..b35dd0e5 100644 --- a/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl +++ b/zh-cn/device_api/hdi/usb/gadget/mtp/v1_0/UsbfnMtpTypes.idl @@ -13,7 +13,7 @@ * limitations under the License. */ -/* * +/** * @addtogroup HdiUsbfnMtp * @{ * @@ -36,7 +36,7 @@ package ohos.hdi.usb.gadget.mtp.v1_0; -/* * +/** * @brief 标准设备描述符,对应于USB协议中的标准设备描述符。 * * @since 4.0 -- Gitee From 2d8eefb312dae02e09c46172f57fd575c586d3df Mon Sep 17 00:00:00 2001 From: liuziweicom Date: Wed, 29 Nov 2023 17:01:37 +0800 Subject: [PATCH 0141/2135] add Signed-off-by: liuziweicom --- .../hdi/user_auth/v1_2/IUserAuthInterface.idl | 31 +++++++++++++ .../hdi/user_auth/v1_2/UserAuthTypes.idl | 44 +++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl b/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl index 07f1f56c..29dde86f 100644 --- a/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_2/IUserAuthInterface.idl @@ -291,6 +291,8 @@ interface IUserAuthInterface { * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 + * + * @deprecated 从4.1版本开始废弃,使用{@link BeginEnrollmentV1_2}接口代替 */ BeginEnrollmentV1_1([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParam param, [out] struct ScheduleInfoV1_1 info); @@ -303,6 +305,8 @@ interface IUserAuthInterface { * * @return 0 表示操作成功。 * @return 非0 表示操作失败。 + * + * @deprecated 从4.1版本开始废弃,使用{@link BeginAuthenticationV1_2}接口代替 */ BeginAuthenticationV1_1([in] unsigned long contextId, [in] struct AuthSolution param, [out] struct ScheduleInfoV1_1[] scheduleInfos); @@ -338,5 +342,32 @@ interface IUserAuthInterface { * @return 非0 表示操作失败。 */ GetAllExtUserInfo([out] ExtUserInfo[] userInfos); + + /** + * @brief 开始认证用户,并生成认证方案。 + * + * @param contextId 上下文索引。 + * @param param 认证方案{@link AuthSolutionV1_2}。 + * @param scheduleInfos 调度信息{@link ScheduleInfoV1_1}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + BeginAuthenticationV1_2([in] unsigned long contextId, [in] struct AuthSolutionV1_2 param, + [out] struct ScheduleInfoV1_1[] scheduleInfos); + + /** + * @brief 开始注册用户认证凭据。当注册凭据类型为口令且该用户已经注册了口令凭据时,将会更新口令凭据。 + * + * @param userId 用户ID。 + * @param authToken 用户口令认证令牌。 + * @param param 注册凭据参数{@link EnrollParamV1_2}。 + * @param info 调度信息{@link ScheduleInfoV1_1}。 + * + * @return 0 表示操作成功。 + * @return 非0 表示操作失败。 + */ + BeginEnrollmentV1_2([in] int userId, [in] unsigned char[] authToken, [in] struct EnrollParamV1_2 param, + [out] struct ScheduleInfoV1_1 info); } /** @} */ diff --git a/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl b/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl index 6d3127f4..b73ced90 100644 --- a/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl +++ b/zh-cn/device_api/hdi/user_auth/v1_2/UserAuthTypes.idl @@ -173,6 +173,8 @@ struct ScheduleInfo { * * @since 4.1 * @version 1.2 + * + * @deprecated 从4.1版本开始废弃,使用{@link AuthSolutionV1_2}接口代替 */ struct AuthSolution { /** 用户ID。 */ @@ -243,6 +245,8 @@ struct IdentifyResultInfo { * * @since 4.1 * @version 1.2 + * + * @deprecated 从4.1版本开始废弃,使用{@link EnrollParamV1_2}接口代替 */ struct EnrollParam { /** 用户认证凭据类型@{AuthType}。 */ @@ -350,4 +354,44 @@ struct ExtUserInfo { /** 该用户的用户信息 */ struct UserInfo userInfo; }; + +/** + * @brief 认证方案。 + * + * @since 4.1 + * @version 1.2 + */ +struct AuthSolutionV1_2 { + /** 用户ID。 */ + int userId; + /** 认证结果可信等级。 */ + unsigned int authTrustLevel; + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器。 */ + unsigned int executorSensorHint; + /** 挑战值,用于签发认证令牌。 */ + unsigned char[] challenge; + /** 调用者名称。 */ + String callerName; + /** 调用接口版本。 */ + int apiVersion; +}; + +/** + * @brief 注册认证凭据参数。 + * + * @since 4.1 + * @version 1.2 + */ +struct EnrollParamV1_2 { + /** 用户认证凭据类型@{AuthType}。 */ + enum AuthType authType; + /** 既定用户认证凭据类型的执行器传感器提示,用于找到对应认证方式的传感器,取值不为0。 */ + unsigned int executorSensorHint; + /** 调用者名称。 */ + String callerName; + /** 调用接口版本。 */ + int apiVersion; +}; /** @} */ \ No newline at end of file -- Gitee From e0aa76a3bc5ff6d2ce9bb0e9231d6b06a1d872e2 Mon Sep 17 00:00:00 2001 From: chunsen Date: Mon, 4 Dec 2023 14:23:45 +0800 Subject: [PATCH 0142/2135] add power_manager IDL translation Signed-off-by: chunsen --- zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl b/zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl index 7bacfcb8..62581d2f 100644 --- a/zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl +++ b/zh-cn/device_api/hdi/battery/v1_1/IBatteryCallback.idl @@ -56,7 +56,7 @@ import ohos.hdi.battery.v1_1.Types; * * * @param 输入参数,事件 电池信息,如电池电量、电压和健康状态。 - * @see 电池信息。 + * @see BatteryInfo * * @since 3.1 */ -- Gitee From ae3464697e9aa0fd57379e0144c3d3825b5f4c92 Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Fri, 1 Dec 2023 16:12:18 +0800 Subject: [PATCH 0143/2135] fix: synchronous idl Signed-off-by: fan-jingle --- .../display/buffer/v1_0/DisplayBufferType.idl | 3 +- ...IAllocatorInterface.idl => IAllocator.idl} | 23 +- .../{IMapperInterface.idl => IMapper.idl} | 77 +- .../hdi/display/buffer/v1_1/IMetadata.idl | 112 +++ .../composer/v1_0/DisplayComposerType.idl | 741 +++++++++--------- .../composer/v1_0/IDisplayComposer.idl | 168 ++-- .../composer/v1_0/IHotPlugCallback.idl | 20 +- .../composer/v1_0/IRefreshCallback.idl | 19 +- .../display/composer/v1_0/IVBlankCallback.idl | 21 +- .../composer/v1_1/DisplayComposerType.idl | 79 ++ .../composer/v1_1/IDisplayComposer.idl | 194 +++++ .../display/composer/v1_1/IModeCallback.idl | 69 ++ .../composer/v1_1/ISeamlessChangeCallback.idl | 65 ++ 13 files changed, 1046 insertions(+), 545 deletions(-) rename zh-cn/device_api/hdi/display/buffer/v1_0/{IAllocatorInterface.idl => IAllocator.idl} (72%) rename zh-cn/device_api/hdi/display/buffer/v1_0/{IMapperInterface.idl => IMapper.idl} (50%) create mode 100644 zh-cn/device_api/hdi/display/buffer/v1_1/IMetadata.idl create mode 100644 zh-cn/device_api/hdi/display/composer/v1_1/DisplayComposerType.idl create mode 100644 zh-cn/device_api/hdi/display/composer/v1_1/IDisplayComposer.idl create mode 100644 zh-cn/device_api/hdi/display/composer/v1_1/IModeCallback.idl create mode 100644 zh-cn/device_api/hdi/display/composer/v1_1/ISeamlessChangeCallback.idl diff --git a/zh-cn/device_api/hdi/display/buffer/v1_0/DisplayBufferType.idl b/zh-cn/device_api/hdi/display/buffer/v1_0/DisplayBufferType.idl index c8a7e704..11a1ad8f 100644 --- a/zh-cn/device_api/hdi/display/buffer/v1_0/DisplayBufferType.idl +++ b/zh-cn/device_api/hdi/display/buffer/v1_0/DisplayBufferType.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,6 +33,7 @@ * @since 3.2 * @version 1.0 */ +package ohos.hdi.display.buffer.v1_0; /** * @brief 定义待分配内存的信息。 diff --git a/zh-cn/device_api/hdi/display/buffer/v1_0/IAllocatorInterface.idl b/zh-cn/device_api/hdi/display/buffer/v1_0/IAllocator.idl similarity index 72% rename from zh-cn/device_api/hdi/display/buffer/v1_0/IAllocatorInterface.idl rename to zh-cn/device_api/hdi/display/buffer/v1_0/IAllocator.idl index 766259a8..1befd179 100644 --- a/zh-cn/device_api/hdi/display/buffer/v1_0/IAllocatorInterface.idl +++ b/zh-cn/device_api/hdi/display/buffer/v1_0/IAllocator.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,7 +26,7 @@ */ /** - * @file IAllocatorInterface.idl + * @file IAllocator.idl * * @brief 显示内存分配接口声明。 * @@ -44,18 +44,7 @@ package ohos.hdi.display.buffer.v1_0; import ohos.hdi.display.buffer.v1_0.DisplayBufferType; -sequenceable OHOS.HDI.Display.BufferHandleParcelable; - - /** - * @brief 显示内存分配接口声明。 - * - * 主要提供显示内存分配的功能,具体方法使用详见函数说明。 - * - * @since 3.2 - * @version 1.0 - */ - -interface IAllocatorInterface { +interface IAllocator { /** * @brief 显示内存分配。 * @@ -64,12 +53,12 @@ interface IAllocatorInterface { * @param info 表示申请内存AllocInfo信息。 * @param handle 指向申请的内存handle指针。 * - * @return DISPLAY_SUCCESS 表示执行成功。 - * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 * * @since 3.2 * @version 1.0 */ - AllocMem([in] struct AllocInfo info, [out] BufferHandleParcelable handle); + AllocMem([in] struct AllocInfo info, [out] NativeBuffer handle); } /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/buffer/v1_0/IMapperInterface.idl b/zh-cn/device_api/hdi/display/buffer/v1_0/IMapper.idl similarity index 50% rename from zh-cn/device_api/hdi/display/buffer/v1_0/IMapperInterface.idl rename to zh-cn/device_api/hdi/display/buffer/v1_0/IMapper.idl index 14cd4f74..9d7710cc 100644 --- a/zh-cn/device_api/hdi/display/buffer/v1_0/IMapperInterface.idl +++ b/zh-cn/device_api/hdi/display/buffer/v1_0/IMapper.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,7 +26,7 @@ */ /** - * @file IMapperInterface.idl + * @file IMapper.idl * * @brief 显示内存映射接口声明。 * @@ -44,104 +44,65 @@ package ohos.hdi.display.buffer.v1_0; import ohos.hdi.display.buffer.v1_0.DisplayBufferType; -sequenceable OHOS.HDI.Display.BufferHandleParcelable; - - /** - * @brief 显示内存映射接口声明。 - * - * 主要提供释放显示内存、显示内存映射、YUV内存映射等功能,具体方法使用详见函数说明。 - * - * @since 3.2 - * @version 1.0 - */ - -interface IMapperInterface { +interface IMapper { /** * @brief 释放显示内存。 * * @param handle 待释放的内存handle指针。 * - * @return 成功返回有效地址,失败返回NULL。 - * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 * @since 3.2 * @version 1.0 */ - FreeMem([in] BufferHandleParcelable handle); + FreeMem([in] NativeBuffer handle); /** * @brief 显示内存映射,将内存映射到对应的进程地址空间中。 * * @param handle 待映射内存handle指针。 * - * @return 成功返回有效地址,失败返回NULL。 - * - * @since 3.2 - * @version 1.0 - */ - Mmap([in] BufferHandleParcelable handle); - - /** - * @brief YUV内存映射。 - * - * @param handle 表示内存映射的输出缓存。 - * - * @return 成功返回有效地址,失败返回NULL。 - * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 * @since 3.2 * @version 1.0 */ - MmapCache([in] BufferHandleParcelable buffer); + Mmap([in] NativeBuffer handle); /** * @brief 内存反映射,将内存进行反映射。 * * @param handle 待反映射内存handle指针。 * - * @return DISPLAY_SUCCESS 表示执行成功。 - * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 - * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 * @since 3.2 * @version 1.0 */ - Unmap([in] BufferHandleParcelable handle); + Unmap([in] NativeBuffer handle); /** * @brief 刷新Cache,刷新Cache里的内容到内存并且使Cache里的内容无效。 * * @param handle 待刷新Cache的handle指针。 * - * @return DISPLAY_SUCCESS 表示执行成功。 - * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 - * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 * @since 3.2 * @version 1.0 */ - FlushCache([in] BufferHandleParcelable handle); - - /** - * @brief 刷新Mmap映射的Cache,刷新Mmap映射的Cache里的内容到内存并且使Cache里的内容无效。 - * - * @param handle 待刷新Cache的handle指针。 - * - * @return DISPLAY_SUCCESS 表示执行成功。 - * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 - * - * @since 3.2 - * @version 1.0 - */ - FlushMCache([in] BufferHandleParcelable buffer); + FlushCache([in] NativeBuffer handle); /** * @brief 使cache中的内容无效用以存储更新内存内容。 * - * @param handle 待无效cache的handle指针。 - * - * @return DISPLAY_SUCCESS 表示执行成功。 - * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @param handle 待无效cache的handle指针。 * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 * @since 3.2 * @version 1.0 */ - InvalidateCache([in] BufferHandleParcelable handle); + InvalidateCache([in] NativeBuffer handle); } /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/buffer/v1_1/IMetadata.idl b/zh-cn/device_api/hdi/display/buffer/v1_1/IMetadata.idl new file mode 100644 index 00000000..a433de07 --- /dev/null +++ b/zh-cn/device_api/hdi/display/buffer/v1_1/IMetadata.idl @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Display + * @{ + * + * @brief 显示模块驱动接口定义。 + * + * 提供给上层图形服务使用的驱动接口,包括图层管理、设备控制、显示内存管理等相关接口。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file IMetadata.idl + * + * @brief 显示数据映射接口声明。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Display模块接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.display.buffer.v1_1; + +interface IMetadata { + /** + * @brief IPC后的初始化NativeBuffer + * + * @param handle 待无效cache的handle指针。 + * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + RegisterBuffer([in] NativeBuffer handle); + + /** + * @brief 通过键值对的方式设置随帧数据 + * + * @param handle 待无效cache的handle指针。 + * @param key 数据键 + * @param value 数据值 + * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + SetMetadata([in] NativeBuffer handle, [in] unsigned int key, [in] unsigned char[] value); + + /** + * @brief 通过键值对的方式设置随帧数据 + * + * @param handle 待无效cache的handle指针。 + * @param key metadata key + * @param value metadata value + * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + GetMetadata([in] NativeBuffer handle, [in] unsigned int key, [out] unsigned char[] value); + + /** + * @brief 列出bufferhandle中设置的所有key值 + * + * @param handle 待无效cache的handle指针。 + * @param keys 数据键 + * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + ListMetadataKeys([in] NativeBuffer handle, [out] unsigned int[] keys); + + /** + * @brief 按键值内存删除数据 + * + * @param handle 待无效cache的handle指针。 + * @param key 要擦除的元数据密钥 + * + * @return 返回0 表示执行成功。 + * @return 返回其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + EraseMetadataKey([in] NativeBuffer handle, [in] unsigned int key); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/display/composer/v1_0/DisplayComposerType.idl b/zh-cn/device_api/hdi/display/composer/v1_0/DisplayComposerType.idl index 5e1b7b20..5a36ccff 100644 --- a/zh-cn/device_api/hdi/display/composer/v1_0/DisplayComposerType.idl +++ b/zh-cn/device_api/hdi/display/composer/v1_0/DisplayComposerType.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -41,148 +41,197 @@ * @version 1.0 */ package ohos.hdi.display.composer.v1_0; -sequenceable OHOS.HDI.Display.BufferHandleParcelable; sequenceable OHOS.HDI.Display.HdifdParcelable; enum DispCmd { /* request cmd */ - REQUEST_CMD_PREPAREDISPLAYLAYERS = 256, - REQUEST_CMD_SETDISPLAYCLIENTBUFFER = 257, - REQUEST_CMD_SETDISPLAYCLIENTDAMAGE = 258, - REQUEST_CMD_COMMIT = 259, - REQUEST_CMD_SETLAYERALPHA = 260, - REQUEST_CMD_SETLAYERPOSITION = 261, - REQUEST_CMD_SETLAYERCROP = 262, - REQUEST_CMD_SETLAYERZORDER = 263, - REQUEST_CMD_SETLAYERPREMULTI = 264, - REQUEST_CMD_SETTRANSFORMMODE = 265, - REQUEST_CMD_SETLAYERDIRTYREGION = 266, - REQUEST_CMD_SETLAYERVISIBLEREGION = 267, - REQUEST_CMD_SETLAYERBUFFER = 268, - REQUEST_CMD_SETLAYERCOMPOSITIONTYPE = 269, - REQUEST_CMD_SETLAYERBLENDTYPE = 270, - REQUEST_CMD_SETLAYERVISIBLE = 271, + REQUEST_CMD_PREPARE_DISPLAY_LAYERS = 64, /**< 请求 CMD 准备显示图层 */ + REQUEST_CMD_SET_DISPLAY_CLIENT_BUFFER = 65, /**< 请求 CMD 设置显示客户端缓冲区 */ + REQUEST_CMD_SET_DISPLAY_CLIENT_DAMAGE = 66, /**< 请求 CMD 设置显示客户端损坏 */ + REQUEST_CMD_COMMIT = 67, /**< 请求 CMD 提交 */ + REQUEST_CMD_SET_LAYER_ALPHA = 68, /**< 请求 CMD 设置图层 ALPHA */ + REQUEST_CMD_SET_LAYER_REGION = 69, /**< 请求 CMD 设置图层区域 */ + REQUEST_CMD_SET_LAYER_CROP = 70, /**< 请求 CMD 设置图层裁剪 */ + REQUEST_CMD_SET_LAYER_ZORDER = 71, /**< 请求 CMD 设置图层ZORDER */ + REQUEST_CMD_SET_LAYER_PREMULTI = 72, /**< 请求 CMD 设置图层PREMULTI */ + REQUEST_CMD_SET_LAYER_TRANSFORM_MODE = 73, /**< 请求 CMD 设置图层变换模式 */ + REQUEST_CMD_SET_LAYER_DIRTY_REGION = 74, /**< 请求 CMD 设置图层脏区 */ + REQUEST_CMD_SET_LAYER_VISIBLE_REGION = 75, /**< 请求 CMD 设置图层可见区域 */ + REQUEST_CMD_SET_LAYER_BUFFER = 76, /**< 请求 CMD 设置图层缓冲区 */ + REQUEST_CMD_SET_LAYER_COMPOSITION_TYPE = 77, /**< 请求 CMD 设置图层成分类型 */ + REQUEST_CMD_SET_LAYER_BLEND_TYPE = 78, /**< 请求 CMD 设置图层混合类型 */ + REQUEST_CMD_SET_LAYER_VISIBLE = 79, /**< 请求 CMD 设置图层可见 */ + REQUEST_CMD_SET_LAYER_MASK_INFO = 80, /**< 请求 CMD 设置图层掩码信息 */ + REQUEST_CMD_SET_LAYER_COLOR = 81, /**< 请求 CMD 设置图层颜色 */ + REQUEST_CMD_BUTT, /**< 请求 CMD 对接 */ /* reply cmd */ - REPLY_CMD_SETERROR = 1024, - REPLY_CMD_PREPAREDISPLAYLAYERS = 1025, - REPLY_CMD_COMMIT = 1026, + REPLY_CMD_SET_ERROR = 512, /**< 回复 CMD 设置错误 */ + REPLY_CMD_PREPARE_DISPLAY_LAYERS = 513, /**< 回复 CMD 准备显示图层 */ + REPLY_CMD_COMMIT = 514, /**< 回复 CMD 提交 */ + REPLY_CMD_BUTT, /**< 回复 CMD 对接*/ /* Pack control cmd */ - CONTROL_CMD_REQUEST_BEGIN = 8192, - CONTROL_CMD_REPLY_BEGIN = 8193, - CONTROL_CMD_REQUEST_END = 8194, - CONTROL_CMD_REPLY_END = 8195, + CONTROL_CMD_REQUEST_BEGIN = 1024, /**< 控制 CMD 请求开始 */ + CONTROL_CMD_REPLY_BEGIN = 1025, /**< 控制 CMD 回复开始 */ + CONTROL_CMD_REQUEST_END = 1026, /**< 控制 CMD 请求结束 */ + CONTROL_CMD_REPLY_END = 1027, /**< 控制 CMD 回复结束 */ + CONTROL_CMD_BUTT /**< 控制 CMD 对接 */ }; /** - * @brief 显示接口类型。 + * @brief 返回值类型定义。 * */ -enum InterfaceType { - DISP_INTF_HDMI = 0, /**< HDMI 接口 */ - DISP_INTF_LCD = 1, /**< LCD 接口 */ - DISP_INTF_BT1120 = 2, /**< BT1120 接口 */ - DISP_INTF_BT656 = 3, /**< BT656 接口 */ - DISP_INTF_YPBPR = 4, /**< YPBPR 接口 */ - DISP_INTF_RGB = 5, /**< RGB 接口 */ - DISP_INTF_CVBS = 6, /**< CVBS 接口 */ - DISP_INTF_SVIDEO = 7, /**< SVIDEO 接口 */ - DISP_INTF_VGA = 8, /**< VGA 接口 */ - DISP_INTF_MIPI = 9, /**< MIPI 接口 */ - DISP_INTF_PANEL = 10, /**< PANEL 接口 */ - DISP_INTF_BUTT = 11, /**< BUTT 接口, 一个不可用类型, 用于默认初始化。 */ +enum DispErrCode { + DISPLAY_SUCCESS = 0, /**< 成功 */ + DISPLAY_FAILURE = -1, /**< 失败 */ + DISPLAY_FD_ERR = -2, /**< Fd错误 */ + DISPLAY_PARAM_ERR = -3, /**< 参数错误 */ + DISPLAY_NULL_PTR = -4, /**< 空指针 */ + DISPLAY_NOT_SUPPORT = -5, /**< 不支持的特性 */ + DISPLAY_NOMEM = -6, /**< 内存不足 */ + DISPLAY_SYS_BUSY = -7, /**< 系统繁忙 */ + DISPLAY_NOT_PERM = -8, /**< 操作不允许 */ }; /** - * @brief 返回值类型定义。 + * @brief 像素格式类型定义。 * */ -enum DispErrCode { - DISPLAY_SUCCESS = 0, /**< 成功 */ - DISPLAY_FAILURE = -1, /**< 失败 */ - DISPLAY_FD_ERR = -2, /**< Fd错误 */ - DISPLAY_PARAM_ERR = -3, /**< 参数错误 */ - DISPLAY_NULL_PTR = -4, /**< 空指针 */ - DISPLAY_NOT_SUPPORT = -5, /**< 不支持的特性 */ - DISPLAY_NOMEM = -6, /**< 内存不足 */ - DISPLAY_SYS_BUSY = -7, /**< 系统繁忙 */ - DISPLAY_NOT_PERM = -8, /**< 操作不允许 */ +enum PixelFormat { + PIXEL_FMT_CLUT8 = 0, /**< CLUT8 格式 */ + PIXEL_FMT_CLUT1, /**< CLUT1 格式 */ + PIXEL_FMT_CLUT4, /**< CLUT4 格式 */ + PIXEL_FMT_RGB_565, /**< RGB565 格式 */ + PIXEL_FMT_RGBA_5658, /**< RGBA5658 格式 */ + PIXEL_FMT_RGBX_4444, /**< RGBX4444 格式 */ + PIXEL_FMT_RGBA_4444, /**< RGBA4444 格式 */ + PIXEL_FMT_RGB_444, /**< RGB444 格式 */ + PIXEL_FMT_RGBX_5551, /**< RGBX5551 格式 */ + PIXEL_FMT_RGBA_5551, /**< RGBA5551 格式 */ + PIXEL_FMT_RGB_555, /**< RGB555 格式 */ + PIXEL_FMT_RGBX_8888, /**< RGBX8888 格式 */ + PIXEL_FMT_RGBA_8888, /**< RGBA8888 格式 */ + PIXEL_FMT_RGB_888, /**< RGB888 格式 */ + PIXEL_FMT_BGR_565, /**< BGR565 格式 */ + PIXEL_FMT_BGRX_4444, /**< BGRX4444 格式 */ + PIXEL_FMT_BGRA_4444, /**< BGRA4444 格式 */ + PIXEL_FMT_BGRX_5551, /**< BGRX5551 格式 */ + PIXEL_FMT_BGRA_5551, /**< BGRA5551 格式 */ + PIXEL_FMT_BGRX_8888, /**< BGRX8888 格式 */ + PIXEL_FMT_BGRA_8888, /**< BGRA8888 格式 */ + PIXEL_FMT_YUV_422_I, /**< YUV422 交错格式 */ + PIXEL_FMT_YCBCR_422_SP, /**< YCBCR422 半平面格式 */ + PIXEL_FMT_YCRCB_422_SP, /**< YCRCB422 半平面格式 */ + PIXEL_FMT_YCBCR_420_SP, /**< YCBCR420 半平面格式 */ + PIXEL_FMT_YCRCB_420_SP, /**< YCRCB420 半平面格式 */ + PIXEL_FMT_YCBCR_422_P, /**< YCBCR422 平面格式 */ + PIXEL_FMT_YCRCB_422_P, /**< YCRCB422 平面格式 */ + PIXEL_FMT_YCBCR_420_P, /**< YCBCR420 平面格式 */ + PIXEL_FMT_YCRCB_420_P, /**< YCRCB420 平面格式 */ + PIXEL_FMT_YUYV_422_PKG, /**< YUYV422 平面格式 */ + PIXEL_FMT_UYVY_422_PKG, /**< UYVY422 平面格式 */ + PIXEL_FMT_YVYU_422_PKG, /**< YVYU422 平面格式 */ + PIXEL_FMT_VYUY_422_PKG, /**< VYUY422 平面格式 */ + PIXEL_FMT_RGBA_1010102, /**< RGBA_1010102 供应商格式*/ + PIXEL_FMT_VENDER_MASK = 0X7FFF0000, /**< 供应商掩码 格式 */ + PIXEL_FMT_BUTT = 0X7FFFFFFF /**< Invalid 像素格式 */ +}; + +/* * + * @brief 定义缓冲区使用情况 + * + */ +enum BufferUsage : unsigned long { + HBM_USE_CPU_READ = (1ULL << 0), /**< CPU 读取内存 */ + HBM_USE_CPU_WRITE = (1ULL << 1), /**< CPU 写入内存 */ + HBM_USE_MEM_MMZ = (1ULL << 2), /**< 媒体内存区 (MMZ) */ + HBM_USE_MEM_DMA = (1ULL << 3), /**< 直接内存访问 (DMA) 内存区 */ + HBM_USE_MEM_SHARE = (1ULL << 4), /**< 共享内存内存区*/ + HBM_USE_MEM_MMZ_CACHE = (1ULL << 5), /**< 存在缓存的 MMZ*/ + HBM_USE_MEM_FB = (1ULL << 6), /**< 帧内存 */ + HBM_USE_ASSIGN_SIZE = (1ULL << 7), /**< 分配内存 */ + HBM_USE_HW_RENDER = (1ULL << 8), /**< 写入GPU内存情况 */ + HBM_USE_HW_TEXTURE = (1ULL << 9), /**< 读取GPU内存情况 */ + HBM_USE_HW_COMPOSER = (1ULL << 10), /**< 硬件编写情况 */ + HBM_USE_PROTECTED = (1ULL << 11), /**< 安全缓冲区情况,例如 DRM */ + HBM_USE_CAMERA_READ = (1ULL << 12), /**< 读取相机情况 */ + HBM_USE_CAMERA_WRITE = (1ULL << 13), /**< 写入相机情况 */ + HBM_USE_VIDEO_ENCODER = (1ULL << 14), /**< 编码情况 */ + HBM_USE_VIDEO_DECODER = (1ULL << 15), /**< 解码情况 */ + HBM_USE_CPU_READ_OFTEN = (1ULL << 16), /**< HBM 经常使用 CPU 读取情况 */ + HBM_USE_VENDOR_PRI0 = (1ULL << 44), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI1 = (1ULL << 45), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI2 = (1ULL << 46), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI3 = (1ULL << 47), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI4 = (1ULL << 48), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI5 = (1ULL << 49), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI6 = (1ULL << 50), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI7 = (1ULL << 51), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI8 = (1ULL << 52), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI9 = (1ULL << 53), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI10 = (1ULL << 54), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI11 = (1ULL << 55), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI12 = (1ULL << 56), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI13 = (1ULL << 57), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI14 = (1ULL << 58), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI15 = (1ULL << 59), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI16 = (1ULL << 60), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI17 = (1ULL << 61), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI18 = (1ULL << 62), /**< 为供应商提供 */ + HBM_USE_VENDOR_PRI19 = (1ULL << 63), /**< 为供应商提供 */ +}; + +/** + * @brief 枚举图像的转换类型 + * + */ +enum TransformType { + ROTATE_NONE = 0, /**< 不旋转 */ + ROTATE_90, /**< 旋转90度 */ + ROTATE_180, /**< 旋转180度 */ + ROTATE_270, /**< 旋转270度 */ + MIRROR_H, /**< 水平方向镜像转换 */ + MIRROR_V, /**< 垂直方向镜像转换 */ + MIRROR_H_ROTATE_90, /**< 水平方向镜像转换, 旋转90度 */ + MIRROR_V_ROTATE_90, /**< 垂直方向镜像转换, 旋转90度 */ + ROTATE_BUTT /**< 无效操作 */ }; /** - * @brief 图层类型定义。 - * + * @brief 枚举显示状态。 */ -enum LayerType { - LAYER_TYPE_GRAPHIC = 0, /**< 图形层 */ - LAYER_TYPE_OVERLAY = 1, /**< 视频层 */ - LAYER_TYPE_SIDEBAND = 2, /**< 媒体播放 */ - LAYER_TYPE_CURSOR = 3, /**< 光标层 */ - LAYER_TYPE_BUTT = 4, /**< 空图层 */ +enum DispPowerStatus { + POWER_STATUS_ON = 0, /**< 上电模式 */ + POWER_STATUS_STANDBY = 1, /**< 待机模式 */ + POWER_STATUS_SUSPEND = 2, /**< 休眠模式 */ + POWER_STATUS_OFF = 3, /**< 下电模式 */ + POWER_STATUS_BUTT /**< 默认模式 */ }; -enum BufferUsage { - HBM_USE_CPU_READ = ( 1 << 0 ), - HBM_USE_CPU_WRITE = ( 1 << 1 ), - HBM_USE_MEM_MMZ = ( 1 << 2 ), - HBM_USE_MEM_DMA = ( 1 << 3 ), - HBM_USE_MEM_SHARE = ( 1 << 4 ), - HBM_USE_MEM_MMZ_Cache = ( 1 << 5 ), - HBM_USE_MEM_FB = ( 1 << 6 ), - HBM_USE_ASSIGN_SIZE = ( 1 << 7 ), +/** + * @brief 枚举特殊层的组合类型。 + */ +enum CompositionType { + COMPOSITION_CLIENT, /**< Client 合成类型,使用CPU或者GPU合成。 */ + COMPOSITION_DEVICE, /**< Device 合成类型,使用Device合成。 */ + COMPOSITION_CURSOR, /**< Cursor合成类型,用于光标合成。 */ + COMPOSITION_VIDEO, /**< Video合成类型,用于视频层合成。 */ + COMPOSITION_DEVICE_CLEAR, /**< Device清除合成类型, 用于清楚Device*/ + COMPOSITION_CLIENT_CLEAR, /**< Client清除合成类型, 用于清除Client*/ + COMPOSITION_TUNNEL, /**< Tunnel合成类型, 用于tunnel合成. */ + COMPOSITION_BUTT /**< 合成类型, 一个不可用类型,用于默认初始化。 */ }; /** - * @brief 像素格式类型定义。 - * - */ -enum PixelFormat { - PIXEL_FMT_CLUT8 = 0, /**< CLUT8 格式 */ - PIXEL_FMT_CLUT1 = 1, /**< CLUT1 格式 */ - PIXEL_FMT_CLUT4 = 2, /**< CLUT4 格式 */ - PIXEL_FMT_RGB_565 = 3, /**< RGB565 格式 */ - PIXEL_FMT_RGBA_5658 = 4, /**< RGBA5658 格式 */ - PIXEL_FMT_RGBX_4444 = 5, /**< RGBX4444 格式 */ - PIXEL_FMT_RGBA_4444 = 6, /**< RGBA4444 格式 */ - PIXEL_FMT_RGB_444 = 7, /**< RGB444 格式 */ - PIXEL_FMT_RGBX_5551 = 8, /**< RGBX5551 格式 */ - PIXEL_FMT_RGBA_5551 = 9, /**< RGBA5551 格式 */ - PIXEL_FMT_RGB_555 = 10, /**< RGB555 格式 */ - PIXEL_FMT_RGBX_8888 = 11, /**< RGBX8888 格式 */ - PIXEL_FMT_RGBA_8888 = 12, /**< RGBA8888 格式 */ - PIXEL_FMT_RGB_888 = 13, /**< RGB888 格式 */ - PIXEL_FMT_BGR_565 = 14, /**< BGR565 格式 */ - PIXEL_FMT_BGRX_4444 = 15, /**< BGRX4444 格式 */ - PIXEL_FMT_BGRA_4444 = 16, /**< BGRA4444 格式 */ - PIXEL_FMT_BGRX_5551 = 17, /**< BGRX5551 格式 */ - PIXEL_FMT_BGRA_5551 = 18, /**< BGRA5551 格式 */ - PIXEL_FMT_BGRX_8888 = 19, /**< BGRX8888 格式 */ - PIXEL_FMT_BGRA_8888 = 20, /**< BGRA8888 格式 */ - PIXEL_FMT_YUV_422_I = 21, /**< YUV422 交错格式 */ - PIXEL_FMT_YCBCR_422_SP = 22, /**< YCBCR422 半平面格式 */ - PIXEL_FMT_YCRCB_422_SP = 23, /**< YCRCB422 半平面格式 */ - PIXEL_FMT_YCBCR_420_SP = 24, /**< YCBCR420 半平面格式 */ - PIXEL_FMT_YCRCB_420_SP = 25, /**< YCRCB420 半平面格式 */ - PIXEL_FMT_YCBCR_422_P = 26, /**< YCBCR422 平面格式 */ - PIXEL_FMT_YCRCB_422_P = 27, /**< YCRCB422 平面格式 */ - PIXEL_FMT_YCBCR_420_P = 28, /**< YCBCR420 平面格式 */ - PIXEL_FMT_YCRCB_420_P = 29, /**< YCRCB420 平面格式 */ - PIXEL_FMT_YUYV_422_PKG = 30, /**< YUYV422 打包格式 */ - PIXEL_FMT_UYVY_422_PKG = 31, /**< UYVY422 打包格式t */ - PIXEL_FMT_YVYU_422_PKG = 32, /**< YVYU422 打包格式 */ - PIXEL_FMT_VYUY_422_PKG = 33, /**< VYUY422 打包格式*/ - PIXEL_FMT_BUTT = 34, /**< Invalid 像素格式 */ -}; - -/** - * @brief 图层变换类型定义。 + * @brief 图层类型定义。 * */ -enum TransformType { - ROTATE_NONE = 0, /**< 不旋转 */ - ROTATE_90 = 1, /**< 旋转90度 */ - ROTATE_180 = 2, /**< 旋转180度 */ - ROTATE_270 = 3, /**< 旋转270度 */ - ROTATE_BUTT = 4, /**< 无效操作 */ +enum LayerType { + LAYER_TYPE_GRAPHIC, /**< 图形层 */ + LAYER_TYPE_OVERLAY, /**< 视频层 */ + LAYER_TYPE_SDIEBAND, /**< 媒体播放 */ + LAYER_TYPE_CURSOR, /**< 光标层 */ + LAYER_TYPE_BUTT /**< 空图层 */ }; /** @@ -193,49 +242,49 @@ enum TransformType { */ enum BlendType { BLEND_NONE = 0, /**< No 混合操作 */ - BLEND_CLEAR = 1, /**< CLEAR 混合操作 */ - BLEND_SRC = 2, /**< SRC 混合操作 */ - BLEND_SRCOVER = 3, /**< SRC_OVER 混合操作 */ - BLEND_DSTOVER = 4, /**< DST_OVER 混合操作 */ - BLEND_SRCIN = 5, /**< SRC_IN 混合操作 */ - BLEND_DSTIN = 6, /**< DST_IN 混合操作 */ - BLEND_SRCOUT = 7, /**< SRC_OUT 混合操作 */ - BLEND_DSTOUT = 8, /**< DST_OUT 混合操作 */ - BLEND_SRCATOP = 9, /**< SRC_ATOP 混合操作 */ - BLEND_DSTATOP = 10, /**< DST_ATOP 混合操作 */ - BLEND_ADD = 11, /**< ADD 混合操作 */ - BLEND_XOR = 12, /**< XOR 混合操作 */ - BLEND_DST = 13, /**< DST 混合操作 */ - BLEND_AKS = 14, /**< AKS 混合操作 */ - BLEND_AKD = 15, /**< AKD 混合操作 */ - BLEND_BUTT = 16, /**< 空操作 */ + BLEND_CLEAR, /**< CLEAR 混合操作 */ + BLEND_SRC, /**< SRC 混合操作 */ + BLEND_SRCOVER, /**< SRC_OVER 混合操作 */ + BLEND_DSTOVER, /**< DST_OVER 混合操作 */ + BLEND_SRCIN, /**< SRC_IN 混合操作 */ + BLEND_DSTIN, /**< DST_IN 混合操作 */ + BLEND_SRCOUT, /**< SRC_OUT 混合操作 */ + BLEND_DSTOUT, /**< DST_OUT 混合操作 */ + BLEND_SRCATOP, /**< SRC_ATOP 混合操作 */ + BLEND_DSTATOP, /**< DST_ATOP 混合操作 */ + BLEND_ADD, /**< ADD 混合操作 */ + BLEND_XOR, /**< XOR 混合操作 */ + BLEND_DST, /**< DST 混合操作 */ + BLEND_AKS, /**< AKS 混合操作 */ + BLEND_AKD, /**< AKD 混合操作 */ + BLEND_BUTT /**< 空操作 */ }; /** * @brief 硬件加速支持的ROP操作类型。 * - * 硬件加速支持的ROP操作类型,在将前景位图的RGB颜色分量和Alpha分量值与背景位图的RGB颜色 + * 硬件加速支持的ROP操作类型,在将前景位图的RGB颜色分量和Alpha分量值与背景位图的RGB颜色 * 分量值和Alpha分量值进行按位的布尔运算(包括按位与,按位或等),将结果输出。 * */ enum RopType { ROP_BLACK = 0, /**< 黑色 */ - ROP_NOTMERGEPEN = 1, /**< ~(S2+S1) */ - ROP_MASKNOTPEN = 2, /**< ~S2&S1 */ - ROP_NOTCOPYPEN = 3, /**< ~S2 */ - ROP_MASKPENNOT = 4, /**< S2&~S1 */ - ROP_NOT = 5, /**< ~S1 */ - ROP_XORPEN = 6, /**< S2^S1 */ - ROP_NOTMASKPEN = 7, /**< ~(S2&S1) */ - ROP_MASKPEN = 8, /**< S2&S1 */ - ROP_NOTXORPEN = 9, /**< ~(S2^S1) */ - ROP_NOP = 10, /**< S1 */ - ROP_MERGENOTPEN = 11, /**< ~S2+S1 */ - ROP_COPYPE = 12, /**< S2 */ - ROP_MERGEPENNOT = 13, /**< S2+~S1 */ - ROP_MERGEPEN = 14, /**< S2+S1 */ - ROP_WHITE = 15, /**< 白色 */ - ROP_BUTT = 16, /**< 无效值 */ + ROP_NOTMERGEPEN, /**< ~(S2+S1) */ + ROP_MASKNOTPEN, /**< ~S2&S1 */ + ROP_NOTCOPYPEN, /**< ~S2 */ + ROP_MASKPENNOT, /**< S2&~S1 */ + ROP_NOT, /**< ~S1 */ + ROP_XORPEN, /**< S2^S1 */ + ROP_NOTMASKPEN, /**< ~(S2&S1) */ + ROP_MASKPEN, /**< S2&S1 */ + ROP_NOTXORPEN, /**< ~(S2^S1) */ + ROP_NOP, /**< S1 */ + ROP_MERGENOTPEN, /**< ~S2+S1 */ + ROP_COPYPE, /**< S2 */ + ROP_MERGEPENNOT, /**< S2+~S1 */ + ROP_MERGEPEN, /**< S2+S1 */ + ROP_WHITE, /**< 白色 */ + ROP_BUTT /**< 无效值 */ }; /** @@ -244,9 +293,9 @@ enum RopType { */ enum ColorKey { CKEY_NONE = 0, /**< 不使用Colorkey */ - CKEY_SRC = 1, /**< 使用源Colorkey */ - CKEY_DST = 2, /**< 使用目标Colorkey */ - CKEY_BUTT = 3, /**< 空操作 */ + CKEY_SRC, /**< 使用源Colorkey */ + CKEY_DST, /**< 使用目标Colorkey */ + CKEY_BUTT /**< 空操作 */ }; /** @@ -255,9 +304,9 @@ enum ColorKey { */ enum MirrorType { MIRROR_NONE = 0, /**< 不使用镜像 */ - MIRROR_LR = 1, /**< 左右镜像 */ - MIRROR_TB = 2, /**< 上下镜像 */ - MIRROR_BUTT = 3, /**< 空操作 */ + MIRROR_LR, /**< 左右镜像 */ + MIRROR_TB, /**< 上下镜像 */ + MIRROR_BUTT /**< 空操作 */ }; /** @@ -266,195 +315,27 @@ enum MirrorType { */ enum Connection { CON_INVALID = 0, /**< 无效类型 */ - CONNECTED = 1, /**< 已连接 */ - DISCONNECTED = 2, /**< 断开连接 */ -}; - -/** - * @brief 枚举显示状态。 - */ -enum DispPowerStatus { - POWER_STATUS_ON = 0, /**< 上电模式 */ - POWER_STATUS_STANDBY = 1, /**< 待机模式 */ - POWER_STATUS_SUSPEND = 2, /**< 休眠模式 */ - POWER_STATUS_OFF = 3, /**< 下电模式 */ - POWER_STATUS_BUTT = 4, /**< 默认模式 */ + CONNECTED, /**< 已连接 */ + DISCONNECTED /**< 断开连接 */ }; /** - * @brief 枚举特殊层的组合类型。 - */ -enum CompositionType { - COMPOSITION_CLIENT = 0, /**< Client 合成类型,使用CPU或者GPU合成。 */ - COMPOSITION_DEVICE = 1, /**< Device 合成类型,使用Device合成。 */ - COMPOSITION_CURSOR = 2, /**< Cursor合成类型,用于光标合成。 */ - COMPOSITION_VIDEO = 3, /**< Video合成类型,用于视频层合成。 */ - COMPOSITION_BUTT = 4, /**< 合成类型, 一个不可用类型,用于默认初始化。 */ -}; - -/** - * @brief 色域类型枚举值。 - * - */ -enum ColorGamut { - COLOR_GAMUT_INVALID = -1, /**< 无效值 */ - COLOR_GAMUT_NATIVE = 0, /**< 默认值 */ - COLOR_GAMUT_STANDARD_BT601 = 1, /**< Standard BT601类型 */ - COLOR_GAMUT_STANDARD_BT709 = 2, /**< Standard BT709类型 */ - COLOR_GAMUT_DCI_P3 = 3, /**< DCI P3类型 */ - COLOR_GAMUT_SRGB = 4, /**< SRGB类型 */ - COLOR_GAMUT_ADOBE_RGB = 5, /**< Adobe RGB类型 */ - COLOR_GAMUT_DISPLAY_P3 = 6, /**< display P3类型 */ - COLOR_GAMUT_BT2020 = 7, /**< BT2020类型 */ - COLOR_GAMUT_BT2100_PQ = 8, /**< BT2100 PQ类型 */ - COLOR_GAMUT_BT2100_HLG = 9, /**< BT2100 HLG类型 */ - COLOR_GAMUT_DISPLAY_BT2020 = 10, /**< Display BT2020类型 */ -}; - -/** - * @brief 枚举色域的映射类型。 - * - */ -enum GamutMap { - GAMUT_MAP_CONSTANT = 0, /**< 不变 */ - GAMUT_MAP_EXPANSION = 1, /**< 映射增强 */ - GAMUT_MAP_HDR_CONSTANT = 2, /**< 不变,用于HDR。 */ - GAMUT_MAP_HDR_EXPANSION = 3, /**< 映射增强,用于HDR。 */ -}; - -/** - * @brief 枚举颜色空间的类型。 - * - */ -enum ColorDataSpace { - /** 未知的 */ - COLOR_DATA_SPACE_UNKNOWN = 0, - /** BT601色域 */ - GAMUT_BT601 = 1, - /** BT709色域 */ - GAMUT_BT709 = 2, - /** DCI_P3色域 */ - GAMUT_DCI_P3 = 3, - /** SRGB色域 */ - GAMUT_SRGB = 4, - /** ADOBE_RGB色域 */ - GAMUT_ADOBE_RGB = 5, - /** DISPLAY_P3色域 */ - GAMUT_DISPLAY_P3 = 6, - /** BT2020色域 */ - GAMUT_BT2020 = 7, - /** BT2100_PQ色域 */ - GAMUT_BT2100_PQ = 8, - /** BT2100_HLG色域 */ - GAMUT_BT2100_HLG = 9, - /** DISPLAY_BT2020色域 */ - GAMUT_DISPLAY_BT2020 = 10, - /** UNSPECIFIED转换函数 */ - TRANSFORM_FUNC_UNSPECIFIED = 256, - /** LINEAR转换函数 */ - TRANSFORM_FUNC_LINEAR = 512, - /** SRGB转换函数 */ - TRANSFORM_FUNC_SRGB = 768, - /** SMPTE_170M转换函数 */ - TRANSFORM_FUNC_SMPTE_170M = 1024, - /** GM2_2转换函数 */ - TRANSFORM_FUNC_GM2_2 = 1280, - /** GM2_6转换函数 */ - TRANSFORM_FUNC_GM2_6 = 1536, - /** GM2_8转换函数 */ - TRANSFORM_FUNC_GM2_8 = 1792, - /** ST2084转换函数 */ - TRANSFORM_FUNC_ST2084 = 2048, - /** HLG转换函数 */ - TRANSFORM_FUNC_HLG = 2304, - /** UNSPECIFIED精度 */ - PRECISION_UNSPECIFIED = 65536, - /** FULL精度 */ - PRECISION_FULL = 131072, - /** LIMITED精度 */ - PRESION_LIMITED = 196608, - /** EXTENDED精度 */ - PRESION_EXTENDED = 262144, - /** BT601色域 | SMPTE_170M转换函数 | FULL精度 */ - BT601_SMPTE170M_FULL = GAMUT_BT601 | TRANSFORM_FUNC_SMPTE_170M | PRECISION_FULL, - /** BT601色域 | SMPTE_170M转换函数 | LIMITED精度 */ - BT601_SMPTE170M_LIMITED = GAMUT_BT601 | TRANSFORM_FUNC_SMPTE_170M | PRESION_LIMITED, - /** BT709色域 | LINEAR转换函数 | FULL精度 */ - BT709_LINEAR_FULL = GAMUT_BT709 | TRANSFORM_FUNC_LINEAR | PRECISION_FULL, - /** BT709色域 | LINEAR转换函数 | EXTENDED精度 */ - BT709_LINEAR_EXTENDED = GAMUT_BT709 | TRANSFORM_FUNC_LINEAR | PRESION_EXTENDED, - /** BT709色域 | SRGB转换函数 | FULL精度 */ - BT709_SRGB_FULL = GAMUT_BT709 | TRANSFORM_FUNC_SRGB | PRECISION_FULL, - /** BT709色域 | SRGB转换函数 | EXTENDED精度 */ - BT709_SRGB_EXTENDED = GAMUT_BT709 | TRANSFORM_FUNC_SRGB | PRESION_EXTENDED, - /** BT709色域 | SMPTE_170M转换函数 | LIMITED精度 */ - BT709_SMPTE170M_LIMITED = GAMUT_BT709 | TRANSFORM_FUNC_SMPTE_170M | PRESION_LIMITED, - /** DCI_P3色域 | LINEAR转换函数 | FULL精度 */ - DCI_P3_LINEAR_FULL = GAMUT_DCI_P3 | TRANSFORM_FUNC_LINEAR | PRECISION_FULL, - /** DCI_P3色域 | GM2_6转换函数 | FULL精度 */ - DCI_P3_GAMMA26_FULL = GAMUT_DCI_P3 | TRANSFORM_FUNC_GM2_6 | PRECISION_FULL, - /** DISPLAY_P3色域 | LINEAR转换函数 | FULL精度 */ - DISPLAY_P3_LINEAR_FULL = GAMUT_DISPLAY_P3 | TRANSFORM_FUNC_LINEAR | PRECISION_FULL, - /** DCI_P3色域 | SRGB转换函数 | FULL精度 */ - DCI_P3_SRGB_FULL = GAMUT_DCI_P3 | TRANSFORM_FUNC_SRGB | PRECISION_FULL, - /** ADOBE_RGB色域 | GM2_2转换函数 | FULL精度 */ - ADOBE_RGB_GAMMA22_FULL = GAMUT_ADOBE_RGB | TRANSFORM_FUNC_GM2_2 | PRECISION_FULL, - /** BT2020色域 | LINEAR转换函数 | FULL精度 */ - BT2020_LINEAR_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_LINEAR | PRECISION_FULL, - /** BT2020色域 | SRGB转换函数 | FULL精度 */ - BT2020_SRGB_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_SRGB | PRECISION_FULL, - /** BT2020色域 | SMPTE_170M转换函数 | FULL精度 */ - BT2020_SMPTE170M_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_SMPTE_170M | PRECISION_FULL, - /** BT2020色域 | ST2084转换函数 | FULL精度 */ - BT2020_ST2084_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_ST2084 | PRECISION_FULL, - /** BT2020色域 | HLG转换函数 | FULL精度 */ - BT2020_HLG_FULL = GAMUT_BT2020 | TRANSFORM_FUNC_HLG | PRECISION_FULL, - /** BT2020色域 | ST2084转换函数 | LIMITED精度 */ - BT2020_ST2084_LIMITED = GAMUT_BT2020 | TRANSFORM_FUNC_ST2084 | PRESION_LIMITED, -}; - -/** - * @brief 枚举HDR格式。 - * - */ -enum HDRFormat { - NOT_SUPPORT_HDR = 0, /**< 不支持HDR */ - DOLBY_VISION = 1, /**< Dolby Vision格式 */ - HDR10 = 2, /**< HDR10格式 */ - HLG = 3, /**< HLG格式 */ - HDR10_PLUS = 4, /**< HDR10 Plus格式 */ - HDR_VIVID = 5, /**< Vivid格式 */ -}; - -/** - * @brief 枚举HDR元数据关键字。 + * @brief 显示接口类型。 * */ -enum HDRMetadataKey { - MATAKEY_RED_PRIMARY_X = 0, /**< 红基色X坐标 */ - MATAKEY_RED_PRIMARY_Y = 1, /**< 红基色Y坐标 */ - MATAKEY_GREEN_PRIMARY_X = 2, /**< 绿基色X坐标 */ - MATAKEY_GREEN_PRIMARY_Y = 3, /**< 绿基色Y坐标 */ - MATAKEY_BLUE_PRIMARY_X = 4, /**< 蓝基色X坐标 */ - MATAKEY_BLUE_PRIMARY_Y = 5, /**< 蓝基色Y坐标 */ - MATAKEY_WHITE_PRIMARY_X = 6, /**< 白点X坐标 */ - MATAKEY_WHITE_PRIMARY_Y = 7, /**< 白点Y坐标 */ - MATAKEY_MAX_LUMINANCE = 8, /**< 最大的光亮度 */ - MATAKEY_MIN_LUMINANCE = 9, /**< 最小的光亮度 */ - MATAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, /**< 最大的内容亮度水平 */ - MATAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, /**< 最大的帧平均亮度水平 */ - MATAKEY_HDR10_PLUS = 12, /**< HDR10 Plus */ - MATAKEY_HDR_VIVID = 13, /**< Vivid */ -}; - -struct HdiBufferHandleInfo { - unsigned int seqId; - BufferHandleParcelable hdl; -}; - -struct HdifdInfo { - int id; - HdifdParcelable hdiFd; +enum InterfaceType { + DISP_INTF_HDMI = 0, /**< HDMI 接口 */ + DISP_INTF_LCD, /**< LCD 接口 */ + DISP_INTF_BT1120, /**< BT1120 接口 */ + DISP_INTF_BT656, /**< BT656 接口 */ + DISP_INTF_YPBPR, /**< YPBPR 接口 */ + DISP_INTF_RGB, /**< RGB 接口 */ + DISP_INTF_CVBS, /**< CVBS 接口 */ + DISP_INTF_SVIDEO, /**< SVIDEO 接口 */ + DISP_INTF_VGA, /**< VGA 接口 */ + DISP_INTF_MIPI, /**< MIPI 接口 */ + DISP_INTF_PANEL, /**< PANEL 接口 */ + DISP_INTF_BUTT, /**< BUTT 接口, 一个不可用类型, 用于默认初始化。 */ }; /** @@ -479,21 +360,21 @@ struct DisplayCapability { unsigned int virtualDispCount; /**< 支持的虚拟屏数 */ boolean supportWriteBack; /**< 是否支持回写 */ unsigned int propertyCount; /**< 属性数组大小 */ - struct PropertyObject[] props; /**< 属性数组*/ + struct PropertyObject[] props; /**< 属性数组 */ }; /** - * @brief 定义显示信息结构体。 - * + * @brief 定义输出模式信息。 */ -struct DisplayInfo { - unsigned int width; /**< 显示屏宽度 */ - unsigned int height; /**< 显示屏高度 */ - int rotAngle; /**< 显示屏旋转角度 */ +struct DisplayModeInfo { + int width; /**< 像素宽度 */ + int height; /**< 像素高度 */ + unsigned int freshRate; /**< 刷新速率 */ + int id; /**< 模式ID */ }; /** - * @brief 定义图层信息结构体。 + * @brief Defines 定义图层信息结构体。 * * 在创建图层时,需要将LayerInfo传递给创建图层接口,创建图层接口根据图层信息创建相应图层。 * @@ -518,29 +399,6 @@ struct LayerAlpha { unsigned char gAlpha; /**< 全局Alpha值,取值范围:[0, 255]。 */ }; -/** - * @brief 定义一层的缓冲区数据,包括虚拟和物理内存地址。 - * - */ -struct BufferData { - unsigned long phyAddr; /**< 物理内存地址 */ - unsigned long long virAddr; /**< 虚拟内存地址 */ -}; - -/** - * @brief 图层Buffer,用于存放图层数据。 - * - */ -struct LayerBuffer { - FileDescriptor fenceId; /**< Buffer 的Fence号 */ - int width; /**< Buffer宽度 */ - int height; /**< Buffer高度 */ - int pitch; /**< 一行数据所占字节数 */ - enum PixelFormat pixFormat; /**< Buffer像素格式 */ - struct BufferData data; /**< 图层Buffer数据 */ - BufferHandleParcelable hdl; /**< 图层Buffer句柄 */ -}; - /** * @brief 定义矩形框信息。 * @@ -622,13 +480,94 @@ struct GfxOpt { }; /** - * @brief 定义输出模式信息。 + * @brief 色域类型枚举值。 */ -struct DisplayModeInfo { - int width; /**< 像素宽度 */ - int height; /**< 像素高度 */ - unsigned int freshRate; /**< 刷新速率 */ - int id; /**< 模式ID */ +enum ColorGamut { + COLOR_GAMUT_INVALID = -1, /**< 无效值 */ + COLOR_GAMUT_NATIVE = 0, /**< 默认值 */ + COLOR_GAMUT_STANDARD_BT601 = 1, /**< Standard BT601类型 */ + COLOR_GAMUT_STANDARD_BT709 = 2, /**< Standard BT709类型 */ + COLOR_GAMUT_DCI_P3 = 3, /**< DCI P3类型 */ + COLOR_GAMUT_SRGB = 4, /**< SRGB类型 */ + COLOR_GAMUT_ADOBE_RGB = 5, /**< Adobe RGB类型 */ + COLOR_GAMUT_DISPLAY_P3 = 6, /**< display P3类型 */ + COLOR_GAMUT_BT2020 = 7, /**< BT2020类型 */ + COLOR_GAMUT_BT2100_PQ = 8, /**< BT2100 PQ类型 */ + COLOR_GAMUT_BT2100_HLG = 9, /**< BT2100 HLG类型 */ + COLOR_GAMUT_DISPLAY_BT2020 = 10, /**< Display BT2020类型 */ +}; + +/** + * @brief 枚举色域的映射类型。 + * + */ +enum GamutMap { + GAMUT_MAP_CONSTANT = 0, /**< 不变 */ + GAMUT_MAP_EXPANSION = 1, /**< 映射增强 */ + GAMUT_MAP_HDR_CONSTANT = 2, /**< 不变,用于HDR。 */ + GAMUT_MAP_HDR_EXPANSION = 3, /**< 映射增强,用于HDR。 */ +}; + +/** + * @brief 枚举颜色空间的类型。 + * + */ +enum ColorDataSpace { + COLOR_DATA_SPACE_UNKNOWN = 0, /**< 未知的 */ + GAMUT_BT601 = 0x00000001, /**< BT601色域 */ + GAMUT_BT709 = 0x00000002, /**< BT709色域 */ + GAMUT_DCI_P3 = 0x00000003, /**< DCI_P3色域 */ + GAMUT_SRGB = 0x00000004, /**< SRGB色域 */ + GAMUT_ADOBE_RGB = 0x00000005, /**< ADOBE_RGB色域 */ + GAMUT_DISPLAY_P3 = 0x00000006, /**< DISPLAY_P3色域 */ + GAMUT_BT2020 = 0x00000007, /**< BT2020色域 */ + GAMUT_BT2100_PQ = 0x00000008, /**< BT2100_PQ色域 */ + GAMUT_BT2100_HLG = 0x00000009, /**< BT2100_HLG色域 */ + GAMUT_DISPLAY_BT2020 = 0x0000000a, /**< DISPLAY_BT2020色域 */ + TRANSFORM_FUNC_UNSPECIFIED = 0x00000100, /**< UNSPECIFIED转换函数 */ + TRANSFORM_FUNC_LINEAR = 0x00000200, /**< LINEAR转换函数 */ + TRANSFORM_FUNC_SRGB = 0x00000300, /**< SRGB转换函数 */ + TRANSFORM_FUNC_SMPTE_170M = 0x00000400, /**< SMPTE_170M转换函数 */ + TRANSFORM_FUNC_GM2_2 = 0x00000500, /**< GM2_2转换函数 */ + TRANSFORM_FUNC_GM2_6 = 0x00000600, /**< GM2_6转换函数 */ + TRANSFORM_FUNC_GM2_8 = 0x00000700, /**< GM2_8转换函数 */ + TRANSFORM_FUNC_ST2084 = 0x00000800, /**< ST2084转换函数 */ + TRANSFORM_FUNC_HLG = 0x00000900, /**< HLG转换函数 */ + PRECISION_UNSPECIFIED = 0x00010000, /**< UNSPECIFIED精度 */ + PRECISION_FULL = 0x00020000, /**< FULL精度 */ + PRESION_LIMITED = 0x00030000, /**< LIMITED精度 */ + PRESION_EXTENDED = 0x00040000, /**< EXTENDED精度 */ + BT601_SMPTE170M_FULL = 1 | 1024 | 131072, /**< BT601色域 | SMPTE_170M转换函数 | FULL精度 */ + BT601_SMPTE170M_LIMITED = 1 | 1024 | 196608, /**< BT601色域 | SMPTE_170M转换函数 | LIMITED精度 */ + BT709_LINEAR_FULL = 2 | 512 | 131072, /**< BT709色域 | LINEAR转换函数 | FULL精度 */ + BT709_LINEAR_EXTENDED = 2 | 512 | 262144, /**< BT709色域 | LINEAR转换函数 | EXTENDED精度 */ + BT709_SRGB_FULL = 2 | 768 | 131072, /**< BT709色域 | SRGB转换函数 | FULL精度 */ + BT709_SRGB_EXTENDED = 2 | 768 | 262144, /**< BT709色域 | SRGB转换函数 | EXTENDED精度 */ + BT709_SMPTE170M_LIMITED = 2 | 1024 | 196608, /**< BT709色域 | SMPTE_170M转换函数 | LIMITED精度 */ + DCI_P3_LINEAR_FULL = 3 | 512 | 131072, /**< DCI_P3色域 | LINEAR转换函数 | FULL精度 */ + DCI_P3_GAMMA26_FULL = 3 | 1536 | 131072, /**< DCI_P3色域 | GM2_6转换函数 | FULL精度 */ + DISPLAY_P3_LINEAR_FULL = 6 | 512 | 131072, /**< DISPLAY_P3色域 | LINEAR转换函数 | FULL精度 */ + DCI_P3_SRGB_FULL = 3 | 768 | 131072, /**< DCI_P3色域 | SRGB转换函数 | FULL精度 */ + ADOBE_RGB_GAMMA22_FULL = 5 | 1280 | 131072, /**< ADOBE_RGB色域 | GM2_2转换函数 | FULL精度 */ + BT2020_LINEAR_FULL = 7 | 512 | 131072, /**< BT2020色域 | LINEAR转换函数 | FULL精度 */ + BT2020_SRGB_FULL = 7 | 768 | 131072, /**< BT2020色域 | SRGB转换函数 | FULL精度 */ + BT2020_SMPTE170M_FULL = 7 | 1024 | 131072, /**< BT2020色域 | SMPTE_170M转换函数 | FULL精度 */ + BT2020_ST2084_FULL = 7 | 2048 | 131072, /**< BT2020色域 | ST2084转换函数 | FULL精度 */ + BT2020_HLG_FULL = 7 | 2304 | 131072, /**< BT2020色域 | HLG转换函数 | FULL精度 */ + BT2020_ST2084_LIMITED = 7 | 2048 | 196608, /**< BT2020色域 | ST2084转换函数 | LIMITED精度 */ +}; + +/** + * @brief 枚举HDR格式。 + * + */ +enum HDRFormat { + NOT_SUPPORT_HDR = 0, /**< 不支持HDR */ + DOLBY_VISION = 1, /**< Dolby Vision格式 */ + HDR10 = 2, /**< HDR10格式 */ + HLG = 3, /**< HLG格式 */ + HDR10_PLUS = 4, /**< HDR10 Plus格式 */ + HDR_VIVID = 5, /**< Vivid格式 */ }; /** @@ -643,6 +582,27 @@ struct HDRCapability { float minLum; /**< 最小光亮度luminance值 */ }; +/** + * @brief 枚举HDR元数据关键字。 + * + */ +enum HDRMetadataKey { + MATAKEY_RED_PRIMARY_X = 0, /**< 红基色X坐标 */ + MATAKEY_RED_PRIMARY_Y = 1, /**< 红基色Y坐标 */ + MATAKEY_GREEN_PRIMARY_X = 2, /**< 绿基色X坐标 */ + MATAKEY_GREEN_PRIMARY_Y = 3, /**< 绿基色Y坐标 */ + MATAKEY_BLUE_PRIMARY_X = 4, /**< 蓝基色X坐标 */ + MATAKEY_BLUE_PRIMARY_Y = 5, /**< 蓝基色Y坐标 */ + MATAKEY_WHITE_PRIMARY_X = 6, /**< 白点X坐标 */ + MATAKEY_WHITE_PRIMARY_Y = 7, /**< 白点Y坐标 */ + MATAKEY_MAX_LUMINANCE = 8, /**< 最大的光亮度 */ + MATAKEY_MIN_LUMINANCE = 9, /**< 最小的光亮度 */ + MATAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, /**< 最大的内容亮度水平 */ + MATAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, /**< 最大的帧平均亮度水平 */ + MATAKEY_HDR10_PLUS = 12, /**< HDR10 Plus */ + MATAKEY_HDR_VIVID = 13, /**< Vivid */ +}; + /** * @brief HDR元数据结构体定义。 * @@ -662,6 +622,15 @@ enum PresentTimestampType { HARDWARE_DISPLAY_PTS_TIMESTAMP = 1 << 1, /**< 时间戳类型 */ }; +/** + * @brief 图层蒙版枚举值。 + * + */ +enum MaskInfo { + LAYER_NORAML = 0, + LAYER_HBM_SYNC = 1, +}; + /** * @brief 上屏时间戳结构体定义。 * @@ -694,4 +663,24 @@ struct YUVDescInfo { unsigned int uvStride; /**< UV的Stride信息 */ unsigned int uvStep; /**< UV的Step信息 */ }; + +/** + * @brief 定义 hdi fd 信息结构体。 + * + */ +struct HdifdInfo { + int id; /**< fd对应id*/ + HdifdParcelable hdiFd; /**< fd具体信息*/ +}; + +/** + * @brief 定义图层颜色设置的结构结构体 + * + */ +struct LayerColor { + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; +}; /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/composer/v1_0/IDisplayComposer.idl b/zh-cn/device_api/hdi/display/composer/v1_0/IDisplayComposer.idl index 96dab2a7..138a3de1 100644 --- a/zh-cn/device_api/hdi/display/composer/v1_0/IDisplayComposer.idl +++ b/zh-cn/device_api/hdi/display/composer/v1_0/IDisplayComposer.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -48,7 +48,6 @@ import ohos.hdi.display.composer.v1_0.IVBlankCallback; import ohos.hdi.display.composer.v1_0.IRefreshCallback; sequenceable OHOS.HDI.Display.HdifdParcelable; -sequenceable OHOS.HDI.Display.BufferHandleParcelable; /** * @brief 显示合成接口声明。 @@ -58,7 +57,6 @@ sequenceable OHOS.HDI.Display.BufferHandleParcelable; * @since 3.2 * @version 1.0 */ - interface IDisplayComposer { /** * @brief 注册热插拔事件回调。 @@ -75,6 +73,35 @@ interface IDisplayComposer { */ RegHotPlugCallback([in] IHotPlugCallback cb); + /** + * @brief 设置显示设备的客户端缓冲区缓存计数。 + * + * @param devId 表示需要操作的设备ID。 + * @param count 客户端缓冲区缓存计数。 + * + * @return DISPLAY_SUCCESS 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 3.2 + * @version 1.0 + */ + SetClientBufferCacheCount([in] unsigned int devId, [in] unsigned int count); + + /** + * @brief 注册VBlank事件回调。 + * + * 注册VBlank事件回调,当有VBlank事件发生时接口实现层需要回调注册的接口。 + * + * @param devId 表示需要操作的设备ID。 + * @param cb VBlank事件回调实例,当有VBlank事件发生时并且DisplayVsync处于Enable状态,接口实现层需要通过该实例通知图形服务。 + * + * @return DISPLAY_SUCCESS 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * + * @since 3.2 + * @version 1.0 + */ + RegDisplayVBlankCallback([in] unsigned int devId, [in] IVBlankCallback cb); + /** * @brief 获取显示设备能力集。 * @@ -140,7 +167,7 @@ interface IDisplayComposer { */ SetDisplayMode([in] unsigned int devId, [in] unsigned int modeId); - /** + /** * @brief 获取显示设备当前的电源状态。 * * 图形服务可以通过该接口获取设置显示设备的电源状态,该电源状态由接口实现层进行状态的写入。 @@ -205,30 +232,13 @@ interface IDisplayComposer { SetDisplayBacklight([in] unsigned int devId, [in] unsigned int level); /** - * @brief 获取显示设备属性值。 - * - * 图形服务可以通过该接口获取显示设备具体的属性值。 - * - * @param devId 指示需要操作的设备ID。 - * @param id 由接口{@Link GetDisplayCapability}返回的属性ID。 - * @param value 属性ID对应的属性值,由接口实现层写入。 - * - * @return DISPLAY_SUCCESS 表示执行成功。 - * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 - * - * @since 3.2 - * @version 1.0 - */ - GetDisplayProperty([in] unsigned int devId, [in] unsigned int id, [out] unsigned long value); - - /** - * @brief 获取显示设备合成类型有变化的layer。 - * - * 在合成准备阶段,显示设备会根据设备的合成能力修改图层的合成类型,该接口会返回哪些图层合成类型发生了变化。 + * @brief 使能垂直同步信号。 * + * 图形服务可以通过该接口使能或取消垂直同步信号,当有垂直同步信号产生时,接口实现层需要回调图形服务通过RegDisplayVBlankCallback注册的 + * VBlankCallback 回调。 + * 图形服务在需要刷新显示时需要使能垂直同步信号,在收到{@link VBlankCallback}事件回调时再进行合成送显,不需要刷新显示时需要取消垂直同步信号。 * @param devId 表示需要操作的设备ID。 - * @param Layers 指向图层数组首地址。 - * @param type 指向合成类型数组首地址。 + * @param enabled 使能状态,true表示能,false表示不能。 * * @return DISPLAY_SUCCESS 表示执行成功。 * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 @@ -236,64 +246,50 @@ interface IDisplayComposer { * @since 3.2 * @version 1.0 */ - GetDisplayCompChange([in] unsigned int devId, [out] unsigned int[] layers, [out] int[] type); + SetDisplayVsyncEnabled([in] unsigned int devId, [in] boolean enabled); /** - * @brief 设置显示设备的裁剪区域。 + * @brief 打开图层。 * - * 图形服务可以通过该接口设置显示设备的ClientBuffer的裁剪区域,裁剪区域不能超过ClientBuffer的大小。 + * GUI在使用图层时,需要先根据图层信息打开图层,打开图层成功可获得图层ID,根据图层ID使用图层各接口。 * - * @param devId 表示需要操作的设备ID。 - * @param rect ClientBuffer的裁剪区域。 + * @param devId 显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备,即取值范围0~4。 + * @param layerInfo 图层信息,上层GUI打开图层时需传递图层信息,包括图层类型,图层大小,像素格式等信息。 + * @param layerId 图层ID,打开图层成功后返回给GUI的图层ID,用于标识唯一的图层。 * * @return DISPLAY_SUCCESS 表示执行成功。 * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 * + * @see CloseLayer * @since 3.2 * @version 1.0 */ - SetDisplayClientCrop([in] unsigned int devId, [in] struct IRect rect); + CreateLayer([in] unsigned int devId, [in] struct LayerInfo layerInfo, [in] unsigned int cacheCount, + [out] unsigned int layerId); /** - * @brief 设置显示设备的显示区域。 + * @brief 在指定的显示设备上打开图层。 * - * 图形服务可以通过该接口设置显示设备的显示区域。 + * 在 GUI 上使用图层之前,必须根据图层信息打开图层。在图层 + * 打开后,可以获取图层 ID,然后根据图层 ID 使用其他功能。 * - * @param devId 表示需要操作的设备ID。 - * @param rect 显示区域。 + * @param devId:显示设备的ID。取值范围为 0 到 4,其中 0 表示第一个显示设备,4 表示最后一个显示设备。 + * @param layerId 指示指向唯一标识层的层 ID 的指针。返回图层 ID到图层成功打开后添加到 GUI。 * * @return DISPLAY_SUCCESS 表示执行成功。 * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 - * * @since 3.2 * @version 1.0 */ - SetDisplayClientDestRect([in] unsigned int devId, [in] struct IRect rect); - - /** - * @brief 使能垂直同步信号。 - * - * 图形服务可以通过该接口使能或取消垂直同步信号,当有垂直同步信号产生时,接口实现层需要回调图形服务通过RegDisplayVBlankCallback注册的 - * VBlankCallback 回调。 - * 图形服务在需要刷新显示时需要使能垂直同步信号,在收到{@link VBlankCallback}事件回调时再进行合成送显,不需要刷新显示时需要取消垂直同步信号。 - * @param devId 表示需要操作的设备ID。 - * @param enabled 使能状态,true表示能,false表示不能。 - * - * @return DISPLAY_SUCCESS 表示执行成功。 - * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 - * - * @since 3.2 - * @version 1.0 - */ - SetDisplayVsyncEnabled([in] unsigned int devId, [in] boolean enabled); + DestroyLayer([in] unsigned int devId, [in] unsigned int layerId); /** - * @brief 注册VBlank事件回调。 + * @brief 设置显示设备的裁剪区域。 * - * 注册VBlank事件回调,当有VBlank事件发生时接口实现层需要回调注册的接口。 + * 图形服务可以通过该接口设置显示设备的ClientBuffer的裁剪区域,裁剪区域不能超过ClientBuffer的大小。 * * @param devId 表示需要操作的设备ID。 - * @param cb VBlank事件回调实例,当有VBlank事件发生时并且DisplayVsync处于Enable状态,接口实现层需要通过该实例通知图形服务。 + * @param rect ClientBuffer的裁剪区域。 * * @return DISPLAY_SUCCESS 表示执行成功。 * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 @@ -301,7 +297,7 @@ interface IDisplayComposer { * @since 3.2 * @version 1.0 */ - RegDisplayVBlankCallback([in] unsigned int devId, [in] IVBlankCallback cb); + SetDisplayClientCrop([in] unsigned int devId, [in] struct IRect rect); /** * @brief 获取显示图层fence。 @@ -369,7 +365,7 @@ interface IDisplayComposer { * @since 3.2 * @version 1.0 */ - SetVirtualDisplayBuffer([in] unsigned int devId, [in] BufferHandleParcelable buffer, [in] HdifdParcelable fence); + SetVirtualDisplayBuffer([in] unsigned int devId, [in] NativeBuffer buffer, [in] HdifdParcelable fence); /** * @brief 设置显示设备属性值。 @@ -389,27 +385,61 @@ interface IDisplayComposer { SetDisplayProperty([in] unsigned int devId, [in] unsigned int id, [in] unsigned long value); /** - * @brief 打开图层。 + * @brief 获取显示设备属性值。 * - * GUI在使用图层时,需要先根据图层信息打开图层,打开图层成功可获得图层ID,根据图层ID使用图层各接口。 + * 图形服务可以通过该接口获取显示设备具体的属性值。 * - * @param devId 显示设备ID,用于支持多个显示设备,取值从0开始,0表示第一个设备,最大支持5个设备,即取值范围0~4。 - * @param layerInfo 图层信息,上层GUI打开图层时需传递图层信息,包括图层类型,图层大小,像素格式等信息。 - * @param layerId 图层ID,打开图层成功后返回给GUI的图层ID,用于标识唯一的图层。 + * @param devId 指示需要操作的设备ID。 + * @param id 由接口{@Link GetDisplayCapability}返回的属性ID。 + * @param value 属性ID对应的属性值,由接口实现层写入。 * * @return DISPLAY_SUCCESS 表示执行成功。 * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 * - * @see CloseLayer * @since 3.2 * @version 1.0 */ - CreateLayer([in] unsigned int devId, [in] struct LayerInfo layerInfo, [out] unsigned int layerId); - DestroyLayer([in] unsigned int devId, [in] unsigned int layerId); - /* func for smq transfer */ + GetDisplayProperty([in] unsigned int devId, [in] unsigned int id, [out] unsigned long value); + + /* 用于 SMQ 传输的 FUNC */ + /* * + * @brief 初始化命令请求对象。 + * + * @param request 指示要初始化的 SharedMemQueue。 + * + * @return DISPLAY_SUCCESS 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 3.2 + * @version 1.0 + */ InitCmdRequest([in] SharedMemQueue request); + + /* * + * @brief 发送命令请求。 + * + * @param inEleCnt 表示元素的个数。 + * @param inFds 表示 HdifdParcelable 的 ID。 + * @param outEleCnt outEleCnt inEleCnt 指示要获取的元素数。 + * @param outFds outEleCnt 指示要获取的 HdifdParcelable 的 ID。 + * + * @return DISPLAY_SUCCESS 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 3.2 + * @version 1.0 + */ CmdRequest([in] unsigned int inEleCnt, [in] struct HdifdInfo[] inFds, [out] unsigned int outEleCnt, [out] struct HdifdInfo[] outFds); + + /* * + * @brief 获取命令请求的返回结果。 + * + * @param reply 表示返回的结果。 + * + * @return DISPLAY_SUCCESS 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 3.2 + * @version 1.0 + */ GetCmdReply([out] SharedMemQueue reply); } /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/composer/v1_0/IHotPlugCallback.idl b/zh-cn/device_api/hdi/display/composer/v1_0/IHotPlugCallback.idl index 338372c4..03e39b76 100644 --- a/zh-cn/device_api/hdi/display/composer/v1_0/IHotPlugCallback.idl +++ b/zh-cn/device_api/hdi/display/composer/v1_0/IHotPlugCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -44,14 +44,18 @@ package ohos.hdi.display.composer.v1_0; import ohos.hdi.display.composer.v1_0.DisplayComposerType; - /** - * @brief 热插拔事件回调接口声明。 - * - * @since 3.2 - * @version 1.0 - */ - [callback] interface IHotPlugCallback { + /** + * @brief 热插拔事件回调接口声明。 + * + * @param outputId 指示显示设备的 ID。 + * @param connected 设备是否连接。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 3.2 + * @version 1.0 + */ OnHotPlug([in] unsigned int outputId, [in] boolean connected); } /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/composer/v1_0/IRefreshCallback.idl b/zh-cn/device_api/hdi/display/composer/v1_0/IRefreshCallback.idl index c3d17562..6aa87a59 100644 --- a/zh-cn/device_api/hdi/display/composer/v1_0/IRefreshCallback.idl +++ b/zh-cn/device_api/hdi/display/composer/v1_0/IRefreshCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -44,14 +44,17 @@ package ohos.hdi.display.composer.v1_0; import ohos.hdi.display.composer.v1_0.DisplayComposerType; - /** - * @brief 显示刷新事件回调接口声明。 - * - * @since 3.2 - * @version 1.0 - */ - [callback] interface IRefreshCallback { + /** + * @brief 显示刷新事件回调接口声明。 + * + * @param devId:显示设备的ID。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 3.2 + * @version 1.0 + */ OnRefresh([in] unsigned int devId); } /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/composer/v1_0/IVBlankCallback.idl b/zh-cn/device_api/hdi/display/composer/v1_0/IVBlankCallback.idl index 33c8bb09..516dbe2d 100644 --- a/zh-cn/device_api/hdi/display/composer/v1_0/IVBlankCallback.idl +++ b/zh-cn/device_api/hdi/display/composer/v1_0/IVBlankCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -44,14 +44,19 @@ package ohos.hdi.display.composer.v1_0; import ohos.hdi.display.composer.v1_0.DisplayComposerType; - /** - * @brief 帧同步事件回调接口声明。 - * - * @since 3.2 - * @version 1.0 - */ - [callback] interface IVBlankCallback { + + /** + * @brief 帧同步事件回调接口声明。 + * + * @param sequence 序列号。 + * @param ns 调用时的时间。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 3.2 + * @version 1.0 + */ OnVBlank([in] unsigned int sequence, [in] unsigned long ns); } /** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/composer/v1_1/DisplayComposerType.idl b/zh-cn/device_api/hdi/display/composer/v1_1/DisplayComposerType.idl new file mode 100644 index 00000000..bb863320 --- /dev/null +++ b/zh-cn/device_api/hdi/display/composer/v1_1/DisplayComposerType.idl @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Display + * @{ + * + * @brief 显示模块驱动接口定义。 + * + * 提供给上层图形服务使用的驱动接口,包括图层管理、设备控制、显示内存管理等相关接口。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file DisplayComposerType.idl + * + * @brief 显示合成类型定义,定义显示图层合成操作相关接口所使用的数据类型。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Display模块接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.display.composer.v1_1; +sequenceable OHOS.HDI.Display.HdifdParcelable; +import ohos.hdi.display.composer.v1_0.DisplayComposerType; + +/** + * @brief 像素格式类型定义。 + */ +enum PixelFormat : ohos.hdi.display.composer.v1_0.PixelFormat { + PIXEL_FMT_YCBCR_P010 = 35, /**< YCBCR420 半平面 10 位格式 */ + PIXEL_FMT_YCRCB_P010, /**< YCRCB420 半平面 10 位格式 */ + PIXEL_FMT_RAW10, /**< RAW 10bit 格式 */ +}; + +/** + * @brief 枚举显示状态。 + */ +enum DispPowerStatus : ohos.hdi.display.composer.v1_0.DispPowerStatus { + POWER_STATUS_OFF_FAKE = 4, /**< 当 hwc 关闭时,电源状态为 ON */ + POWER_STATUS_BUTT_V1_1, /**< 电源状态无效 */ +}; + +/** + * @brief 枚举特殊层的组合类型。 + */ +enum CompositionType : ohos.hdi.display.composer.v1_0.CompositionType { + COMPOSITION_SOLID_COLOR = 7, /**< Tunnel 组合类型,用于 tunnel. */ + COMPOSITION_BUTT_V1_1, /**< 无效的合成类型 */ +}; + +/** + * @brief 定义输出模式 ext 信息。 + */ +struct DisplayModeInfoExt { + struct DisplayModeInfo v1_0; /* 显示合成类型定义,定义显示图层合成操作相关接口所使用的数据类型。 */ + unsigned int groupId; /* ltpo 序号 */ +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/composer/v1_1/IDisplayComposer.idl b/zh-cn/device_api/hdi/display/composer/v1_1/IDisplayComposer.idl new file mode 100644 index 00000000..f4e575d7 --- /dev/null +++ b/zh-cn/device_api/hdi/display/composer/v1_1/IDisplayComposer.idl @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Display + * @{ + * + * @brief 显示模块驱动接口定义。 + * + * 提供给上层图形服务使用的驱动接口,包括图层管理、设备控制、显示内存管理等相关接口。 + * + * @since 4.1 + * @version 1.1 + */ + + /** + * @file IDisplayComposer.idl + * + * @brief 显示合成接口声明。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Display模块接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.display.composer.v1_1; + +import ohos.hdi.display.composer.v1_0.IDisplayComposer; +import ohos.hdi.display.composer.v1_0.DisplayComposerType; +import ohos.hdi.display.composer.v1_1.DisplayComposerType; +import ohos.hdi.display.composer.v1_1.IModeCallback; +import ohos.hdi.display.composer.v1_1.ISeamlessChangeCallback; +import ohos.hdi.display.composer.v1_0.IRefreshCallback; + +/** + * @brief 显示合成接口声明。 + * + * 主要提供注册热插拔事件回调、获取显示设备能力集等功能,具体方法使用详见函数说明。 + * + * @since 4.1 + * @version 1.1 + */ +interface IDisplayComposer extends ohos.hdi.display.composer.v1_0.IDisplayComposer { + /** + * @brief 注册要在准备好更改帧速率时调用的回调。 + * + * @param cb 指示用于通知图形服务已准备好更改帧速率的实例。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + RegSeamlessChangeCallback([in] ISeamlessChangeCallback cb); + + /** + * @brief 获取显示设备支持的显示模式。 + * + * @param devId 指示显示设备的 ID。 + * @param modes 表示有关显示设备支持的所有模式的信息向量, + * 包括所有支持的分辨率、刷新率和 groupId。每种模式都有一个 ID,该 ID 将在以下情况下使用 + * 模式已设置或获取。有关详细信息,请参阅 {@link DisplayModeInfoExt}。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + GetDisplaySupportedModesExt([in] unsigned int devId, [out] struct DisplayModeInfoExt[] modes); + + /** + * @brief 设置显示设备的显示模式。 + * + * @param devId 指示显示设备的 ID。 + * @param modeId 指示显示模式的 ID。设备切换到指定的显示模式 + * 此接口中的此参数。 + * @param cb 表示更改模式时要调用的回调。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + SetDisplayModeAsync([in] unsigned int devId, [in] unsigned int modeId, [in] IModeCallback cb); + + /** + * @brief 获取当前 vblank 周期。 + * @param devId 指示显示设备的 ID。 + * @param period 指示 vblank 周期 (ns)。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + GetDisplayVBlankPeriod([in] unsigned int devId, [out] unsigned long period); + + /** + * @brief 设置给定图层的参数,参数更改必须在此调用后完全生效。 + * + * @param devId 指示显示设备的 ID。 + * @param layerId 指示要操作的层的 ID。 + * @param key 指示特定键。 + * @param value 指示与键对应的值。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + SetLayerPerFrameParameter([in] unsigned int devId, [in] unsigned int layerId, [in] String key, [out] byte[] value); + + /** + * @brief 返回支持的参数键的列表 + * + * @param keys 指示支持的参数键。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + GetSupportedLayerPerFrameParameterKey([out] String[] keys); + + /** + * @brief 设置给定图层的参数,参数更改必须在此调用后完全生效。 + * + * @param devId 指示显示设备的 ID。 + * @param width 指示显示设备的像素宽度 + * @param height 指示显示设备的像素高度 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + SetDisplayOverlayResolution([in] unsigned int devId, [in] unsigned int width, [in] unsigned int height); + + /** + * @brief 注册要在发生刷新事件时调用的回调。 + * + * @param cb 指示用于通知图形服务发生刷新事件的实例。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + RegRefreshCallback([in] IRefreshCallback cb); + + /** + * @brief 获取显示设备的色域。 + * + * @param devId 指示显示设备的 ID。 + * @param gamuts 指示有关显示设备支持的所有色域的信息的向量。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + GetDisplaySupportedColorGamuts([in] unsigned int devId, [out] struct ColorGamut[] gamuts); + + /** + * @brief 获取显示设备的功能。 + * + * @param devId 指示显示设备的 ID。 + * @param info 指示指向 hdr 设备支持的功能的指针。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + GetHDRCapabilityInfos([in] unsigned int devId, [out] struct HDRCapability info); +} + /** @} */ diff --git a/zh-cn/device_api/hdi/display/composer/v1_1/IModeCallback.idl b/zh-cn/device_api/hdi/display/composer/v1_1/IModeCallback.idl new file mode 100644 index 00000000..2b1f1497 --- /dev/null +++ b/zh-cn/device_api/hdi/display/composer/v1_1/IModeCallback.idl @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Display + * @{ + * + * @brief 显示模块驱动接口定义。 + * + * 提供给上层图形服务使用的驱动接口,包括图层管理、设备控制、显示内存管理等相关接口。 + * + * @since 4.1 + * @version 1.1 + */ + + /** + * @file IModeCallback.idl + * + * @brief 显示合成接口声明。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Display模块接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.display.composer.v1_1; +package ohos.hdi.display.composer.v1_1; + +/** + * @brief 显示模式更改时使用接口。 + * + * + * @since 4.1 + * @version 1.1 + */ +import ohos.hdi.display.composer.v1_1.DisplayComposerType; + +[callback] interface IModeCallback { + /** + * @brief 显示模式更改时要调用的回调。 + * + * @param modeId GetDisplaySupportedModes返回的显示模式 ID。 + * @param vBlankPeriod modeId 指示的 vblank。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + OnMode([in] unsigned int modeId, [in] unsigned long vBlankPeriod); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/display/composer/v1_1/ISeamlessChangeCallback.idl b/zh-cn/device_api/hdi/display/composer/v1_1/ISeamlessChangeCallback.idl new file mode 100644 index 00000000..e89458c7 --- /dev/null +++ b/zh-cn/device_api/hdi/display/composer/v1_1/ISeamlessChangeCallback.idl @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Display + * @{ + * + * @brief 显示模块驱动接口定义。 + * + * 提供给上层图形服务使用的驱动接口,包括图层管理、设备控制、显示内存管理等相关接口。 + * + * @since 4.1 + * @version 1.1 + */ + + /** + * @file ISeamlessChangeCallback.idl + * + * @brief 显示合成接口声明。 + * + * @since 4.1 + * @version 1.1 + */ + +/** + * @brief Display模块接口的包路径。 + * + * @since 4.1 + * @version 1.1 + */ +package ohos.hdi.display.composer.v1_1; + +/** + * @brief 更改帧速率需要使用的接口。 + * + * + * @since 4.1 + * @version 1.1 + */ +[callback] interface ISeamlessChangeCallback { + /** + * @brief 准备好更改帧速率时要调用的回调 + * + * @param devId 表示需要操作的设备ID。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link DispErrCode}。 + * @since 4.1 + * @version 1.1 + */ + OnSeamlessChange([in] unsigned int devId); +} +/** @} */ \ No newline at end of file -- Gitee From 2e88c4d55ac3af7748fa6eb10f32730704a379c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=9D=B0?= Date: Mon, 4 Dec 2023 12:54:15 +0000 Subject: [PATCH 0144/2135] update zh-cn/native_sdk/net/dns/native_net_conn_api.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 徐杰 --- zh-cn/native_sdk/net/dns/native_net_conn_api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/native_net_conn_api.h index 4baab2a6..cbcf8a14 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/native_net_conn_api.h @@ -20,7 +20,7 @@ * @addtogroup NetConn * @{ * - * @brief Provide C interface for the data network connection module of network management. + * @brief 为网络管理数据网络连接模块儿提供C接口. * * @since 11 * @version 1.0 @@ -29,7 +29,7 @@ /** * @file native_net_conn_api.h * - * @brief Provide C interface for the data network connection module of network management. + * @brief 为网络管理数据网络连接模块儿提供C接口. * * @library libnetconn_ndk.z.so * @syscap SystemCapability.Communication.NetManager.Core -- Gitee From 58777a90d447883f56efbc07e9f2638b4c188680 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Tue, 5 Dec 2023 17:23:42 +0800 Subject: [PATCH 0145/2135] modify brief and name Signed-off-by: liuxiyao223 --- en/native_sdk/net_ssl/net_ssl_c.h | 22 ++++++++++++++++++---- en/native_sdk/net_ssl/net_ssl_c_type.h | 14 +++++++------- zh-cn/native_sdk/net_ssl/net_ssl_c.h | 22 ++++++++++++++++++---- zh-cn/native_sdk/net_ssl/net_ssl_c_type.h | 14 +++++++------- 4 files changed, 50 insertions(+), 22 deletions(-) diff --git a/en/native_sdk/net_ssl/net_ssl_c.h b/en/native_sdk/net_ssl/net_ssl_c.h index 1ffc4c2d..dd2b531f 100644 --- a/en/native_sdk/net_ssl/net_ssl_c.h +++ b/en/native_sdk/net_ssl/net_ssl_c.h @@ -20,7 +20,7 @@ * @addtogroup netstack * @{ * - * @brief Provides C APIs for the SSL/TLS certificate chain verification module. + * @brief Provides C APIs for the NetStack module. * * @since 11 * @version 1.0 @@ -48,13 +48,27 @@ extern "C" { * * @param cert Certificate to be verified. * @param caCert CA certificate specified by the user. If this parameter is left blank, the preset certificate is used. - * @return 0 if success; non-0 otherwise. + * @return 0 - success. + * 2305001 - Unspecified error. + * 2305002 - Unable to get issuer certificate. + * 2305003 - Unable to get certificate revocation list (CRL). + * 2305004 - Unable to decrypt certificate signature. + * 2305005 - Unable to decrypt CRL signature. + * 2305006 - Unable to decode issuer public key. + * 2305007 - Certificate signature failure. + * 2305008 - CRL signature failure. + * 2305009 - Certificate is not yet valid. + * 2305010 - Certificate has expired. + * 2305011 - CRL is not yet valid. + * 2305012 - CRL has expired. + * 2305023 - Certificate has been revoked. + * 2305024 - Invalid certificate authority (CA). + * 2305027 - Certificate is untrusted. * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 */ -uint32_t OH_NetStack_VerifyCertification(const struct OH_NetStack_CertBlob *cert, - const struct OH_NetStack_CertBlob *caCert); +uint32_t OH_NetStack_VerifyCertification(const struct NetStack_CertBlob *cert, const struct NetStack_CertBlob *caCert); #ifdef __cplusplus } #endif diff --git a/en/native_sdk/net_ssl/net_ssl_c_type.h b/en/native_sdk/net_ssl/net_ssl_c_type.h index 35712e65..661770f4 100644 --- a/en/native_sdk/net_ssl/net_ssl_c_type.h +++ b/en/native_sdk/net_ssl/net_ssl_c_type.h @@ -20,7 +20,7 @@ * @addtogroup netstack * @{ * - * @brief Provides C APIs for the SSL/TLS certificate chain verification module. + * @brief Provides C APIs for the NetStack module. * * @since 11 * @version 1.0 @@ -48,13 +48,13 @@ extern "C" { * @since 11 * @version 1.0 */ -enum OH_NetStack_CertType { +enum NetStack_CertType { /** PEM certificate */ - OH_NetStack_CERT_TYPE_PEM = 0, + NetStack_CERT_TYPE_PEM = 0, /** DER certificate */ - OH_NetStack_CERT_TYPE_DER = 1, + NetStack_CERT_TYPE_DER = 1, /** Invalid certificate */ - OH_NetStack_CERT_TYPE_MAX + NetStack_CERT_TYPE_INVALID }; /** @@ -63,9 +63,9 @@ enum OH_NetStack_CertType { * @since 11 * @version 1.0 */ -struct OH_NetStack_CertBlob { +struct NetStack_CertBlob { /** Certificate type */ - enum OH_NetStack_CertType type; + enum NetStack_CertType type; /** Certificate content length */ uint32_t size; /** Certificate content */ diff --git a/zh-cn/native_sdk/net_ssl/net_ssl_c.h b/zh-cn/native_sdk/net_ssl/net_ssl_c.h index 86630668..7ba549cc 100644 --- a/zh-cn/native_sdk/net_ssl/net_ssl_c.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c.h @@ -20,7 +20,7 @@ * @addtogroup netstack * @{ * - * @brief 为SSL/TLS证书链校验模块提供C接口 + * @brief 为网络协议栈模块提供c接口 * * @since 11 * @version 1.0 @@ -48,13 +48,27 @@ extern "C" { * * @param cert 用户传入的待校验证书 * @param caCert 用户指定的证书,若为空则以系统预置证书进行校验 - * @return 返回0表示校验成功,否则,表示校验失败 + * @return 0 - 成功 + * 2305001 - 未指定的错误. + * 2305002 - 无法获取颁发者证书. + * 2305003 - 无法获取证书吊销列表(CRL). + * 2305004 - 无法解密证书签名. + * 2305005 - 无法解密CRL签名. + * 2305006 - 无法解码颁发者公钥. + * 2305007 - 证书签名失败. + * 2305008 - CRL签名失败. + * 2305009 - 证书尚未生效. + * 2305010 - 证书已过期. + * 2305011 - CRL尚未有效. + * 2305012 - CRL已过期. + * 2305023 - 证书已被吊销. + * 2305024 - 证书颁发机构(CA)无效. + * 2305027 - 证书不受信任. * @syscap SystemCapability.Communication.Netstack * @since 11 * @version 1.0 */ -uint32_t OH_NetStack_VerifyCertification(const struct OH_NetStack_CertBlob *cert, - const struct OH_NetStack_CertBlob *caCert); +uint32_t OH_NetStack_VerifyCertification(const struct NetStack_CertBlob *cert, const struct NetStack_CertBlob *caCert); #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h index 72db1996..8f75d9f1 100644 --- a/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h @@ -20,7 +20,7 @@ * @addtogroup netstack * @{ * - * @brief 为SSL/TLS证书链校验模块提供C接口 + * @brief 为网络协议栈模块提供c接口 * * @since 11 * @version 1.0 @@ -48,13 +48,13 @@ extern "C" { * @since 11 * @version 1.0 */ -enum OH_NetStack_CertType { +enum NetStack_CertType { /** PEM证书类型 */ - OH_NetStack_CERT_TYPE_PEM = 0, + NetStack_CERT_TYPE_PEM = 0, /** DER证书类型 */ - OH_NetStack_CERT_TYPE_DER = 1, + NetStack_CERT_TYPE_DER = 1, /** 错误证书类型 */ - OH_NetStack_CERT_TYPE_MAX + NetStack_CERT_TYPE_INVALID }; /** @@ -63,9 +63,9 @@ enum OH_NetStack_CertType { * @since 11 * @version 1.0 */ -struct OH_NetStack_CertBlob { +struct NetStack_CertBlob { /** 证书类型 */ - enum OH_NetStack_CertType type; + enum NetStack_CertType type; /** 证书内容长度 */ uint32_t size; /** 证书内容 */ -- Gitee From 5072e1bbfbc8c4a2932081a844afe0dd35ef289d Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Fri, 8 Dec 2023 02:50:29 +0000 Subject: [PATCH 0146/2135] add sensor native header Signed-off-by: hellohyh001 --- zh-cn/native_sdk/sensor/oh_sensor.h | 90 +++++ zh-cn/native_sdk/sensor/oh_sensor_type.h | 457 +++++++++++++++++++++++ 2 files changed, 547 insertions(+) create mode 100644 zh-cn/native_sdk/sensor/oh_sensor.h create mode 100644 zh-cn/native_sdk/sensor/oh_sensor_type.h diff --git a/zh-cn/native_sdk/sensor/oh_sensor.h b/zh-cn/native_sdk/sensor/oh_sensor.h new file mode 100644 index 00000000..7f7bc07a --- /dev/null +++ b/zh-cn/native_sdk/sensor/oh_sensor.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Sensor + * @{ + * + * @brief 提供API来使用常见的传感器特性。例如,调用API来获取传感器和订阅或取消订阅传感器数据。 + * @since 11 + */ +/** + * @file oh_sensor.h + * + * @brief 声明操作传感器的API,包括获取传感器信息和订阅取消订阅传感器数据。 + * @library libohsensor.so + * @syscap SystemCapability.Sensors.Sensor + * @since 11 + */ + +#ifndef OH_SENSOR_H +#define OH_SENSOR_H + +#include "oh_sensor_type.h" + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief 获取设备上所有传感器的信息。 + * + * @param infos - 双指针指向设备上所有传感器的信息。请参考{@link Sensor_Info}。 + * @param count - 指向设备上传感器数量的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * + * @since 11 + */ +Sensor_Result OH_Sensor_GetInfos(Sensor_Info **infos, uint32_t *count); + +/** + * @brief 订阅传感器数据。系统将以指定的频率向用户报告传感器数据。 + * 订阅加速度传感器,需要申请ohos.permission.ACCELEROMETER权限; + * 订阅陀螺仪传感器,需要申请ohos.permission.GYROSCOPE权限; + * 订阅计步器相关传感器时,需要申请ohos.permission.ACTIVITY_MOTION权限; + * 订阅与健康相关的传感器时,比如心率传感器,需要申请ohos.permission.READ_HEALTH_DATA权限,否则订阅失败。 + * 订阅其余传感器不需要申请权限。 + * + * @param id - 指向传感器订阅ID的指针。请参考{@link Sensor_SubscriptionId}。 + * @param attribute - 指向订阅属性的指针,该属性用于指定数据报告频率。请参考{@link Sensor_SubscriptionAttribute}。 + * @param subscriber - 指向订阅者信息的指针,该信息用于指定的回调函数报告传感器数据。请参考{@link Sensor_Subscriber}。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @permission ohos.permission.ACCELEROMETER or ohos.permission.GYROSCOPE or + * ohos.permission.ACTIVITY_MOTION or ohos.permission.READ_HEALTH_DATA + * @since 11 + */ +Sensor_Result OH_Sensor_Subscribe(const Sensor_SubscriptionId *id, + const Sensor_SubscriptionAttribute *attribute, const Sensor_Subscriber *subscriber); + +/** + * @brief 取消订阅传感器数据。 + * 取消订阅加速度计传感器,需要申请ohos.permission.ACCELEROMETER权限; + * 取消订阅陀螺仪传感器,需要申请ohos.permission.GYROSCOPE权限; + * 取消订阅计步器相关传感器时,需要申请ohos.permission.ACTIVITY_MOTION权限; + * 取消订阅与健康相关的传感器时,需要申请ohos.permission.READ_HEALTH_DATA权限,否则取消订阅失败。 + * 取消订阅其余传感器不需要申请权限。 + * + * @param id - 指向传感器订阅ID的指针。请参考{@link Sensor_SubscriptionId}。 + * @param subscriber - 指向订阅者信息的指针,该信息用于指定的回调函数报告传感器数据。请参考{@link Sensor_Subscriber}。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @permission ohos.permission.ACCELEROMETER or ohos.permission.GYROSCOPE or + * ohos.permission.ACTIVITY_MOTION or ohos.permission.READ_HEALTH_DATA + * + * @since 11 + */ +Sensor_Result OH_Sensor_Unsubscribe(const Sensor_SubscriptionId *id, const Sensor_Subscriber *subscriber); +#ifdef __cplusplus +} +#endif +#endif // OH_SENSOR_H \ No newline at end of file diff --git a/zh-cn/native_sdk/sensor/oh_sensor_type.h b/zh-cn/native_sdk/sensor/oh_sensor_type.h new file mode 100644 index 00000000..d6316b3e --- /dev/null +++ b/zh-cn/native_sdk/sensor/oh_sensor_type.h @@ -0,0 +1,457 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Sensor + * @{ + * + * @brief 提供标准的开放api,定义常用传感器属性。 + * + * @since 11 + */ + +/** + * @file oh_sensor_type.h + * + * @brief 定义常用传感器属性。 + * @library libohsensor.so + * @syscap SystemCapability.Sensors.Sensor + * @since 11 + */ + +#ifndef OH_SENSOR_TYPE_H +#define OH_SENSOR_TYPE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 枚举传感器类型。 + * + * @since 11 + */ +typedef enum Sensor_Type { + /** + * 加速度传感器。 + * @since 11 + */ + SENSOR_TYPE_ACCELEROMETER = 1, + /** + * 陀螺仪传感器。 + * @since 11 + */ + SENSOR_TYPE_GYROSCOPE = 2, + /** + * 环境光传感器。 + * @since 11 + */ + SENSOR_TYPE_AMBIENT_LIGHT = 5, + /** + * 地磁传感器。 + * @since 11 + */ + SENSOR_TYPE_MAGNETIC_FIELD = 6, + /** + * 气压传感器。 + * @since 11 + */ + SENSOR_TYPE_BAROMETER = 8, + /** + * 霍尔传感器。 + * @since 11 + */ + SENSOR_TYPE_HALL = 10, + /** + * 接近光传感器。 + * @since 11 + */ + SENSOR_TYPE_PROXIMITY = 12, + /** + * 方向传感器。 + * @since 11 + */ + SENSOR_TYPE_ORIENTATION = 256, + /** + * 重力传感器。 + * @since 11 + */ + SENSOR_TYPE_GRAVITY = 257, + /** + * 旋转矢量传感器。 + * @since 11 + */ + SENSOR_TYPE_ROTATION_VECTOR = 259, + /** + * 计步器检测传感器。 + * @since 11 + */ + SENSOR_TYPE_PEDOMETER_DETECTION = 265, + /** + * 计步器传感器。 + * @since 11 + */ + SENSOR_TYPE_PEDOMETER = 266, + /** + * 心率传感器。 + * @since 11 + */ + SENSOR_TYPE_HEART_RATE = 278, +} Sensor_Type; + +/** + * @brief 定义传感器错误码。 + * + * @since 11 + */ +typedef enum Sensor_Result { + /** + * 操作成功。 + * @since 11 + */ + SENSOR_SUCCESS = 0, + /** + * 权限验证失败。 + * @since 11 + */ + SENSOR_PERMISSION_DENIED = 201, + /** + * 参数检查失败。例如,没有传入强制参数,或者传入的参数类型不正确。 + * @since 11 + */ + SENSOR_PARAMETER_ERROR = 401, + /** + * 传感器服务异常。 + * @since 11 + */ + SENSOR_SERVICE_EXCEPTION = 14500101, +} Sensor_Result; + +/** + * @brief 枚举传感器报告的数据的精度级别。 + * + * @since 11 + */ +typedef enum Sensor_Accuracy { + /** + * 传感器数据不可靠。有可能传感器不与设备接触而进行测量。 + * @since 11 + */ + SENSOR_ACCURACY_UNRELIABLE = 0, + /** + * 传感器数据精度较低。数据在使用前必须根据环境进行校准。 + * @since 11 + */ + SENSOR_ACCURACY_LOW = 1, + /** + * 传感器数据处于中等精度水平。建议用户在使用前根据实际环境进行数据校准。 + * @since 11 + */ + SENSOR_ACCURACY_MEDIUM = 2, + /** + * 传感器数据具有很高的精度。数据可以直接使用。 + * @since 11 + */ + SENSOR_ACCURACY_HIGH = 3 +} Sensor_Accuracy; + +/** + * @brief 定义传感器信息。 + * @since 11 + */ +typedef struct Sensor_Info Sensor_Info; + +/** + * @brief 用给定的数字创建一个实例数组,请参考{@link Sensor_Info}。 + * + * @param count - 要创建的实例的数量,请参考 {@link Sensor_Info}。 + * @return 如果操作成功,返回指向{@link Sensor_Info}实例数组的双指针;否则返回NULL。 + * @since 11 + */ +Sensor_Info **OH_Sensor_CreateInfos(uint32_t count); + +/** + * @brief 销毁实例数组并回收内存,请参考{@link Sensor_Info}。 + * + * @param sensors - 指向{@link Sensor_Info}实例数组的双指针。 + * @param count - 要销毁的{@link Sensor_Info}实例的数量。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_Sensor_DestroyInfos(Sensor_Info **sensors, uint32_t count); + +/** + * @brief 获取传感器名称。 + * @param sensor - 指向传感器信息的指针。 + * @param sensorName - 指向传感器名称的指针。 + * @param length - 指向长度的指针,以字节为单位。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorInfo_GetName(Sensor_Info* sensor, char *sensorName, uint32_t *length); + +/** + * @brief 获取传感器的厂商名称。 + * + * @param sensor - 指向传感器信息的指针。 + * @param vendorName - 指向供应商名称的指针。 + * @param length - 指向长度的指针,以字节为单位。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorInfo_GetVendorName(Sensor_Info* sensor, char *vendorName, uint32_t *length); + +/** + * @brief 获取传感器类型。 + * + * @param sensor - 指向传感器信息的指针。 + * @param sensorType - 指向传感器类型的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorInfo_GetType(Sensor_Info* sensor, Sensor_Type *sensorType); + +/** + * @brief 获取传感器分辨率。 + * + * @param sensor - 指向传感器信息的指针。 + * @param resolution - 指向传感器分辨率的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorInfo_GetResolution(Sensor_Info* sensor, float *resolution); + +/** + * @brief 获取传感器的最小数据上报间隔。 + * + * @param sensor - 指向传感器信息的指针。 + * @param minSamplingInterval - 指向最小数据报告间隔的指针,以纳秒为单位。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorInfo_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minSamplingInterval); + +/** + * @brief 获取传感器的最大数据上报间隔时间。 + * + * @param sensor - 指向传感器信息的指针。 + * @param maxSamplingInterval - -指向最大数据报告间隔的指针,单位为纳秒。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorInfo_GetMaxSamplingInterval(Sensor_Info* sensor, int64_t *maxSamplingInterval); + +/** + * @brief 定义传感器数据信息。 + * @since 11 + */ +typedef struct Sensor_Event Sensor_Event; + +/** + * @brief 获取传感器类型。 + * + * @param sensorEvent - 指向传感器数据信息的指针。 + * @param sensorType - 指向传感器类型的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorEvent_GetType(Sensor_Event* sensorEvent, Sensor_Type *sensorType); + +/** + * @brief 获取传感器数据的时间戳。 + * + * @param sensorEvent - 指向传感器数据信息的指针。 + * @param timestamp - 时间戳指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timestamp); + +/** + * @brief 获取传感器数据的精度。 + * + * @param sensorEvent - 指向传感器数据信息的指针。 + * @param accuracy - 指向精度的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *accuracy); + +/** + * @brief 获取传感器数据。数据的长度和内容依赖于监听的传感器类型,传感器上报的数据格式如下: + * SENSOR_TYPE_ACCELEROMETER: data[0]、data[1]、data[2]分别表示设备x、y、z轴的加速度分量,单位m/s2; + * SENSOR_TYPE_GYROSCOPE: data[0]、data[1]、data[2]分别表示设备x、y、z轴的旋转角速度,单位弧度/s; + * SENSOR_TYPE_AMBIENT_LIGHT: data[0]表示环境光强度,in lux; + * SENSOR_TYPE_MAGNETIC_FIELD: data[0]、data[1]、data[2]分别表示设备x、y、z轴的地磁分量,单位微特斯拉; + * SENSOR_TYPE_BAROMETER:data[0]表示气压值,单位hPa; + * SENSOR_TYPE_HALL: data[0]表示皮套吸合状态,0表示打开,大于0表示吸附; + * SENSOR_TYPE_PROXIMITY:data[0]表示接近状态,0表示接近,大于0表示远离; + * SENSOR_TYPE_ORIENTATION:data[0]、data[1]、data[2]分别表示设备绕z、x、y轴的角度,单位度; + * SENSOR_TYPE_GRAVITY:data[0]、data[1]、data[2]分别表示设备x、y、z轴的重力加速度分量,单位m/s2; + * SENSOR_TYPE_ROTATION_VECTOR:data[0]、data[1]、data[2]分别表示设备x、y、z轴的旋转角度,单位度,data[3]表示旋转向量元素; + * SENSOR_TYPE_PEDOMETER_DETECTION:data[0]表示几步检测状态,1表示检测到了步数变化; + * SENSOR_TYPE_PEDOMETER:data[0]表示步数; + * SENSOR_TYPE_HEART_RATE:data[0]表示心率数值; + * + * @param sensorEvent - 传感器数据信息。 + * @param data - 出参,传感器数据。 + * @param length - 出参,数组长度。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorEvent_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length); + +/** + * @brief 定义传感器订阅ID,唯一标识传感器。 + * @since 11 + */ +typedef struct Sensor_SubscriptionId Sensor_SubscriptionId; + +/** + * @brief 创建一个{@link Sensor_SubscriptionId}实例。 + * + * @return 如果操作成功,返回指向{@link Sensor_SubscriptionId}实例的指针;否则返回NULL。 + * @since 11 + */ +Sensor_SubscriptionId *OH_Sensor_CreateSubscriptionId(void); + +/** + * @brief 销毁{@link Sensor_SubscriptionId}实例并回收内存。 + * + * @param id - 指向{@link Sensor_SubscriptionId}实例的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_Sensor_DestroySubscriptionId(Sensor_SubscriptionId *id); + +/** + * @brief 获取传感器类型。 + * + * @param id - 指向传感器订阅ID的指针。 + * @param sensorType - 指向传感器类型的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorSubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type *sensorType); + +/** + * @brief 设置传感器类型。 + * + * @param id - 指向传感器订阅ID的指针。 + * @param sensorType - 要设置的传感器类型。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorSubscriptionId_SetType(Sensor_SubscriptionId* id, const Sensor_Type sensorType); + +/** + * @brief 定义传感器订阅属性。 + * @since 11 + */ +typedef struct Sensor_SubscriptionAttribute Sensor_SubscriptionAttribute; + +/** + * @brief 创建{@link Sensor_SubscriptionAttribute}实例。 + * + * @return 如果操作成功,返回指向{@link Sensor_SubscriptionAttribute]实例的指针;否则返回NULL。 + * @since 11 + */ +Sensor_SubscriptionAttribute *OH_Sensor_CreateSubscriptionAttribute(void); + +/** + * @brief 销毁{@link Sensor_SubscriptionAttribute}实例并回收内存。 + * + * @param attribute - 指向{@link Sensor_SubscriptionAttribute}实例的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_Sensor_DestroySubscriptionAttribute(Sensor_SubscriptionAttribute *attribute); + +/** + * @brief 设置传感器数据报告间隔。 + * + * @param attribute - 指向传感器订阅属性的指针。 + * @param samplingInterval - 要设置的数据报告间隔,以纳秒为单位。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorSubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionAttribute* attribute, + const int64_t samplingInterval); + +/** + * @brief 获取传感器数据报告间隔。 + * + * @param attribute - 指向传感器订阅属性的指针。 + * @param samplingInterval - 指向数据报告间隔的指针,以纳秒为单位。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorSubscriptionAttribute_GetSamplingInterval(Sensor_SubscriptionAttribute* attribute, + int64_t *samplingInterval); + +/** + * @brief 定义用于报告传感器数据的回调函数。 + * @since 11 + */ +typedef void (*Sensor_EventCallback)(Sensor_Event *event); + +/** + * @brief 定义传感器订阅者信息。 + * @since 11 + */ +typedef struct Sensor_Subscriber Sensor_Subscriber; + +/** + * @brief 创建一个{@link Sensor_Subscriber}实例。 + * + * @return 如果操作成功,返回指向{@link Sensor_Subscriber}实例的指针;否则返回NULL。 + * @since 11 + */ +Sensor_Subscriber *OH_Sensor_CreateSubscriber(void); + +/** + * @brief 销毁{@link Sensor_Subscriber}实例并回收内存。 + * + * @param subscriber - 指向{@link Sensor_Subscriber}实例的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_Sensor_DestroySubscriber(Sensor_Subscriber *subscriber); + +/** + * @brief 设置一个回调函数来报告传感器数据。 + * + * @param subscriber - 指向传感器订阅者信息的指针。 + * @param callback - 设置回调函数。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorSubscriber_SetCallback(Sensor_Subscriber* subscriber, const Sensor_EventCallback callback); + +/** + * @brief 获取用于报告传感器数据的回调函数。 + * + * @param subscriber - 指向传感器订阅者信息的指针。 + * @param callback - 指向回调函数的指针。 + * @return 如果操作成功返回SENSOR_SUCCESS;否则返回{@link Sensor_Result}中定义的错误代码。 + * @since 11 + */ +int32_t OH_SensorSubscriber_GetCallback(Sensor_Subscriber* subscriber, Sensor_EventCallback *callback); +#ifdef __cplusplus +} +#endif +#endif // OH_SENSOR_TYPE_H \ No newline at end of file -- Gitee From 36ee890221f67fe2e11108393dd6e475e3c6552a Mon Sep 17 00:00:00 2001 From: luzhiye Date: Tue, 12 Dec 2023 09:47:58 +0800 Subject: [PATCH 0147/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9Eidl=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E6=B3=A8=E9=87=8Av1=5F2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luzhiye --- .../hdi/camera/v1_2/ICameraDevice.idl | 86 +++++ .../hdi/camera/v1_2/ICameraHost.idl | 146 ++++++++ .../hdi/camera/v1_2/IStreamOperator.idl | 89 +++++ .../camera/v1_2/IStreamOperatorCallback.idl | 64 ++++ zh-cn/device_api/hdi/camera/v1_2/Types.idl | 331 ++++++++++++++++++ 5 files changed, 716 insertions(+) create mode 100644 zh-cn/device_api/hdi/camera/v1_2/ICameraDevice.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_2/ICameraHost.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_2/IStreamOperator.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_2/IStreamOperatorCallback.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_2/Types.idl diff --git a/zh-cn/device_api/hdi/camera/v1_2/ICameraDevice.idl b/zh-cn/device_api/hdi/camera/v1_2/ICameraDevice.idl new file mode 100644 index 00000000..d49b10c5 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/ICameraDevice.idl @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file ICameraDevice.idl + * + * @brief Camera设备操作接口。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_1.ICameraDevice; +import ohos.hdi.camera.v1_2.IStreamOperatorCallback; +import ohos.hdi.camera.v1_2.IStreamOperator; + +/** + * @brief 定义Camera设备基本的操作。 + * + * 获取流操作句柄,获取动态能力值等操作。 + */ +interface ICameraDevice extends ohos.hdi.camera.v1_1.ICameraDevice { + /** + * @brief 获取流操作句柄。 + * + * @param callbackObj 设置流回调接口,详细可查看{@link IStreamOperatorCallback}, + * 用于上报捕获开始{@link OnCaptureStarted},捕获结束{@link OnCaptureEnded}, + * 捕获错误等信息{@link OnCaptureError}。 + * @param streamOperator 返回流操作句柄。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + GetStreamOperator_V1_2([in] IStreamOperatorCallback callbackObj, [out] IStreamOperator streamOperator); + + /** + * @brief 获取动态能力值。 + * + * @param metaIn 能力输入。 + * @param metaOut 能力输出。 + * 捕获错误等信息{@link OnCaptureError}。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + GetStatus([in] unsigned char[] metaIn, [out] unsigned char[] metaOut); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/camera/v1_2/ICameraHost.idl b/zh-cn/device_api/hdi/camera/v1_2/ICameraHost.idl new file mode 100644 index 00000000..ed585dd8 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/ICameraHost.idl @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + + /** + * @file ICameraHost.idl + * + * @brief Camera服务的管理类,对上层提供HDI接口。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_1.ICameraHost; +import ohos.hdi.camera.v1_2.ICameraDevice; +import ohos.hdi.camera.v1_2.ICameraHostCallback; +import ohos.hdi.camera.v1_0.ICameraDeviceCallback; + +/** + * @brief 定义Camera设备功能操作。 + * + * 打开并执行Camera设备、通知设备状态更改信息、设置回调接口等相关操作。 + */ +interface ICameraHost extends ohos.hdi.camera.v1_1.ICameraHost { + /** + * @brief 打开Camera设备。 + * + * 打开指定的Camera设备,通过此接口可以获取到ICameraDevice对象,通过ICameraDevice对象可以操作具体的Camera设备。 + * + * @param cameraId 需要打开的Camera设备ID,可通过{@link GetCameraIds}接口获取当前已有Camera设备列表。 + * @param callbackObj Camera设备相关的回调函数,具体参见{@link ICameraDeviceCallback}。 + * @param device 返回当前要打开的Camera设备ID对应的ICameraDevice对象。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + OpenCameraV1_2([in] String cameraId, [in] ICameraDeviceCallback callbackObj, [out] ICameraDevice device); + + /** + * @brief 将设备状态更改通知设备供应商。 + * + * 通过调用此函数,可以通知设备供应商设备状态更改。 + * + * @param notifyType 通知的类型。 + * @param deviceState 设备的状态。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + NotifyDeviceStateChangeInfo([in] int notifyType, [in] int deviceState); + + /** + * @brief 设置ICameraHost回调接口,回调函数参考{@link ICameraHostCallback}。 + * + * @param callbackObj 要设置的回调函数。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + SetCallbackV1_2([in] ICameraHostCallback callbackObj); + + /** + * @brief 打开或关闭闪光灯。 + * + * @param level 指定是打开还是关闭闪光灯。值 1 表示打开闪光灯,0 表示相反。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + SetFlashlightV1_2([in] float level); + + /** + * @brief 切换镜头时预热相机设备。 + * + * 当用户触摸摄像头应用镜头开关图标时可以调用此功能以加速启动的相机设备,由cameraId指定。 + * + * @param cameraId 指示相机设备的ID,可以通过调用 {@link GetCameraIds} 获取。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + PreCameraSwitch([in] String cameraId); + + /** + * @brief 预启动Camera设备。 + * + * 当用户触摸摄像头应用图标时可以调用此函数以加速启动的相机设备,由cameraId指定。 + * + * @param config 预启动配置. 详细可查看{@link PrelaunchConfig}. + * @param operationMode 流操作模式. 详细可查看{@link OperationMode}. + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + PrelaunchWithOpMode([in] struct PrelaunchConfig config, [in] int operationMode); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/camera/v1_2/IStreamOperator.idl b/zh-cn/device_api/hdi/camera/v1_2/IStreamOperator.idl new file mode 100644 index 00000000..67a993b1 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/IStreamOperator.idl @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file IStreamOperator.idl + * + * @brief 流的操作接口。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_1.IStreamOperator; +import ohos.hdi.camera.v1_2.Types; + +/** + * @brief 定义Camera设备流操作。 + * + * 对Camera设备执行流的创建、配置与添加参数、属性获取、句柄绑定与解除、图像捕获与取消、流的转换以及流释放操作。 + * + * 流是指从底层设备输出,经本模块内部各环节处理,最终传递到上层服务或者应用的一组数据序列。 + * 本模块支持的流的类型有预览流,录像流,拍照流等,更多类型可查看{@link StreamIntent}。 + */ +interface IStreamOperator extends ohos.hdi.camera.v1_1.IStreamOperator { + + /** + * @brief 更新流. + * + * 该函数必须在 Loop CancelCaptures {@link CancelCaptures} 之后调用。 + * + * @param streamInfos 表示流信息列表,由 {@link StreamInfo} 定义。 + * 传递的流信息可能会被更改。因此,您可以运行{@link GetStreamAttributes}来获取创建流后最新的流属性。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + UpdateStreams([in] struct StreamInfo_V1_1[] streamInfos); + + /** + * @brief 确认捕获。 + * + * 该函数必须在开始捕获后调用,场景处于夜景模式。 + * + * @param captureId 要确认的流的ID。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.1 + * @version 1.2 + */ + ConfirmCapture([in] int captureId); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/camera/v1_2/IStreamOperatorCallback.idl b/zh-cn/device_api/hdi/camera/v1_2/IStreamOperatorCallback.idl new file mode 100644 index 00000000..05337274 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/IStreamOperatorCallback.idl @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file IStreamOperatorCallback.idl + * + * @brief {@link IStreamOperator}相关的回调,这些回调均由调用者实现。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_2.Types; + +/** + * @brief 定义Camera设备流回调操作。 + * + * 对Camera设备执行流回调的抓捕,结束,错误捕获和帧捕获等操作。 + */ +[callback] interface IStreamOperatorCallback extends ohos.hdi.camera.v1_0.IStreamOperatorCallback { + /** + * @brief 在捕获开始时调用。 + * + * @param captureId 回调对应的捕获请求ID。 + * @param infos 捕获开始消息的列表。 + * + * @since 4.1 + * @version 1.2 + */ + OnCaptureStartedV1_2([in] int captureId, [in] struct CaptureStartedInfo[] infos); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/camera/v1_2/Types.idl b/zh-cn/device_api/hdi/camera/v1_2/Types.idl new file mode 100644 index 00000000..c0e66a05 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/Types.idl @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file Types.idl + * + * @brief Camera模块HDI接口使用的数据类型。 + * + * @since 4.1 + * @version 1.2 + */ + + /** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_1.Types; + +sequenceable ohos.hdi.camera.v1_0.BufferHandleSequenceable; +sequenceable ohos.hdi.camera.v1_0.MapDataSequenceable; + +/** + * @brief HDI接口的返回值。 + */ +enum CamRetCode { + /** + * 调用成功。 + */ + NO_ERROR = 0, + + /** + * 设备当前忙。 + */ + CAMERA_BUSY = -1, + + /** + * 资源不足。 + */ + INSUFFICIENT_RESOURCES = -2, + + /** + * 参数错误。 + */ + INVALID_ARGUMENT = -3, + + /** + * 不支持当前调用方法。 + */ + METHOD_NOT_SUPPORTED = -4, + + /** + * Camera设备已经关闭。 + */ + CAMERA_CLOSED = -5, + + /** + * 驱动层发生严重错误。 + */ + DEVICE_ERROR = -6, + + /** + * 无权限访问设备。 + */ + NO_PERMISSION = -7, + + /** + * 设备冲突。 + */ + DEVICE_CONFLICT = -8 +}; + +/** + * @brief 扩展流信息的类型。 + */ +enum ExtendedStreamInfoType_V1_2 { + /** + * 快速缩略图的扩展流信息。 + */ + EXTENDED_STREAM_INFO_QUICK_THUMBNAIL = 0, + + /** + * sketch的扩展流信息。 + */ + EXTENDED_STREAM_INFO_SKETCH = 1, +}; + +/** + * @brief 流使用模式。 + */ +enum OperationMode_V1_2 { + /** + * 普通模式,支持照片和视频场景 + */ + NORMAL = 0, + + /** + * 拍摄模式,专用于照片场景 + * 如果实现了此模式,则不应再实现 NORMAL 模式 + */ + CAPTURE = 1, + + /** + * 视频模式,专用于视频秒控 + * 如果实现了此模式,则不应再实现 NORMAL 模式 + */ + VIDEO = 2, + + /** + * 人像模式,专用于人像照片拍摄 + */ + PORTRAIT = 3, + + /** + * 夜间模式,专用于夜间拍摄场景 + */ + NIGHT = 4, + + /** + * 专业模式,专用于专业拍照场景 + */ + PROFESSIONAL = 5, + + /** + * 慢动作模式,专用于捕捉慢动作 + */ + SLOW_MOTION = 6, + + /** + * 扫描模式,专用于扫码 + */ + SCAN_CODE = 7, + + /** + * 微距模式,专用于微距拍照 + */ + CAPTURE_MACRO = 8, + + /** + * 微距模式,专用于微距录像 + */ + VIDEO_MACRO = 9, + + /** + * 超级防抖模式,专用于使用超级防抖模式 + */ + SUPER_STAB = 10, +}; + +/** + * @brief 延迟拍照的类型。 + */ +enum DeferredDeliveryImageType { + /** + * 不支持延迟拍照。 + */ + NONE = 0, + + /** + * 支持静止图像。 + */ + STILL_IMAGE = 1, + + /** + * 支持动态图像。 + */ + MOVING_IMAGE = 2, +}; + +/** + * @brief 会话状态的类型。 + */ +enum SessionStatus { + /** + * 会话已准备就绪。 + */ + SESSION_STATUS_READY = 0, + + /** + * 会话已准备就绪,但已达到存储限制。 + */ + SESSION_STATUS_READY_SPACE_LIMIT_REACHED = 1, + + /** + * 会话暂时未就绪。 + */ + SESSSON_STATUS_NOT_READY_TEMPORARILY = 2, + + /** + * 由于过热,会话未就绪。 + */ + SESSION_STATUS_NOT_READY_OVERHEAT = 3, + + /** + * 由于被抢占,会话未就绪。 + */ + SESSION_STATUS_NOT_READY_PREEMPTED = 4, +}; + +/** + * @brief 错误代码的类型。 + */ +enum ErrorCode { + /** + * 超时。 + */ + TIMEOUT = 0, + + /** + * 错误。 + */ + ERROR = 1, + + /** + * 忙碌。 + */ + BUSY = 3, + + /** + * 高温。 + */ + HIGH_TEMPERATURE = 4, + + /** + * 中止。 + */ + ABORT = 5, +}; + +/** + * @brief 执行模式的类型。 + */ +enum ExecutionMode { + /** + * 高性能模式。 + */ + HIGH_PREFORMANCE = 0, + + /** + * 平衡模式。 + */ + BALANCED = 1, + + /** + * 低功耗模式。 + */ + LOW_POWER = 2, +}; + +/** + * @brief 定义 ImageBufferInfo,它由 {@link IImageProcessCallback::OnProcessDone} 使用。 + */ +struct ImageBufferInfo { + /** + * metadata是否有效。 + */ + boolean isMetaDataValid; + + /** + * metadata的数据。 + */ + MapDataSequenceable metadata; + + /** + * ImageHandle的数据。 + */ + BufferHandleSequenceable imageHandle; + + /** + * gainMapHandle是否有效。 + */ + boolean isGainMapValid; + + /** + * gainMapHandle的数据。 + */ + BufferHandleSequenceable gainMapHandle; + + /** + * depthMapHandle是否有效。 + */ + boolean isDepthMapValid; + + /** + * depthMapHandle的数据。 + */ + BufferHandleSequenceable depthMapHandle; +}; + +/** + * @brief 定义CaptureStartedInfo,该信息由{@link IStreamOperatorCallback::OnCaptureStartedV1_2}使用。 + */ +struct CaptureStartedInfo { + /** + * 流的ID,用于在设备内唯一标识一条流。 + */ + int streamId_; + + /** + * 曝光时间,单位为毫秒。 + */ + int exposureTime_; +}; +/** @} */ \ No newline at end of file -- Gitee From b8f04c499ffa0f0503b1fcd21f16b83f6bfc33aa Mon Sep 17 00:00:00 2001 From: pengqihao Date: Tue, 12 Dec 2023 03:37:30 +0000 Subject: [PATCH 0148/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=B6=E5=90=8C?= =?UTF-8?q?=E6=AD=A51.2idl=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pengqihao --- zh-cn/device_api/hdi/camera/v1_2/BUILD.gn | 48 +++++++ .../hdi/camera/v1_2/ICameraHostCallback.idl | 64 +++++++++ .../hdi/camera/v1_2/IImageProcessCallback.idl | 84 ++++++++++++ .../hdi/camera/v1_2/IImageProcessService.idl | 79 ++++++++++++ .../hdi/camera/v1_2/IImageProcessSession.idl | 121 ++++++++++++++++++ 5 files changed, 396 insertions(+) create mode 100644 zh-cn/device_api/hdi/camera/v1_2/BUILD.gn create mode 100644 zh-cn/device_api/hdi/camera/v1_2/ICameraHostCallback.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_2/IImageProcessCallback.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_2/IImageProcessService.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_2/IImageProcessSession.idl diff --git a/zh-cn/device_api/hdi/camera/v1_2/BUILD.gn b/zh-cn/device_api/hdi/camera/v1_2/BUILD.gn new file mode 100644 index 00000000..003c6396 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/BUILD.gn @@ -0,0 +1,48 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libcamera_proxy_1.2") { + deps = [] + public_configs = [] + } +} else { + hdi("camera") { + module_name = "camera_service" + imports = [ "ohos.hdi.camera.v1_1:camera" ] + + sources = [ + "ICameraDevice.idl", + "ICameraHost.idl", + "ICameraHostCallback.idl", + "IImageProcessCallback.idl", + "IImageProcessService.idl", + "IImageProcessSession.idl", + "IStreamOperator.idl", + "IStreamOperatorCallback.idl", + "Types.idl", + ] + + sequenceable_pub_deps = [ + "../sequenceable/buffer_handle:libbuffer_handle_sequenceable_1.0", + "../sequenceable/buffer_producer:libbuffer_producer_sequenceable_1.0", + "../sequenceable/map_data:libmap_data_sequenceable_1.0", + ] + sequenceable_ext_deps = [ "graphic_surface:surface" ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_camera" + } +} diff --git a/zh-cn/device_api/hdi/camera/v1_2/ICameraHostCallback.idl b/zh-cn/device_api/hdi/camera/v1_2/ICameraHostCallback.idl new file mode 100644 index 00000000..7cce148f --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/ICameraHostCallback.idl @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + + /** + * @file ICameraHostCallback.idl + * + * @brief ICameraHost的回调接口,提供Camera设备和闪关灯状态变化的回调函数,回调函数由调用者实现。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_0.ICameraHostCallback; +import ohos.hdi.camera.v1_2.Types; + +/** + * @brief 定义Camera设备功能回调操作。 + * + * 返回闪光灯状态 + */ +[callback] interface ICameraHostCallback extends ohos.hdi.camera.v1_0.ICameraHostCallback { + /** + * @brief 当闪光状态发生变化时调用以报告最新状态。 + * + * @param status 闪光灯最新的状态. + * + * @since 4.1 + * @version 1.2 + */ + OnFlashlightStatusV1_2([in] enum FlashlightStatus status); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/camera/v1_2/IImageProcessCallback.idl b/zh-cn/device_api/hdi/camera/v1_2/IImageProcessCallback.idl new file mode 100644 index 00000000..71e47082 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/IImageProcessCallback.idl @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file iimage_process_callback.idl + * + * @brief 声明图像进程的回调。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_2.Types; + +/** +*@brief 定义声明图像处理回调。 +* +* 获取在流程完成时、状态已更改时、出错时的回调函数 +*/ +[callback] interface IImageProcessCallback { + /** + * @brief 在进程完成时调用。 + * 有关报告模式的详细信息,请参阅 {@link SetResultMode}。 + * + * @param imageId 镜像ID。 + * @param buffer 缓冲区。 + * + * @since 4.1 + * @version 1.2 + */ + OnProcessDone([in] String imageId, [in] ImageBufferInfo buffer); + + /** + * @brief 在进程状态更改时调用。 + * 有关报告模式的详细信息,请参阅 {@link SetResultMode}。 + * + * @param status 会话的新状态。 + * + * @since 4.1 + * @version 1.2 + */ + OnStatusChanged([in] enum SessionStatus status); + + /** + * @brief 闪光灯的最新状态。 + * + * @since 4.1 + * @version 1.2 + */ + OnError([in] String imageId, [in] int errorCode); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/camera/v1_2/IImageProcessService.idl b/zh-cn/device_api/hdi/camera/v1_2/IImageProcessService.idl new file mode 100644 index 00000000..c5f4df72 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/IImageProcessService.idl @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file IImageProcessService.idl + * + * @brief 声明用于图像处理服务的API。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ + +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_2.IImageProcessSession; +import ohos.hdi.camera.v1_2.IImageProcessCallback; + +/** +*@brief 声明图像处理进程服务。 +* +* 创建映像处理会话,注册后台捕获后回调 +*/ +interface IImageProcessService { + /** + * @brief 创建映像处理会话。 + * + * @param userId 用户ID。 + * @param imageProcessCallback 镜像进程回调。有关详细信息,请参阅 {@link IImageProcessCallback}。 + * @param imageProcessSession 指示图像处理会话。有关详细信息,请参阅 {@link IImageProcessSession} + * + * @since 4.1 + * @version 1.2 + */ + CreateImageProcessSession([in] int userId, + [in] IImageProcessCallback imageProcessCallback, + [out] IImageProcessSession imageProcessSession); + + /** + * @brief 注册后台后捕获回调。 + * + * @param imageProcessSession 指示图像处理会话。有关详细信息,请参阅 {@link IImageProcessSession} + * + * @since 4.1 + * @version 1.2 + */ + RegisterBackgroundPostCaptureCallback([in] IImageProcessCallback imageProcessCallback); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/camera/v1_2/IImageProcessSession.idl b/zh-cn/device_api/hdi/camera/v1_2/IImageProcessSession.idl new file mode 100644 index 00000000..13e39e4b --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_2/IImageProcessSession.idl @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file iimage_process_session.idl + * + * @brief 声明用于图像处理会话的API。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ + +package ohos.hdi.camera.v1_2; + +import ohos.hdi.camera.v1_2.Types; + +/** +*@brief 图像处理会话进程。 +* +* 获取Coucurrency、待处理图像,设置执行模式,处理流程图像,删除图像,执行会话中断,会话重启。 +*/ +interface IImageProcessSession { + /** + * @brief 获取具有spacific后处理执行模式的流程会话的Coucurrency任务计数。 + * + * @param mode 执行模式。 + * @param taskCount coucurrency任务计数。 + * + * @since 4.1 + * @version 1.2 + */ + GetCoucurrency([in] enum ExecutionMode mode, [out] int taskCount); + + /** + * @brief 获取未处理的挂起图像的ID。 + * + * @param imageIds 待处理图像的 ID。 + * + * @since 4.1 + * @version 1.2 + */ + GetPendingImages([out] List imageIds); + + /** + * @brief 设置处理后执行模式。 + * + * @param mode 执行模式。 + * + * @since 4.1 + * @version 1.2 + */ + SetExecutionMode([in] ExecutionMode mode); + + /** + * @brief 按镜像ID处理特定镜像。 + * + * @param imageId 图像ID。 + * + * @since 4.1 + * @version 1.2 + */ + ProcessImage([in] String imageId); + + /** + * @brief 按映像ID删除特定映像。 + * + * @param imageId 图像ID。 + * + * @since 4.1 + * @version 1.2 + */ + RemoveImage([in] String imageId); + + /** + * @brief 中断进程会话。 + * + * @since 4.1 + * @version 1.2 + */ + Interrupt(); + + /** + * @brief 重置进程会话。 + * + * @since 4.1 + * @version 1.2 + */ + Reset(); +} +/** @} */ \ No newline at end of file -- Gitee From 8399fc5b18c4d444e353e397e4dc3ea0dc50b12d Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Tue, 12 Dec 2023 14:54:19 +0800 Subject: [PATCH 0149/2135] =?UTF-8?q?=E7=94=B5=E8=AF=9D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=BD=91=E7=BB=9CHDI=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuxiyao223 --- zh-cn/device_api/hdi/ril/v1_1/IRil.idl | 1674 ++++++++ .../device_api/hdi/ril/v1_1/IRilCallback.idl | 1563 ++++++++ zh-cn/device_api/hdi/ril/v1_1/Types.idl | 3507 +++++++++++++++++ .../device_api/hdi/ril/v1_2/IRilCallback.idl | 67 + 4 files changed, 6811 insertions(+) create mode 100644 zh-cn/device_api/hdi/ril/v1_1/IRil.idl create mode 100644 zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl create mode 100644 zh-cn/device_api/hdi/ril/v1_1/Types.idl create mode 100644 zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl diff --git a/zh-cn/device_api/hdi/ril/v1_1/IRil.idl b/zh-cn/device_api/hdi/ril/v1_1/IRil.idl new file mode 100644 index 00000000..7defcfb6 --- /dev/null +++ b/zh-cn/device_api/hdi/ril/v1_1/IRil.idl @@ -0,0 +1,1674 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Ril + * @{ + * + * @brief Ril模块接口定义。 + * + * Ril模块为上层电话服务提供相关调用接口,涉及电话、短信、彩信、网络搜索、SIM卡等功能接口及各种回调等。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file IRil.idl + * + * @brief Ril模块的请求接口。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @brief Ril模块接口的包路径。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.ril.v1_1; +import ohos.hdi.ril.v1_1.IRilCallback; +import ohos.hdi.ril.v1_1.Types; + +/** + * @brief Ril模块的请求接口。 + * + * 请求接口包括打电话、发短信彩信、激活SIM卡、上网等。 + * + * @since 3.2 + * @version 1.1 + */ +interface IRil { + /** + * @brief 设置IRil回调接口,回调函数参考{@link IRilCallback}。 + * + * @param rilCallback 要设置的回调函数。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetCallback([in] IRilCallback rilCallback); + + /** + * @brief 设置紧急呼叫号码。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param emergencyInfoList 表示紧急号码列表,详见{@link EmergencyInfoList}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetEmergencyCallList([in] int slotId, [in] int serialId, [in] struct EmergencyInfoList emergencyInfoList); + + /** + * @brief 获取紧急号码。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetEmergencyCallList([in] int slotId, [in] int serialId); + + /** + * @brief 获取通话状态列表。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCallList([in] int slotId, [in] int serialId); + + /** + * @brief 拨打电话。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dialInfo 表示拨号信息,详见{@link DialInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] Dial([in] int slotId, [in] int serialId, [in] struct DialInfo dialInfo); + + /** + * @brief 拒接电话。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] Reject([in] int slotId, [in] int serialId); + + /** + * @brief 挂断电话。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param callId 表示通话ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] Hangup([in] int slotId, [in] int serialId, [in] int callId); + + /** + * @brief 接听电话。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] Answer([in] int slotId, [in] int serialId); + + /** + * @brief 保持通话。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] HoldCall([in] int slotId, [in] int serialId); + + /** + * @brief 取消保持通话。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] UnHoldCall([in] int slotId, [in] int serialId); + + /** + * @brief 切换通话。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SwitchCall([in] int slotId, [in] int serialId); + + /** + * @brief 合并为会议电话。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param callType 表示通话类型,当前只能为0(即语音通话)。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] CombineConference([in] int slotId, [in] int serialId, [in] int callType); + + /** + * @brief 与会议电话分离。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param callId 表示通话ID。 + * @param callType 表示通话类型,当前只能为0(即语音通话)。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SeparateConference([in] int slotId, [in] int serialId, [in] int callId, [in] int callType); + + /** + * @brief 获取呼叫等待。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCallWaiting([in] int slotId, [in] int serialId); + + /** + * @brief 设置呼叫等待。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param activate 表示禁止或使能呼叫等待功能,0表示禁止,1表示使能。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetCallWaiting([in] int slotId, [in] int serialId, [in] int activate); + + /** + * @brief 获取呼叫转移。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param reason 表示呼叫转移的类型,0表示无条件转移,1表示用户忙时转移,2表示无回复时转移,3表示无法接通时转移。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCallTransferInfo([in] int slotId, [in] int serialId, [in] int reason); + + /** + * @brief 设置呼叫转移。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param callForwardSetInfo 表示呼叫转移信息,详见{@link CallForwardSetInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetCallTransferInfo([in] int slotId, [in] int serialId, + [in] struct CallForwardSetInfo callForwardSetInfo); + + /** + * @brief 获取呼叫限制。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param fac 表示呼叫限制操作对象。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCallRestriction([in] int slotId, [in] int serialId, [in] String fac); + + /** + * @brief 设置呼叫限制。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param callRestrictionInfo 表示呼叫限制信息,详见{@link CallRestrictionInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetCallRestriction([in] int slotId, [in] int serialId, + [in] struct CallRestrictionInfo callRestrictionInfo); + + /** + * @brief 获取主叫号码显示(CLIP)。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetClip([in] int slotId, [in] int serialId); + + /** + * @brief 设置主叫号码显示。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param action 表示禁止或使能主叫号码显示功能,0表示禁止,1表示使能。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetClip([in] int slotId, [in] int serialId, [in] int action); + + /** + * @brief 获取主叫号码显示限制(CLIR)。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetClir([in] int slotId, [in] int serialId); + + /** + * @brief 设置主叫号码显示限制。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param action 表示禁止或使能主叫号码显示限制功能,0表示禁止,1表示使能。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetClir([in] int slotId, [in] int serialId, [in] int action); + + /** + * @brief 设置通话偏好模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param mode 表示通话偏好模式,1表示仅电路(CS)域通话,2表示电路(CS)域通话优先,3表示IP多媒体系统(IMS)通话优先,4表示仅IP多媒体系统(IMS)通话。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetCallPreferenceMode([in] int slotId, [in] int serialId, [in] int mode); + + /** + * @brief 获取通话偏好模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCallPreferenceMode([in] int slotId, [in] int serialId); + + /** + * @brief 设置非结构化补充数据业务(USSD)。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param str 表示USSD信息,最大长度为160个字符。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetUssd([in] int slotId, [in] int serialId, [in] String str); + + /** + * @brief 获取Ussd业务。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetUssd([in] int slotId, [in] int serialId); + + /** + * @brief 设置静音。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param mute 表示禁止或使能静音,0表示禁止,1表示使能。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetMute([in] int slotId, [in] int serialId, [in] int mute); + + /** + * @brief 获取静音。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetMute([in] int slotId, [in] int serialId); + + /** + * @brief 获取通话失败原因。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCallFailReason([in] int slotId, [in] int serialId); + + /** + * @brief 通话保持和恢复。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param type 表示挂断的通话类型,0表示直接挂断,1表示挂断前台和后台,2表示挂断前台、恢复后台,3表示挂断所有通话。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] CallSupplement([in] int slotId, [in] int serialId, [in] int type); + + /** + * @brief 发送双音多频(DTMF)。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dtmfInfo 表示DTMF信息,详见{@link DtmfInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SendDtmf([in] int slotId, [in] int serialId, [in] struct DtmfInfo dtmfInfo); + + /** + * @brief 开启DTMF。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dtmfInfo 表示DTMF信息,详见{@link DtmfInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] StartDtmf([in] int slotId, [in] int serialId, [in] struct DtmfInfo dtmfInfo); + + /** + * @brief 关闭DTMF。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dtmfInfo 表示DTMF信息,详见{@link DtmfInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] StopDtmf([in] int slotId, [in] int serialId, [in] struct DtmfInfo dtmfInfo); + + /** + * @brief 设置呼叫限制密码。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param setBarringInfo 表示设置呼叫限制密码的信息,详见{@link SetBarringInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetBarringPassword([in] int slotId, [in] int serialId, [in] struct SetBarringInfo setBarringInfo); + + /** + * @brief 激活数据业务。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dataCallInfo 表示数据业务信息,详见{@link DataCallInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] ActivatePdpContext([in] int slotId, [in] int serialId, [in] struct DataCallInfo dataCallInfo); + + /** + * @brief 断开数据业务。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param uniInfo 表示通用信息,详见{@link UniInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] DeactivatePdpContext([in] int slotId, [in] int serialId, [in] struct UniInfo uniInfo); + + /** + * @brief 获取当前所有数据连接状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param uniInfo 表示通用信息,详见{@link UniInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetPdpContextList([in] int slotId, [in] int serialId, [in] struct UniInfo uniInfo); + + /** + * @brief 设置初始化默认网络接入技术(APN)信息。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dataProfileDataInfo 表示分组报文协议(PDP)上下文信息,详见{@link DataProfileDataInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetInitApnInfo([in] int slotId, [in] int serialId, [in] struct DataProfileDataInfo dataProfileDataInfo); + + /** + * @brief 获取当前链路信息。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param cid PDP上下文标识符。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetLinkBandwidthInfo([in] int slotId, [in] int serialId, [in] int cid); + + /** + * @brief 设置当前链路信息的上报规则。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dataLinkBandwidthReportingRule 表示网络频率上报规则,详见{@link DataLinkBandwidthReportingRule}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetLinkBandwidthReportingRule([in] int slotId, [in] int serialId, + [in] struct DataLinkBandwidthReportingRule dataLinkBandwidthReportingRule); + + /** + * @brief 使能SIM卡槽数据业务。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dataPermitted 表示是否使能,0表示不使能,1表示使能。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetDataPermitted([in] int slotId, [in] int serialId, [in] int dataPermitted); + + /** + * @brief 设置数据业务使用的PDP上下文信息。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dataProfilesInfo 表示PDP上下文信息列表,详见{@link DataProfilesInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetDataProfileInfo([in] int slotId, [in] int serialId, [in] struct DataProfilesInfo dataProfilesInfo); + + /** + * @brief 发送数据业务性能模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dataPerformanceInfo 表示数据业务性能模式,详见{@link DataPerformanceInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SendDataPerformanceMode([in] int slotId, [in] int serialId, [in] struct DataPerformanceInfo dataPerformanceInfo); + + /** + * @brief 发送数据业务睡眠模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param dataSleepInfo 表示数据业务睡眠模式,详见{@link DataSleepInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SendDataSleepMode([in] int slotId, [in] int serialId, [in] struct DataSleepInfo dataSleepInfo); + + /** + * @brief 设置Modem状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param fun 表示功能模式,0表示最小模式,1表示online模式,4表示offline模式,其他模式由芯片自定义。 + * @param rst 表示Modem是否自动复位,0表示不复位,1表示复位。 + * + * @return 0 表示执行成功 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetRadioState([in] int slotId, [in] int serialId, [in] int fun, [in] int rst); + + /** + * @brief 获取Modem状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetRadioState([in] int slotId, [in] int serialId); + + /** + * @brief 获取国际移动设备识别码。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetImei([in] int slotId, [in] int serialId); + + /** + * @brief 获取移动设备识别码。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetMeid([in] int slotId, [in] int serialId); + + /** + * @brief 获取电路(CS)域接入技术。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetVoiceRadioTechnology([in] int slotId, [in] int serialId); + + /** + * @brief 获取基带版本。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetBasebandVersion([in] int slotId, [in] int serialId); + + /** + * @brief 发送手机正在关机状态到Modem。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] ShutDown([in] int slotId, [in] int serialId); + + /** + * @brief 获取SIM卡数据。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param SimIoRequestInfo 表示SIM卡数据请求信息,详见{@link SimIoRequestInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetSimIO([in] int slotId, [in] int serialId, [in] struct SimIoRequestInfo simIO); + + /** + * @brief 获取SIM卡状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetSimStatus([in] int slotId, [in] int serialId); + + /** + * @brief 获取SIM卡国际移动用户识别码。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetImsi([in] int slotId, [in] int serialId); + + /** + * @brief 获取SIM卡锁状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param SimLockInfo 表示SIM卡锁信息,详见{@link SimLockInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetSimLockStatus([in] int slotId, [in] int serialId, [in] struct SimLockInfo simLockInfo); + + /** + * @brief 设置SIM卡锁。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param SimLockInfo 表示SIM卡锁信息,详见{@link SimLockInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetSimLock([in] int slotId, [in] int serialId, [in] struct SimLockInfo simLockInfo); + + /** + * @brief 修改SIM卡密码。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param simPassword 表示SIM卡密码信息,详见{@link SimPasswordInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] ChangeSimPassword([in] int slotId, [in] int serialId, [in] struct SimPasswordInfo simPassword); + + /** + * @brief PIN解锁。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param pin 表示用于解锁的PIN码。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] UnlockPin([in] int slotId, [in] int serialId, [in] String pin); + + /** + * @brief PUK解锁。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param puk 表示用于解锁的PUK码。 + * @param pin 表示用于解锁的PIN码。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] UnlockPuk([in] int slotId, [in] int serialId, [in] String puk, [in] String pin); + + /** + * @brief PIN2解锁。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param pin2 表示用于解锁的PIN2码。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] UnlockPin2([in] int slotId, [in] int serialId, [in] String pin2); + + /** + * @brief PUK2解锁。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param puk2 表示用于解锁的PUK2码。 + * @param pin2 表示用于解锁的PIN2码。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] UnlockPuk2([in] int slotId, [in] int serialId, [in] String puk2, [in] String pin2); + + /** + * @brief 激活去激活SIM卡。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param index 表示索引值。 + * @param enable 表示激活状态,0为去激活,1为激活。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetActiveSim([in] int slotId, [in] int serialId, [in] int index, [in] int enable); + + /** + * @brief 发送SIM卡应用开发工具箱(STK) TerminalResponse指令。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param strCmd 表示指令的字串文本。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimStkSendTerminalResponse([in] int slotId, [in] int serialId, [in] String strCmd); + + /** + * @brief 发送STK Envelope指令。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param strCmd 表示指令的字串文本。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimStkSendEnvelope([in] int slotId, [in] int serialId, [in] String strCmd); + + /** + * @brief 发送STK CallSetup指令。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param accept 表示是否接受CallSetup请求,0为不接受,1为接受。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimStkSendCallSetupRequestResult([in] int slotId, [in] int serialId, [in] int accept); + + /** + * @brief 获取STK是否Ready状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimStkIsReady([in] int slotId, [in] int serialId); + + /** + * @brief 获取主副卡协议栈。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetRadioProtocol([in] int slotId,[in] int serialId); + + /** + * @brief 设置主副卡协议栈。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param radioProtocol 表示Radio协议信息,详见{@link RadioProtocol}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetRadioProtocol([in] int slotId,[in] int serialId,[in] struct RadioProtocol radioProtocol); + + /** + * @brief 打开应用协议数据单元(APDU)逻辑通道。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param appID 表示应用标识符。 + * @param p2 表示AT指令码的参数2。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimOpenLogicalChannel([in] int slotId, [in] int serialId, [in] String appID, [in] int p2); + + /** + * @brief 关闭应用协议数据单元(APDU)逻辑通道。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param channelId 表示请求关闭的逻辑通道ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimCloseLogicalChannel([in] int slotId, [in] int serialId, [in] int channelId); + + /** + * @brief 应用协议数据单元(APDU)逻辑通道数据传输,由应用主动发起连接和关闭。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param apduSimIO 表示通过应用协议数据单元(APDU)传输的SIM数据请求信息,详见{@link ApduSimIORequestInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimTransmitApduLogicalChannel([in] int slotId, [in] int serialId, + [in] struct ApduSimIORequestInfo apduSimIO); + + /** + * @brief 应用协议数据单元(APDU)基础通道数据传输,默认打开的传输通道。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param apduSimIO 表示通过应用协议数据单元(APDU)传输的SIM数据请求信息,详见{@link ApduSimIORequestInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimTransmitApduBasicChannel([in] int slotId, [in] int serialId, + [in] struct ApduSimIORequestInfo apduSimIO); + + /** + * @brief SIM卡鉴权。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param simAuthInfo 表示SIM卡鉴权请求信息,详见{@link SimAuthenticationRequestInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SimAuthentication([in] int slotId, [in] int serialId, + [in] struct SimAuthenticationRequestInfo simAuthInfo); + + /** + * @brief 解锁SIM卡。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param lockType 表示锁类型,参考3GPP TS 22.022 [33]。 + * @param key 表示用于解锁的密码,参考3GPP TS 22.022 [33]。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] UnlockSimLock([in] int slotId, [in] int serialId, [in] int lockType, [in] String key); + + /** + * @brief 获取信号强度。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetSignalStrength([in] int slotId, [in] int serialId); + + /** + * @brief 获取电路(CS)域注册状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCsRegStatus([in] int slotId, [in] int serialId); + + /** + * @brief 获取分组(PS)域注册状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetPsRegStatus([in] int slotId, [in] int serialId); + + /** + * @brief 获取运营商名称信息。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetOperatorInfo([in] int slotId, [in] int serialId); + + /** + * @brief 获取可用网络信息。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetNetworkSearchInformation([in] int slotId, [in] int serialId); + + /** + * @brief 获取选网模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetNetworkSelectionMode([in] int slotId, [in] int serialId); + + /** + * @brief 设置选网模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param networkModeInfo 表示选网模式信息,详见{@link SetNetworkModeInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetNetworkSelectionMode([in] int slotId, [in] int serialId, + [in] struct SetNetworkModeInfo networkModeInfo); + + /** + * @brief 获取相邻小区信息。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetNeighboringCellInfoList([in] int slotId, [in] int serialId); + + /** + * @brief 获取小区信息。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCurrentCellInfo([in] int slotId, [in] int serialId); + + /** + * @brief 设置首选网络类型。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param preferredNetworkType 表示首选网络类型,详见{@link PreferredNetworkTypeInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetPreferredNetwork([in] int slotId, [in] int serialId, [in] int preferredNetworkType); + + /** + * @brief 获取首选网络类型。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetPreferredNetwork([in] int slotId, [in] int serialId); + + /** + * @brief 获取物理通道配置。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetPhysicalChannelConfig([in] int slotId, [in] int serialId); + + /** + * @brief 设置小区位置更新通知模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param mode 表示通知模式,详见{@link RilRegNotifyMode}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetLocateUpdates([in] int slotId, [in] int serialId, [in] enum RilRegNotifyMode mode); + + /** + * @brief 设置Modem主动上报消息过滤器。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param newFilter 表示消息类型过滤器,使用二进制标志位表示不同的消息类型,0表示关闭, + * 1表示信号强度,2表示网络注册状态,4表示数据连接状态,8表示链路容量,16表示物理通道配置。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetNotificationFilter([in] int slotId, [in] int serialId, [in] int newFilter); + + /** + * @brief 设置设备状态。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param deviceStateType 表示设备状态类型,0表示省电模式,1表示充电模式,2表示低数据模式。 + * @param deviceStateOn 表示设备状态开关,0表示关闭,1表示开启。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetDeviceState([in] int slotId, [in] int serialId, [in] int deviceStateType, [in] int deviceStateOn); + + /** + * @brief 发送全球移动通信系统 (GSM)短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param gsmSmsMessageInfo 表示GSM短信信息,详见{@link GsmSmsMessageInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SendGsmSms([in] int slotId, [in] int serialId, [in] struct GsmSmsMessageInfo gsmSmsMessageInfo); + + /** + * @brief 发送码分多址(CDMA)短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param cdmaSmsMessageInfo 表示CDMA短信信息,详见{@link SendCdmaSmsMessageInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SendCdmaSms([in] int slotId, [in] int serialId, [in] struct SendCdmaSmsMessageInfo cdmaSmsMessageInfo); + + /** + * @brief 写入GSM SIM卡短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param gsmSmsMessageInfo 表示SIM卡短信信息,详见{@link SmsMessageIOInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] AddSimMessage([in] int slotId, [in] int serialId, [in] struct SmsMessageIOInfo gsmSmsMessageInfo); + + /** + * @brief 删除GSM SIM卡短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param index 表示消息索引。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] DelSimMessage([in] int slotId, [in] int serialId, [in] int index); + + /** + * @brief 更新GSM SIM卡短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param gsmSmsMessageInfo 表示SIM卡短信信息,详见{@link SmsMessageIOInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] UpdateSimMessage([in] int slotId, [in] int serialId, [in] struct SmsMessageIOInfo gsmSmsMessageInfo); + + /** + * @brief 写入CDMA SIM卡短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param cdmaSmsMessageInfo 表示SIM卡短信信息,详见{@link SmsMessageIOInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] AddCdmaSimMessage([in] int slotId, [in] int serialId, [in] struct SmsMessageIOInfo cdmaSmsMessageInfo); + + /** + * @brief 删除CDMA SIM卡短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param index 表示消息索引。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] DelCdmaSimMessage([in] int slotId, [in] int serialId, [in] int index); + + /** + * @brief 更新CDMA SIM卡短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param cdmaSmsMessageInfo 表示SIM卡短信信息,详见{@link SmsMessageIOInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] UpdateCdmaSimMessage([in] int slotId, [in] int serialId, [in] struct SmsMessageIOInfo cdmaSmsMessageInfo); + + /** + * @brief 设置短信中心地址。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param serviceCenterAddress 表示短信中心地址信息,详见{@link ServiceCenterAddress}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetSmscAddr([in] int slotId, [in] int serialId, [in] struct ServiceCenterAddress serviceCenterAddress); + + /** + * @brief 获取短信中心地址。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetSmscAddr([in] int slotId, [in] int serialId); + + /** + * @brief 激活GSM小区广播。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param cellBroadcastInfo 表示GSM小区广播配置信息,详见{@link CBConfigInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetCBConfig([in] int slotId, [in] int serialId, [in] struct CBConfigInfo cellBroadcastInfo); + + /** + * @brief 获取GSM小区广播配置。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCBConfig([in] int slotId, [in] int serialId); + + /** + * @brief 激活CDMA小区广播。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param cdmaCBConfigInfoList 表示CDMA小区广播配置信息列表,详见{@link CdmaCBConfigInfoList}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SetCdmaCBConfig([in] int slotId, [in] int serialId, [in] struct CdmaCBConfigInfoList cdmaCBConfigInfoList); + + /** + * @brief 获取CDMA小区广播配置。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] GetCdmaCBConfig([in] int slotId, [in] int serialId); + + /** + * @brief 发送GSM长短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param gsmSmsMessageInfo 表示GSM短信信息,详见{@link GsmSmsMessageInfo}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SendSmsMoreMode([in] int slotId, [in] int serialId, [in] struct GsmSmsMessageInfo gsmSmsMessageInfo); + + /** + * @brief 确认接收新短信。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param modeData 表示接收短信处理模式,详见{@link ModeData}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SendSmsAck([in] int slotId, [in] int serialId, [in] struct ModeData modeData); + + /** + * @brief 发送应答给无线接口层(RIL)。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + [oneway] SendRilAck(); + + /** + * @brief 获取RRC连接状态. + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @return Returns 0 表示执行成功。 + * @return Returns 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + [oneway] GetRrcConnectionState([in] int slotId, [in] int serialId); + + /** + * @brief 设置NR选项模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param mode NR的选择模式。 + * @return Returns 0 表示执行成功。 + * @return Returns 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + [oneway] SetNrOptionMode([in] int slotId, [in] int serialId, [in] int mode); + + /** + * @brief 获取NR选项模式。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @return Returns 0 表示执行成功。 + * @return Returns a 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + [oneway] GetNrOptionMode([in] int slotId, [in] int serialId); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl b/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl new file mode 100644 index 00000000..41ba1f1a --- /dev/null +++ b/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl @@ -0,0 +1,1563 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Ril + * @{ + * + * @brief Ril模块接口定义。 + * + * Ril模块为上层电话服务提供相关调用接口,涉及电话、短信、彩信、网络搜索、SIM卡等功能接口及各种回调等。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file IRilCallback.idl + * + * @brief Ril模块的回调接口 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @brief Ril模块接口的包路径。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.ril.v1_1; + +import ohos.hdi.ril.v1_1.Types; + +/** + * @brief Ril模块的回调接口。 + * + * 回调接口提供打电话、发短彩信、激活SIM卡、上网等回调函数,回调函数由调用者实现。 + * + * @since 3.2 + * @version 1.1 + */ +[callback] interface IRilCallback { + /** + * @brief 紧急呼叫号码上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param emergencyInfoList 表示紧急号码列表,详见{@link EmergencyInfoList}。 + * + * @since 3.2 + * @version 1.0 + */ + CallEmergencyNotice([in] struct RilRadioResponseInfo responseInfo, + [in] struct EmergencyInfoList emergencyInfoList); + + /** + * @brief 通话状态更新上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + CallStateUpdated([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 通话回铃音上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param ringbackVoice 表示回铃音信息,详见{@link RingbackVoice}。 + * + * @since 3.2 + * @version 1.0 + */ + CallRingbackVoiceNotice([in] struct RilRadioResponseInfo responseInfo, + [in] struct RingbackVoice ringbackVoice); + + /** + * @brief SRVCC(Single Radio Voice Call Continuity)状态上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param srvccStatus 表示SRVCC(Single Radio Voice Call Continuity)状态,详见{@link SrvccStatus}。 + * + * @since 3.2 + * @version 1.0 + */ + CallSrvccStatusNotice([in] struct RilRadioResponseInfo responseInfo, + [in] struct SrvccStatus srvccStatus); + + /** + * @brief USSD业务信息上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param ussdNoticeInfo 表示USSD业务信息,详见{@link UssdNoticeInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + CallUssdNotice([in] struct RilRadioResponseInfo responseInfo, + [in] struct UssdNoticeInfo ussdNoticeInfo); + + /** + * @brief 补充业务信息上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param ssNoticeInfo 表示补充业务信息,详见{@link SsNoticeInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + CallSsNotice([in] struct RilRadioResponseInfo responseInfo, + [in] struct SsNoticeInfo ssNoticeInfo); + + /** + * @brief RSRVCC(Reverse Single Radio Voice Call Continuity)状态上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + CallRsrvccStatusNotify([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 设置紧急呼叫号码列表响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetEmergencyCallListResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询紧急呼叫号码列表响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param emergencyInfoList 表示紧急号码列表,详见{@link EmergencyInfoList}。 + * + * @since 3.2 + * @version 1.0 + */ + GetEmergencyCallListResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct EmergencyInfoList emergencyInfoList); + + /** + * @brief 查询通话状态列表响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param callList 表示通话状态信息列表,详见{@link CallInfoList}。 + * + * @since 3.2 + * @version 1.0 + */ + GetCallListResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct CallInfoList callList); + + /** + * @brief 拨打电话响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + DialResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 挂断电话响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + HangupResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 拒接电话响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + RejectResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 接听电话响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + AnswerResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 保持通话响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + HoldCallResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 取消保持通话响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + UnHoldCallResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 切换通话响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SwitchCallResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询主叫号码显示响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param getClipResult 表示主叫号码显示结果信息,详见{@link GetClipResult}。 + * + * @since 3.2 + * @version 1.0 + */ + GetClipResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct GetClipResult getClipResult); + + /** + * @brief 设置主叫号码显示响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetClipResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 合并为会议电话响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + CombineConferenceResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 与会议电话分离响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SeparateConferenceResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 挂断前台、恢复后台响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + CallSupplementResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询呼叫等待响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param callWaitResult 表示呼叫等待结果信息,详见{@link CallWaitResult}。 + * + * @since 3.2 + * @version 1.0 + */ + GetCallWaitingResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct CallWaitResult callWaitResult); + + /** + * @brief 设置呼叫等待响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetCallWaitingResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询呼叫转移响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cFQueryList 表示呼叫转移信息列表,详见{@link CallForwardQueryInfoList}。 + * + * @since 3.2 + * @version 1.0 + */ + GetCallTransferInfoResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct CallForwardQueryInfoList cFQueryList); + + /** + * @brief 设置呼叫转移响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetCallTransferInfoResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询呼叫限制响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param result 表示呼叫限制结果信息,详见{@link CallRestrictionResult}。 + * + * @since 3.2 + * @version 1.0 + */ + GetCallRestrictionResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct CallRestrictionResult result); + + /** + * @brief 设置呼叫限制响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetCallRestrictionResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询主叫号码显示限制响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param getClirResult 表示主叫号码显示限制结果信息,详见{@link GetClirResult}。 + * + * @since 3.2 + * @version 1.0 + */ + GetClirResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct GetClirResult getClirResult); + + /** + * @brief 设置主叫号码显示限制响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetClirResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 开启DTMF响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + StartDtmfResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 发送DTMF响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SendDtmfResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 关闭DTMF响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + StopDtmfResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询通话偏好模式响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param mode 表示CallPreference模式。 + * + * @since 3.2 + * @version 1.0 + */ + GetCallPreferenceModeResponse([in] struct RilRadioResponseInfo responseInfo, [in] int mode); + + /** + * @brief 设置通话偏好模式响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetCallPreferenceModeResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 设置USSD业务响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetUssdResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询USSD业务响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cusd 表示USSD业务信息。 + * + * @since 3.2 + * @version 1.0 + */ + GetUssdResponse([in] struct RilRadioResponseInfo responseInfo, [in] int cusd); + + /** + * @brief 设置静音响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetMuteResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询静音响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param mute 表示静音状态,0表示非静音,1表示静音。 + * + * @since 3.2 + * @version 1.0 + */ + GetMuteResponse([in] struct RilRadioResponseInfo responseInfo, [in] int mute); + + /** + * @brief 查询通话失败原因响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param callFail 表示通话失败原因。 + * + * @since 3.2 + * @version 1.0 + */ + GetCallFailReasonResponse([in] struct RilRadioResponseInfo responseInfo, [in] int callFail); + + /** + * @brief 设置呼叫限制密码响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetBarringPasswordResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 数据业务建立与断开等状态变化上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param dataCallResultList 表示数据业务激活结果列表,详见{@link DataCallResultList}。 + * + * @since 3.2 + * @version 1.0 + */ + PdpContextListUpdated([in] struct RilRadioResponseInfo responseInfo, [in] struct DataCallResultList dataCallResultList); + + /** + * @brief 激活数据业务响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param setupDataCallResultInfo 表示数据业务激活结果信息,详见{@link SetupDataCallResultInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + ActivatePdpContextResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct SetupDataCallResultInfo setupDataCallResultInfo); + + /** + * @brief 断开数据业务响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + DeactivatePdpContextResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取当前所有数据连接状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param dataCallResultList 表示数据业务激活结果列表,详见{@link DataCallResultList}。 + * + * @since 3.2 + * @version 1.0 + */ + GetPdpContextListResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct DataCallResultList dataCallResultList); + + /** + * @brief 设置初始化默认网络接入技术(APN)信息响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetInitApnInfoResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取当前链路信息响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param dataLinkBandwidthInfo 表示网络频率信息,详见{@link DataLinkBandwidthInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetLinkBandwidthInfoResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct DataLinkBandwidthInfo dataLinkBandwidthInfo); + + /** + * @brief 设置当前链路信息的上报规则响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetLinkBandwidthReportingRuleResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 使能SIM卡槽数据业务响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetDataPermittedResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief Radio状态上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param state 表示Radio状态,0表示OFF,1表示ON。 + * + * @since 3.2 + * @version 1.0 + */ + RadioStateUpdated([in] struct RilRadioResponseInfo responseInfo, [in] int state); + + /** + * @brief 语音接入技术变化上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param voiceRadioTechnology 表示变化后的电路域接入技术,详见{@link VoiceRadioTechnology}。 + * + * @since 3.2 + * @version 1.0 + */ + VoiceRadioTechUpdated([in] struct RilRadioResponseInfo responseInfo, + [in] struct VoiceRadioTechnology voiceRadioTechnology); + + /** + * @brief Modem收到手机正在关机响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + ShutDownResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 设置Modem状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetRadioStateResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 查询Modem状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetRadioStateResponse([in] struct RilRadioResponseInfo responseInfo,[in] int state); + + /** + * @brief 获取国际移动设备识别码响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param imei 表示IMEI。 + * + * @since 3.2 + * @version 1.0 + */ + GetImeiResponse([in] struct RilRadioResponseInfo responseInfo, [in] String imei); + + /** + * @brief 获取移动设备识别码响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param meid 表示MEID。 + * + * @since 3.2 + * @version 1.0 + */ + GetMeidResponse([in] struct RilRadioResponseInfo responseInfo, [in] String meid); + + /** + * @brief 获取电路域接入技术响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param VoiceRadioTechnology 表示语音接入技术,详见{@link VoiceRadioTechnology}。 + * + * @since 3.2 + * @version 1.0 + */ + GetVoiceRadioTechnologyResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct VoiceRadioTechnology voiceRadioTechnology); + + /** + * @brief 查询基带版本响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param basebandVersion 表示基带版本。 + * + * @since 3.2 + * @version 1.0 + */ + GetBasebandVersionResponse([in] struct RilRadioResponseInfo responseInfo, [in] String basebandVersion); + + /** + * @brief SIM卡状态变化上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStateUpdated([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief STK SessionEnd指令上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkSessionEndNotify([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief STK Proactive指令上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkProactiveNotify([in] struct RilRadioResponseInfo responseInfo, [in] String response); + + /** + * @brief STK Alpha指令上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkAlphaNotify([in] struct RilRadioResponseInfo responseInfo, [in] String response); + + /** + * @brief STK事件上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkEventNotify([in] struct RilRadioResponseInfo responseInfo, [in] String response); + + /** + * @brief STK CallSetup指令上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkCallSetupNotify([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief SIM状态刷新上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimRefreshNotify([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief STK Radio协议更新上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimRadioProtocolUpdated([in] struct RilRadioResponseInfo responseInfo, [in] struct RadioProtocol radioProtocol); + + /** + * @brief 获取SIM卡数据响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param result 表示SIM卡IO响应结果信息,详见{@link IccIoResultInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetSimIOResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct IccIoResultInfo result); + + /** + * @brief 获取SIM卡状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param CardStatusInfo 表示卡状态信息,详见{@link CardStatusInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetSimStatusResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct CardStatusInfo result); + + /** + * @brief 获取SIM卡IMSI响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param response 表示获取到的IMSI文本。 + * + * @since 3.2 + * @version 1.0 + */ + GetImsiResponse([in] struct RilRadioResponseInfo responseInfo, [in] String response); + + /** + * @brief 获取SIM卡锁状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param simLockStatus 表示SIM卡锁状态,详见{@link simLockStatus}。 + * + * @since 3.2 + * @version 1.0 + */ + GetSimLockStatusResponse([in] struct RilRadioResponseInfo responseInfo, [in] int simLockStatus); + + /** + * @brief 设置SIM卡锁响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param LockStatusResp 表示获取到的SIM卡锁状态响应,详见{@link LockStatusResp}。 + * + * @since 3.2 + * @version 1.0 + */ + SetSimLockResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct LockStatusResp lockStatus); + + /** + * @brief 修改SIM卡密码响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param LockStatusResp 表示获取到的SIM卡锁状态响应,详见{@link LockStatusResp}。 + * + * @since 3.2 + * @version 1.0 + */ + ChangeSimPasswordResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct LockStatusResp lockStatus); + + /** + * @brief PIN解锁响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param LockStatusResp 表示获取到的SIM卡锁状态响应,详见{@link LockStatusResp}。 + * + * @since 3.2 + * @version 1.0 + */ + UnlockPinResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct LockStatusResp lockStatus); + + /** + * @brief PUK解锁响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param LockStatusResp 表示获取到的SIM卡锁状态响应,详见{@link LockStatusResp}。 + * + * @since 3.2 + * @version 1.0 + */ + UnlockPukResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct LockStatusResp lockStatus); + + /** + * @brief PIN2解锁响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param LockStatusResp 表示获取到的SIM卡锁状态响应,详见{@link LockStatusResp}。 + * + * @since 3.2 + * @version 1.0 + */ + UnlockPin2Response([in] struct RilRadioResponseInfo responseInfo, [in] struct LockStatusResp lockStatus); + + /** + * @brief PUK2解锁响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param LockStatusResp 表示获取到的SIM卡锁状态响应,详见{@link LockStatusResp}。 + * + * @since 3.2 + * @version 1.0 + */ + UnlockPuk2Response([in] struct RilRadioResponseInfo responseInfo, [in] struct LockStatusResp lockStatus); + + /** + * @brief 激活去激活SIM卡响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetActiveSimResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 发送STK TerminalResponse指令响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkSendTerminalResponseResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 发送STK Envelope指令响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkSendEnvelopeResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 发送STK CallSetup指令响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkSendCallSetupRequestResultResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取STK是否Ready状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimStkIsReadyResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取主副卡协议栈响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param RadioProtocol 表示获取到的Radio协议,详见{@link RadioProtocol}。 + * + * @since 3.2 + * @version 1.0 + */ + GetRadioProtocolResponse([in] struct RilRadioResponseInfo responseInfo,[in] struct RadioProtocol radioProtocol); + + /** + * @brief 设置主副卡协议栈响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param RadioProtocol 表示获取到的响应Radio协议,详见{@link RadioProtocol}。 + * + * @since 3.2 + * @version 1.0 + */ + SetRadioProtocolResponse([in] struct RilRadioResponseInfo responseInfo,[in] struct RadioProtocol radioProtocol); + + /** + * @brief APDU打开逻辑通道响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param OpenLogicalChannelResponse 表示打开逻辑通道的响应信息,详见{@link OpenLogicalChannelResponse}。 + * + * @since 3.2 + * @version 1.0 + */ + SimOpenLogicalChannelResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct OpenLogicalChannelResponse pOpenLogicalChannelResponse); + + /** + * @brief APDU关闭逻辑通道响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimCloseLogicalChannelResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief APDU逻辑通道数据传输响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param result 表示数据传输结果信息,详见{@link IccIoResultInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimTransmitApduLogicalChannelResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct IccIoResultInfo result); + + /** + * @brief APDU基础通道数据传输响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param result 表示数据传输结果信息,详见{@link IccIoResultInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimTransmitApduBasicChannelResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct IccIoResultInfo result); + + /** + * @brief SIM卡鉴权响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param result 表示SIM卡鉴权的结果信息,详见{@link IccIoResultInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SimAuthenticationResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct IccIoResultInfo result); + + /** + * @brief 解锁SIM卡响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param LockStatusResp 表示获取到的SIM卡锁状态响应,详见{@link LockStatusResp}。 + * + * @since 3.2 + * @version 1.0 + */ + UnlockSimLockResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct LockStatusResp lockStatus); + + /** + * @brief CS域网络注册状态变化上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param csRegStatusInfo 表示CS注册状态信息,详见{@link CsRegStatusInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + NetworkCsRegStatusUpdated([in] struct RilRadioResponseInfo responseInfo, + [in] struct CsRegStatusInfo csRegStatusInfo); + + /** + * @brief PS域网络注册状态变化上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param psRegStatusInfo 表示PS注册状态信息,详见{@link PsRegStatusInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + NetworkPsRegStatusUpdated([in] struct RilRadioResponseInfo responseInfo, + [in] struct PsRegStatusInfo psRegStatusInfo); + + /** + * @brief 信号强度变化上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param rssi 表示信号强度,详见{@link Rssi}。 + * + * @since 3.2 + * @version 1.0 + */ + SignalStrengthUpdated([in] struct RilRadioResponseInfo responseInfo, [in] struct Rssi rssi); + + /** + * @brief NITZ时区变化上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param timeZoneStr 表示时区。 + * + * @since 3.2 + * @version 1.0 + */ + NetworkTimeZoneUpdated([in] struct RilRadioResponseInfo responseInfo, [in] String timeZoneStr); + + /** + * @brief NITZ时间更新上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param timeStr 表示时间。 + * + * @since 3.2 + * @version 1.0 + */ + NetworkTimeUpdated([in] struct RilRadioResponseInfo responseInfo, [in] String timeStr); + + /** + * @brief 物理通道配置消息上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param channelConfigInfoList 表示通道配置信息列表,详见{@link ChannelConfigInfoList}。 + * + * @since 3.2 + * @version 1.0 + */ + NetworkPhyChnlCfgUpdated([in] struct RilRadioResponseInfo responseInfo, + [in] struct ChannelConfigInfoList channelConfigInfoList); + + /** + * @brief 小区信息上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cellListCurrentInfo 表示当前小区信息,详见{@link CellListCurrentInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + NetworkCurrentCellUpdated([in] struct RilRadioResponseInfo responseInfo, + [in] struct CellListCurrentInfo cellListCurrentInfo); + + /** + * @brief 小区信息上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cellListCurrentInfo 表示当前小区信息,详见{@link CellListCurrentInfo_1_1}. + * + * @since 4.0 + * @version 1.1 + */ + NetworkCurrentCellUpdated_1_1([in] struct RilRadioResponseInfo responseInfo, + [in] struct CellListCurrentInfo_1_1 cellListCurrentInfo); + + /** + * @brief 获取信号强度响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param rssi 表示信号强度,详见{@link Rssi}。 + * + * @since 3.2 + * @version 1.0 + */ + GetSignalStrengthResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct Rssi rssi); + + /** + * @brief 获取语音(CS)域注册状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param csRegStatusInfo 表示CS注册状态信息,详见{@link CsRegStatusInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetCsRegStatusResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct CsRegStatusInfo csRegStatusInfo); + + /** + * @brief 获取分组(PS)域注册状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param psRegStatusInfo 表示PS注册状态信息,详见{@link PsRegStatusInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetPsRegStatusResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct PsRegStatusInfo psRegStatusInfo); + + /** + * @brief 获取运营商名称信息响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param psRegStatusInfo 表示运营商信息,详见{@link OperatorInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetOperatorInfoResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct OperatorInfo psRegStatusInfo); + + /** + * @brief 获取可用网络信息响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param availableNetworkList 表示可用网络列表,详见{@link AvailableNetworkList}。 + * + * @since 3.2 + * @version 1.0 + */ + GetNetworkSearchInformationResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct AvailableNetworkList availableNetworkList); + + /** + * @brief 获取选网模式响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param setNetworkModeInfo 表示可选择的网络模式,详见{@link SetNetworkModeInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetNetworkSelectionModeResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct SetNetworkModeInfo setNetworkModeInfo); + + /** + * @brief 设置选网模式响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetNetworkSelectionModeResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取相邻小区信息响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cellListNearbyInfo 表示附近的小区信息列表,详见{@link CellListNearbyInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetNeighboringCellInfoListResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct CellListNearbyInfo cellListNearbyInfo); + + /** + * @brief 获取小区信息响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cellListCurrentInfo 表示附近的小区信息列表,详见{@link CellListCurrentInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetCurrentCellInfoResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct CellListCurrentInfo cellListCurrentInfo); + + /** + * @brief 获取小区信息响应。 + * + * @param responseInfo responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cellListCurrentInfo 表示附近的小区信息列表,详见{@link CellListCurrentInfo_1_1}. + * + * @since 4.0 + * @version 1.1 + */ + GetCurrentCellInfoResponse_1_1([in] struct RilRadioResponseInfo responseInfo, + [in] struct CellListCurrentInfo_1_1 cellListCurrentInfo); + + /** + * @brief 设置首选网络类型响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetPreferredNetworkResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取首选网络类型响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param preferredNetworkTypeInfo 表示首选网络类型信息,详见{@link PreferredNetworkTypeInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetPreferredNetworkResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct PreferredNetworkTypeInfo preferredNetworkTypeInfo); + + /** + * @brief 获取物理通道配置响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param channelConfigInfoList 表示物理通道配置信息列表,详见{@link ChannelConfigInfoList}。 + * + * @since 3.2 + * @version 1.0 + */ + GetPhysicalChannelConfigResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct ChannelConfigInfoList channelConfigInfoList); + + /** + * @brief 开启或关闭小区位置更新导致的网络状态通知响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetLocateUpdatesResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 设置通知过滤器响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetNotificationFilterResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 设置设备状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetDeviceStateResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief GSM新短信通知上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param smsMessageInfo 表示上报短信信息,详见{@link SmsMessageInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + NewSmsNotify([in] struct RilRadioResponseInfo responseInfo, [in] struct SmsMessageInfo smsMessageInfo); + + /** + * @brief CDMA新短信通知上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param smsMessageInfo 表示上报短信信息,详见{@link SmsMessageInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + NewCdmaSmsNotify([in] struct RilRadioResponseInfo responseInfo,[in] struct SmsMessageInfo smsMessageInfo); + + /** + * @brief 新短信状态通知上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param smsMessageInfo 表示上报短信信息,详见{@link SmsMessageInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SmsStatusReportNotify([in] struct RilRadioResponseInfo responseInfo, [in] struct SmsMessageInfo smsMessageInfo); + + /** + * @brief 收到SIM卡短信上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param recordNumber 表示SIM卡短信数量。 + * @param indicationType 表示响应类型,详见{@link HRilNotiType}。 + * + * @since 3.2 + * @version 1.0 + */ + NewSmsStoredOnSimNotify([in] struct RilRadioResponseInfo responseInfo, [in] int recordNumber, + [in] int indicationType); + + /** + * @brief 小区广播配置上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cellBroadConfigReportInfo 表示小区广播上报信息,详见{@link CBConfigReportInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + CBConfigNotify([in] struct RilRadioResponseInfo responseInfo, + [in] struct CBConfigReportInfo cellBroadConfigReportInfo); + + /** + * @brief 发送GSM短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param sendSmsResultInfo 表示发送短信响应信息,详见{@link SendSmsResultInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SendGsmSmsResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct SendSmsResultInfo sendSmsResultInfo); + + /** + * @brief 发送CDMA短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param sendSmsResultInfo 表示发送短信响应信息,详见{@link SendSmsResultInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SendCdmaSmsResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct SendSmsResultInfo sendSmsResultInfo); + + /** + * @brief 写入GSM SIM卡短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + AddSimMessageResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 删除GSM SIM卡短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + DelSimMessageResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 更新GSM SIM卡短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + UpdateSimMessageResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 写入CDMA SIM卡短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + AddCdmaSimMessageResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 删除CDMA SIM卡短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + DelCdmaSimMessageResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 更新CDMA SIM卡短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + UpdateCdmaSimMessageResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 设置短信中心地址响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetSmscAddrResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取短信中心地址响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @param serviceCenterAddress 表示短信中心地址信息,详见{@link ServiceCenterAddress}。 + * @since 3.2 + * @version 1.0 + */ + GetSmscAddrResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct ServiceCenterAddress serviceCenterAddress); + + /** + * @brief 激活GSM小区广播响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetCBConfigResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取GSM小区广播配置响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cellBroadcastInfo 表示GSM小区广播配置信息,详见{@link CBConfigInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetCBConfigResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct CBConfigInfo cellBroadcastInfo); + + /** + * @brief 激活CDMA小区广播响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SetCdmaCBConfigResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取CDMA小区广播配置响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param cdmaCBConfigInfo 表示CDMA小区广播配置信息,详见{@link CdmaCBConfigInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + GetCdmaCBConfigResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct CdmaCBConfigInfo cdmaCBConfigInfo); + + /** + * @brief 发送GSM长短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param sendSmsResultInfo 表示发送短信响应信息,详见{@link SendSmsResultInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SendSmsMoreModeResponse([in] struct RilRadioResponseInfo responseInfo, + [in] struct SendSmsResultInfo sendSmsResultInfo); + + /** + * @brief 确认接收新短信响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + SendSmsAckResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 通用错误响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 3.2 + * @version 1.0 + */ + CommonErrorResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取RRC连接状态响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param state 表示RRC连接状态。 + * + * @since 4.0 + * @version 1.1 + */ + GetRrcConnectionStateResponse([in] struct RilRadioResponseInfo responseInfo, [in] int state); + + /** + * @brief 设置NR选项模式响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 4.0 + * @version 1.1 + */ + SetNrOptionModeResponse([in] struct RilRadioResponseInfo responseInfo); + + /** + * @brief 获取NR选项模式响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param mode 表示NR选项模式。 + * + * @since 4.0 + * @version 1.1 + */ + GetNrOptionModeResponse([in] struct RilRadioResponseInfo responseInfo, [in] int mode); + + /** + * @brief RRC连接状态更新上报。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param state 表示RRC连接状态。 + * + * @since 4.0 + * @version 1.1 + */ + GetRrcConnectionStateUpdated([in] struct RilRadioResponseInfo responseInfo, [in] int state); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/ril/v1_1/Types.idl b/zh-cn/device_api/hdi/ril/v1_1/Types.idl new file mode 100644 index 00000000..b99ce84b --- /dev/null +++ b/zh-cn/device_api/hdi/ril/v1_1/Types.idl @@ -0,0 +1,3507 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @addtogroup Ril + * @{ + * + * @brief Ril模块接口定义。 + * + * Ril模块为上层电话服务提供相关调用接口,涉及电话、短信、彩信、网络搜索、SIM卡等功能接口及各种回调等。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file Types.idl + * + * @brief Ril模块HDI接口使用的数据类型。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @brief Ril模块接口的包路径。 + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.ril.v1_1; + +/** + * @brief 紧急呼叫类型。 + */ +enum EccType { + /** + * 默认 + */ + TYPE_CATEGORY = 0, + + /** + * 匪警 + */ + TYPE_POLICE = 1, + + /** + * 救护 + */ + TYPE_AMBULANCE = 2, + + /** + * 火警 + */ + TYPE_FIRE = 4, + + /** + * 海警 + */ + TYPE_SEA = 8, + + /** + * 高山营救 + */ + TYPE_MOUNTAIN = 16, +}; + +/** + * @brief 表示号码是有卡时有效还是无卡时有效。 + */ +enum SimpresentType { + /** + * 无卡时有效 + */ + TYPE_NO_CARD = 0, + + /** + * 有卡时有效 + */ + TYPE_HAS_CARD = 1, +}; + +/** + * @brief 表示号码有效性是否区分电路(CS)域非正常服务状态。 + */ +enum AbnormalServiceType { + /** + * 所有状态均有效 + */ + TYPE_ALL = 0, + + /** + * 仅在CS域非正常服务时有效 + */ + TYPE_ONLY_CS = 1, +}; + +/** + * @brief Ril错误码。 + */ +enum RilErrType { + /** + * 调用成功 + */ + NONE = 0, + + /** + * 通用错误 + */ + RIL_ERR_GENERIC_FAILURE = 1, + + /** + * 参数错误 + */ + RIL_ERR_INVALID_PARAMETER = 2, + + /** + * 内存满载 + */ + RIL_ERR_MEMORY_FULL = 3, + + /** + * 命令发送失败 + */ + RIL_ERR_CMD_SEND_FAILURE = 4, + + /** + * 命令连接终止 + */ + RIL_ERR_CMD_NO_CARRIER = 5, + + /** + * 非法响应 + */ + RIL_ERR_INVALID_RESPONSE = 6, + + /** + * 状态已存在 + */ + RIL_ERR_REPEAT_STATUS = 7, + + /** + * 网络搜索中 + */ + RIL_ERR_NETWORK_SEARCHING = 8, + + /** + * 网络搜索中断 + */ + RIL_ERR_NETWORK_SEARCHING_INTERRUPTED = 9, + + /** + * Modem设备关闭 + */ + RIL_ERR_MODEM_DEVICE_CLOSE = 10, + + /** + * SIM卡未插入 + */ + RIL_ERR_NO_SIMCARD_INSERTED = 11, + + /** + * 需要输入PIN码 + */ + RIL_ERR_NEED_PIN_CODE = 12, + + /** + * 需要输入PUK码 + */ + RIL_ERR_NEED_PUK_CODE = 13, + + /** + * 搜网超时 + */ + RIL_ERR_NETWORK_SEARCH_TIMEOUT = 14, + + /** + * PIN码或PUK码错误 + */ + RIL_ERR_PINPUK_PASSWORD_NOCORRECT = 15, + + /** + * Modem参数错误 + */ + RIL_ERR_INVALID_MODEM_PARAMETER = 50, + + /** + * IPC错误 + */ + RIL_ERR_HDF_IPC_FAILURE = 300, + + /** + * 空指针 + */ + RIL_ERR_NULL_POINT = 301, + + /** + * 厂商库未实现 + */ + RIL_ERR_VENDOR_NOT_IMPLEMENT = 302 +}; + +/** + * @brief 响应类型。 + */ +enum RilResponseTypes { + /** + * 请求响应 + */ + RIL_RESPONSE_REQUEST = 0, + + /** + * 通知响应 + */ + RIL_RESPONSE_NOTICE = 1, + + /** + * 应答请求响应 + */ + RIL_RESPONSE_REQUEST_ACK = 2, + + /** + * 必须应答请求响应 + */ + RIL_RESPONSE_REQUEST_MUST_ACK = 3, + + /** + * 必须应答通知响应 + */ + RIL_RESPONSE_NOTICE_MUST_ACK = 4, +}; + +/** + * @brief Ril系统服务状态。 + */ +enum RilSrvStatus { + /** + * 无服务 + */ + RIL_NO_SRV_SERVICE = 0, + + /** + * 有限制服务 + */ + RIL_RESTRICTED_SERVICE = 1, + + /** + * 服务有效 + */ + RIL_SERVICE_VALID = 2, + + /** + * 有限制的区域服务 + */ + RIL_REGIONAL_SERVICE = 3, + + /** + * 省电和睡眠状态 + */ + RIL_ENERGY_SAVING_SERVICE = 4, +}; + +/** + * @brief 系统服务域。 + */ +enum RilSrvDomain { + /** + * 无服务 + */ + RIL_NO_DOMAIN_SERVICE = 0, + + /** + * 仅CS服务 + */ + RIL_CS_SERVICE = 1, + + /** + * 仅分组(PS)服务 + */ + RIL_PS_SERVICE = 2, + + /** + * CS+PS服务 + */ + RIL_CS_PS_SERVICE = 3, + + /** + * CS、PS均未注册 + */ + RIL_CS_PS_SEARCHING = 4, + + /** + * CDMA不支持 + */ + RIL_CDMA_NOT_SUPPORT = 255, +}; + +/** + * @brief 漫游状态。 + */ +enum RilRoamStatus { + /** + * 非漫游状态 + */ + RIL_NO_ROAM = 0, + /** + * 漫游状态 + */ + RIL_ROAMING = 1, + /** + * 未知 + */ + RIL_ROAM_UNKNOWN = 2, +}; + +/** + * @brief SIM卡锁定状态。 + */ +enum RilSimLockStatus { + /** + * 未被CardLock功能锁定 + */ + RIL_SIM_CARD_UNLOCK = 0, + + /** + * 被CardLock功能锁定 + */ + RIL_SIM_CARD_LOCK = 1, +}; + +/** + * @brief 系统制式。 + */ +enum RilSysMode { + /** + * 服务不存在 + */ + RIL_NO_SYSMODE_SERVICE = 0, + + /** + * 全球移动通信系统 (GSM) + */ + RIL_GSM_MODE = 1, + + /** + * 码分多址(CDMA) + */ + RIL_CDMA_MODE = 2, + + /** + * 宽带码分多址(WCDMA) + */ + RIL_WCDMA_MODE = 3, + + /** + * 时分同步码分多址(TDSCDMA) + */ + RIL_TDSCDMA_MODE = 4, + + /** + * 全球微波接入互操作性(WIMAX) + */ + RIL_WIMAX_MODE = 5, + + /** + * 长期演进(LTE) + */ + RIL_LTE_MODE = 6, + + /** + * 载波聚合(CA) + */ + RIL_LTE_CA_MODE = 7, + + /** + * 5G新空口(NR) + */ + RIL_NR_MODE = 8, +}; + +/** + * @brief 语音接入技术类型。 + */ +enum RilRadioTech { + /** + * 非法 + */ + RADIO_TECHNOLOGY_INVALID = 65535, + + /** + * 未知 + */ + RADIO_TECHNOLOGY_UNKNOWN = 0, + + /** + * GSM + */ + RADIO_TECHNOLOGY_GSM = 1, + + /** + * 无线电传输技术(1XRTT) + */ + RADIO_TECHNOLOGY_1XRTT = 2, + + /** + * WCDMA + */ + RADIO_TECHNOLOGY_WCDMA = 3, + + /** + * 高速分组接入(HSPA) + */ + RADIO_TECHNOLOGY_HSPA = 4, + + /** + * 高速下行分组接入(HSPAP) + */ + RADIO_TECHNOLOGY_HSPAP = 5, + + /** + * 同步码分多址的无线接入技术(SCDMA) + */ + RADIO_TECHNOLOGY_TD_SCDMA = 6, + + /** + * 仅演进数据(EVDO) + */ + RADIO_TECHNOLOGY_EVDO = 7, + + /** + * 演进的高速分组网络(EHRPD) + */ + RADIO_TECHNOLOGY_EHRPD = 8, + + /** + * LTE + */ + RADIO_TECHNOLOGY_LTE = 9, + + /** + * CA + */ + RADIO_TECHNOLOGY_LTE_CA = 10, + + /** + * 工业无线局域网(IWLAN) + */ + RADIO_TECHNOLOGY_IWLAN = 11, + + /** + * NR + */ + RADIO_TECHNOLOGY_NR = 12, +}; + +/** + * @brief SIM卡状态。 + */ +enum RilSimStatus { + /** + * USIM卡状态无效 + */ + RIL_USIM_INVALID = 0, + + /** + * USIM卡状态有效 + */ + RIL_USIM_VALID = 1, + + /** + * USIM卡在CS下无效 + */ + RIL_USIM_CS_INVALID = 2, + + /** + * USIM卡在PS下无效 + */ + RIL_USIM_PS_INVALID = 3, + + /** + * USIM卡在CS+PS下均无效 + */ + RIL_USIM_CS_PS_INVALID = 4, + + /** + * 仿真SIM卡 + */ + RIL_ROM_SIM = 240, + + /** + * USIM卡不存在 + */ + RIL_NO_USIM = 255, +}; + +/** + * @brief 描述网络注册状态。 + */ +enum RilRegStatus { + /** + * 没有注册,MT(Mobile Terminal)现在没有搜索和注册新的运营商 + */ + NO_REG_MT_NO_SEARCH = 0, + + /** + * 注册了归属网络 + */ + REG_MT_HOME = 1, + + /** + * 没有注册,MT正在搜索并注册新的运营商 + */ + NO_REG_MT_SEARCHING = 2, + + /** + * 注册被拒绝 + */ + REG_MT_REJECTED = 3, + + /** + * 未知状态 + */ + REG_MT_UNKNOWN = 4, + + /** + * 注册了漫游网络 + */ + REG_MT_ROAMING = 5, + + /** + * 处于紧急模式 + */ + REG_MT_EMERGENCY = 6, +}; + +/** + * @brief 小区连接状态。 + */ +enum RilCellConnectionStatus { + /** + * 未知连接状态 + */ + RIL_SERVING_CELL_UNKNOWN = 0, + + /** + * 主要连接状态 + */ + RIL_SERVING_CELL_PRIMARY = 1, + + /** + * 次要连接状态 + */ + RIL_SERVING_CELL_SECONDARY = 2, +}; + +/** + * @brief 上报模式。 + */ +enum RilRegNotifyMode { + /** + * 禁止主动上报 + */ + REG_NOT_NOTIFY = 0, + + /** + * 网络注册状态发生改变时上报 + */ + REG_NOTIFY_STAT_ONLY = 1, + + /** + * 小区信息发生改变时上报 + */ + REG_NOTIFY_STAT_LAC_CELLID = 2, +}; + +/** + * @brief 设置Radio协议动作参数。 + */ +enum RadioProtocolPhase { + /** + * 初始化 + */ + RADIO_PROTOCOL_PHASE_INITIAL, + + /** + * 检查 + */ + RADIO_PROTOCOL_PHASE_CHECK, + + /** + * 更新 + */ + RADIO_PROTOCOL_PHASE_UPDATE, + + /** + * 上报 + */ + RADIO_PROTOCOL_PHASE_NOTIFY, + + /** + * 结束 + */ + RADIO_PROTOCOL_PHASE_COMPLETE, +}; + +/** + * @brief Radio协议状态。 + */ +enum RadioProtocolStatus { + /** + * 无状态 + */ + RADIO_PROTOCOL_STATUS_NONE, + + /** + * 成功 + */ + RADIO_PROTOCOL_STATUS_SUCCESS, + + /** + * 失败 + */ + RADIO_PROTOCOL_STATUS_FAIL, +}; + +/** + * @brief 紧急呼叫号码。 + */ +struct EmergencyCall { + /** + * 号码条数索引 + */ + int index; + + /** + * 号码总条数 + */ + int total; + + /** + * 号码 + */ + String eccNum; + + /** + * 国家码 + */ + String mcc; + + /** + * 紧急呼叫类型,具体查看{@link EccType} + */ + enum EccType eccType; + + /** + * 表示号码是有卡时生效还是无卡生效,具体查看{@link SimpresentType} + */ + enum SimpresentType simpresent; + + /** + * 表示号码有效性是否区分CS域非正常服务状态,具体查看{@link AbnormalService} + */ + enum AbnormalServiceType abnormalService; +}; + +/** + * @brief 紧急呼叫号码列表。 + */ +struct EmergencyInfoList { + /** + * 总数 + */ + int callSize; + + /** + *号码列表标识 + */ + int flag; + + /** + * 号码列表 + * + */ + List calls; +}; + +/** + * @brief 响应通用信息。 + */ +struct RilRadioResponseInfo { + /** + * 卡槽ID + */ + int slotId; + + /** + * 响应标识 + */ + int flag; + + /** + * 请求的序列号 + */ + int serial; + + /** + * 错误码 + */ + enum RilErrType error; + + /** + * 响应类型,具体查看{@link RilResponseTypes} + */ + enum RilResponseTypes type; +}; + +/** + * @brief 数据业务激活结果信息。 + */ +struct SetupDataCallResultInfo { + /** + * 激活结果信息标识 + */ + int flag; + + /** + * 数据业务激活失败原因码,参考3GPP TS 24.008 + */ + int reason; + + /** + * 数据业务激活重试次数 + */ + int retryTime; + + /** + * 分组报文协议(PDP)上下文标识符 + */ + int cid; + + /** + * 是否激活成功,0表示激活失败,1表示激活成功 + */ + int active; + + /** + * 最大传输数据单元 + */ + int maxTransferUnit; + + /** + * 数据单元标识 + */ + int pduSessionId; + + /** + * 数据业务类型,“default”表示默认数据业务,“mms”表示彩信数据业务 + */ + String type; + + /** + * 网络设备名称 + */ + String netPortName; + + /** + * 网络地址 + */ + String address; + + /** + * 域名服务地址 + */ + String dns; + + /** + * 备用域名服务地址 + */ + String dnsSec; + + /** + * 网关地址 + */ + String gateway; + + /** + * 首选代理呼叫控制功能模块(P-CSCF)地址 + */ + String pCscfPrimAddr; + + /** + * 备用P-CSCF地址 + */ + String pCscfSecAddr; +}; + +/** + * @brief 数据业务激活结果列表。 + */ +struct DataCallResultList { + /** + * 数据业务激活结果信息数量 + */ + int size; + + /** + * 数据业务激活结果列表 + */ + List dcList; +}; + +/** + * @brief PDP上下文信息。 + */ +struct DataProfileDataInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * 数据业务类型号,0表示默认数据业务,1表示彩信数据业务 + */ + int profileId; + + /** + * 鉴权类型 + *- 0:无 + *- 1:密码认证协议(PAP) + *- 2:质询握手认证协议(CHAP) + */ + int authenticationType; + + /** + * 接入点名称 + */ + String apn; + + /** + * 网际协议版本 + */ + String protocol; + + /** + * 漫游网际协议版本 + */ + String roamingProtocol; + + /** + * 用户名 + */ + String userName; + + /** + * 密码 + */ + String password; +}; + +/** + * @brief PDP上下文信息列表。 + */ +struct DataProfilesInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * PDP上下文数量 + */ + int profilesSize; + + /** + * 是否漫游 + */ + boolean isRoaming; + + /** + * PDP上下文信息列表 + */ + List profiles; +}; + +/** + * @brief 数据业务信息。 + */ +struct DataCallInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * 无线接入技术,具体查看{@link RilRadioTech} + */ + int radioTechnology; + + /** + * 是否modem设置PDP上下文 + */ + boolean modemCognitive; + + /** + * 是否允许漫游,true表示允许,false表示禁止 + */ + boolean roamingAllowed; + + /** + * 是否漫游,true表示漫游,false表示非漫游 + */ + boolean isRoaming; + + /** + * PDP上下文信息 + */ + struct DataProfileDataInfo dataProfileInfo; +}; + +/** + * @brief 网络频率信息。 + */ +struct DataLinkBandwidthInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * PDP上下文标识符 + */ + int cid; + + /** + * 服务质量(QoS)类别指示 + */ + int qi; + + /** + * 下行方向保证比特速率(GBR) + */ + int dlGfbr; + + /** + * 上行方向GBR + */ + int ulGfbr; + + /** + * 下行方向最大比特速率(MBR) + */ + int dlMfbr; + + /** + * 上行方向MBR + */ + int ulMfbr; + + /** + * 上行方向聚合最大比特速率(AMBR) + */ + int ulSambr; + + /** + * 下行方向AMBR + */ + int dlSambr; + + /** + * 时间单位 + */ + int averagingWindow; +}; + +/** + * @brief 网络频率上报规则。 + */ +struct DataLinkBandwidthReportingRule { + /** + * 请求的序列号 + */ + int serial; + + /** + * 无线接入技术,具体查看{@link RilRadioTech} + */ + int rat; + + /** + * 迟滞时间 + */ + int delayMs; + + /** + * 上行迟滞 + */ + int delayUplinkKbps; + + /** + * 下行迟滞 + */ + int delayDownlinkKbps; + + /** + * 最大上行参数数量 + */ + int maximumUplinkKbpsSize; + + /** + * 最大下行参数数量 + */ + int maximumDownlinkKbpsSize; + + /** + * 最大上行参数列表 + */ + List maximumUplinkKbps; + + /** + * 最大下行参数列表 + */ + List maximumDownlinkKbps; +}; + +/** + * @brief 数据业务性能模式。 + */ +struct DataPerformanceInfo { + /** + * 开启性能模式 + */ + int performanceEnable; + + /** + * 强制开启 + */ + int enforce; +}; + +/** + * @brief 数据业务睡眠模式。 + */ +struct DataSleepInfo { + /** + * 开启睡眠模式 + */ + int sleepEnable; +}; + +/** + * @brief 通用信息。 + */ +struct UniInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * GSM索引 + */ + int gsmIndex; + + /** + * 通用信息标识 + */ + boolean flag; + + /** + * 参数一 + */ + int arg1; + + /** + * 参数二 + */ + int arg2; + + /** + * 字符串 + */ + String strTmp; +}; + +/** + * @brief 电路域接入技术。 + */ +struct VoiceRadioTechnology { + + /** + * 系统服务状态 + */ + enum RilSrvStatus srvStatus; + + /** + * 系统服务域 + */ + enum RilSrvDomain srvDomain; + + /** + * 漫游状态 + */ + enum RilRoamStatus roamStatus; + + /** + * SIM卡状态 + */ + enum RilSimStatus simStatus; + + /** + * SIM卡的LOCK状态 + */ + enum RilSimLockStatus lockStatus; + + /** + * 系统制式 + */ + enum RilSysMode sysMode; + + /** + * 系统制式对应字符串 + */ + String sysModeName; + + /** + * 语音接入技术类型,具体查看{@link RilRadioTech} + */ + enum RilRadioTech actType; + + /** + * 语音接入技术类型对应字符串 + */ + String actName; + + /** + * 接入技术标识 + */ + int flag; +}; + +/** + * @brief 拨号信息。 + */ +struct DialInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * CLIR模式 + *- 0:默认 + *- 1:开启 + *- 2:关闭 + */ + int clir; + + /** + * 电话号码 + */ + String address; +}; + +/** + * @brief 通话状态信息。 + */ +struct CallInfo { + /** + * 呼叫标识 + */ + int index; + + /** + * 呼叫方向,0表示主叫,1表示被叫 + */ + int dir; + + /** + * 呼叫状态 + *- 0:激活状态 + *- 1:呼叫保持状态 + *- 2:主叫,拨号状态 + *- 3:主叫,回铃音状态 + *- 4:被叫,来电状态 + *- 5:被叫,呼叫等待状态 + *- 6:挂断状态 + *- 7:正在挂断状态 + *- 8:空闲状态 + */ + int state; + + /** + * 呼叫模式 + *- 0:语音呼叫 + *- 1:数据呼叫 + *- 2:传真 + */ + int mode; + + /** + * 多方通话状态 + *- 0:不在多方通话中 + *- 1:在多方通话中 + */ + int mpty; + + /** + * 语音电话的呼叫域 + *- 0:CS域电话 + *- 1:IP多媒体系统(IMS)域电话 + */ + int voiceDomain; + + /** + * 通话类型,当前仅可为0,表示语音呼叫 + */ + int callType; + + /** + * 码地址类型 + *- 129:普通号码 + *- 145:国际号码 + */ + int type; + + /** + * 电话号码 + */ + String number; + + /** + * 号码在电话本中对应的姓名 + */ + String alpha; +}; + +/** + * @brief 通话状态信息列表。 + */ +struct CallInfoList { + /** + * 总数 + */ + int callSize; + + /** + * 通话状态信息列表标识 + */ + int flag; + + /** + * 通话状态信息列表 + */ + List calls; +}; + +/** + * @brief 主叫号码显示结果信息。 + */ +struct GetClipResult { + /** + * 查询结果,具体查看{@link RilErrType} + */ + int result; + + /** + * 禁止或使能CLIP(Calling line Identification Presentation Supplementary Service)功能 + */ + int action; + + /** + * CLIP业务在网络的签约状态 + *- 0:CLIP业务未提供 + *- 1:CLIP业务已提供 + *- 2:未知(网络原因) + */ + int clipStat; +}; + +/** + * @brief 主叫号码显示限制结果信息。 + */ +struct GetClirResult { + /** + * 查询结果,具体查看{@link RilErrType} + */ + int result; + + /** + * 禁止或使能CLIR功能 + */ + int action; + + /** + * CLIR业务在网络的签约状态。 + *- 0:CLIR业务未提供 + *- 1:CLIR业务以永久模式提供 + *- 2:未知(网络原因) + *- 3:CLIR业务临时限制 + *- 4:CLIR业务临时允许 + */ + int clirStat; +}; + +/** + * @brief 呼叫等待结果信息。 + */ +struct CallWaitResult { + /** + * 查询结果,具体查看{@link RilErrType} + */ + int result; + + /** + * 当前呼叫等待的业务状态 + *- 0:未激活 + *- 1:激活 + */ + int status; + + /** + * 业务类别,参考3GPP TS 27.007 + */ + int classCw; +}; + +/** + * @brief 呼叫限制信息。 + */ +struct CallRestrictionInfo { + /** + * 操作模式 + *- 0:去激活 + *- 1:激活 + */ + int mode; + + /** + * 操作对象 + */ + String fac; + + /** + * 密码 + */ + String password; +}; + +/** + * @brief 呼叫限制结果信息。 + */ +struct CallRestrictionResult { + /** + * 查询结果,具体查看{@link RilErrType} + */ + int result; + + /** + * 业务状态 + *- 0:未激活 + *- 1:激活 + */ + int status; + + /** + * 业务类别,参考3GPP TS 27.007 + */ + int classCw; +}; + +/** + * @brief 呼叫转移信息。 + */ +struct CallForwardSetInfo { + /** + * 呼叫转移类型 + *- 0:无条件转移 + *- 1:遇忙转移 + *- 2:无应答转移 + *- 3:不可达转移(无网络服务或者关机时) + *- 4:所有呼叫转移 + *- 5:所有条件转移 + */ + int reason; + + /** + * 呼叫转移的操作模式 + *- 0:去激活 + *- 1:激活 + *- 2:状态查询 + *- 3:注册 + *- 4:删除 + */ + int mode; + + /** + * 业务类别,参考3GPP TS 27.007 + */ + int classx; + + /** + * 电话号码 + */ + String number; +}; + +/** + * @brief 呼叫转移查询结果信息。 + */ +struct CallForwardQueryResult { + /** + * 请求的序列号 + */ + int serial; + + /** + * 查询结果,具体查看{@link RilErrType} + */ + int result; + + /** + * 状态 + *- 0:未激活 + *- 1:激活 + */ + int status; + + /** + * 业务类别,参考3GPP TS 27.007 + */ + int classx; + + /** + * 号码地址类型 + *- 129:普通号码 + *- 145:国际号码 + */ + int type; + + /** + * 呼叫转移类型 + *- 0:无条件转移 + *- 1:遇忙转移 + *- 2:无应答转移 + *- 3:不可达转移(无网络服务或者关机时) + *- 4:所有呼叫转移 + *- 5:所有条件转移 + */ + int reason; + + /** + * 等待时长 + */ + int time; + + /** + * 电话号码 + */ + String number; +}; + +/** + * @brief 呼叫转移信息列表。 + */ +struct CallForwardQueryInfoList { + /** + * 总数 + */ + int callSize; + + /** + * 呼叫转移查询结果信息标识 + */ + int flag; + + /** + * 呼叫转移查询结果信息 + * + */ + List calls; +}; + +/** + * @brief 非结构化补充数据业务(USSD)业务信息。 + */ +struct UssdNoticeInfo { + /** + * USSD类型 + *- 0:网络不需要客户端回复 + *- 1:网络需要客户端回复 + *- 2:USSD会话被网络释放 + *- 3:其他本地客户端已经作出响应 + *- 4:操作不支持 + *- 5:网络超时 + */ + int type; + + /** + * USSD字符串 + */ + String message; +}; + +/** + * @brief 补充业务信息。 + */ +struct SsNoticeInfo { + /** + * 业务类型 + *- 0:无条件 + *- 1:遇忙时 + *- 2:无应答时 + *- 3:不可达时(无网络服务或者关机时) + */ + int serviceType; + + /** + * 请求类型 + *- 0:去激活 + *- 1:激活 + *- 2:状态查询 + *- 3:注册 + *- 4:删除 + */ + int requestType; + + /** + * 服务类别,参考3GPP TS 27.007 + */ + int serviceClass; + + /** + * 查询结果,具体查看{@link RilErrType} + */ + int result; +}; + +/** + * @brief SRVCC(Single Radio Voice Call Continuity)状态信息。 + */ +struct SrvccStatus { + /** + * SRVCC(Single Radio Voice Call Continuity)状态 + *- 0:开始 + *- 1:成功 + *- 2:失败 + *- 3:取消 + */ + int status; +}; + +/** + * @brief 回铃音信息。 + */ +struct RingbackVoice { + /** + * 回铃音状态 + *- 0:网络回铃音 + *- 1:本地回铃音 + */ + int status; +}; + +/** + * @brief 发送双音多频(DTMF)信息。 + */ +struct DtmfInfo { + /** + * 呼叫 ID + */ + int callId; + + /** + * DTMF音播放的时长 + */ + int onLength; + + /** + * DTMF发送的间隔 + */ + int offLength; + + /** + * DTMF字符串长度 + */ + int stringLength; + + /** + * DTMF关键字 + */ + String dtmfKey; +}; + +/** + * @brief 设置呼叫限制密码的信息。 + */ +struct SetBarringInfo { + /** + * 操作对象 + */ + String fac; + + /** + * 旧密码 + */ + String oldPassword; + + /** + * 新密码 + */ + String newPassword; +}; + +/** + * @brief SIM卡状态信息。 + */ +struct CardStatusInfo { + /** + * SIM卡索引 + */ + int index; + + /** + * SIM卡类型。 + *- 0:未知。 + *- 1:普通SIM卡。 + *- 2:USIM,支持4G网络 + */ + int simType; + + /** + * SIM卡状态。 + *- -1:未知。 + *- 0:SIM卡未插入。 + *- 1:正常识卡。 + *- 2:需要输入PIN码。 + *- 3:需要输入PUK码。 + *- 4:需要输入PIN2码。 + *- 5:需要输入PUK2码 + */ + int simState; +}; + +/** + * @brief SIM数据请求信息。 + */ +struct SimIoRequestInfo { + /** + * ME(Mobile Equipment)传递给SIM的命令,参考GSM 51.011[28] + */ + int command; + + /** + * SIM卡上基本数据文件的标识符 + */ + int fileId; + + /** + * SIM数据请求命令参数1,参考3GPP TS 51.011[28] + */ + int p1; + + /** + * SIM数据请求命令参数2,参考3GPP TS 51.011[28] + */ + int p2; + + /** + * SIM数据请求命令参数3,参考3GPP TS 51.011[28] + */ + int p3; + + /** + * 请求的序列号 + */ + int serial; + + /** + * 要写入SIM的数据信息 + */ + String data; + + /** + * SIM卡文件路径,参考ETSI TS 102 221 [60] + */ + String path; + + /** + * PIN2码 + */ + String pin2; + + /** + * 应用标识 + */ + String aid; +}; + +/** + * @brief SIM数据的响应结果信息。 + */ +struct IccIoResultInfo { + /** + * SIM卡状态字1,命令执行后SIM卡返回的响应 + */ + int sw1; + + /** + * SIM卡状态字2,命令执行后SIM卡返回的响应 + */ + int sw2; + + /** + * 响应信息 + */ + String response; +}; + +/** + * @brief SIM卡锁信息。 + */ +struct SimLockInfo { + /** + * 业务类别,取值为该类信息的整数之和,默认为255。 + *- 1:电话服务。 + *- 2:数据服务。 + *- 4:传真服务。 + *- 8:短消息服务。 + *- 16:数据电路同步。 + *- 32:数据电路异步。 + *- 64:专用分组访问。 + *- 128:专用便携式设备(PAD)访问 + */ + int classx; + + /** + * 请求的序列号 + */ + int serial; + + /** + * SIM锁类型。 + *- AO:禁止所有呼出 + *- OI:禁止所有国际呼出。 + *- OX:禁止所有国际呼出,归属国除外 + *- AI:禁止所有呼入 + *- IR:归属地以外漫游时,禁止所有呼入。 + *- AB:禁止所有业务(仅在模式大于等于0时适用) + *- AG:禁止呼出业务(仅在模式大于等于0时适用) + *- AC:禁止呼入业务(仅在模式大于等于0时适用) + *- FD:FDN,固定号码拨号 + *- PN:锁网络 + *- PU:锁子网 + *- PP:锁定SP + */ + String fac; + + /** + * 模式。 + *- 0:去激活(当fac参数为PN,PU,PP时,为解锁操作)。 + *- 1:激活(当fac参数为PN,PU,PP时,不支持激活)。 + *- 2:查询 + */ + int mode; + + /** + * SIM卡锁状态。 + * 当fac参数为PN,PU,PP时,表示的是锁网锁卡前三层锁的激活状态。 + *- 0:未激活。 + *- 1:激活 + */ + int status; + + /** + * 密码文本 + */ + String passwd; +}; + +/** + * @brief SIM卡密码信息。 + */ +struct SimPasswordInfo { + /** + * SIM锁类型。 + *- AO:禁止所有呼出 + *- OI:禁止所有国际呼出。 + *- OX:禁止所有国际呼出,归属国除外 + *- AI:禁止所有呼入 + *- IR:归属地以外漫游时,禁止所有呼入。 + *- AB:禁止所有业务(仅在模式大于等于0时适用) + *- AG:禁止呼出业务(仅在模式大于等于0时适用) + *- AC:禁止呼入业务(仅在模式大于等于0时适用) + *- FD:FDN,固定号码拨号 + *- PN:锁网络 + *- PU:锁子网 + *- PP:锁定SP + */ + String fac; + + /** + * 旧密码文本 + */ + String oldPassword; + + /** + * 新密码文本 + */ + String newPassword; + + /** + * 请求的序列号 + */ + int serial; + + /** + * 旧密码或新密码的最大长度 + */ + int passwordLength; +}; + +/** + * @brief SIM密码输入次数信息。 + */ +struct SimPinInputTimes { + /** + * 请求的序列号 + */ + int serial; + + /** + * 剩余次数 + */ + int times; + + /** + * PUK码剩余次数 + */ + int pukTimes; + + /** + * PIN码剩余次数 + */ + int pinTimes; + + /** + * PUK2码剩余次数 + */ + int puk2Times; + + /** + * PIN2码剩余次数 + */ + int pin2Times; + + /** + * 请求字段,例如: + * SIM PIN2:表示SIM卡PIN2码请求 + */ + String code; +}; + +/** + * @brief APDU数据传输请求信息。 + */ +struct ApduSimIORequestInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * 通道ID + */ + int channelId; + + /** + * APDU指令类型,参考ETSI 102 221 [55] + */ + int type; + + /** + * APDU指令,参考ETSI 102 221 [55] + */ + int instruction; + + /** + * SIM数据请求命令参数,参考3GPP TS 51.011[28] + */ + int p1; + + /** + * SIM数据请求命令参数2,参考3GPP TS 51.011[28] + */ + int p2; + + /** + * SIM数据请求命令参数3,参考3GPP TS 51.011[28] + * 如果p3为负值,则会向SIM发送一个4字节的APDU + */ + int p3; + + /** + * 请求传输的数据信息 + */ + String data; +}; + +/** + * @brief SIM卡鉴权请求信息。 + */ +struct SimAuthenticationRequestInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * 应用标识 + */ + String aid; + + /** + * 认证数据信息 + */ + String authData; +}; + +/** + * @brief APDU打开逻辑通道响应信息。 + */ +struct OpenLogicalChannelResponse { + /** + * SIM卡状态字1,命令执行后SIM卡返回的响应 + */ + int sw1; + + /** + * SIM卡状态字2,命令执行后SIM卡返回的响应 + */ + int sw2; + + /** + * 打开的逻辑通道ID + */ + int channelId; + + /** + * 响应信息 + */ + String response; +}; + +/** + * @brief SIM卡解锁响应 + */ +struct LockStatusResp { + /** + * 查询结果,具体查看{@link RilErrType} + */ + int result; + + /** + * 剩余次数 + */ + int remain; +}; + +/** + * @brief 主副卡协议栈信息。 + */ +struct RadioProtocol { + /** + * 卡槽ID + */ + int slotId; + + /** + * 会话ID + */ + int sessionId; + + /** + * Radio协议参数,具体查看{@link RadioProtocolPhase} + */ + enum RadioProtocolPhase phase; + + /** + * Radio协议技术信息。 + *- 1:GSM + *- 2:1XRTT + *- 4:WCDMA + *- 8:HSPA + *- 16:HSPAP + *- 32:TDSCDMA + *- 64:EVDO + *- 128:EHRPD + *- 256:LTE + *- 512:LTE_CA + *- 1024:IWLAN + *- 2048:NR + */ + int technology; + + /** + * modem ID,底层与slotId的对应字段 + */ + int modemId; + + /** + * Radio协议状态,具体查看{@link RadioProtocolStatus} + */ + enum RadioProtocolStatus status; +}; + +/** + * @brief GSM信号强度。 + */ +struct GsmRssi { + /** + * 信号接收强度,取值范围0~31 + */ + int rxlev; + + /** + * 误码率,取值范围0~7 + */ + int ber; +}; + +/** + * @brief CDMA信号强度。 + */ +struct CdmaRssi { + /** + * 信号强度的绝对值, 该值是实际信号强度值乘以-1 + */ + int absoluteRssi; + + /** + * PN码(Pseudo-Noise Code)片的接收能量与总接收功率谱密度之比 + */ + int ecno; +}; + +/** + * @brief WCDMA信号强度。 + */ +struct WcdmaRssi { + /** + * 信号接收强度,取值范围0~99 + */ + int rxlev; + + /** + * 每个PN码片的接收能量与总接收功率谱密度之比 + */ + int ecio; + + /** + * 接收信号码功率,取值范围0~96 + */ + int rscp; + + /** + * 误码率,取值范围0~7 + */ + int ber; +}; + +/** + * @brief LTE信号强度。 + */ +struct LteRssi { + /** + * 信号接收强度,取值范围0~99 + */ + int rxlev; + + /** + * 表示信号接收质量,取值范围0~33 + */ + int rsrq; + + /** + * 表示接收信号码功率,取值范围0~97 + */ + int rsrp; + + /** + * 表示信号干扰噪声比,适用于LTE模式,取值范围0~251 + */ + int snr; +}; + +/** + * @brief TDSCDMA信号强度。 + */ +struct TdScdmaRssi { + /** + * 表示接收信号码功率 + */ + int rscp; +}; + +/** + * @brief NR信号强度。 + */ +struct NrRssi { + /** + * 表示接收信号码功率 + */ + int rsrp; + + /** + * 表示信号接收质量 + */ + int rsrq; + + /** + * 表示信号干扰噪声比 + */ + int sinr; +}; + +/** + * @brief 接收信号强度信息。 + */ +struct Rssi { + /** + * GSM信号强度信息,具体查看{@link GsmRssi} + */ + struct GsmRssi gw; + + /** + * CDMA信号强度信息,具体查看{@link CdmaRssi} + */ + struct CdmaRssi cdma; + + /** + * WCDMA信号强度信息,具体查看{@link WcdmaRssi} + */ + struct WcdmaRssi wcdma; + + /** + * LTE信号强度信息,具体查看{@link LteRssi} + */ + struct LteRssi lte; + + /** + * TDSCDMA信号强度信息,具体查看{@link TdScdmaRssi} + */ + struct TdScdmaRssi tdScdma; + + /** + * NR信号强度信息,具体查看{@link NrRssi} + */ + struct NrRssi nr; +}; + +/** + * @brief CS注册状态信息。 + */ +struct CsRegStatusInfo { + /** + * 通知类型 + *- 0:禁止主动上报 + *- 1:使用格式1上报,格式具体由芯片自定义 + *- 2:使用格式2上报,格式具体由芯片自定义 + */ + int notifyType; + + /** + * 注册状态,具体查看{@link RilRegStatus} + */ + enum RilRegStatus regStatus; + + /** + * 地区区域码 + */ + int lacCode; + + /** + * 小区标识 + */ + int cellId; + + /** + * 语音接入技术类型,具体查看{@link RilRadioTech} + */ + enum RilRadioTech radioTechnology; + + /** + * 标志,由搜网管理在响应中使用 + */ + int flag; +}; + +/** + * @brief PS注册状态信息。 + */ +struct PsRegStatusInfo { + /** + * 通知类型 + *- 0:禁止主动上报 + *- 1:使用格式1上报,具体由芯片自定义 + *- 2:使用格式2上报,具体由芯片自定义 + */ + int notifyType; + + /** + * 注册状态,具体查看{@link RilRegStatus} + */ + enum RilRegStatus regStatus; + + /** + * 地区区域码 + */ + int lacCode; + + /** + * 小区标识 + */ + int cellId; + + /** + * 语音接入技术类型,具体查看{@link RilRadioTech} + */ + enum RilRadioTech radioTechnology; + + /** + * 表示NR模式是否可用 + */ + boolean isNrAvailable; + + /** + * 表示ENDC是否可用 + */ + boolean isEnDcAvailable; + + /** + * 表示DCNR是否受限 + */ + boolean isDcNrRestricted; +}; + +/** + * @brief 运营商信息。 + * + */ +struct OperatorInfo { + /** + * 获取注册网络的长格式的运营商名称 + */ + String longName; + + /** + * 获取注册网络的短格式的运营商名称 + */ + String shortName; + + /** + * 运营商编号 + */ + String numeric; +}; + +/** + * @brief 可用网络信息。 + */ +struct AvailableNetworkInfo { + /** + * 获取注册网络的长字母数字格式名称 + */ + String longName; + + /** + * 获取注册网络的短字母数字格式名称 + */ + String shortName; + + /** + * 可用网络编号 + */ + String numeric; + + /** + * 网络状态,具体查看{@link RilRegStatus} + */ + int status; + + /** + * 语音接入技术类型,具体查看{@link RilRadioTech} + */ + int rat; +}; + +/** + * @brief 可用网络列表。 + */ +struct AvailableNetworkList { + /** + * 编号 + */ + int itemNum; + + /** + * 可用网络列表信息, + */ + List availableNetworkInfo; + + /** + * 网络列表标识位 + */ + int flag; +}; + +/** + * @brief 设置网络模式信息。 + */ +struct SetNetworkModeInfo { + /** + * 网络模式,具体查看{@link PreferredNetworkTypeInfo} + */ + int selectMode; + + /** + * 网络运营商 + */ + String oper; + + /** + * 标志 + */ + int flag; +}; + +/** + * @brief GSM小区信息。 + */ +struct CellListRatGsm { + /** + * 小区的band信息 + */ + int band; + + /** + * BCCH(Broadcast Control Channel)载频的绝对射频频道号,取值范围0~1023 + */ + int arfcn; + + /** + * 基站识别码 + */ + int bsic; + + /** + * 小区信息标识 + */ + int cellId; + + /** + * 位置区号,取值范围0~0xFFFF + */ + int lac; + + /** + * 信号接收强度,取值范围-120~37 + */ + int rxlev; +}; + +/** + * @brief LTE小区信息。 + */ +struct CellListRatLte { + /** + * BCCH载频的绝对射频频道号,取值范围0~1023 + */ + int arfcn; + + /** + * 物理小区标识 + */ + int pci; + + /** + * 信号接收功率,取值范围-140~-44 + */ + int rsrp; + + /** + * 信号接收质量,取值范围-19~-3 + */ + int rsrq; + + /** + * 信号接收强度,取值范围-120~37 + */ + int rxlev; +}; + +/** + * @brief WCDMA小区信息。 + */ +struct CellListRatWcdma { + /** + * BCCH载频的绝对射频频道号,取值范围0~16383 + */ + int arfcn; + + /** + * 主扰码, 取值范围0~511 + */ + int psc; + + /** + * 接收信号码功率, 取值范围-120~25 + */ + int rscp; + + /** + * 每个调制比特的功率与噪声频谱密度之比, 取值范围-25~0 + */ + int ecno; +}; + +/** + * @brief CDMA小区信息。 + */ +struct CellListRatCdma { + /** + * 系统标识 + */ + int systemId; + + /** + * 网络标识 + */ + int networkId; + + /** + * 基本标识 + */ + int baseId; + + /** + * 区域标识 + */ + int zoneId; + + /** + * PN导频序列 + */ + int pilotPn; + + /** + * 导频信号强度 + */ + int pilotStrength; + + /** + * 信道 + */ + int channel; + + /** + * 经度 + */ + int longitude; + + /** + * 纬度 + */ + int latitude; +}; + +/** + * @brief TDSCDMA小区信息。 + */ +struct CellListRatTdscdma { + /** + * BCCH载频的绝对射频频道号 + */ + int arfcn; + + /** + * 同步标识 + */ + int syncId; + + /** + * 超级小区 + */ + int sc; + + /** + * 小区标识 + */ + int cellId; + + /** + * 位置区号,取值范围0~0xFFFF + */ + int lac; + + /** + * 接收信号码功率 + */ + int rscp; + + /** + * 不连续接收周期长度 + */ + int drx; + + /** + * 路由区域码 + */ + int rac; + + /** + * 超级小区标识 + */ + int cpid; +}; + +/** + * @brief NR小区信息。 + */ +struct CellListRatNr { + /** + * BCCH载频的绝对射频频道号 + */ + int nrArfcn; + + /** + * 物理小区标识 + */ + int pci; + + /** + * 类型分配码 + */ + int tac; + + /** + * NR小区标识 + */ + int nci; +}; + +/** + * @brief 多种网络模式的小区信息。 + */ +union ServiceCellParas { + /** + * GSM小区信息,具体查看{@link CellListRatGsm} + */ + struct CellListRatGsm gsm; + + /** + * LTE小区信息,具体查看{@link CellListRatLte} + */ + struct CellListRatLte lte; + + /** + * WCDMA小区信息,具体查看{@link CellListRatWcdma} + */ + struct CellListRatWcdma wcdma; + + /** + * CDMA小区信息,具体查看{@link CellListRatCdma} + */ + struct CellListRatCdma cdma; + + /** + * TDSCDMA小区信息,具体查看{@link CellListRatTdscdma} + */ + struct CellListRatTdscdma tdscdma; + + /** + * NR小区信息,具体查看{@link CellListRatNr} + */ + struct CellListRatNr nr; +}; + +/** + * @brief 相邻小区信息。 + */ +struct CellNearbyInfo { + /** + * 接入技术类型 + *- 0:未知 + *- 1:GSM + *- 2:CDMA + *- 3:WCDMA + *- 4:TDSCDMA + *- 5:LTE + *- 6:NR + */ + int ratType; + + /** + * 多种网络模式的小区信息 + */ + union ServiceCellParas serviceCells; +}; + +/** + * @brief 附近小区信息列表。 + */ +struct CellListNearbyInfo { + /** + * 编号 + */ + int itemNum; + + /** + * 附近小区信息列表 + */ + List cellNearbyInfo; +}; + +/** + * @brief GSM蜂窝信息。 + */ +struct CellRatGsm { + /** + * 小区的band信息 + */ + int band; + + /** + * BCCH载频的绝对射频频道号,取值范围0~1023 + */ + int arfcn; + + /** + * 基站识别码 + */ + int bsic; + + /** + * 小区标识 + */ + int cellId; + + /** + * 位置区号,取值范围0~0xFFFF + */ + int lac; + + /** + * 信号接收强度,取值范围-120~37 + */ + int rxlev; + + /** + * 信号接收质量,取值范围0~7 + */ + int rxQuality; + + /** + * 取值范围0~63 + */ + int ta; +}; + +/** + * @brief LTE蜂窝信息。 + */ +struct CellRatLte { + /** + * BCCH载频的绝对射频频道号 + */ + int arfcn; + + /** + * 小区标识 + */ + int cellId; + + /** + * 物理小区标识 + */ + int pci; + + /** + * 类型分配码 + */ + int tac; + + /** + * 信号接收功率,取值范围-140~-44 + */ + int rsrp; + + /** + * 信号接收质量,取值范围-19~-3 + */ + int rsrq; + + /** + * 接收信号强度dbm,-90~-25 + */ + int rssi; +}; + +/** + * @brief WCDMA蜂窝信息。 + */ +struct CellRatWcdma { + /** + * BCCH载频的绝对射频频道号,取值范围0~16383 + */ + int arfcn; + + /** + * 主扰码,取值范围0~511 + */ + int psc; + + /** + * 小区标识 + */ + int cellId; + + /** + * 位置区号,取值范围0~0xFFFF + */ + int lac; + + /** + * 信号接收功率dBm, 取值范围-140~-44 + */ + int rscp; + + /** + * 信号接收强度,取值范围-19~-3 + */ + int rxlev; + + /** + * 接收信号强度dbm,取值范围-90~-25 + */ + int ecno; + + /** + * 不连续接收周期长度,取值范围6~9 + */ + int drx; + + /** + * UTRAN(UMTS Terrestrial Radio Access Network)注册区域标识 + */ + int ura; +}; + +/** + * @brief CDMA蜂窝信息。 + */ +struct CellRatCdma { + /** + * 系统标识 + */ + int systemId; + + /** + * 网络标识 + */ + int networkId; + + /** + * 基础标识 + */ + int baseId; + + /** + * 区域标识 + */ + int zoneId; + + /** + * PN导频序列 + */ + int pilotPn; + + /** + * 导频信号强度 + */ + int pilotStrength; + + /** + * 信道 + */ + int channel; + + /** + * 经度 + */ + int longitude; + + /** + * 纬度 + */ + int latitude; +}; + +/** + * @brief TDSCDMA蜂窝信息。 + */ +struct CellRatTdscdma { + /** + * BCCH载频的绝对射频频道号 + */ + int arfcn; + + /** + * 同步标识 + */ + int syncId; + + /** + * 超级小区 + */ + int sc; + + /** + * 小区标识 + */ + int cellId; + + /** + * 地区区域码 + */ + int lac; + + /** + * 接收信号码功率 + */ + int rscp; + + /** + * 不连续接收周期长度 + */ + int drx; + + /** + * 路由区域码 + */ + int rac; + + /** + * 超级小区标识 + */ + int cpid; +}; + +/** + * @brief NR蜂窝信息。 + */ +struct CellRatNr { + /** + * BCCH载频的绝对射频频道号 + */ + int nrArfcn; + + /** + * 物理小区标识 + */ + int pci; + + /** + * 类型分配码 + */ + int tac; + + /** + * NR小区标识 + */ + int nci; +}; + +/** + * @brief 当前蜂窝数据信息。 + */ +union CurrentServiceCellParas { + /** + * Gsm蜂窝信息 + */ + struct CellRatGsm gsm; + + /** + * LTE蜂窝信息 + */ + struct CellRatLte lte; + + /** + * WCDMA蜂窝信息 + */ + struct CellRatWcdma wcdma; + + /** + * CDMA蜂窝信息 + */ + struct CellRatCdma cdma; + + /** + * TDSCDMA蜂窝信息 + */ + struct CellRatTdscdma tdscdma; + + /** + * NR蜂窝信息 + */ + struct CellRatNr nr; +}; + +/** + * @brief NR蜂窝信息。 + * + * @since 4.0 + * @version 1.1 + */ +struct CellRatNr_1_1 { + /** + * BCCH载频的绝对射频频道号 + */ + int nrArfcn; + + /** + * 物理小区标识 + */ + int pci; + + /** + * 类型分配码 + */ + int tac; + + /** + * NR小区标识 + */ + int nci; + + /** + * 信号接收功率,取值范围-140~-44 + */ + int rsrp; + + /** + * 信号接收质量,取值范围-19~-3 + */ + int rsrq; +}; + +/** + * @brief 当前蜂窝数据信息。 + * + * @since 4.0 + * @version 1.1 + */ +union CurrentServiceCellParas_1_1 { + /** + * Gsm蜂窝信息 + */ + struct CellRatGsm gsm; + + /** + * LTE蜂窝信息 + */ + struct CellRatLte lte; + + /** + * WCDMA蜂窝信息 + */ + struct CellRatWcdma wcdma; + + /** + * CDMA蜂窝信息 + */ + struct CellRatCdma cdma; + + /** + * TDSCDMA蜂窝信息 + */ + struct CellRatTdscdma tdscdma; + + /** + * NR蜂窝信息 + */ + struct CellRatNr_1_1 nr; +}; + +/** + * @brief 当前小区信息。 + * + * @since 4.0 + * @version 1.1 + */ +struct CurrentCellInfo_1_1 { + /** + * 语音接入技术类型,具体查看{@link RilRadioTech} + */ + int ratType; + + /** + * 移动国家码 + */ + int mcc; + + /** + * 移动网络码 + */ + int mnc; + + /** + * 小区信息参数,具体查看{@link CurrentServiceCellParas_1_1}. + */ + union CurrentServiceCellParas_1_1 serviceCells; +}; + +/** + * @brief 当前小区信息列表。 + * + * @since 4.0 + * @version 1.1 + */ +struct CellListCurrentInfo_1_1 { + /** + * 小区信息数量 + */ + int itemNum; + + /** + * 当前小区信息 + */ + List cellCurrentInfo; +}; + +/** + * @brief 当前小区信息。 + */ +struct CurrentCellInfo { + /** + * 语音接入技术类型,具体查看{@link RilRadioTech} + */ + int ratType; + + /** + * 移动国家码 + */ + int mcc; + + /** + * 移动网络码 + */ + int mnc; + + /** + * 小区信息参数,具体查看{@link CurrentServiceCellParas} + */ + union CurrentServiceCellParas serviceCells; +}; + +/** + * @brief 当前小区信息列表。 + */ +struct CellListCurrentInfo { + /** + * 小区信息数量 + */ + int itemNum; + + /** + * 当前小区信息 + */ + List cellCurrentInfo; +}; + +/** + * @brief 首选网络类型信息。 + */ +struct PreferredNetworkTypeInfo { + /** + * 网络类型 + *- 0:自动。 + *- 1:GSM。 + *- 2:WCDMA。 + *- 3:LTE。 + *- 4:LTE、WCDMA。 + *- 5:LTE、WCDMA、GSM。 + *- 6:WCDMA、GSM。 + *- 7:CDMA。 + *- 8:EVDO。 + *- 9:EVDO、CDMA。 + *- 10:WCDMA、GSM、EVDO、CDMA。 + *- 11:LTE、EVDO、CDMA。 + *- 12:LTE、WCDMA、GSM、EVDO、CDMA。 + *- 13:TDSCDMA。 + *- 14:TDSCDMA、GSM。 + *- 15:TDSCDMA、WCDMA。 + *- 16:TDSCDMA、WCDMA、GSM。 + *- 17:LTE、TDSCDMA。 + *- 18:LTE、TDSCDMA、GSM。 + *- 19:LTE、TDSCDMA、WCDMA。 + *- 20:LTE、TDSCDMA、WCDMA、GSM。 + *- 21:TDSCDMA、WCDMA、GSM、EVDO、CDMA。 + *- 22:LTE、TDSCDMA、WCDMA、GSM、EVDO、CDMA。 + *- 31:NR。 + *- 32:NR、LTE。 + *- 33:NR、LTE、WCDMA。 + *- 34:NR、LTE、WCDMA、GSM。 + *- 35:NR、LTE、EVDO、CDMA。 + *- 36:NR、LTE、WCDMA、GSM、EVDO、CDMA。 + *- 37:NR、LTE、TDSCDMA。 + *- 38:NR、LTE、TDSCDMA、GSM。 + *- 39:NR、LTE、TDSCDMA、WCDMA。 + *- 40:NR、LTE、TDSCDMA、WCDMA、GSM。 + *- 41:NR、LTE、TDSCDMA、WCDMA、GSM、EVDO、CDMA + */ + int preferredNetworkType; + + /** + * 网络标识 + */ + int flag; +}; + +/** + * @brief 物理通道配置。 + */ +struct PhysicalChannelConfig { + /** + * 连接状态 + */ + enum RilCellConnectionStatus cellConnStatus; + + /** + * 语音接入技术类型,具体查看{@link RilRadioTech} + */ + enum RilRadioTech ratType; + + /** + * 下行带宽,单位为kHz + */ + int cellBandwidthDownlinkKhz; + + /** + * 上行带宽,单位为kHz + */ + int cellBandwidthUplinkKhz; + + /** + * 频率范围 + */ + int freqRange; + + /** + * 下行信道号 + */ + int downlinkChannelNum; + + /** + * 上行信道号 + */ + int uplinkChannelNum; + + /** + * 物理小区标识 + */ + int physicalCellId; + + /** + * 逻辑设备编号 + */ + int contextIdNum; + + /** + * 上行信道号 + */ + List contextIds; +}; + +/** + * @brief 通道配置信息列表。 + */ +struct ChannelConfigInfoList { + /** + * 编号 + */ + int itemNum; + + /** + * 物理通道配置 + */ + List channelConfigInfos; + + /** + * 通道配置标识 + */ + int flag; +}; + +/** + * @brief 发送GSM短信信息。 + */ +struct GsmSmsMessageInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * 状态 + */ + int state; + + /** + * 短信业务中心 + */ + String smscPdu; + + /** + * 协议数据单元 + */ + String pdu; +}; + +/** + * @brief 发送CDMA短信信息。 + */ +struct SendCdmaSmsMessageInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * 状态 + */ + int state; + + /** + * 短信业务中心 + */ + String smscPdu; +}; + +/** + * @brief SIM卡短信信息 + */ +struct SmsMessageIOInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * 短信业务中心 + */ + String smscPdu; + + /** + * 协议数据单元 + */ + String pdu; + + /** + * 状态 + */ + int state; + + /** + * 消息索引 + */ + int index; +}; + +/** + * @brief 短信中心地址信息。 + */ +struct ServiceCenterAddress { + /** + * 请求的序列号 + */ + int serial; + + /** + * 短信中心地址类型,参考3GPP TS 24.011 [6] + */ + int tosca; + + /** + * 短信中心地址,参考3GPP TS 24.011 [6] + */ + String address; +}; + +/** + * @brief GSM小区广播配置信息。 + */ +struct CBConfigInfo { + /** + * 请求的序列号 + */ + int serial; + + /** + * 是否激活 + */ + int mode; + + /** + * 响应类型 + *- 0:查询上报 + *- 1:主动上报 + */ + int indicationType; + + /** + * 消息标识符组合 + */ + String mids; + + /** + * 数据编码方案组合 + */ + String dcss; +}; + +/** + * @brief CDMA小区广播配置信息。 + */ +struct CdmaCBConfigInfo { + /** + * 服务 + */ + int service; + + /** + * 语言 + */ + int language; + + /** + * 是否选中 + */ + int checked; +}; + +/** + * @brief CDMA小区广播配置信息列表。 + */ +struct CdmaCBConfigInfoList { + /** + * 请求的序列号 + */ + int serial; + + /** + * 总数 + */ + int size; + + /** + * CDMA小区广播配置信息列表 + */ + List list; +}; + +/** + * @brief 小区广播上报信息。 + */ +struct CBConfigReportInfo { + /** + * 响应类型 + *- 0:查询上报 + *- 1:主动上报 + */ + int indicationType; + + /** + * 小区广播序列号 + */ + int sn; + + /** + * 消息标识符组合 + */ + int mid; + + /** + * 小区广播页序号 + */ + int page; + + /** + * 小区广播总页数 + */ + int pages; + + /** + * pdu字节数 + */ + int length; + + /** + * 解码后的小区广播内容 + */ + String data; + + /** + * 数据编码方案组合 + */ + String dcs; + + /** + * 协议数据单元 + */ + String pdu; +}; + +/** + * @brief 上报短信信息。 + */ +struct SmsMessageInfo { + /** + * 响应类型 + *- 0:查询上报 + *- 1:主动上报 + */ + int indicationType; + + /** + * 总数 + */ + int size; + + /** + * 协议数据单元 + */ + List pdu; +}; + +/** + * @brief 接收短信处理模式。 + */ +struct ModeData { + /** + * 请求的序列号 + */ + int serial; + + /** + * 是否接收短信 + */ + boolean result; + + /** + * 接收短信处理模式,详见{@link AckIncomeCause} + */ + int mode; + + /** + * 协议数据单元 + */ + String pdu; +}; + +/** + * @brief 发送短信响应信息。 + */ +struct SendSmsResultInfo { + /** + * 信息参考号 + */ + int msgRef; + + /** + * 协议数据单元 + */ + String pdu; + + /** + * 错误码 + */ + int errCode; + + /** + * 短信响应标识 + */ + int flag; +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl b/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl new file mode 100644 index 00000000..18b2fc25 --- /dev/null +++ b/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Ril + * @{ + * + * @brief Ril模块接口定义。 + * + * Ril模块为上层电话服务提供相关调用接口,涉及电话、短信、彩信、网络搜索、SIM卡等功能接口及各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file IRilCallback.idl + * + * @brief Ril模块的回调接口。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Ril模块接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.ril.v1_2; + +import ohos.hdi.ril.v1_1.IRilCallback; + +/** + * @brief Ril模块的回调接口。 + * + * 回调接口提供打电话、发短彩信、激活SIM卡、上网等回调函数,回调函数由调用者实现。 + * + * @since 4.1 + * @version 1.2 + */ +[callback] interface IRilCallback extends ohos.hdi.ril.v1_1.IRilCallback { + /** + * @brief Callback for reporting resident network. + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param plmn 表示常驻网络 + * + * @since 4.1 + * @version 1.2 + */ + ResidentNetworkUpdated([in] struct RilRadioResponseInfo responseInfo, [in] String plmn); +} +/** @} */ \ No newline at end of file -- Gitee From f52f1c63e12c7a15ce6923013bdeffb624916706 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Tue, 12 Dec 2023 21:43:40 +0800 Subject: [PATCH 0150/2135] =?UTF-8?q?IssueNo:=20=E7=94=B5=E8=AF=9D?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=B8=85=E9=99=A4=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5HDI=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 电话服务清除数据连接HDI文档更新 Sig: SIG_Telephony Feature or Bugfix: Bugfix Binary Source: No Signed-off-by: liuxiyao223 --- zh-cn/device_api/hdi/ril/v1_2/IRil.idl | 85 +++++++++++++++++++ .../device_api/hdi/ril/v1_2/IRilCallback.idl | 12 ++- 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 zh-cn/device_api/hdi/ril/v1_2/IRil.idl diff --git a/zh-cn/device_api/hdi/ril/v1_2/IRil.idl b/zh-cn/device_api/hdi/ril/v1_2/IRil.idl new file mode 100644 index 00000000..cb7430f5 --- /dev/null +++ b/zh-cn/device_api/hdi/ril/v1_2/IRil.idl @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Ril + * @{ + * + * @brief Ril模块接口定义。 + * + * Ril模块为上层电话服务提供相关调用接口,涉及电话、短信、彩信、网络搜索、SIM卡等功能接口及各种回调等。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @file IRil.idl + * + * @brief Ril模块的请求接口。 + * + * @since 4.1 + * @version 1.2 + */ + +/** + * @brief Ril模块接口的包路径。 + * + * @since 4.1 + * @version 1.2 + */ +package ohos.hdi.ril.v1_2; + +import ohos.hdi.ril.v1_2.IRilCallback; +import ohos.hdi.ril.v1_1.IRil; +import ohos.hdi.ril.v1_2.Types; + +/** + * @brief Ril模块的请求接口。 + * + * 请求接口包括打电话、发短信彩信、激活SIM卡、上网等。 + * + * @since 4.1 + * @version 1.2 + */ +interface IRil extends ohos.hdi.ril.v1_1.IRil { + /** + * @brief 设置IRil回调接口,回调函数参考{@link IRilCallback}。 + * + * @param rilCallback 要设置的回调函数。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.1 + * @version 1.2 + */ + [oneway] SetCallback1_2([in] IRilCallback rilCallback); + + /** + * @brief 清除所有数据连接。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.1 + * @version 1.2 + */ + [oneway] CleanAllConnections([in] int slotId, [in] int serialId); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl b/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl index 18b2fc25..74363a54 100644 --- a/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl +++ b/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl @@ -54,7 +54,7 @@ import ohos.hdi.ril.v1_1.IRilCallback; */ [callback] interface IRilCallback extends ohos.hdi.ril.v1_1.IRilCallback { /** - * @brief Callback for reporting resident network. + * @brief 常驻网络上报。 * * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 * @param plmn 表示常驻网络 @@ -63,5 +63,15 @@ import ohos.hdi.ril.v1_1.IRilCallback; * @version 1.2 */ ResidentNetworkUpdated([in] struct RilRadioResponseInfo responseInfo, [in] String plmn); + + /** + * @brief 清除所有数据连接响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 4.1 + * @version 1.2 + */ + CleanAllConnectionsResponse([in] struct RilRadioResponseInfo responseInfo); } /** @} */ \ No newline at end of file -- Gitee From 7e32df23c050a87b4c64f96b14f6f1bc054b3801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Wed, 13 Dec 2023 14:42:43 +0800 Subject: [PATCH 0151/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-vibrator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- .../hdi/vibrator/v1_1/VibratorTypes.idl | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/zh-cn/device_api/hdi/vibrator/v1_1/VibratorTypes.idl b/zh-cn/device_api/hdi/vibrator/v1_1/VibratorTypes.idl index e8dd41c8..91f5dd04 100755 --- a/zh-cn/device_api/hdi/vibrator/v1_1/VibratorTypes.idl +++ b/zh-cn/device_api/hdi/vibrator/v1_1/VibratorTypes.idl @@ -71,4 +71,32 @@ struct HdfVibratorInfo { int frequencyMaxValue; /**< 最大频率。 */ int frequencyMinValue; /**< 最小频率。 */ }; + +/** + * @brief 定义复合振动效果参数。 + * + * 参数包括复合效果的类型和顺序。 + * + * @since 3.2 + */ +struct HdfCompositeEffect { + /** 复合效果的类型,请参见{@link union HdfEffectType} */ + int type; + /** 合成效果的序列,请参见{@link union CompositeEffect} */ + union CompositeEffect[] compositeEffects; +}; + +/** + * @brief 定义振动效果信息。 + * + * 该信息包括设置效果的能力和效果的振动持续时间。 + * + * @since 3.2 + */ +struct HdfEffectInfo { + /** 效果的振动持续时间,以毫秒为单位 */ + int duration; + /** 设置效果能力。1表示支持,0表示不支持 */ + boolean isSupportEffect; +}; /** @} */ -- Gitee From bcf9e0ffbad952ca0cd7291261be5f1f7693ec70 Mon Sep 17 00:00:00 2001 From: qinjihong Date: Tue, 12 Dec 2023 19:30:43 +0800 Subject: [PATCH 0152/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9Ecamera=5FV1=5F1?= =?UTF-8?q?=E7=9A=84idl=E4=B8=AD=E6=96=87=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinjihong --- .../hdi/camera/v1_1/ICameraDevice.idl | 88 +++++++++ .../hdi/camera/v1_1/ICameraHost.idl | 92 +++++++++ .../hdi/camera/v1_1/IStreamOperator.idl | 115 +++++++++++ zh-cn/device_api/hdi/camera/v1_1/Types.idl | 183 ++++++++++++++++++ 4 files changed, 478 insertions(+) create mode 100644 zh-cn/device_api/hdi/camera/v1_1/ICameraDevice.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_1/ICameraHost.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_1/IStreamOperator.idl create mode 100644 zh-cn/device_api/hdi/camera/v1_1/Types.idl diff --git a/zh-cn/device_api/hdi/camera/v1_1/ICameraDevice.idl b/zh-cn/device_api/hdi/camera/v1_1/ICameraDevice.idl new file mode 100644 index 00000000..37575834 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_1/ICameraDevice.idl @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @file ICameraDevice.idl + * + * @brief Camera设备操作接口。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.0 + * @version 1.1 + */ +package ohos.hdi.camera.v1_1; + +import ohos.hdi.camera.v1_0.ICameraDevice; +import ohos.hdi.camera.v1_0.IStreamOperatorCallback; +import ohos.hdi.camera.v1_1.IStreamOperator; +import ohos.hdi.camera.v1_1.Types; + +/** + * @brief 定义Camera设备基本的操作。 + * + * 设置流回调接口、更新控制参数、执行metadata相关操作。 + * + * @since 4.0 + * @version 1.1 + */ +interface ICameraDevice extends ohos.hdi.camera.v1_0.ICameraDevice { + /** + * @brief 获取流操作句柄。 + * + * @param callbackObj 设置流回调接口,详细可查看{@link IStreamOperatorCallback}, + * 用于上报捕获开始{@link OnCaptureStarted},捕获结束{@link OnCaptureEnded}, + * 捕获错误等信息{@link OnCaptureError}。 + * @param streamOperator 返回流操作句柄。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.0 + * @version 1.1 + */ + GetStreamOperator_V1_1([in] IStreamOperatorCallback callbackObj, [out] IStreamOperator streamOperator); + + /** + * @brief 获取默认的相机设备控制参数。 + * + * @param settings指示默认的相机参数, 包括传感器帧速率和3A参数。 + * 3A 代表自动对焦 (AF), 自动曝光 (AE), 和自动白平衡 (?AWB). + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.0 + * @version 1.1 + */ + GetDefaultSettings([out] unsigned char[] settings); +} diff --git a/zh-cn/device_api/hdi/camera/v1_1/ICameraHost.idl b/zh-cn/device_api/hdi/camera/v1_1/ICameraHost.idl new file mode 100644 index 00000000..301811d5 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_1/ICameraHost.idl @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @file ICameraHost.idl + * + * @brief Camera服务的管理类,对上层提供HDI接口。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.0 + * @version 1.1 + */ +package ohos.hdi.camera.v1_1; + +import ohos.hdi.camera.v1_0.ICameraDeviceCallback; +import ohos.hdi.camera.v1_0.ICameraHost; +import ohos.hdi.camera.v1_1.ICameraDevice; +import ohos.hdi.camera.v1_1.Types; + +/** + * @brief 定义Camera设备功能操作。 + * + * 打开和预启动Camera设备的相关操作。 + * + * @since 4.0 + * @version 1.1 + */ +interface ICameraHost extends ohos.hdi.camera.v1_0.ICameraHost { + /** + * @brief 打开Camera设备。 + * + * 打开指定的Camera设备,通过此接口可以获取到ICameraDevice对象,通过ICameraDevice对象可以操作具体的Camera设备。 + * + * @param cameraId 需要打开的Camera设备ID,可通过{@link GetCameraIds}接口获取当前已有Camera设备列表。 + * @param callbackObj Camera设备相关的回调函数,具体参见{@link ICameraDeviceCallback}。 + * @param device 返回当前要打开的Camera设备ID对应的ICameraDevice对象。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @see GetCameraIds + * + * @since 4.0 + * @version 1.1 + */ + OpenCamera_V1_1([in] String cameraId, [in] ICameraDeviceCallback callbackObj, [out] ICameraDevice device); + + /** + * @brief 预启动Camera设备。 + * + * 当需要加速cameraId指定Camera设备的启动时可调用该接口。 + * + * @param config表示预启动配置信息,当前可忽略。更多细节查看{@link PrelaunchConfig}。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.0 + * @version 1.1 + */ + Prelaunch([in] struct PrelaunchConfig config); +} diff --git a/zh-cn/device_api/hdi/camera/v1_1/IStreamOperator.idl b/zh-cn/device_api/hdi/camera/v1_1/IStreamOperator.idl new file mode 100644 index 00000000..9eca0041 --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_1/IStreamOperator.idl @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @file IStreamOperator.idl + * + * @brief 流的操作接口。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @brief Camera设备接口的包路径。 + * + * @since 4.0 + * @version 1.1 + */ +package ohos.hdi.camera.v1_1; + +import ohos.hdi.camera.v1_0.IStreamOperator; +import ohos.hdi.camera.v1_1.Types; + +/** + * @brief 定义Camera设备流操作。 + * + * 对Camera设备执行流的创建、配置与添加参数、属性获取、句柄绑定与解除、图像捕获与取消、流的转换以及流释放操作。 + * + * 流是指从底层设备输出,经本模块内部各环节处理,最终传递到上层服务或者应用的一组数据序列。 + * 本模块支持的流的类型有预览流,录像流,拍照流等,更多类型可查看{@link StreamIntent}。 + * + * @since 4.0 + * @version 1.1 + */ +interface IStreamOperator extends ohos.hdi.camera.v1_0.IStreamOperator { + /** + * @brief 查询是否支持添加参数对应的流。 + * + * 此函数接口根据输入的运行模式和配置信息以及当前模块中正在运行的流,查询是否支持动态添加流。 + * - 如果本模块支持在不停止其他流的情况下添加新流,或者即使停止其他流但上层服务或应用不感知, + * 则通过type参数返回DYNAMIC_SUPPORTED,上层服务或应用可以直接添加新流; + * - 如果本模块支持添加新流但需要上层服务或应用先停止所有流的捕获,则通过type参数返回RE_CONFIGURED_REQUIRED; + * - 如果不支持添加输入的新流,则返回NOT_SUPPORTED。 + * 此函数需要在调用{@link CreateStreams}创建流之前调用。 + * + * @param mode 流的使用模式,支持的模式参考{@link OperationMode}。 + * @param modeSetting 流的配置,包括帧率,3A等配置信息。3A:自动曝光 (AE)、自动聚焦 (AF)、自动白平衡 (AWB) + * @param infos 流的配置信息,具体参考{@link StreamInfo}。 + * @param type 对动态配置流的支持类型,支持类型定义在{@link StreamSupportType}。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.0 + * @version 1.1 + */ + IsStreamsSupported_V1_1([in] enum OperationMode_V1_1 mode, [in] unsigned char[] modeSetting, + [in] struct StreamInfo_V1_1[] infos, [out] enum StreamSupportType type); + + /** + * @brief 创建流。 + * + * 此函数接口依据输入的流信息创建流,调用该接口之前需先通过{@link IsStreamsSupported}查询HAL是否支持要创建的流。 + * + * @param streamInfos 流信息列表,流信息定义在{@link StreamInfo}。输入的流信息可能会被修改,需通过 + * {@link GetStreamAttributes}获取最新的流属性。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.0 + * @version 1.1 + */ + CreateStreams_V1_1([in] struct StreamInfo_V1_1[] streamInfos); + + /** + * @brief 配置流。 + * + * 本接口需在调用{@link CreateStreams}创建流之后调用。 + * + * @param mode 流运行的模式,支持的模式定义在{@link OperationMode}。 + * @param modeSetting 流的配置参数,包括帧率,ZOOM等信息。ZOOM:变焦。 + * + * @return NO_ERROR 表示执行成功。 + * @return 其他值表示执行失败,具体错误码查看{@link CamRetCode}。 + * + * @since 4.0 + * @version 1.1 + */ + CommitStreams_V1_1([in] enum OperationMode_V1_1 mode, [in] unsigned char[] modeSetting); +} diff --git a/zh-cn/device_api/hdi/camera/v1_1/Types.idl b/zh-cn/device_api/hdi/camera/v1_1/Types.idl new file mode 100644 index 00000000..78c98f7d --- /dev/null +++ b/zh-cn/device_api/hdi/camera/v1_1/Types.idl @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Camera + * @{ + * + * @brief Camera模块接口定义。 + * + * Camera模块涉及相机设备的操作、流的操作、离线流的操作和各种回调等。 + * + * @since 4.0 + * @version 1.1 + */ + +/** + * @file Types.idl + * + * @brief Camera模块HDI接口使用的数据类型。 + * + * @since 4.0 + * @version 1.1 + */ + + /** + * @brief Camera设备接口的包路径。 + * + * @since 4.0 + * @version 1.1 + */ +package ohos.hdi.camera.v1_1; +sequenceable ohos.hdi.camera.v1_0.BufferProducerSequenceable; + +import ohos.hdi.camera.v1_0.Types; + +/** + * @brief 扩展流信息。 + * + * @since 4.0 + * @version 1.1 + */ +enum ExtendedStreamInfoType { + /** + * 快速缩略图的扩展流信息. + */ + EXTENDED_STREAM_INFO_QUICK_THUMBNAIL = 0, +}; + +/** + * @brief 扩展流信息。 + * + * @since 4.0 + * @version 1.1 + */ +struct ExtendedStreamInfo { + /** + * 扩展流信息类型。 + */ + enum ExtendedStreamInfoType type; + + /** + * 图像宽度。 + */ + int width; + + /** + * 图像高度。 + */ + int height; + + /** + * 图像格式。 + */ + int format; + + /** + * 图像颜色空间。 + */ + int dataspace; + + /** + * 图形提供的生产者句柄,用于快速缩略图。 + */ + BufferProducerSequenceable bufferQueue; +}; + +/** + * @brief 流信息,用于创建流时传入相关的配置参数。 + * + * @since 4.0 + * @version 1.1 + */ +struct StreamInfo_V1_1 { + /** + * 流信息的上一版本。 + */ + struct StreamInfo v1_0; + + /** + * 可选扩展流信息。 + */ + struct ExtendedStreamInfo[] extendedStreamInfos; +}; + +/** + * @brief 预启动配置信息,用于{@link Prelaunch}。 + * + * @since 4.0 + * @version 1.1 + */ +struct PrelaunchConfig { + /** + * Camera ID,相机设备唯一标识。 + */ + String cameraId; + + /** + * 流预启动模式中使用的流信息,目前可以忽略。 + */ + struct StreamInfo_V1_1[] streamInfos_V1_1; + + /** + * 表示预启动配置信息。 + */ + unsigned char[] setting; +}; + +/** + * @brief 流的使用模式。 + * + * @since 4.0 + * @version 1.1 + */ +enum OperationMode_V1_1 { + /** + * 普通模式, 支持拍照和录像场景。 + */ + NORMAL = 0, + + /** + * 拍照模式, 专用于拍照场景。 + * 如果执行此模式, 不应再执行普通模式。 + */ + CAPTURE = 1, + + /** + * 录像模式, 专用于录像场景。 + * 如果执行此模式, 不应再执行普通模式。 + */ + VIDEO = 2, + + /** + * 人像模式, 专用于人像场景 + */ + PORTRAIT = 3, + + /** + * 夜景模式, 专用于夜间拍照场景 + */ + NIGHT = 4, + + /** + * 专业模式, 专用于专业拍照场景 + */ + PROFESSIONAL = 5, + + /** + * 慢动作模式, 专用于捕捉慢动作 + */ + SLOW_MOTION = 6, +}; -- Gitee From 985332ae489880bb938d68f48710523d05248006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Wed, 13 Dec 2023 19:10:26 +0800 Subject: [PATCH 0153/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-vibrator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- .../hdi/vibrator/v1_1/VibratorTypes.idl | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/zh-cn/device_api/hdi/vibrator/v1_1/VibratorTypes.idl b/zh-cn/device_api/hdi/vibrator/v1_1/VibratorTypes.idl index 91f5dd04..9cece962 100755 --- a/zh-cn/device_api/hdi/vibrator/v1_1/VibratorTypes.idl +++ b/zh-cn/device_api/hdi/vibrator/v1_1/VibratorTypes.idl @@ -55,6 +55,20 @@ enum HdfVibratorMode { HDF_VIBRATOR_MODE_BUTT, /**< 表示效果模式无效。 */ }; +/** + * @brief 枚举复合效果的效果类型。 + * + * @since 3.2 + */ +enum HdfEffectType { + /** 表示给定时间序列的时间效果类型 */ + HDF_EFFECT_TYPE_TIME, + /** 表示给定基本振动序列的基本振动效果类型 */ + HDF_EFFECT_TYPE_PRIMITIVE, + /** 表示效果类型无效 */ + HDF_EFFECT_TYPE_BUTT, +}; + /** * @brief 定义马达参数。 * @@ -72,6 +86,45 @@ struct HdfVibratorInfo { int frequencyMinValue; /**< 最小频率。 */ }; +/** + * @brief 定义时间效果参数。 + * + * 参数包括振动的延迟、时间、强度和频率。 + * + * @since 3.2 + */ +struct TimeEffect { + int delay; /** 等待时间 */ + int time; /** 振动时间 */ + unsigned short intensity; /** 振动强度 */ + short frequency; /** 振动频率(Hz) */ +}; + +/** + * @brief 定义基本效果参数。 + * + * 参数包括延迟、效应id和振动强度。 + * + * @since 3.2 + */ +struct PrimitiveEffect { + int delay; /** 等待时间 */ + int effectId; /** 效果id */ + unsigned short intensity; /** 振动强度 */ +}; + +/** + * @brief 定义复合效果定义两种效果。 + * + * 参数包括时间效果和基元效果。 + * + * @since 3.2 + */ +union CompositeEffect { + struct TimeEffect timeEffect; /** 时间效果,请参阅{@link TimeEffect} */ + struct PrimitiveEffect primitiveEffect; /** 预定义效果,请参见{@link PrimitiveEffect} */ +}; + /** * @brief 定义复合振动效果参数。 * -- Gitee From 5abe9e305cf68a9aa2cd748b679dcc5b5bba8d73 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Wed, 13 Dec 2023 20:10:54 +0800 Subject: [PATCH 0154/2135] =?UTF-8?q?ril=E6=A8=A1=E5=9D=97idl=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E6=96=87=E6=A1=A3=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuxiyao223 --- zh-cn/device_api/hdi/ril/v1_1/IRil.idl | 16 ++++++- .../device_api/hdi/ril/v1_1/IRilCallback.idl | 35 +++++++++++++++- zh-cn/device_api/hdi/ril/v1_1/Types.idl | 42 ++++++++++++++++++- 3 files changed, 90 insertions(+), 3 deletions(-) diff --git a/zh-cn/device_api/hdi/ril/v1_1/IRil.idl b/zh-cn/device_api/hdi/ril/v1_1/IRil.idl index 7defcfb6..009d84b0 100644 --- a/zh-cn/device_api/hdi/ril/v1_1/IRil.idl +++ b/zh-cn/device_api/hdi/ril/v1_1/IRil.idl @@ -640,6 +640,20 @@ interface IRil { */ [oneway] GetLinkBandwidthInfo([in] int slotId, [in] int serialId, [in] int cid); + /** + * @brief 获取链接功能。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + [oneway] GetLinkCapability([in] int slotId, [in] int serialId); + /** * @brief 设置当前链路信息的上报规则。 * @@ -1671,4 +1685,4 @@ interface IRil { */ [oneway] GetNrOptionMode([in] int slotId, [in] int serialId); } -/** @} */ \ No newline at end of file +/** @} */ diff --git a/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl b/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl index 41ba1f1a..67743101 100644 --- a/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl +++ b/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl @@ -502,6 +502,17 @@ import ohos.hdi.ril.v1_1.Types; */ PdpContextListUpdated([in] struct RilRadioResponseInfo responseInfo, [in] struct DataCallResultList dataCallResultList); + /** + * @brief 报告数据链路功能。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param capability 表示数据链路能力。 + * + * @since 4.0 + * @version 1.1 + */ + DataLinkCapabilityUpdated([in] struct RilRadioResponseInfo responseInfo, [in] struct DataLinkCapability capability); + /** * @brief 激活数据业务响应。 * @@ -558,6 +569,17 @@ import ohos.hdi.ril.v1_1.Types; GetLinkBandwidthInfoResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct DataLinkBandwidthInfo dataLinkBandwidthInfo); + /** + * @brief Callback for the response of get link capability. + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param capability 数据链路能力。 + * + * @since 4.0 + * @version 1.1 + */ + GetLinkCapabilityResponse([in] struct RilRadioResponseInfo responseInfo, [in] struct DataLinkCapability capability); + /** * @brief 设置当前链路信息的上报规则响应。 * @@ -601,6 +623,17 @@ import ohos.hdi.ril.v1_1.Types; VoiceRadioTechUpdated([in] struct RilRadioResponseInfo responseInfo, [in] struct VoiceRadioTechnology voiceRadioTechnology); + /** + * @brief Reporting the dsds mode. + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * @param state 表示Dsds模式。 + * + * @since 4.0 + * @version 1.1 + */ + DsdsModeUpdated([in] struct RilRadioResponseInfo responseInfo, [in] int state); + /** * @brief Modem收到手机正在关机响应。 * @@ -1560,4 +1593,4 @@ import ohos.hdi.ril.v1_1.Types; */ GetRrcConnectionStateUpdated([in] struct RilRadioResponseInfo responseInfo, [in] int state); } -/** @} */ \ No newline at end of file +/** @} */ diff --git a/zh-cn/device_api/hdi/ril/v1_1/Types.idl b/zh-cn/device_api/hdi/ril/v1_1/Types.idl index b99ce84b..71b4c3db 100644 --- a/zh-cn/device_api/hdi/ril/v1_1/Types.idl +++ b/zh-cn/device_api/hdi/ril/v1_1/Types.idl @@ -820,6 +820,46 @@ struct DataCallResultList { List dcList; }; +/** + * @brief 定义数据链路功能。 + * + * @since 4.0 + * @version 1.1 + */ +struct DataLinkCapability { + /** + * 主要服务下行链路能力。 + * + * @since 4.0 + * @version 1.1 + */ + int primaryDownlinkKbps; + + /** + * 主要服务上行链路能力。 + * + * @since 4.0 + * @version 1.1 + */ + int primaryUplinkKbps; + + /** + * 辅助服务下行链路能力。 + * + * @since 4.0 + * @version 1.1 + */ + int secondaryDownlinkKbps; + + /** + * 辅助服务上行链路能力。 + * + * @since 4.0 + * @version 1.1 + */ + int secondaryUplinkKbps; +}; + /** * @brief PDP上下文信息。 */ @@ -3504,4 +3544,4 @@ struct SendSmsResultInfo { */ int flag; }; -/** @} */ \ No newline at end of file +/** @} */ -- Gitee From 1fc873c0134b54242ff0a4dedc81a3137a0d1f03 Mon Sep 17 00:00:00 2001 From: xieyao_whu Date: Thu, 14 Dec 2023 01:42:42 +0000 Subject: [PATCH 0155/2135] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E9=9A=8F=E5=8D=A1=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xieyao_whu --- zh-cn/device_api/hdi/ril/v1_2/Types.idl | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 zh-cn/device_api/hdi/ril/v1_2/Types.idl diff --git a/zh-cn/device_api/hdi/ril/v1_2/Types.idl b/zh-cn/device_api/hdi/ril/v1_2/Types.idl new file mode 100644 index 00000000..5ef12e87 --- /dev/null +++ b/zh-cn/device_api/hdi/ril/v1_2/Types.idl @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Ril + * @{ + * + * @brief Defines Ril-related APIs. + * + * The radio interface layer (RIL) module provides APIs and callbacks for upper-layer telephony services, + * including call, SMS, MMS, network search, and SIM card services. + * + * @since 4.1 + * @version 1.2 + */ + +package ohos.hdi.ril.v1_2; + +import ohos.hdi.ril.v1_1.Types; + +/** + * @brief Sim matched operator info. + */ +struct NcfgOperatorInfo { + /** + * Operator Name Matched with SIM card + */ + String operName; + /** + * Operator Key Matched with SIM card + */ + String operKey; + /** + * Current SIM State + */ + int state; + /** + * Reserved Field + */ + String reserve; +}; -- Gitee From 4ac79f1955aa286ae884441de44edd4e6fc82b35 Mon Sep 17 00:00:00 2001 From: xieyao_whu Date: Thu, 14 Dec 2023 01:49:00 +0000 Subject: [PATCH 0156/2135] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E9=9A=8F=E5=8D=A1=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xieyao_whu --- zh-cn/device_api/hdi/ril/v1_2/IRil.idl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/zh-cn/device_api/hdi/ril/v1_2/IRil.idl b/zh-cn/device_api/hdi/ril/v1_2/IRil.idl index cb7430f5..9b5da10c 100644 --- a/zh-cn/device_api/hdi/ril/v1_2/IRil.idl +++ b/zh-cn/device_api/hdi/ril/v1_2/IRil.idl @@ -68,6 +68,22 @@ interface IRil extends ohos.hdi.ril.v1_1.IRil { */ [oneway] SetCallback1_2([in] IRilCallback rilCallback); + /** + * @brief 下发随卡信息接口。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param ncfgOperatorInfo 要下发的随卡信息,参考{@link Types}。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.1 + * @version 1.2 + */ + [oneway] SendSimMatchedOperatorInfo([in] int slotId, [in] int serialId, + [in] struct NcfgOperatorInfo ncfgOperatorInfo); + /** * @brief 清除所有数据连接。 * -- Gitee From d5dcf9ffe56c9b910360a1f2c71b405a7e2fdb6b Mon Sep 17 00:00:00 2001 From: xieyao_whu Date: Thu, 14 Dec 2023 01:51:54 +0000 Subject: [PATCH 0157/2135] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E9=9A=8F=E5=8D=A1=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xieyao_whu --- zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl b/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl index 74363a54..5a93b363 100644 --- a/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl +++ b/zh-cn/device_api/hdi/ril/v1_2/IRilCallback.idl @@ -64,6 +64,16 @@ import ohos.hdi.ril.v1_1.IRilCallback; */ ResidentNetworkUpdated([in] struct RilRadioResponseInfo responseInfo, [in] String plmn); + /** + * @brief 下发随卡信息响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 4.1 + * @version 1.2 + */ + SendSimMatchedOperatorInfoResponse([in] struct RilRadioResponseInfo responseInfo); + /** * @brief 清除所有数据连接响应。 * -- Gitee From cbe1fadced6201974cb279e0e192142cf9559a5e Mon Sep 17 00:00:00 2001 From: xieyao_whu Date: Thu, 14 Dec 2023 02:42:19 +0000 Subject: [PATCH 0158/2135] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E9=9A=8F=E5=8D=A1=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xieyao_whu --- zh-cn/device_api/hdi/ril/v1_2/Types.idl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/zh-cn/device_api/hdi/ril/v1_2/Types.idl b/zh-cn/device_api/hdi/ril/v1_2/Types.idl index 5ef12e87..003fc413 100644 --- a/zh-cn/device_api/hdi/ril/v1_2/Types.idl +++ b/zh-cn/device_api/hdi/ril/v1_2/Types.idl @@ -17,10 +17,9 @@ * @addtogroup Ril * @{ * - * @brief Defines Ril-related APIs. + * @brief Ril模块接口定义。 * - * The radio interface layer (RIL) module provides APIs and callbacks for upper-layer telephony services, - * including call, SMS, MMS, network search, and SIM card services. + * Ril模块为上层电话服务提供相关调用接口,涉及电话、短信、彩信、网络搜索、SIM卡等功能接口及各种回调等。 * * @since 4.1 * @version 1.2 @@ -31,23 +30,23 @@ package ohos.hdi.ril.v1_2; import ohos.hdi.ril.v1_1.Types; /** - * @brief Sim matched operator info. + * @brief 随卡信息。 */ struct NcfgOperatorInfo { /** - * Operator Name Matched with SIM card + * 随卡匹配的运营商名称。 */ String operName; /** - * Operator Key Matched with SIM card + * 随卡匹配的运营商标识。 */ String operKey; /** - * Current SIM State + * SIM卡状态。 */ int state; /** - * Reserved Field + * 预留字段。 */ String reserve; }; -- Gitee From 14705ada6d5b44aeb51a0e2a51ce4f18566d2324 Mon Sep 17 00:00:00 2001 From: xieyao_whu Date: Thu, 14 Dec 2023 03:20:02 +0000 Subject: [PATCH 0159/2135] update zh-cn/device_api/hdi/ril/v1_2/Types.idl. Signed-off-by: xieyao_whu --- zh-cn/device_api/hdi/ril/v1_2/Types.idl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zh-cn/device_api/hdi/ril/v1_2/Types.idl b/zh-cn/device_api/hdi/ril/v1_2/Types.idl index 003fc413..1ca83e5f 100644 --- a/zh-cn/device_api/hdi/ril/v1_2/Types.idl +++ b/zh-cn/device_api/hdi/ril/v1_2/Types.idl @@ -31,6 +31,9 @@ import ohos.hdi.ril.v1_1.Types; /** * @brief 随卡信息。 + * + * @since 4.1 + * @version 1.2 */ struct NcfgOperatorInfo { /** -- Gitee From 14e78b7b5d7af408d82e9dc04eda1ef68c692196 Mon Sep 17 00:00:00 2001 From: xieyao_whu Date: Thu, 14 Dec 2023 03:20:44 +0000 Subject: [PATCH 0160/2135] update zh-cn/device_api/hdi/ril/v1_2/IRil.idl. Signed-off-by: xieyao_whu --- zh-cn/device_api/hdi/ril/v1_2/IRil.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/device_api/hdi/ril/v1_2/IRil.idl b/zh-cn/device_api/hdi/ril/v1_2/IRil.idl index 9b5da10c..f310a87f 100644 --- a/zh-cn/device_api/hdi/ril/v1_2/IRil.idl +++ b/zh-cn/device_api/hdi/ril/v1_2/IRil.idl @@ -73,7 +73,7 @@ interface IRil extends ohos.hdi.ril.v1_1.IRil { * * @param slotId 表示卡槽ID。 * @param serialId 表示请求的序列化ID。 - * @param ncfgOperatorInfo 要下发的随卡信息,参考{@link Types}。 + * @param ncfgOperatorInfo 要下发的随卡信息,参考{@link NcfgOperatorInfo}。 * * @return 0 表示执行成功。 * @return 非零值 表示操作失败。 -- Gitee From 8f11ec07f9a0bc1abf508fbcae3ca3fbca60eb3d Mon Sep 17 00:00:00 2001 From: xieyao_whu Date: Thu, 14 Dec 2023 03:52:06 +0000 Subject: [PATCH 0161/2135] update zh-cn/device_api/hdi/ril/v1_2/Types.idl. Signed-off-by: xieyao_whu --- zh-cn/device_api/hdi/ril/v1_2/Types.idl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zh-cn/device_api/hdi/ril/v1_2/Types.idl b/zh-cn/device_api/hdi/ril/v1_2/Types.idl index 1ca83e5f..ee3a5475 100644 --- a/zh-cn/device_api/hdi/ril/v1_2/Types.idl +++ b/zh-cn/device_api/hdi/ril/v1_2/Types.idl @@ -25,6 +25,15 @@ * @version 1.2 */ +/** + * @file Types.idl + * + * @brief Ril模块HDI接口使用的数据类型。 + * + * @since 4.1 + * @version 1.2 + */ + package ohos.hdi.ril.v1_2; import ohos.hdi.ril.v1_1.Types; -- Gitee From a56387fc6396e19e5437d7337a8c7230d504efc4 Mon Sep 17 00:00:00 2001 From: maoyong Date: Thu, 14 Dec 2023 11:09:37 +0800 Subject: [PATCH 0162/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=B4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=B0=86=E8=8B=B1=E6=96=87=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=B8=AD=E6=96=87=E6=B3=A8=E9=87=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: maoyong --- .../neural_network_core.h | 957 ++++++++++++++++++ .../neural_network_runtime.h | 603 +++-------- .../neural_network_runtime_compat.h | 274 +++++ .../neural_network_runtime_type.h | 105 +- 4 files changed, 1460 insertions(+), 479 deletions(-) create mode 100644 zh-cn/native_sdk/ai/neural_network_runtime/neural_network_core.h create mode 100644 zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_compat.h diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_core.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_core.h new file mode 100644 index 00000000..1724d9ba --- /dev/null +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_core.h @@ -0,0 +1,957 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup NeuralNeworkRuntime + * @{ + * + * @brief 提供Neural Network Runtime加速模型推理的相关接口。 + * + * @since 9 + * @version 2.0 + */ + +/** + * @file neural_network_core.h + * + * @brief Neural Network Core模块接口定义,AI推理框架使用Neural Network Core提供的Native接口,完成模型编译,并在加速硬件上执行推理和计算。 + * + * 注意:Neural Network Core的接口目前均不支持多线程并发调用.\n + * + * @library libneural_network_core.so + * @Syscap SystemCapability.Ai.NeuralNetworkRuntime + * @since 11 + * @version 1.0 + */ + +#ifndef NEURAL_NETWORK_CORE_H +#define NEURAL_NETWORK_CORE_H + +#include "neural_network_runtime_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** +* @brief @brief 创建{@link OH_NNCompilation}类型的编译实例 + * + * 使用OH_NNModel模块完成模型的构造后,借助OH_NNCompilation模块提供的接口,将模型传递到底层硬件完成编译。本方法接受一个 + * {@link OH_NNModel}实例,创建出{@link OH_NNCompilation}实例;通过 + * {@link OH_NNCompilation_SetDevice}方法,设置编译的设备,最后调用 + * {@link OH_NNCompilation_Build}完成编译。\n + * + * 除了计算硬件的选择,OH_NNCompilation模块支持模型缓存、性能偏好、优先级设置、float16计算等特性,参考以下方法: + * - {@link OH_NNCompilation_SetCache} + * - {@link OH_NNCompilation_SetPerformanceMode} + * - {@link OH_NNCompilation_SetPriority} + * - {@link OH_NNCompilation_EnableFloat16}\n + * + * 调用本方法创建{@link OH_NNCompilation}后,{@link OH_NNModel}实例可以释放。\n + * + * @param model 指向{@link OH_NNModel}实例的指针。 + * @return 返回一个指向{@link OH_NNCompilation}实例的指针。 + * @since 9 + * @version 1.0 + */ +OH_NNCompilation *OH_NNCompilation_Construct(const OH_NNModel *model); + +/** + * @brief 基于离线模型文件创建编译实例。 + * + * 此方法与传递在线构建模型或离线模型文件缓存的方式冲突,并且您只需要选择三种构建方法中的一种。\n + * + * 离线模型是由硬件供应商提供的模型转换器离线编译的模型类型。所以离线模型只能在指定的设备上使用,但离线模型的编译时间通常 + * 远少于{@link OH_NNModel}。\n + * + * 在开发过程中需要离线执行编译,并在应用包中部署离线模型。\n + * + * @param modelPath 离线模型文件路径。 + * @return 指向{@link OH_NNCompilation}实例的指针。 + * @since 11 + * @version 1.0 + */ +OH_NNCompilation *OH_NNCompilation_ConstructWithOfflineModelFile(const char *modelPath); + +/** + * @brief 基于离线模型文件缓存创建编译实例。 + * + * 此方法与传递在线构建模型或离线模型文件路径的方式冲突,并且您只需要选择三种构建方法中的一种。\n + * + * 请注意,返回的{@link OH_NNCompilation}实例只将modelBuffer指针保存在里面,而不是复制其数据。 + * 在销毁{@link OH_NNCompilation}实例之前,不应释放modelBuffer。\n + * + * @param modelBuffer 离线模型文件缓存。 + * @param modelSize 离线模型缓存大小。 + * @return 指向{@link OH_NNCompilation}实例的指针。 + * @since 11 + * @version 1.0 + */ +OH_NNCompilation *OH_NNCompilation_ConstructWithOfflineModelBuffer(const void *modelBuffer, size_t modelSize); + +/** +* @brief 创建一个空的编译实例,以便稍后从缓存中恢复。 + * + * 从缓存恢复的时间少于使用{@link OH_NNModel}进行编译的时间。\n + * + * 应该先调用{@link OH_NNCompilation_SetCache}或{@link OH_NNCompilation_ImportCacheFromBuffer}, + * 然后调用{@link OH_NNCompilation_Build}完成恢复。\n + * + * @since 11 + * @version 1.0 + */ +OH_NNCompilation *OH_NNCompilation_ConstructForCache(); + +/** + * @brief 将缓存导出到给定的缓冲区。 + * + * 缓存是编译构建的结果{@link OH_NNCompilation_Build},因此必须在{@link OH_NNCompilation_Build}之后调用此方法。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @param buffer 指向给定缓冲区的指针。 + * @param length 缓冲区长度。 + * @param modelSize 模型缓存的字节大小。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_ExportCacheToBuffer(OH_NNCompilation *compilation, + const void *buffer, + size_t length, + size_t *modelSize); + +/** + * @brief 从给定模型缓存导入。 + * + * 调用{@link OH_NNCompilation_ImportCacheFromBuffer}后,应调用{@link OH_NNCompilation_Build}完成恢复。\n + * + * 请注意,compilation只将buffer指针保存在里面,而不是复制其数据。您不能在compilation被销毁之前释放缓存buffer。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @param buffer 指向给定缓存的指针。 + * @param modelSize 模型缓存的字节大小。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_ImportCacheFromBuffer(OH_NNCompilation *compilation, + const void *buffer, + size_t modelSize); + +/** + * @brief 为自定义硬件属性添加扩展配置。 + * + * 某些设备有自己的特定属性,这些属性尚未在NNRt中打开。此方法为您提供了另一种方式设置设备的这些自定义硬件属性。 + * 您应该从设备供应商的文档查询它们的名称和值,并将它们逐一添加到编译实例中。这些属性将直接传递给设备驱动程序, + * 如果驱动程序无法解析它们,此方法将返回错误码。\n + * + * 调用{@link OH_NNCompilation_Build}后,configNameconfigValue可以释放。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @param configName 配置名称。 + * @param configValue 保存配置值的地址。 + * @param configValueSize 配置值的字节大小。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_AddExtensionConfig(OH_NNCompilation *compilation, + const char *configName, + const void *configValue, + const size_t configValueSize); + +/** + * @brief 指定模型编译和计算的硬件。 + * + * 编译阶段,需要指定模型编译和执行计算的硬件设备。先调用{@link OH_NNDevice_GetAllDevicesID}获取可用的设备ID, + * 通过{@link OH_NNDevice_GetType}和{@link OH_NNDevice_GetType}获取设备信息后,将期望编译执行的 + * 设备ID传入本方法进行设置。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @param deviceID 指定的硬件ID。如果为0,则默认使用当前设备列表中的第1台设备。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_SetDevice(OH_NNCompilation *compilation, size_t deviceID); + +/** + * @brief 设置编译模型的缓存目录和版本。 + * + * 在支持缓存的硬件上,模型在硬件驱动层编译后可以保存为缓存文件,下次编译时直接从缓存文件读取模型,减少重新编译的耗时。本方法接受缓存路径和版本,根据缓存 + * 路径中和版本的不同情况,本方法采取不同的行为:\n + * + * - 缓存路径指定的目录下没有文件: + * 将编译后的模型缓存到目录下,设置缓存版本等于version。\n + * + * - 缓存路径指定的目录下存在完整的缓存文件,且版本号 == version: + * 读取路径下的缓存文件,传递到底层硬件中转换为可以执行的模型实例。\n + * + * - 缓存路径指定的目录下存在完整的缓存文件,但版本号 < version: + * 路径下的缓存文件需要更新,模型在底层硬件完成编译后,覆写路径下的缓存文件,将版本号更新为version。\n + * + * - 缓存路径指定的目录下存在完整的缓存文件,但版本号 > version: + * 路径下的缓存文件版本高于version,不读取缓存文件,同时返回{@link OH_NN_INVALID_PARAMETER}错误码。\n + * + * - 缓存路径指定的目录下的缓存文件不完整或没有缓存文件的访问权限: + * 返回{@link OH_NN_INVALID_FILE}错误码。\n + * + * - 缓存目录不存在,或者没有访问权限: + * 返回{@link OH_NN_INVALID_PATH}错误码。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @param cachePath 模型缓存文件目录,本方法在cachePath目录下为不同的硬件创建缓存目录。建议每个模型使用单独的缓存目录。 + * @param version 缓存版本。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_SetCache(OH_NNCompilation *compilation, const char *cachePath, uint32_t version); + +/** + * @brief 设置模型计算的性能模式。 + * + * Neural Network Runtime 支持为模型计算设置性能模式,满足低功耗到极致性能的需求。如果编译阶段没有调用本方法设置性能模式, + * 编译实例为模型默认分配{@link OH_NN_PERFORMANCE_NONE}模式。在{@link OH_NN_PERFORMANCE_NONE} + * 模式下,硬件按默认的性能模式执行计算。\n + * + * 在不支持性能模式设置的硬件上调用本方法,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @param performanceMode 指定性能模式,可选的性能模式参考{@link OH_NN_PerformanceMode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_SetPerformanceMode(OH_NNCompilation *compilation, + OH_NN_PerformanceMode performanceMode); + +/** + * @brief 设置模型计算的优先级。 + * + * Neural Network Runtime 支持为模型设置计算优先级,优先级仅作用于相同uid进程创建的模型,不同uid进程、不同设备的优先级不会 + * 相互影响。\n + * + * 在不支持优先级设置的硬件上调用本方法,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @param priority 指定优先级,可选的优先级参考{@link OH_NN_Priority}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_SetPriority(OH_NNCompilation *compilation, OH_NN_Priority priority); + +/** + * @brief 是否以float16的浮点数精度计算。 + * + * 默认使用float32或int8,在支持float16精度的硬件上调用本方法,float32浮点数精度的模型将以float16的精度执行计算,以减少内存占用和执行时间。\n + * + * 在不支持float16精度计算的硬件上调用本方法,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @param enableFloat16 Float16低精度计算标志位。设置为true时,执行Float16推理;设置为false时,执行float32推理。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_EnableFloat16(OH_NNCompilation *compilation, bool enableFloat16); + +/** + * @brief 进行模型编译 + * + * 完成编译配置后,调用本方法指示模型编译已完成。编译实例将模型和编译选项推送至硬件设备进行编译。在调用本方法后,无法进行额外的编译操作,调用 + * {@link OH_NNCompilation_SetDevice}、{@link OH_NNCompilation_SetCache}、 + * {@link OH_NNCompilation_SetPerformanceMode}、 + * {@link OH_NNCompilation_SetPriority}和{@link OH_NNCompilation_EnableFloat16} + * 方法将返回{@link OH_NN_OPERATION_FORBIDDEN}。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_Build(OH_NNCompilation *compilation); + +/** + * @brief 释放Compilation对象。 + * + * 调用{@link OH_NNCompilation_Construct}、{@link OH_NNCompilation_ConstructWithOfflineModelFile}、 + * {@link OH_NNCompilation_ConstructWithOfflineModelBuffer}、{@link OH_NNCompilation_ConstructForCache}创建的编译实例需要调用本方法主动释放。\n + * + * 如果compilation为空指针或者*compilation为空指针,本方法只打印warning日志,不执行释放逻辑。\n + * + * @param compilation 指向{@link OH_NNCompilation}实例的二级指针。编译实例销毁后,本方法将*compilation主动设置为空指针。 + * @since 9 + * @version 1.0 + */ +void OH_NNCompilation_Destroy(OH_NNCompilation **compilation); + + +/** + * @brief 创建一个{@link NN_TensorDesc}实例。 + * + * {@link NN_TensorDesc}描述了各种张量属性,如名称/数据类型/形状/格式等。 + * + * 可以调用以下方法,基于传入的{@link NN_TensorDesc}实例创建{@link NN_Tensor}实例: + * - {@link OH_NNTensor_Create} + * - {@link OH_NNTensor_CreateWithSize} + * - {@link OH_NNTensor_CreateWithFd}\n + * 请注意,此方法会将{@link NN_TensorDesc}实例复制到{@link NN_Tensor}中,因此,您可以创建多个{@link NN_Tensor}个实例, + * 并持有相同的{@link NN_TensorDesc}实例。当{@link NN_TensorDesc}实例不再使用时,您应该调用{@link OH_NNTensorDesc_Destroy}方法销毁它。\n + * + * @return 指向{@link NN_TensorDesc}实例的指针 + * @since 11 + * @version 1.0 + */ +NN_TensorDesc *OH_NNTensorDesc_Create(); + +/** + * @brief 释放一个{@link NN_TensorDesc}实例。 + * + * 当{@link NN_TensorDesc}实例不再使用时,需要调用该方法释放。否则将发生内存泄漏。\n + * + * 如果tensorDesc*tensorDesc为空指针,则此方法将返回错误码,并且不会执行释放。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的二级指针。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_Destroy(NN_TensorDesc **tensorDesc); + +/** + * @brief 设置{@link NN_TensorDesc}的名称。 + * + * {@link NN_TensorDesc}实例创建完成后,调用该方法设置张量的名称,(*name)的值是以'\0'结尾的C样式字符串。\n + * + * 如果tensorDescname为空指针,则此方法将返回错误码。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param name 需要设置的张量名称。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_SetName(NN_TensorDesc *tensorDesc, const char *name); + +/** + * @brief 获取{@link NN_TensorDesc}的名称。 + * + * 调用该方法获取指定{@link NN_TensorDesc}实例的名称,(*name)的值是以'\0'结尾的C样式字符串。\n + * + * 如果tensorDescname为空指针,则此方法将返回错误码。 + * 作为输出参数,*name必须为空指针,否则该方法将返回错误码。 + * 例如,您应该定义char* tensorName = NULL,并传递&tensorName作为name的参数。\n + * + * 您不需要释放name的内存。当tensorDesc被销毁时,它会自动释放。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param name 返回的张量名称。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetName(const NN_TensorDesc *tensorDesc, const char **name); + +/** + * @brief 设置{@link NN_TensorDesc}的数据类型。 + * + * {@link NN_TensorDesc}实例创建完成后,调用该方法设置张量数据类型。\n + * + * 如果tensorDesc为空指针,则此方法将返回错误码。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param dataType 需要设置的张量数据类型。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_SetDataType(NN_TensorDesc *tensorDesc, OH_NN_DataType dataType); + +/** + * @brief 获取{@link NN_TensorDesc}的数据类型。 + * + * 调用此方法获取指定{@link NN_TensorDesc}实例的数据类型。\n + * + * 如果tensorDescdataType为空指针,则此方法将返回错误码。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param dataType 张量返回的数据类型。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetDataType(const NN_TensorDesc *tensorDesc, OH_NN_DataType *dataType); + +/** + * @brief 设置{@link NN_TensorDesc}的数据形状。 + * + * {@link NN_TensorDesc}实例创建完成后,调用该方法设置张量形状。\n + * + * 如果tensorDescshape为空指针,或shapeLength为0,则此方法将返回错误码。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param shape 需要设置的张量的形状列表。 + * @param shapeLength 需要设置的形状列表的长度。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_SetShape(NN_TensorDesc *tensorDesc, const int32_t *shape, size_t shapeLength); + +/** + * @brief 获取{@link NN_TensorDesc}的形状。 + * + * 调用此方法获取指定{@link NN_TensorDesc}实例的形状。\n + * + * 如果tensorDescshapeshapeLength为空指针,则该方法将返回错误码。 + * 作为输出参数,*shape必须为空指针,否则该方法将返回错误码。 + * 例如,您应该定义 int32_t* tensorShape = NULL,并传递&tensorShape作为shape的参数。 + * + * 您不需要释放shape的内存。当tensorDesc被销毁时,它会自动释放。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param shape 返回的张量形状列表。 + * @param shapeLength 返回的形状列表长度。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetShape(const NN_TensorDesc *tensorDesc, int32_t **shape, size_t *shapeLength); + +/** + * @brief 设置{@link NN_TensorDesc}的格式。 + * + * {@link NN_TensorDesc}实例创建完成后,调用该方法设置张量的格式。\n + * + * 如果tensorDesc为空指针,则此方法将返回错误码。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param format 需要设置的张量格式。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_SetFormat(NN_TensorDesc *tensorDesc, OH_NN_Format format); + +/** + * @brief 获取{@link NN_TensorDesc}的格式。 + * + * 调用此方法获取指定{@link NN_TensorDesc}实例的格式。\n + * + * 如果tensorDescformat为空指针,则此方法将返回错误码。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param format 返回的张量格式。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetFormat(const NN_TensorDesc *tensorDesc, OH_NN_Format *format); + +/** + * @brief 获取{@link NN_TensorDesc}的元素个数。 + * + * 调用该方法获取指定{@link NN_TensorDesc}实例的元素个数。如果需要获取张量数据的字节大小,请调用{@link OH_NNTensorDesc_GetByteSize}。\n + * + * 如果张量形状是动态可变的,则此方法将返回错误码,elementCount将为0。\n + * + * 如果tensorDescelementCount为空指针,则此方法将返回错误码。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param elementCount 张量返回的元素个数。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetElementCount(const NN_TensorDesc *tensorDesc, size_t *elementCount); + +/** + * @brief 获取{@link NN_TensorDesc}的字节大小。 + * + * 调用该方法可获取指定{@link NN_TensorDesc}实例的字节大小。\n + * + * 如果张量形状是动态可变的,该方法将返回错误码,byteSize将为0。\n + * + * 如果需要获取张量数据的元素个数,请调用{@link OH_NNTensorDesc_GetElementCount}。\n + * + * 如果tensorDescbyteSize为空指针,则此方法将返回错误码。\n + * + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param byteSize 返回的张量字节大小。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetByteSize(const NN_TensorDesc *tensorDesc, size_t *byteSize); + +/** +* @brief 从{@link NN_TensorDesc}创建一个{@link NN_Tensor}实例。 + * + * 该方法使用{@link OH_NNTensorDesc_GetByteSize}计算张量数据的字节大小,并为其分配设备内存。设备驱动将直接通过“零拷贝”方式获取张量数据。 + * + * 请注意,此方法会将tensorDesc复制到{@link NN_Tensor}中,因此,当tensorDesc不再使用时, + * 您应该调用{@link OH_NNTensorDesc_Destroy}方法销毁它。\n + * + * 如果张量形状是动态的,此方法将返回错误码。\n + * + * deviceID表示所选设备。如果为0,则默认使用设备列表中的第1台设备。\n + * + * 必须提供tensorDesc,如果它是空指针,则返回错误码。\n + * + * 调用{@link OH_NNTensor_DestroyTensor}释放{@link NN_Tensor}实例。\n + * + * @param deviceID 设备 ID。如果为0,则默认使用当前设备列表中的第1台设备。 + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @return 指向{@link NN_Tensor}实例的指针。 + * @since 11 + * @version 1.0 + */ +NN_Tensor* OH_NNTensor_Create(size_t deviceID, NN_TensorDesc *tensorDesc); + +/** +* @brief 创建一个指定大小的{@link NN_Tensor}实例。 + * + * 此方法使用size作为张量数据的字节大小,并为其分配设备内存。设备将直接通过“零拷贝”方式获取张量数据。 + * + * 注意,此方法会将tensorDesc复制到{@link NN_Tensor}中。因此,当tensorDesc不再使用时, + * 您应该调用{@link OH_NNTensorDesc_Destroy}方法销毁它。\n + * + * deviceID表示所选设备ID。如果为0,则使用第1台设备。\n + * + * tensorDesc必须提供,如果它是空指针,则该方法返回错误码。 + * size必须不小于tensorDesc的字节大小。否则,此方法将返回错误码。如果张量形状是动态的,不会检查size。\n + * + * 调用{@link OH_NNTensor_DestroyTensor}释放{@link NN_Tensor}实例。\n + * + * @param deviceID 设备id。如果为0,则默认使用当前设备列表中的第1台设备。 + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param size 需要分配的张量数据的大小。 + * @return 指向{@link NN_Tensor}实例的指针。 + * @since 11 + * @version 1.0 + */ +NN_Tensor* OH_NNTensor_CreateWithSize(size_t deviceID, NN_TensorDesc *tensorDesc, size_t size); + +/** + * @brief 创建一个具有指定fd的{@link NN_Tensor}实例。 + * + * 此方法复用传递参数fd对应的共享内存。它可能来自另一个{@link NN_Tensor}实例。 + * 当调用{@link OH_NNTensor_DestroyTensor}方法释放该方法创建的张量时,不会释放该张量数据的内存。\n + * + * 请注意,此方法会将tensorDesc复制到{@link NN_Tensor}中。因此,当tensorDesc不再使用时, + * 您应该调用{@link OH_NNTensorDesc_Destroy}方法销毁它。\n + * + * 请注意,tensorDesc会与{@link NN_Tensor}实例一起释放。因此,您创建的每一个{@link NN_Tensor}实例必须使用一个新的、 + * 尚未被另一个{@link NN_Tensor}实例使用过的tensorDesc;否则,tensorDesc将被释放两次,这将会导致双重释放的内存崩溃。 + * + * deviceID表示所选设备。如果为0,则默认使用当前设备列表中的第1台设备。\n + * + * 必须提供tensorDesc,如果为空指针,则该方法返回错误码。\n + * + * 调用{@link OH_NNTensor_DestroyTensor}释放{@link NN_Tensor}实例。\n + * + * @param deviceID 设备 ID,如果为0,则默认使用当前设备列表中的第1台设备。 + * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 + * @param fd 要使用的共享内存的Fd。 + * @param size 要使用的共享内存的大小。 + * @param offset 要使用的共享内存的偏移量。 + * @return 指向{@link NN_Tensor}实例的指针。 + * @since 11 + * @version 1.0 + */ +NN_Tensor* OH_NNTensor_CreateWithFd(size_t deviceID, + NN_TensorDesc *tensorDesc, + int fd, + size_t size, + size_t offset); + +/** + * @brief 释放一个{@link NN_Tensor}实例。 + * + * 当不再使用{@link NN_Tensor}实例时,需要调用该方法释放该实例。否则,将发生内存泄漏。\n + * + * 如果tensor*tensor为空指针,则此方法将返回错误码,并且不执行释放。\n + * + * @param 指向{@link NN_Tensor}实例的tensorDesc二级指针。 + * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅 @link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensor_Destroy(NN_Tensor **tensor); + +/** + * @brief 获取{@link NN_Tensor}的{@link NN_TensorDesc}实例。 + * + * 调用该方法获取指定{@link NN_Tensor}实例的内部{@link NN_TensorDesc}实例指针。 + * 您可以从返回的{@link NN_TensorDesc}实例中获取各种类型的张量属性,例如名称/格式/数据类型/形状。\n + * + * 您不应将返回的{@link NN_TensorDesc}实例销毁,因为它指向了{@link NN_Tensor}的内部实例。 + * 否则,一旦调用{@link OH_NNTensor_Destroy}将会发生双重释放的内存崩溃。 + * + * 如果Tensor是空指针,则此方法将会返回空指针。\n + * + * @param tensor 指向{@link NN_Tensor}实例的指针。 + * @return 指向{@link NN_TensorDesc}实例的指针,如果执行失败,则返回空指针。 + * @since 11 + * @version 1.0 + */ +NN_TensorDesc* OH_NNTensor_GetTensorDesc(const NN_Tensor *tensor); + +/** + * @brief 获取{@link NN_Tensor}的数据缓存。 + * + * 您可以从张量数据缓存读取/写入数据。数据缓存是从设备上的共享内存映射的,因此设备驱动将通过这种“零拷贝”方式直接获取张量数据。 + * + * 请注意,您只能访问长度为(size - offset)的张量数据缓存,否则可能会发生堆崩溃的错误。\n + * + * 如果Tensor是空指针,则此方法将会返回空指针。\n + * + * @param tensor 指向{@link NN_Tensor}实例的指针。 + * @return 指向张量数据缓冲区的指针。如果操作失败,则返回空指针。 + * @since 11 + * @version 1.0 + */ +void* OH_NNTensor_GetDataBuffer(const NN_Tensor *tensor); + +/** + * @brief 获取{@link NN_Tensor}的数据内存Fd。 + * + * fd 对应了一块设备共享内存,可以通过{@link OH_NNTensor_CreateWithFd}被另外一个{@link NN_Tensor}使用。 \n + * + * 如果tensorfd为空指针,该接口将返回错误。 \n + * + * @param tensor 指向{@link NN_Tensor}实例的指针。 + * @param fd 返回的张量内存Fd。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensor_GetFd(const NN_Tensor *tensor, int *fd); + +/** + * @brief 获取{@link NN_Tensor}的数据内存Fd的大小。 + * + * size与接口{@link OH_NNTensor_CreateWithSize}和{@link OH_NNTensor_CreateWithFd}的参数size相同, + * 但对于通过{@link OH_NNTensor_Create}创建的张量,size等于张量数据实际占用字节数。 \n + * + * 注意张量数据仅能使用共享内存Fd中的[offset, size]一段。 \n + * + * 如果tensorsize为空指针,该接口将返回错误。 \n + * + * @param tensor 指向{@link NN_Tensor}实例的指针。 + * @param size 返回的张量内存Fd的大小。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensor_GetSize(const NN_Tensor *tensor, size_t *size); + +/** + * @brief 获取{@link NN_Tensor}数据内存Fd的偏移量。 + * + * 偏移量offset 对应于张量的共享内存Fd,可以通过{@link OH_NNTensor_CreateWithFd}接口,连同Fd、size一起被另外的{@link NN_Tensor}使用。 \n + * + * 如果tensoroffset为空指针,该接口将返回错误。 \n + * + * 注意张量数据仅能使用共享内存Fd中的[offset, size]一段。 \n + * + * @param tensor 指向{@link NN_Tensor}实例的指针。 + * @param offset 返回的张量内存Fd的偏移量。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensor_GetOffset(const NN_Tensor *tensor, size_t *offset); + +/** + * @brief 创建{@link OH_NNExecutor}类型的执行器实例 + * + * 该接口接受一个{@link OH_NNCompilation}实例,构造一个与硬件关联的模型推理执行器。通过{@link OH_NNExecutor_SetInput}设置模型输入数据, + * 设置输入数据后,调用{@link OH_NNExecutor_Run}方法执行推理,最后通过 + * {@link OH_NNExecutor_SetOutput}获取计算结果。 \n + * + * 调用该接口创建{@link OH_NNExecutor}实例后,如果不需要创建其他执行器,可以安全释放{@link OH_NNCompilation}实例。 \n + * + * @param compilation 指向{@link OH_NNCompilation}实例的指针。 + * @return 返回指向{@link OH_NNExecutor}实例的指针。 + * @since 9 + * @version 1.0 + */ +OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); + +/** + * @brief 获取输出张量的维度信息。 + * + * 调用{@link OH_NNExecutor_Run}完成单次推理后,该接口获取指定输出的维度信息和维数。在动态形状输入、输出的场景中常用。 \n + * + * 作为输出参数,*shape不能为空指针,否则会返回错误。例如你应该定义int32_t* tensorShape = NULL,然后将&tensorShape + * 作为参数传入。 \n + * + * 你无需释放shape的内存,它会随executor一起被释放。 + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在获取输出张量 + * 维度信息时,三个输出的索引值分别为{0, 1, 2}。 + * @param shape 指向int32_t数组的指针,数组中的每个元素值,是输出张量在每个维度上的长度。 + * @param shapeLength uint32_t类型的指针,返回输出的维数。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, + uint32_t outputIndex, + int32_t **shape, + uint32_t *shapeLength); + +/** + * @brief 销毁执行器实例,释放执行器占用的内存。 + * + * 调用{@link OH_NNExecutor_Construct}创建的执行器实例需要调用该接口主动释放,否则将造成内存泄漏。 \n + * + * 如果executor为空指针或者*executor为空指针,该接口仅打印警告日志,不执行销毁操作。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的二级指针。 + * @since 9 + * @version 1.0 + */ +void OH_NNExecutor_Destroy(OH_NNExecutor **executor); + +/** + * @brief 获取输入张量的数量。 + * + * 可以先从executor中获取输入张量的数量,然后通过{@link OH_NNExecutor_CreateInputTensorDesc}由指定张量索引创建张量描述。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputCount 返回的输入张量数量。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_GetInputCount(const OH_NNExecutor *executor, size_t *inputCount); + +/** + * @brief 获取输出张量的数量。 + * + * 可以先从executor中获取输出张量的数量,然后通过{@link OH_NNExecutor_CreateOutputTensorDesc}由指定张量索引创建张量描述。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param outputCount 返回的输出张量数量。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_GetOutputCount(const OH_NNExecutor *executor, size_t *outputCount); + +/** + * @brief 由指定索引值创建一个输入张量的描述。 + * + * 输入张量描述包含了该张量的所有属性值。如果索引值超出了inputCount - 1,接口将返回错误。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param index 输入张量的索引值 + * @return 指向{@link NN_TensorDesc}实例的指针. + * @since 11 + * @version 1.0 + */ +NN_TensorDesc* OH_NNExecutor_CreateInputTensorDesc(const OH_NNExecutor *executor, size_t index); + +/** + * @brief 由指定索引值创建一个输出张量的描述。 + * + * 输出张量描述包含了该张量的所有属性值。如果索引值超出了outputCount - 1,接口将返回错误。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param index 输出张量的索引值 + * @return 指向{@link NN_TensorDesc}实例的指针. + * @since 11 + * @version 1.0 + */ +NN_TensorDesc* OH_NNExecutor_CreateOutputTensorDesc(const OH_NNExecutor *executor, size_t index); + +/** + * @brief 获取所有输入张量的维度范围。 + * + * 当输入张量具有动态shape时,它在不同硬件上支持的维度范围可能是不同的,可以通过该接口获取当前设备上支持的维度范围。 + * *minInputDims保存了指定输入张量的最小维度(维度数与shape匹配),而*maxInputDims则保存了最大维度。 + * 例如,一个输入张量具有动态shape [-1, -1, -1, 3],那么当前设备上它的*minInputDims可以是[1, 10, 10, 3],而*maxInputDims + * 可以是[100, 1024, 1024, 3]。 \n + * + * 注意,如果索引值超出了inputCount - 1,接口将返回错误。 \n + * + * 作为输出参数,*minInputDims*maxInputDims不能为空指针,否则会返回错误。例如,你应该定义int32_t* minInDims = NULL,然后将&minInDims + * 作为参数传入。 \n + * + * 你无需释放*minInputDims*maxInputDims的内存,它会随executor一起被释放。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param index 输入张量的索引值 + * @param minInputDims 返回的数组的指针,保存了指定输入张量的最小维度(维度数与shape匹配) + * @param maxInputDims 返回的数组的指针,保存了指定输入张量的最大维度(维度数与shape匹配) + * @param shapeLength 返回的输入张量的维度数量,与shape一致。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_GetInputDimRange(const OH_NNExecutor *executor, + size_t index, + size_t **minInputDims, + size_t **maxInputDims, + size_t *shapeLength); + +/** + * @brief 设置异步推理结束后的回调处理函数。 + * + * 回调函数的定义见{@link NN_OnRunDone}。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param onRunDone 回调函数句柄{@link NN_OnRunDone}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetOnRunDone(OH_NNExecutor *executor, NN_OnRunDone onRunDone); + +/** + * @brief 设置异步推理执行期间设备驱动服务突然死亡时的回调处理函数。 + * + * 回调函数的定义见{@link NN_OnServiceDied}。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param onServiceDied 回调函数句柄{@link NN_OnServiceDied}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetOnServiceDied(OH_NNExecutor *executor, NN_OnServiceDied onServiceDied); + +/** + * @brief 执行同步推理。 + * + * 需要先通过{@link OH_NNTensor_Create}、{@link OH_NNTensor_CreateWithSize}或{@link OH_NNTensor_CreateWithFd}接口创建 + * 输入和输出张量。然后由{@link OH_NNTensor_GetDataBuffer}获取张量数据指针并向其拷贝输入数据。执行器会通过执行推理产生推理结果, + * 然后将结果写入输出张量中。 \n + * + * 如果输出张量具有动态shape,可以通过{@link OH_NNExecutor_GetOutputShape}接口获取输出张量的实际shape。或者通过 + * {@link OH_NNTensor_GetTensorDesc}接口从输入张量中获取张量描述,然后通过{@link OH_NNTensorDesc_GetShape}接口获取实际shape。 \n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputTensor 输入张量的数组。 + * @param inputCount 输入张量的数量。 + * @param outputTensor 输出张量的数组。 + * @param outputCount 输出张量的数量。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_RunSync(OH_NNExecutor *executor, + NN_Tensor *inputTensor[], + size_t inputCount, + NN_Tensor *outputTensor[], + size_t outputCount); + +/** + * @brief 执行异步推理。 + * + * 需要先通过{@link OH_NNTensor_Create}、{@link OH_NNTensor_CreateWithSize}或{@link OH_NNTensor_CreateWithFd}接口创建 + * 输入和输出张量。然后由{@link OH_NNTensor_GetDataBuffer}获取张量数据指针并向其拷贝输入数据。执行器会通过执行推理产生推理结果, + * 然后将结果写入输出张量中。 \n + * + * 如果输出张量具有动态shape,可以通过{@link OH_NNExecutor_GetOutputShape}接口获取输出张量的实际shape。或者通过 + * {@link OH_NNTensor_GetTensorDesc}接口从输入张量中获取张量描述,然后通过{@link OH_NNTensorDesc_GetShape}接口获取实际shape。 \n + * + * 该接口是非阻塞式的,调用后会立刻返回。回调函数句柄可以通过{@link OH_NNExecutor_SetOnRunDone}和{@link OH_NNExecutor_SetOnServiceDied} + * 来设置。如果推理时长超过了timeout,会立刻终止推理,{@link NN_OnRunDone}的errCode参数会返回{@link OH_NN_TIMEOUT}错误。 \n + * + * userData是区分不同次异步执行的标识符,会作为回调函数的第一个参数返回,你可使用能够区分不同次执行的任意数据作为标识符。 + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputTensor 输入张量的数组。 + * @param inputCount 输入张量的数量。 + * @param outputTensor 输出张量的数组。 + * @param outputCount 输出张量的数量。 + * @param timeout 异步推理的超时时间(单位ms),例如1000。 + * @param userData 异步执行的标识符。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_RunAsync(OH_NNExecutor *executor, + NN_Tensor *inputTensor[], + size_t inputCount, + NN_Tensor *outputTensor[], + size_t outputCount, + int32_t timeout, + void* userData); + +/** + * @brief 获取对接到 Neural Network Runtime 的硬件ID。 + * + * 每个硬件存在唯一且固定的ID,该接口通过uin32_t数组返回当前设备上已经对接的硬件ID。 \n + * + * 硬件ID通过size_t数组返回,数组的每个元素是单个硬件的ID值。数组内存由内部进行管理,在下次调用该接口前,数据指针将一直有效。 \n + * + * @param allDevicesID 指向size_t数组的指针。要求传入的(*allDevicesID)为空指针,否则返回{@link OH_NN_INVALID_PARAMETER}。 + * @param deviceCount uint32_t类型的指针,用于返回(*allDevicesID)的长度。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNDevice_GetAllDevicesID(const size_t **allDevicesID, uint32_t *deviceCount); + +/** + * @brief 获取指定硬件的名称。 + * + * 通过deviceID指定计算硬件,获取硬件的名称。硬件ID需要调用{@link OH_NNDevice_GetAllDevicesID}获取。如果deviceID是0,那么会默认 + * 使用设备列表中的第一个设备。 \n + * + * (*name)是一个C风格的字符串,以'\0'作为结束符。 \n + * + * *name必须是一个空指针,否则接口会返回{@link OH_NN_INVALID_PARAMETER}错误。例如,你应该定义char* deviceName = NULL, + * 然后将&deviceName作为参数传入。 \n + * + * @param deviceID 指定硬件ID。如果deviceID是0,那么会默认使用设备列表中的第一个设备。 + * @param name 指向char数组的指针,保存返回的硬件名称。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNDevice_GetName(size_t deviceID, const char **name); + +/** + * @brief 获取指定硬件的类别信息。 + * + * 通过deviceID指定计算硬件,获取硬件的类别。如果deviceID是0,那么会默认使用设备列表中的第一个设备。目前支持的设备类型有: + * - CPU设备:OH_NN_CPU + * - GPU设备:OH_NN_GPU + * - 机器学习专用加速器:OH_NN_ACCELERATOR + * - 不属于以上类型的其他硬件类型:OH_NN_OTHERS \n + * + * @param deviceID 指定硬件ID。如果deviceID是0,那么会默认使用设备列表中的第一个设备。 + * @param deviceType 指向{@link OH_NN_DeviceType}实例的指针,返回硬件的类别信息。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNDevice_GetType(size_t deviceID, OH_NN_DeviceType *deviceType); + +#ifdef __cplusplus +} +#endif // __cplusplus + +/** @} */ +#endif // NEURAL_NETWORK_CORE_H diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index 7c2f506e..91646b7d 100644 --- a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -21,35 +21,106 @@ * * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 - * @version 1.0 + * @version 2.0 */ /** * @file neural_network_runtime.h * - * @brief Neural Network Runtime部件接口定义,AI推理框架通过Neural Network Runtime提供的Native接口,完成模型构造与编译,并在加速硬件上执行推理计算。 - * - * 注意:Neural Network Runtime的接口目前均不支持多线程调用。\n + * @brief Neural Network Runtime模块接口定义,AI推理框架使用Neural Network Runtime提供的Native接口,完成模型构建。 + * + * 注意:Neural Network Runtime的接口目前均不支持多线程并发调用.\n * * @library libneural_network_runtime.so * @since 9 - * @version 1.0 + * @version 2.0 */ #ifndef NEURAL_NETWORK_RUNTIME_H #define NEURAL_NETWORK_RUNTIME_H #include "neural_network_runtime_type.h" +#include "neural_network_core.h" +#include "neural_network_runtime_compat.h" #ifdef __cplusplus extern "C" { #endif +/** + * @brief 创建一个{@link NN_QuantParam}实例。 + * + * 创建{@link NN_QuantParam}实例后,调用{@link OH_NNQuantParam_SetScales}、{@link OH_NNQuantParam_SetZeroPoints}或 + * {@link OH_NNQuantParam_SetNumBits}设置它的属性值,并调用{@link OH_NNModel_SetTensorQuantParams}将它设置到Tensor中。 + * 最后需要调用{@link OH_NNQuantParam_Destroy}销毁它,以避免内存泄露。 \n + * + * @return 指向{@link NN_QuantParam}实例的指针。 + * @since 11 + * @version 1.0 + */ +NN_QuantParam *OH_NNQuantParam_Create(); + +/** + * @brief 设置{@link NN_QuantParam}的缩放系数。 + * + * 参数quantCount<\b>是Tensor中量化参数的数量,例如对于per-channel量化,quantCount<\b>就是通道数量。 \n + * + * @param quantParams 指向{@link NN_QuantParam}实例的指针。 + * @param scales Tensor所有量化参数的缩放系数构成的数组。 + * @param quantCount Tensor量化参数的数量。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNQuantParam_SetScales(NN_QuantParam *quantParams, const double *scales, size_t quantCount); + +/** + * @brief 设置{@link NN_QuantParam}的零点。 + * + * 参数quantCount<\b>是Tensor中量化参数的数量,例如对于per-channel量化,quantCount<\b>就是通道数量。 \n + * + * @param quantParams 指向{@link NN_QuantParam}实例的指针。 + * @param zeroPoints Tensor所有量化参数的零点构成的数组。 + * @param quantCount Tensor量化参数的数量。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNQuantParam_SetZeroPoints(NN_QuantParam *quantParams, const int32_t *zeroPoints, size_t quantCount); + +/** + * @brief 设置{@link NN_QuantParam}的量化位数。 + * + * 参数quantCount<\b>是Tensor中量化参数的数量,例如对于per-channel量化,quantCount<\b>就是通道数量。 \n + * + * @param quantParams 指向{@link NN_QuantParam}实例的指针。 + * @param numBits Tensor所有量化参数的量化位数构成的数组。 + * @param quantCount Tensor量化参数的数量。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNQuantParam_SetNumBits(NN_QuantParam *quantParams, const uint32_t *numBits, size_t quantCount); + +/** + * @brief 销毁{@link NN_QuantParam}实例。 + * + * 当设置{@link NN_QuantParam}实例到一个Tensor中后,如果不再使用该实例,就需要销毁它以避免内存泄漏。 \n + * + * 如果quantParams*quantParams是空指针,那么该接口仅打印警告日志,不会执行销毁操作。 \n + * + * @param quantParams 指向{@link NN_QuantParam}实例的双指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNQuantParam_Destroy(NN_QuantParam **quantParams); + /** * @brief 创建{@link OH_NNModel}类型的模型实例,搭配OH_NNModel模块提供的其他接口,完成模型实例的构造。 * * 在开始构图前,先调用{@link OH_NNModel_Construct}创建模型实例,根据模型的拓扑结构,调用 - * {@link OH_NNModel_AddTensor}、{@link OH_NNModel_AddOperation}和 + * {@link OH_NNModel_AddTensorToModel}、{@link OH_NNModel_AddOperation}和 * {@link OH_NNModel_SetTensorData}方法,填充模型的数据节点和算子节点;然后调用 * {@link OH_NNModel_SpecifyInputsAndOutputs}指定模型的输入和输出;当构造完模型的拓扑结构,调用 * {@link OH_NNModel_Finish}完成模型的构建。\n @@ -63,30 +134,29 @@ extern "C" { OH_NNModel *OH_NNModel_Construct(void); /** - * @brief 向模型实例中添加张量 + * @brief 向模型实例中添加张量。 * - * Neural Network Runtime模型中的数据节点和算子参数均由模型的张量构成。本方法根据tensor,向model实 + * Neural Network Runtime模型中的数据节点和算子参数均由模型的张量构成。该接口根据{@link NN_TensorDesc}向model实 * 例中添加张量。张量添加的顺序是模型中记录张量的索引值,{@link OH_NNModel_SetTensorData}、 - * {@link OH_NNModel_AddOperation}和{@link OH_NNModel_SpecifyInputsAndOutputs} - * 方法根据该索引值,指定不同的张量。\n + * {@link OH_NNModel_AddOperation}和{@link OH_NNModel_SpecifyInputsAndOutputs}接口根据该索引值,指定不同的张量。\n * * Neural Network Runtime支持动态形状输入和输出。在添加动态形状的数据节点时,需要将tensor.dimensions中支持动态 * 变化的维度设置为-1。例如:一个四维tensor,将tensor.dimensions设置为[1, -1, 2, 2],表示其第二个维度支持 * 动态变化。\n * * @param model 指向{@link OH_NNModel}实例的指针。 - * @param tensor {@link OH_NN_Tensor}张量的指针,tensor指定了添加到模型实例中张量的属性。 + * @param tensorDesc {@link NN_TensorDesc}张量的指针,{@link NN_TensorDesc}指定了添加到模型实例中张量的属性。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 9 * @version 1.0 */ -OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *tensor); +OH_NN_ReturnCode OH_NNModel_AddTensorToModel(OH_NNModel *model, const NN_TensorDesc *tensorDesc); /** - * @brief 设置张量的数值 + * @brief 设置张量的数值。 * - * 对于具有常量值的张量(如模型的权重),需要在构图阶段使用本方法设置数值。张量的索引值根据张量添加进模型的顺序决定,张量的添加参考 - * {@link OH_NNModel_AddTensor}。\n + * 对于具有常量值的张量(如模型的权重),需要在构图阶段使用该接口设置数值。张量的索引值根据张量添加进模型的顺序决定,张量的添加参考 + * {@link OH_NNModel_AddTensorToModel}。\n * * @param model 指向{@link OH_NNModel}实例的指针。 * @param index 张量的索引值。 @@ -99,17 +169,41 @@ OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *ten OH_NN_ReturnCode OH_NNModel_SetTensorData(OH_NNModel *model, uint32_t index, const void *dataBuffer, size_t length); /** - * @brief 向模型实例中添加算子 + * @brief 设置张量的量化参数。 + * + * @param model 指向{@link OH_NNModel}实例的指针。 + * @param index 张量的索引值。 + * @param quantParam 指向{@link NN_QuantParam}的指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNModel_SetTensorQuantParams(OH_NNModel *model, uint32_t index, NN_QuantParam *quantParam); + +/** + * @brief 设置张量的类型,参考{@link OH_NN_TensorType}。 + * + * @param model 指向{@link OH_NNModel}实例的指针。 + * @param index 张量的索引值。 + * @param tensorType 张量类型。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode} + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNModel_SetTensorType(OH_NNModel *model, uint32_t index, OH_NN_TensorType tensorType); + +/** + * @brief 向模型实例中添加算子。 * - * 本方法向模型实例中添加算子,算子类型由op指定,算子的参数、输入和输出由paramIndices、inputIndices和 - * outputIndices指定。本方法将对算子参数的属性和输入输出的数量进行校验,这些属性需要在调用 - * {@link OH_NNModel_AddTensor}添加张量的时候正确设置。每个算子期望的参数、输入和输出属性请参考 + * 该接口向模型实例中添加算子,算子类型由op指定,算子的参数、输入和输出由paramIndices、inputIndices和 + * outputIndices指定。该接口将对算子参数的属性和输入输出的数量进行校验,这些属性需要在调用 + * {@link OH_NNModel_AddTensorToModel}添加张量的时候正确设置。每个算子期望的参数、输入和输出属性请参考 * {@link OH_NN_OperationType}。\n * * paramIndices、inputIndices和outputIndices中存储的是张量的索引值,每个索引值根据张量添加进模型的顺序决定,正确 - * 设置并添加算子要求准确设置每个张量的索引值。张量的添加参考{@link OH_NNModel_AddTensor}。\n + * 设置并添加算子要求准确设置每个张量的索引值。张量的添加参考{@link OH_NNModel_AddTensorToModel}。\n * - * 如果添加算子时,添加了额外的参数(非算子需要的参数),本方法返回{@link OH_NN_INVALID_PARAMETER};如果没有设置算子参数, + * 如果添加算子时,添加了额外的参数(非算子需要的参数),该接口返回{@link OH_NN_INVALID_PARAMETER};如果没有设置算子参数, * 则算子按默认值设置缺省的参数,默认值请参考{@link OH_NN_OperationType}。\n * * @param model 指向{@link OH_NNModel}实例的指针。 @@ -128,19 +222,18 @@ OH_NN_ReturnCode OH_NNModel_AddOperation(OH_NNModel *model, const OH_NN_UInt32Array *outputIndices); /** - * @brief 指定模型的输入输出 + * @brief 指定模型的输入和输出张量的索引值。 * - * 模型实例需要指定张量作为端到端的输入和输出,设置为输入和输出的张量不能使用{@link OH_NNModel_SetTensorData}设置 - * 数值,需要在执行阶段调用OH_NNExecutor的方法设置输入、输出数据。\n + * 模型实例需要指定张量作为端到端的输入和输出张量。注意设置一个张量为输入或输出的张量后,就不能再通过调用{@link OH_NNModel_SetTensorData} + * 设置张量数据,而需要在执行阶段调用OH_NNExecutor的方法设置输入或输出张量数据。\n * - * 张量的索引值根据张量添加进模型的顺序决定,张量的添加参考 - * {@link OH_NNModel_AddTensor}。\n + * 张量的索引值根据张量添加进模型的顺序决定,张量的添加参考{@link OH_NNModel_AddTensorToModel}。\n * - * 暂时不支持异步设置模型输入输出。\n + * 暂时不支持异步设置模型输入和输出张量。\n * * @param model 指向{@link OH_NNModel}实例的指针。 - * @param inputIndices OH_NN_UInt32Array实例的指针,指定算子的输入。 - * @param outputIndices OH_NN_UInt32Array实例的指针,指定算子的输出。 + * @param inputIndices OH_NN_UInt32Array实例的指针,指定算子的输入张量。 + * @param outputIndices OH_NN_UInt32Array实例的指针,指定算子的输出张量。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 9 * @version 1.0 @@ -150,16 +243,16 @@ OH_NN_ReturnCode OH_NNModel_SpecifyInputsAndOutputs(OH_NNModel *model, const OH_NN_UInt32Array *outputIndices); /** - * @brief 完成模型构图 + * @brief 完成模型构图。 * - * 完成模型拓扑结构的搭建后,调用本方法指示构图已完成。在调用本方法后,无法进行额外的构图操作,调用 - * {@link OH_NNModel_AddTensor}、{@link OH_NNModel_AddOperation}、 + * 完成模型拓扑结构的搭建后,调用该接口指示构图已完成。在调用该接口后,无法进行额外的构图操作,调用 + * {@link OH_NNModel_AddTensorToModel}、{@link OH_NNModel_AddOperation}、 * {@link OH_NNModel_SetTensorData}和 * {@link OH_NNModel_SpecifyInputsAndOutputs}将返回 * {@link OH_NN_OPERATION_FORBIDDEN}。\n * * 在调用{@link OH_NNModel_GetAvailableOperations}和{@link OH_NNCompilation_Construct} - * 之前,必须先调用本方法完成构图。\n + * 之前,必须先调用该接口完成构图。\n * * @param model 指向{@link OH_NNModel}实例的指针。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 @@ -171,11 +264,11 @@ OH_NN_ReturnCode OH_NNModel_Finish(OH_NNModel *model); /** * @brief 释放模型实例。 * - * 调用{@link OH_NNModel_Construct}创建的模型实例需要调用本方法主动释放,否则将造成内存泄漏。\n + * 调用{@link OH_NNModel_Construct}创建的模型实例需要调用该接口主动释放,否则将造成内存泄漏。\n * - * 如果model为空指针或者*model为空指针,本方法只打印warning日志,不执行释放逻辑。\n + * 如果model为空指针或者*model为空指针,该接口仅打印警告日志,不执行销毁操作。\n * - * @param model 指向{@link OH_NNModel}实例的二级指针。模型实例销毁后,本方法将*model主动设置为空指针。 + * @param model 指向{@link OH_NNModel}实例的二级指针。模型实例销毁后,该接口会将*model主动设置为空指针。 * @since 9 * @version 1.0 */ @@ -187,12 +280,12 @@ void OH_NNModel_Destroy(OH_NNModel **model); * 查询底层硬件对模型实例内每个算子的支持情况,硬件由deviceID指定,结果将通过isSupported指向的数组表示。如果支持第i个算子,则 * (*isSupported)[i] == true,否则为 false。\n * - * 本方法成功执行后,(*isSupported)将指向记录算子支持情况的bool数组,数组长度和模型实例的算子数量相等。该数组对应的内存由 - * Neural Network Runtime管理,在模型实例销毁或再次调用本方法后自动销毁。\n + * 该接口成功执行后,(*isSupported)将指向记录算子支持情况的bool数组,数组长度和模型实例的算子数量相等。该数组对应的内存由 + * Neural Network Runtime管理,在模型实例销毁或再次调用该接口后自动销毁。\n * * @param model 指向{@link OH_NNModel}实例的指针。 * @param deviceID 指定查询的硬件ID,通过{@link OH_NNDevice_GetAllDevicesID}获取。 - * @param isSupported 指向bool数组的指针。调用本方法时,要求(*isSupported)为空指针,否则返回 + * @param isSupported 指向bool数组的指针。调用该接口时,要求(*isSupported)为空指针,否则返回 * {@link OH_NN_INVALID_PARAMETER}。 * @param opCount 模型实例中算子的数量,对应(*isSupported)数组的长度。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 @@ -204,436 +297,6 @@ OH_NN_ReturnCode OH_NNModel_GetAvailableOperations(OH_NNModel *model, const bool **isSupported, uint32_t *opCount); - -/** - * @brief 创建{@link OH_NNCompilation}类型的编译实例 - * - * 使用OH_NNModel模块完成模型的构造后,借助OH_NNCompilation模块提供的接口,将模型传递到底层硬件完成编译。本方法接受一个 - * {@link OH_NNModel}实例,创建出{@link OH_NNCompilation}实例;通过 - * {@link OH_NNCompilation_SetDevice}方法,设置编译的设备,最后调用 - * {@link OH_NNCompilation_Build}完成编译。\n - * - * 除了计算硬件的选择,OH_NNCompilation模块支持模型缓存、性能偏好、优先级设置、float16计算等特性,参考以下方法: - * - {@link OH_NNCompilation_SetCache} - * - {@link OH_NNCompilation_SetPerformanceMode} - * - {@link OH_NNCompilation_SetPriority} - * - {@link OH_NNCompilation_EnableFloat16}\n - * - * 调用本方法创建{@link OH_NNCompilation}后,{@link OH_NNModel}实例可以释放。\n - * - * @param model 指向{@link OH_NNModel}实例的指针。 - * @return 返回一个指向{@link OH_NNCompilation}实例的指针。 - * @since 9 - * @version 1.0 - */ -OH_NNCompilation *OH_NNCompilation_Construct(const OH_NNModel *model); - -/** - * @brief 指定模型编译和计算的硬件。 - * - * 编译阶段,需要指定模型编译和执行计算的硬件设备。先调用{@link OH_NNDevice_GetAllDevicesID}获取可用的设备ID, - * 通过{@link OH_NNDevice_GetType}和{@link OH_NNDevice_GetType}获取设备信息后,将期望编译执行的 - * 设备ID传入本方法进行设置。\n - * - * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @param deviceID 指定的硬件ID。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNCompilation_SetDevice(OH_NNCompilation *compilation, size_t deviceID); - -/** - * @brief 设置编译后的模型缓存路径和缓存版本。 - * - * 在支持缓存的硬件上,模型在硬件驱动层编译后可以保存为缓存文件,下次编译时直接从缓存文件读取模型,减少重新编译的耗时。本方法接受缓存路径和版本,根据缓存 - * 路径中和版本的不同情况,本方法采取不同的行为:\n - * - * - 缓存路径指定的目录下没有文件: - * 将编译后的模型缓存到目录下,设置缓存版本等于version。\n - * - * - 缓存路径指定的目录下存在完整的缓存文件,且版本号 == version: - * 读取路径下的缓存文件,传递到底层硬件中转换为可以执行的模型实例。\n - * - * - 缓存路径指定的目录下存在完整的缓存文件,但版本号 < version: - * 路径下的缓存文件需要更新,模型在底层硬件完成编译后,覆写路径下的缓存文件,将版本号更新为version。\n - * - * - 缓存路径指定的目录下存在完整的缓存文件,但版本号 > version: - * 路径下的缓存文件版本高于version,不读取缓存文件,同时返回{@link OH_NN_INVALID_PARAMETER}错误码。\n - * - * - 缓存路径指定的目录下的缓存文件不完整或没有缓存文件的访问权限: - * 返回{@link OH_NN_INVALID_FILE}错误码。\n - * - * - 缓存目录不存在,或者没有访问权限: - * 返回{@link OH_NN_INVALID_PATH}错误码。\n - * - * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @param cachePath 模型缓存文件目录,本方法在cachePath目录下为不同的硬件创建缓存目录。建议每个模型使用单独的缓存目录。 - * @param version 缓存版本。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNCompilation_SetCache(OH_NNCompilation *compilation, const char *cachePath, uint32_t version); - -/** - * @brief 设置模型计算的性能模式。 - * - * Neural Network Runtime 支持为模型计算设置性能模式,满足低功耗到极致性能的需求。如果编译阶段没有调用本方法设置性能模式, - * 编译实例为模型默认分配{@link OH_NN_PERFORMANCE_NONE}模式。在{@link OH_NN_PERFORMANCE_NONE} - * 模式下,硬件按默认的性能模式执行计算。\n - * - * 在不支持性能模式设置的硬件上调用本方法,将返回{@link OH_NN_UNAVALIDABLE_DEVICE}错误码。\n - * - * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @param performanceMode 指定性能模式,可选的性能模式参考{@link OH_NN_PerformanceMode}。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNCompilation_SetPerformanceMode(OH_NNCompilation *compilation, - OH_NN_PerformanceMode performanceMode); - -/** - * @brief 设置模型计算的优先级。 - * - * Neural Network Runtime 支持为模型设置计算优先级,优先级仅作用于相同uid进程创建的模型,不同uid进程、不同设备的优先级不会 - * 相互影响。\n - * - * 在不支持优先级设置的硬件上调用本方法,将返回{@link OH_NN_UNAVALIDABLE_DEVICE}错误码。\n - * - * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @param priority 指定优先级,可选的优先级参考{@link OH_NN_Priority}。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNCompilation_SetPriority(OH_NNCompilation *compilation, OH_NN_Priority priority); - -/** - * @brief 是否以float16的浮点数精度计算。 - * - * Neural Network Runtime目前仅支持构造float32浮点模型和int8量化模型。在支持float16精度的硬件上调用本方法, - * float32浮点数精度的模型将以float16的精度执行计算,以减少内存占用和执行时间。\n - * - * 在不支持float16精度计算的硬件上调用本方法,将返回{@link OH_NN_UNAVALIDABLE_DEVICE}错误码。\n - * - * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @param enableFloat16 Float16低精度计算标志位。设置为true时,执行Float16推理;设置为false时,执行float32推理。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNCompilation_EnableFloat16(OH_NNCompilation *compilation, bool enableFloat16); - -/** - * @brief 进行模型编译 - * - * 完成编译配置后,调用本方法指示模型编译已完成。编译实例将模型和编译选项推送至硬件设备进行编译。在调用本方法后,无法进行额外的编译操作,调用 - * {@link OH_NNCompilation_SetDevice}、{@link OH_NNCompilation_SetCache}、 - * {@link OH_NNCompilation_SetPerformanceMode}、 - * {@link OH_NNCompilation_SetPriority}和{@link OH_NNCompilation_EnableFloat16} - * 方法将返回{@link OH_NN_OPERATION_FORBIDDEN}。\n - * - * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNCompilation_Build(OH_NNCompilation *compilation); - -/** - * @brief 释放Compilation对象。 - * - * 调用{@link OH_NNCompilation_Construct}创建的编译实例需要调用本方法主动释放,否则将造成内存泄漏。\n - * - * 如果compilation为空指针或者*compilation为空指针,本方法只打印warning日志,不执行释放逻辑。\n - * - * @param compilation 指向{@link OH_NNCompilation}实例的二级指针。编译实例销毁后,本方法将*compilation主动设置为空指针。 - * @since 9 - * @version 1.0 - */ -void OH_NNCompilation_Destroy(OH_NNCompilation **compilation); - - -/** - * @brief 创建{@link OH_NNExecutor}类型的执行器实例 - * - * 本方法接受一个编译器,构造一个与硬件关联的模型推理执行器。通过{@link OH_NNExecutor_SetInput}设置模型输入数据, - * 设置输入数据后,调用{@link OH_NNExecutor_Run}方法执行推理,最后通过 - * {@link OH_NNExecutor_SetOutput}获取计算结果。\n - * - * 调用本方法创建{@link OH_NNExecutor}实例后,如果不需要创建其他执行器,可以安全释放{@link OH_NNCompilation}实例。\n - * - * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @return 返回指向{@link OH_NNExecutor}实例的指针。 - * @since 9 - * @version 1.0 - */ -OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); - -/** - * @brief 设置模型单个输入的数据。 - * - * 本方法将dataBuffer中,长度为length个字节的数据,拷贝到底层硬件的共享内存。inputIndex指定设置的输入,tensor用于设置输入的 - * 形状、类型、量化参数等信息。\n - * - * 由于Neural Network Runtime支持动态输入形状的模型,在固定形状输入和动态形状输入的场景下,本方法采取不同的处理策略: - * - * - 固定形状输入的场景:tensor各属性必须和构图阶段调用{@link OH_NNModel_AddTensor}添加的张量保持一致; - * - 动态形状输入的场景:在构图阶段,由于动态输入的形状不确定,调用本方法时,要求tensor.dimensions中的每个值必须大于0, - * 以确定执行计算阶段输入的形状。设置形状时,只允许调整数值为-1的维度。假设在构图阶段,输入A的维度为 - * [-1, 224, 224, 3],调用本方法时,只能调整第一个维度的尺寸,如:[3, 224, 224, 3]。调整其他维度将返回 - * {@link OH_NN_INVALID_PARAMETER}。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在设置输入的阶段, - * 三个输入的索引值分别为{0, 1, 2}。 - * @param tensor 设置输入数据对应的张量。 - * @param dataBuffer 指向输入数据的指针。 - * @param length 数据缓冲区的字节长度。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, - uint32_t inputIndex, - const OH_NN_Tensor *tensor, - const void *dataBuffer, - size_t length); - -/** - * @brief 设置模型单个输出的缓冲区。 - * - * 本方法将dataBuffer指向的缓冲区与outputIndex指定的输出绑定,缓冲区的长度由length指定。\n - * - * 调用{@link OH_NNExecutor_Run}完成单次模型推理后,Neural Network Runtime将比对dataBuffer指向的缓冲区与 - * 输出数据的长度,根据不同情况,返回不同结果:\n - * - * - 如果缓冲区大于或等于数据长度:则推理后的结果将拷贝至缓冲区,并返回{@link OH_NN_SUCCESS},可以通过访问dataBuffer读取推理结果。 - * - 如果缓冲区小于数据长度:则{@link OH_NNExecutor_Run}将返回{@link OH_NN_INVALID_PARAMETER}, - * 并输出日志告知缓冲区太小的信息。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在设置输出缓冲区时, - * 三个输出的索引值分别为{0, 1, 2}。 - * @param dataBuffer 指向输出数据的指针。 - * @param length 数据缓冲区的字节长度。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, - uint32_t outputIndex, - void *dataBuffer, - size_t length); - -/** - * @brief 获取输出张量的维度信息。 - * - * 调用{@link OH_NNExecutor_Run}完成单次推理后,本方法获取指定输出的维度信息和维数。在动态形状输入、输出的场景中常用。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在获取输出张量 - * 维度信息时,三个输出的索引值分别为{0, 1, 2}。 - * @param shape 指向int32_t数组的指针,数组中的每个元素值,是输出张量在每个维度上的长度。 - * @param shapeLength uint32_t类型的指针,返回输出的维数。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, - uint32_t outputIndex, - int32_t **shape, - uint32_t *shapeLength); - -/** - * @brief 执行推理。 - * - * 在执行器关联的硬件上,执行模型的端到端推理计算。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_Run(OH_NNExecutor *executor); - -/** - * @brief 在硬件上为单个输入申请共享内存。 - * - * Neural Network Runtime 提供主动申请硬件共享内存的方法。通过指定执行器和输入索引值,本方法在单个输入关联的硬件 - * 上,申请大小为length的共享内存,通过{@link OH_NN_Memory}实例返回。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在申请输入内存时, - * 三个输入的索引值分别为{0, 1, 2}。 - * @param length 申请的内存字节。 - * @return 指向{@link OH_NN_Memory}实例的指针。 - * @since 9 - * @version 1.0 - */ -OH_NN_Memory *OH_NNExecutor_AllocateInputMemory(OH_NNExecutor *executor, uint32_t inputIndex, size_t length); - -/** - * @brief 在硬件上为单个输出申请共享内存。 - * - * Neural Network Runtime 提供主动申请硬件共享内存的方法。通过指定执行器和输出索引值,本方法在单个输出关联的硬件 - * 上,申请大小为length的共享内存,通过{@link OH_NN_Memory}实例返回。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在申请输出内存时, - * 三个输出的索引值分别为{0, 1, 2}。 - * @param length 申请的内存字节。 - * @return 指向{@link OH_NN_Memory}实例的指针。 - * @since 9 - * @version 1.0 - */ -OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, size_t length); - -/** - * @brief 释放{@link OH_NN_Memory}实例指向的输入内存。 - * - * 调用{@link OH_NNExecutor_AllocateInputMemory}创建的内存实例,需要主动调用本方法进行释放,否则将造成内存泄漏。 - * inputIndex和memory的对应关系需要和创建内存实例时保持一致。\n - * - * 如果memory或*memory为空指针,本方法只打印warning日志,不执行释放逻辑。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在释放输入内存时, - * 三个输入的索引值分别为{0, 1, 2}。 - * @param memory 指向{@link OH_NN_Memory}实例的二级指针。共享内存销毁后,本方法将*memory主动设置为空指针。 - * @since 9 - * @version 1.0 - */ -void OH_NNExecutor_DestroyInputMemory(OH_NNExecutor *executor, uint32_t inputIndex, OH_NN_Memory **memory); - -/** - * @brief 释放{@link OH_NN_Memory}实例指向的输出内存。 - * - * 调用{@link OH_NNExecutor_AllocateOutputMemory}创建的内存实例,需要主动调用本方法进行释放,否则将造成内存泄漏。 - * outputIndex和memory的对应关系需要和创建内存实例时保持一致。\n - * - * 如果memory或*memory为空指针,本方法只打印warning日志,不执行释放逻辑。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在释放输出内存时, - * 三个输出的索引值分别为{0, 1, 2}。 - * @param memory 指向{@link OH_NN_Memory}实例的二级指针。共享内存销毁后,本方法将*memory主动设置为空指针。 - * @since 9 - * @version 1.0 - */ -void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, OH_NN_Memory **memory); - -/** - * @brief 将{@link OH_NN_Memory}实例指向的硬件共享内存,指定为单个输入使用的共享内存。 - * - * 在需要自行管理内存的场景下,本方法将执行输入和{@link OH_NN_Memory}内存实例绑定。执行计算时,底层硬件从内存实例指向的共享内存 - * 中读取输入数据。通过本方法,可以实现设置输入、执行计算、读取输出的并发执行,提升数据流的推理效率。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在指定输入的共享 - * 内存时,三个输入的索引值分别为{0, 1, 2}。 - * @param tensor 指向{@link OH_NN_Tensor}的指针,设置单个输入所对应的张量。 - * @param memory 指向{@link OH_NN_Memory}的指针。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, - uint32_t inputIndex, - const OH_NN_Tensor *tensor, - const OH_NN_Memory *memory); - -/** - * @brief 将{@link OH_NN_Memory}实例指向的硬件共享内存,指定为单个输出使用的共享内存。 - * - * 在需要自行管理内存的场景下,本方法将执行输出和{@link OH_NN_Memory}内存实例绑定。执行计算时,底层硬件将计算结果直接写入内存实例指向 - * 的共享内存。通过本方法,可以实现设置输入、执行计算、读取输出的并发执行,提升数据流的推理效率。\n - * - * @param executor 执行器。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在指定输出的共享 - * 内存时,三个输出的索引值分别为{0, 1, 2}。 - * @param memory 指向{@link OH_NN_Memory}的指针。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_SetOutputWithMemory(OH_NNExecutor *executor, - uint32_t outputIndex, - const OH_NN_Memory *memory); - -/** - * @brief 销毁执行器实例,释放执行器占用的内存。 - * - * 调用{@link OH_NNExecutor_Construct}创建的执行器实例需要调用本方法主动释放,否则将造成内存泄漏。\n - * - * 如果executor为空指针或者*executor为空指针,本方法只打印warning日志,不执行释放逻辑。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的二级指针。 - * @since 9 - * @version 1.0 - */ -void OH_NNExecutor_Destroy(OH_NNExecutor **executor); - - -/** - * @brief 获取对接到 Neural Network Runtime 的硬件ID。 - * - * 每个硬件在 Neural Network Runtime 中存在唯一且固定ID,本方法通过uin32_t数组返回当前设备上已经对接的硬件ID。\n - * - * 硬件ID通过size_t数组返回,数组的每个元素是单个硬件的ID值。数组内存由Neural Network Runtime管理。在下次调用本方法前, - * 数据指针有效。\n - * - * @param allDevicesID 指向size_t数组的指针。要求传入的(*allDevicesID)为空指针,否则返回 - * {@link OH_NN_INVALID_PARAMETER}。 - * @param deviceCount uint32_t类型的指针,用于返回(*allDevicesID)的长度。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNDevice_GetAllDevicesID(const size_t **allDevicesID, uint32_t *deviceCount); - -/** - * @brief 获取指定硬件的类型信息。 - * - * 通过deviceID指定计算硬件,获取硬件的名称。硬件ID需要调用{@link OH_NNDevice_GetAllDevicesID}获取。\n - * - * @param deviceID 指定硬件ID。 - * @param name 指向char数组的指针,要求传入的(*char)为空指针,否则返回 - * {@link OH_NN_INVALID_PARAMETER}。(*name)以C风格字符串保存硬件名称,数组以'\0'结尾。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNDevice_GetName(size_t deviceID, const char **name); - -/** - * @brief 获取指定硬件的类别信息。 - * - * 通过deviceID指定计算硬件,获取硬件的类别。目前 Neural Network Runtime 支持的设备类型有: - * - CPU设备:OH_NN_CPU - * - GPU设备:OH_NN_GPU - * - 机器学习专用加速器:OH_NN_ACCELERATOR - * - 不属于以上类型的其他硬件类型:OH_NN_OTHERS\n - * - * @param deviceID 指定硬件ID。 - * @param deviceType 指向{@link OH_NN_DeviceType}实例的指针,返回硬件的类别信息。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNDevice_GetType(size_t deviceID, OH_NN_DeviceType *deviceType); - #ifdef __cplusplus } #endif // __cplusplus diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_compat.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_compat.h new file mode 100644 index 00000000..2c3b722f --- /dev/null +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_compat.h @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup NeuralNeworkRuntime + * @{ + * + * @brief 提供Neural Network Runtime加速模型推理的相关接口。 + * + * @Syscap SystemCapability.Ai.NeuralNetworkRuntime + * @since 9 + * @version 2.0 + */ + +/** + * @file neural_network_runtime_compat.h + * + * @brief 该文件中定义的接口均为兼容先前版本的保留接口,会标记为“deprecated”并在5个版本后删除。建议使用neural_network_core.h和 + * neural_network_runtime.h定义的替代接口实现对应功能。 + * + * 注意:Neural Network Runtime的接口目前均不支持多线程并发调用.\n + * + * @library libneural_network_runtime.so + * @since 11 + * @version 1.0 + */ + +#ifndef NEURAL_NETWORK_RUNTIME_COMPAT_H +#define NEURAL_NETWORK_RUNTIME_COMPAT_H + +#include "neural_network_runtime_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 向模型实例中添加张量 + * + * Neural Network Runtime模型中的数据节点和算子参数均由模型的张量构成,该接口根据tensor,向model实 + * 例中添加张量。张量添加的顺序由模型中记录张量的索引值来确定,{@link OH_NNModel_SetTensorData}、 + * {@link OH_NNModel_AddOperation}和{@link OH_NNModel_SpecifyInputsAndOutputs} + * 接口根据该索引值,指定不同的张量。\n + * + * Neural Network Runtime支持动态形状输入和输出。在添加动态形状的数据节点时,需要将tensor.dimensions中支持动态 + * 变化的维度设置为-1。例如:一个四维tensor,将tensor.dimensions设置为[1, -1, 2, 2],表示其第二个维度支持 + * 动态变化。\n + * + * @param model 指向{@link OH_NNModel}实例的指针。 + * @param tensor {@link OH_NN_Tensor}张量的指针,tensor指定了添加到模型实例中张量的属性。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNModel_AddTensorToModel} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *tensor); + +/** + * @brief 设置模型单个输入的数据。 + * + * 该接口将dataBuffer中,长度为length个字节的数据,拷贝到底层硬件的共享内存。inputIndex指定设置的输入,tensor用于设置输入的 + * 形状、类型、量化参数等信息。\n + * + * 由于Neural Network Runtime支持动态输入形状的模型,在固定形状输入和动态形状输入的场景下,该接口采取不同的处理策略: + * + * - 固定形状输入的场景:tensor各属性必须和构图阶段调用{@link OH_NNModel_AddTensor}添加的张量保持一致; + * - 动态形状输入的场景:在构图阶段,由于动态输入的形状不确定,调用该接口时,要求tensor.dimensions中的每个值必须大于0, + * 以确定执行计算阶段输入的形状。设置形状时,只允许调整数值为-1的维度。假设在构图阶段,输入A的维度为 + * [-1, 224, 224, 3],调用该接口时,只能调整第一个维度的尺寸,如:[3, 224, 224, 3]。调整其他维度将返回 + * {@link OH_NN_INVALID_PARAMETER}。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在设置输入的阶段, + * 三个输入的索引值分别为{0, 1, 2}。 + * @param tensor 设置输入数据对应的张量。 + * @param dataBuffer 指向输入数据的指针。 + * @param length 数据缓冲区的字节长度。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, + uint32_t inputIndex, + const OH_NN_Tensor *tensor, + const void *dataBuffer, + size_t length); + +/** + * @brief 设置模型单个输出的缓冲区。 + * + * 该接口将dataBuffer指向的缓冲区与outputIndex指定的输出绑定,缓冲区的长度由length指定。\n + * + * 调用{@link OH_NNExecutor_Run}完成单次模型推理后,Neural Network Runtime将比对dataBuffer指向的缓冲区与 + * 输出数据的长度,根据不同情况,返回不同结果:\n + * + * - 如果缓冲区大于或等于数据长度:则推理后的结果将拷贝至缓冲区,并返回{@link OH_NN_SUCCESS},可以通过访问dataBuffer读取推理结果。 + * - 如果缓冲区小于数据长度:则{@link OH_NNExecutor_Run}将返回{@link OH_NN_INVALID_PARAMETER}, + * 并输出日志告知缓冲区太小的信息。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在设置输出缓冲区时, + * 三个输出的索引值分别为{0, 1, 2}。 + * @param dataBuffer 指向输出数据的指针。 + * @param length 数据缓冲区的字节长度。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, + uint32_t outputIndex, + void *dataBuffer, + size_t length); + +/** + * @brief 执行推理。 + * + * 在执行器关联的硬件上,执行模型的端到端推理计算。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_Run(OH_NNExecutor *executor); + +/** + * @brief 在硬件上为单个输入申请共享内存。 + * + * Neural Network Runtime 提供主动申请硬件共享内存的方法。通过指定执行器和输入索引值,该接口在单个输入关联的硬件 + * 上,申请大小为length的共享内存,通过{@link OH_NN_Memory}实例返回。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在申请输入内存时, + * 三个输入的索引值分别为{0, 1, 2}。 + * @param length 申请的内存字节。 + * @return 指向{@link OH_NN_Memory}实例的指针。 + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_CreateWithSize} + * @since 9 + * @version 1.0 + */ +OH_NN_Memory *OH_NNExecutor_AllocateInputMemory(OH_NNExecutor *executor, uint32_t inputIndex, size_t length); + +/** + * @brief 在硬件上为单个输出申请共享内存。 + * + * Neural Network Runtime 提供主动申请硬件共享内存的方法。通过指定执行器和输出索引值,该接口在单个输出关联的硬件 + * 上,申请大小为length的共享内存,通过{@link OH_NN_Memory}实例返回。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在申请输出内存时, + * 三个输出的索引值分别为{0, 1, 2}。 + * @param length 申请的内存字节。 + * @return 指向{@link OH_NN_Memory}实例的指针。 + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_CreateWithSize} + * @since 9 + * @version 1.0 + */ +OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, size_t length); + +/** + * @brief 释放{@link OH_NN_Memory}实例指向的输入内存。 + * + * 调用{@link OH_NNExecutor_AllocateInputMemory}创建的内存实例,需要主动调用该接口进行释放,否则将造成内存泄漏。 + * inputIndex和memory的对应关系需要和创建内存实例时保持一致。\n + * + * 如果memory或*memory为空指针,该接口仅打印警告日志,不执行销毁操作。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在释放输入内存时, + * 三个输入的索引值分别为{0, 1, 2}。 + * @param memory 指向{@link OH_NN_Memory}实例的二级指针。共享内存销毁后,该接口将*memory主动设置为空指针。 + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_Destroy} + * @since 9 + * @version 1.0 + */ +void OH_NNExecutor_DestroyInputMemory(OH_NNExecutor *executor, uint32_t inputIndex, OH_NN_Memory **memory); + +/** + * @brief 释放{@link OH_NN_Memory}实例指向的输出内存。 + * + * 调用{@link OH_NNExecutor_AllocateOutputMemory}创建的内存实例,需要主动调用该接口进行释放,否则将造成内存泄漏。 + * outputIndex和memory的对应关系需要和创建内存实例时保持一致。\n + * + * 如果memory或*memory为空指针,该接口仅打印警告日志,不执行销毁操作。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在释放输出内存时, + * 三个输出的索引值分别为{0, 1, 2}。 + * @param memory 指向{@link OH_NN_Memory}实例的二级指针。共享内存销毁后,该接口将*memory主动设置为空指针。 + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_Destroy} + * @since 9 + * @version 1.0 + */ +void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, OH_NN_Memory **memory); + +/** + * @brief 将{@link OH_NN_Memory}实例指向的硬件共享内存,指定为单个输入使用的共享内存。 + * + * 在需要自行管理内存的场景下,该接口将执行输入和{@link OH_NN_Memory}内存实例绑定。执行计算时,底层硬件从内存实例指向的共享内存 + * 中读取输入数据。通过该接口,可以实现设置输入、执行计算、读取输出的并发执行,提升数据流的推理效率。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在指定输入的共享 + * 内存时,三个输入的索引值分别为{0, 1, 2}。 + * @param tensor 指向{@link OH_NN_Tensor}的指针,设置单个输入所对应的张量。 + * @param memory 指向{@link OH_NN_Memory}的指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, + uint32_t inputIndex, + const OH_NN_Tensor *tensor, + const OH_NN_Memory *memory); + +/** + * @brief 将{@link OH_NN_Memory}实例指向的硬件共享内存,指定为单个输出使用的共享内存。 + * + * 在需要自行管理内存的场景下,该接口将执行输出和{@link OH_NN_Memory}内存实例绑定。执行计算时,底层硬件将计算结果直接写入内存实例指向 + * 的共享内存。通过该接口,可以实现设置输入、执行计算、读取输出的并发执行,提升数据流的推理效率。\n + * + * @param executor 执行器。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在指定输出的共享 + * 内存时,三个输出的索引值分别为{0, 1, 2}。 + * @param memory 指向{@link OH_NN_Memory}的指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetOutputWithMemory(OH_NNExecutor *executor, + uint32_t outputIndex, + const OH_NN_Memory *memory); + +#ifdef __cplusplus +} +#endif // __cplusplus + +/** @} */ +#endif // NEURAL_NETWORK_RUNTIME_COMPAT_H diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index 0118ed45..443029b6 100644 --- a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -21,7 +21,7 @@ * * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 - * @version 1.0 + * @version 2.0 */ /** @@ -31,7 +31,7 @@ * * @library libneural_network_runtime.so * @since 9 - * @version 1.0 + * @version 2.0 */ #ifndef NEURAL_NETWORK_RUNTIME_TYPE_H @@ -45,7 +45,7 @@ extern "C" { #endif /** - * @brief Neural Network Runtime的模型句柄 + * @brief 模型句柄 * * @since 9 * @version 1.0 @@ -53,7 +53,7 @@ extern "C" { typedef struct OH_NNModel OH_NNModel; /** - * @brief Neural Network Runtime的编译器句柄 + * @brief 编译器句柄 * * @since 9 * @version 1.0 @@ -61,13 +61,37 @@ typedef struct OH_NNModel OH_NNModel; typedef struct OH_NNCompilation OH_NNCompilation; /** - * @brief Neural Network Runtime的执行器句柄 + * @brief 执行器句柄 * * @since 9 * @version 1.0 */ typedef struct OH_NNExecutor OH_NNExecutor; +/** + * @brief 量化参数的句柄. + * + * @since 11 + * @version 1.0 + */ +typedef struct NN_QuantParam NN_QuantParam; + +/** + * @brief Tensor描述的句柄. + * + * @since 11 + * @version 1.0 + */ +typedef struct NN_TensorDesc NN_TensorDesc; + +/** + * @brief Tensor句柄. + * + * @since 11 + * @version 1.0 + */ +typedef struct NN_Tensor NN_Tensor; + /** * @brief 硬件的性能模式 * @@ -108,7 +132,7 @@ typedef enum { * @brief Neural Network Runtime 定义的错误码类型 * * @since 9 - * @version 1.0 + * @version 2.0 */ typedef enum { /** 操作成功 */ @@ -125,12 +149,65 @@ typedef enum { OH_NN_NULL_PTR = 5, /** 无效文件 */ OH_NN_INVALID_FILE = 6, - /** 硬件发生错误,错误可能包含:HDL服务崩溃 */ + /** 硬件发生错误,错误可能包含:HDL服务崩溃 + * @deprecated since 11 + * @useinstead {@link OH_NN_UNAVAILABLE_DEVICE} + */ OH_NN_UNAVALIDABLE_DEVICE = 7, /** 非法路径 */ - OH_NN_INVALID_PATH = 8 + OH_NN_INVALID_PATH = 8, + /** 执行超时 + * @since 11 + */ + OH_NN_TIMEOUT = 9, + /** 未支持 + * @since 11 + */ + OH_NN_UNSUPPORTED = 10, + /** 连接异常 + * @since 11 + */ + OH_NN_CONNECTION_EXCEPTION = 11, + /** 保存cache异常 + * @since 11 + */ + OH_NN_SAVE_CACHE_EXCEPTION = 12, + /** 动态shape + * @since 11 + */ + OH_NN_DYNAMIC_SHAPE = 13, + /** 硬件发生错误,错误可能包含:HDL服务崩溃 + * @since 11 + */ + OH_NN_UNAVAILABLE_DEVICE = 14 } OH_NN_ReturnCode; +/** + * @brief 异步推理结束后的回调处理函数句柄。 + * + * 使用第一个参数userData来辨别希望获取哪一次异步推理执行,userData和调用异步推理{@link OH_NNExecutor_RunAsync}接口时 + * 传入的参数userData是一致的。使用第二个参数errCode({@link OH_NN_ReturnCode}类型)来获取该次异步推理的返回状态。 \n + * + * @param userData 异步推理执行的标识符,和调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数userData一致。 + * @param errCode 该次异步推理的返回状态({@link OH_NN_ReturnCode}类型)。 + * @param output 异步推理的输出Tensor,和调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数outputTensor一致 + * @param outputCount 异步推理输出Tensor的数量,和调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数outputCount一致 + * @since 11 + * @version 1.0 + */ +typedef void (*NN_OnRunDone)(void*, OH_NN_ReturnCode, void* [], int32_t); + +/** + * @brief 异步推理执行期间设备驱动服务突然死亡时的回调处理函数句柄。 + * + * You should recompile the model if this callback function is called. 如果该回调函数被调用,你需要重新编译模型。 \n + * + * @param userData 异步推理执行的标识符,和调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数userData一致。 + * @since 11 + * @version 1.0 + */ +typedef void (*NN_OnServiceDied)(void*); + /** * @brief Neural Network Runtime 融合算子中激活函数的类型 * @@ -150,7 +227,7 @@ typedef enum : int8_t { * @brief 张量数据的排布类型 * * @since 9 - * @version 1.0 + * @version 2.0 */ typedef enum { /** 当张量没有特定的排布类型时(如标量或矢量),使用本枚举值 */ @@ -159,6 +236,10 @@ typedef enum { OH_NN_FORMAT_NCHW = 1, /** 当张量按照NHWC的格式排布数据时,使用本枚举值 */ OH_NN_FORMAT_NHWC = 2 + /** 当张量按照ND的格式排布数据时,使用本枚举值. + * @since 11 + */ + OH_NN_FORMAT_ND = 3 } OH_NN_Format; /** @@ -1608,6 +1689,8 @@ typedef struct OH_NN_UInt32Array { \end{cases} \f] * + * @deprecated since 11 + * @useinstead {@link NN_QuantParam} * @since 9 * @version 1.0 */ @@ -1629,6 +1712,8 @@ typedef struct OH_NN_QuantParam { * * 通常用于构造模型图中的数据节点和算子参数,在构造张量时需要明确数据类型、维数、维度信息和量化信息。 * + * @deprecated since 11 + * @useinstead {@link NN_TensorDesc} * @since 9 * @version 1.0 */ @@ -1650,6 +1735,8 @@ typedef struct OH_NN_Tensor { /** * @brief 内存结构体 * + * @deprecated since 11 + * @useinstead {@link NN_Tensor} * @since 9 * @version 1.0 */ -- Gitee From ff00a7d3bf39cf13022cf29aeb42b1be739dd89b Mon Sep 17 00:00:00 2001 From: zhoujie223 Date: Thu, 14 Dec 2023 16:28:57 +0800 Subject: [PATCH 0163/2135] =?UTF-8?q?IssueNo:=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=9B=B4=E6=96=B0-VONR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 接口文档更新-VONR Sig: SIG_Telephony Feature or Bugfix: Feature Binary Source: No Signed-off-by: zhoujie223 --- zh-cn/device_api/hdi/ril/v1_1/IRil.idl | 15 +++++++++++++++ zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/zh-cn/device_api/hdi/ril/v1_1/IRil.idl b/zh-cn/device_api/hdi/ril/v1_1/IRil.idl index 009d84b0..36e50354 100644 --- a/zh-cn/device_api/hdi/ril/v1_1/IRil.idl +++ b/zh-cn/device_api/hdi/ril/v1_1/IRil.idl @@ -565,6 +565,21 @@ interface IRil { */ [oneway] SetBarringPassword([in] int slotId, [in] int serialId, [in] struct SetBarringInfo setBarringInfo); + /** + * @brief 设置Vonr开关。 + * + * @param slotId 表示卡槽ID。 + * @param serialId 表示请求的序列化ID。 + * @param status 表示Vonr开关状态,0表示OFF,1表示ON。 + * + * @return 0 表示执行成功。 + * @return 非零值 表示操作失败。 + * + * @since 4.0 + * @version 1.1 + */ + [oneway] SetVonrSwitch([in] int slotId, [in] int serialId, [in] int status); + /** * @brief 激活数据业务。 * diff --git a/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl b/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl index 67743101..be98cf6c 100644 --- a/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl +++ b/zh-cn/device_api/hdi/ril/v1_1/IRilCallback.idl @@ -491,6 +491,16 @@ import ohos.hdi.ril.v1_1.Types; */ SetBarringPasswordResponse([in] struct RilRadioResponseInfo responseInfo); + /** + * @brief 设置Vonr开关的响应。 + * + * @param responseInfo 表示通用响应信息,例如卡槽ID,请求序列ID等,详见{@link RilRadioResponseInfo}。 + * + * @since 4.0 + * @version 1.1 + */ + SetVonrSwitchResponse([in] struct RilRadioResponseInfo responseInfo); + /** * @brief 数据业务建立与断开等状态变化上报。 * -- Gitee From 6116a0a20f6d1721fc53000bcc8cd2836c6e9900 Mon Sep 17 00:00:00 2001 From: xiaobjy Date: Fri, 15 Dec 2023 10:52:02 +0800 Subject: [PATCH 0164/2135] =?UTF-8?q?imagesource=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=98=E6=9B=B4=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiaobjy --- .../native_sdk/media/image/image_source_mdk.h | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/zh-cn/native_sdk/media/image/image_source_mdk.h b/zh-cn/native_sdk/media/image/image_source_mdk.h index 235bce82..f32d1f13 100644 --- a/zh-cn/native_sdk/media/image/image_source_mdk.h +++ b/zh-cn/native_sdk/media/image/image_source_mdk.h @@ -291,6 +291,7 @@ struct OhosImageSourceInfo { * @Syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 + * @deprecated since 11 */ struct OhosImageSource { /** 图像源资源标识符,接受文件资源或者base64资源 */ @@ -414,10 +415,97 @@ struct OhosImageSourceUpdateData { * @Syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 + * @deprecated since 11 + * @useinstead image#OH_ImageSource_CreateFromUri + * @useinstead image#OH_ImageSource_CreateFromFd + * @useinstead image#OH_ImageSource_CreateFromData */ int32_t OH_ImageSource_Create(napi_env env, struct OhosImageSource* src, struct OhosImageSourceOps* ops, napi_value *res); +/** + * @brief 通过给定的标识符URI 和 {@link OhosImageSourceOps}结构体,获取JavaScript native层APIImageSource对象。 + * + * @param env 表明JNI环境的指针。 + * @param uri 表明图像源资源标识符,接受文件资源或者base64资源. + * @param size 表明图像源资源URI的长度. + * @param ops 表明创建一个图像源的选项。查看{@link OhosImageSourceOps}。 + * @param res 表明JavaScript native层APIImageSource对象的指针。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * @see {@link OhosImageSourceOps} + * + * @Syscap SystemCapability.Multimedia.Image + * @since 11 + * @version 4.1 + */ +int32_t OH_ImageSource_CreateFromUri(napi_env env, char* uri, size_t size, + struct OhosImageSourceOps* ops, napi_value *res); + +/** + * @brief 通过给定的文件描述符 fd 和 {@link OhosImageSourceOps}结构体,获取JavaScript native层APIImageSource对象。 + * + * @param env 表明JNI环境的指针。 + * @param fd 表明图像源文件资源描述符。 + * @param ops 表明创建一个图像源的选项。查看{@link OhosImageSourceOps}。 + * @param res 表明JavaScript native层APIImageSource对象的指针。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * @see {@link OhosImageSourceOps} + * + * @Syscap SystemCapability.Multimedia.Image + * @since 11 + * @version 4.1 + */ +int32_t OH_ImageSource_CreateFromFd(napi_env env, int32_t fd, + struct OhosImageSourceOps* ops, napi_value *res); + +/** + * @brief 通过给定的图像源缓冲区资源 data 和 {@link OhosImageSourceOps}结构体,获取JavaScript native层APIImageSource对象。 + * + * @param env 表明JNI环境的指针。 + * @param data 表明图像源缓冲区资源,接受格式化包缓冲区或者base64缓冲区。 + * @param dataSize 表明图像源缓冲区资源大小。 + * @param ops 表明创建一个图像源的选项。查看{@link OhosImageSourceOps}。 + * @param res 表明JavaScript native层APIImageSource对象的指针。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * @see {@link OhosImageSourceOps} + * + * @Syscap SystemCapability.Multimedia.Image + * @since 11 + * @version 4.1 + */ +int32_t OH_ImageSource_CreateFromData(napi_env env, uint8_t* data, size_t dataSize, + struct OhosImageSourceOps* ops, napi_value *res); + +/** + * @brief 通过给定的资源描述符 {@link RawFileDescriptor} 和 {@link OhosImageSourceOps}结构体, + * 获取JavaScript native层APIImageSource对象。 + * + * @param env 表明JNI环境的指针。 + * @param rawFile 表明图像源资源描述符。 + * @param ops 表明创建一个图像源的选项。查看{@link OhosImageSourceOps}。 + * @param res 表明JavaScript native层APIImageSource对象的指针。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * @see {@link OhosImageSourceOps} + * + * @Syscap SystemCapability.Multimedia.Image + * @since 11 + * @version 4.1 + */ +int32_t OH_ImageSource_CreateFromRawFile(napi_env env, RawFileDescriptor rawFile, + struct OhosImageSourceOps* ops, napi_value *res); + /** * @brief 通过给定的infomations{@link OhosImageSource}和{@link OhosImageSourceOps}结构, * 获取增量类型的JavaScript Native API ImageSource对象,图像数据应通过{@link-OH_ImageSource_UpdateData}更新。 @@ -449,10 +537,34 @@ int32_t OH_ImageSource_Create(napi_env env, struct OhosImageSource* src, * @Syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 + * @deprecated since 11 + * @useinstead image#OH_ImageSource_CreateIncrementalFromData */ int32_t OH_ImageSource_CreateIncremental(napi_env env, struct OhosImageSource* source, struct OhosImageSourceOps* ops, napi_value *res); +/** + * @brief 通过给定的图像源缓冲区资源 data 和 {@link OhosImageSourceOps}结构体, + * 获取增量类型的JavaScript Native API ImageSource对象,图像数据应通过{@link-OH_ImageSource_UpdateData}更新。 + * + * @param env 表明JNI环境的指针。 + * @param data 表明图像源缓冲区资源,接受格式化包缓冲区或者base64缓冲区。 + * @param dataSize 表明图像源缓冲区资源大小。 + * @param ops 表明创建一个图像源的选项。查看{@link OhosImageSourceOps}。 + * @param res 表明JavaScript native层APIImageSource对象的指针。 + * @return 如果操作成功返回{@link OHOS_IMAGE_RESULT_SUCCESS}; + * 如果参数错误,返回{@link IMAGE_RESULT_BAD_PARAMETER}; + * 如果 JNI 环境异常,返回{@link IMAGE_RESULT_JNI_ENV_ABNORMAL}; + * 如果参数无效,{@link IMAGE_RESULT_INVALID_PARAMETER}; + * @see {@link OhosImageSourceOps} + * + * @Syscap SystemCapability.Multimedia.Image + * @since 11 + * @version 4.1 + */ +int32_t OH_ImageSource_CreateIncrementalFromData(napi_env env, uint8_t* data, size_t dataSize, + struct OhosImageSourceOps* ops, napi_value *res); + /** * @brief 获取所有支持的解码格式元标记。 * -- Gitee From 90947bc1bce7c407cf65c9d935b9bb24757813ec Mon Sep 17 00:00:00 2001 From: shawn_he Date: Mon, 18 Dec 2023 10:31:49 +0800 Subject: [PATCH 0165/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/context.h | 1 + en/native_sdk/ai/mindspore/data_type.h | 1 + en/native_sdk/ai/mindspore/format.h | 1 + en/native_sdk/ai/mindspore/model.h | 286 +++++++++++++++++++++++-- en/native_sdk/ai/mindspore/status.h | 13 +- en/native_sdk/ai/mindspore/tensor.h | 39 ++-- en/native_sdk/ai/mindspore/types.h | 64 ++++++ 7 files changed, 361 insertions(+), 44 deletions(-) diff --git a/en/native_sdk/ai/mindspore/context.h b/en/native_sdk/ai/mindspore/context.h index 2c39756b..b86ee469 100644 --- a/en/native_sdk/ai/mindspore/context.h +++ b/en/native_sdk/ai/mindspore/context.h @@ -29,6 +29,7 @@ * * @brief Provides **Context** APIs for configuring runtime information. * + * File to include: * @library libmindspore_lite_ndk.so * @since 9 */ diff --git a/en/native_sdk/ai/mindspore/data_type.h b/en/native_sdk/ai/mindspore/data_type.h index 2eeeae0b..a5fa4587 100644 --- a/en/native_sdk/ai/mindspore/data_type.h +++ b/en/native_sdk/ai/mindspore/data_type.h @@ -29,6 +29,7 @@ * * @brief Declares tensor data types. * + * File to include: * @library libmindspore_lite_ndk.so * @since 9 */ diff --git a/en/native_sdk/ai/mindspore/format.h b/en/native_sdk/ai/mindspore/format.h index 961b463c..7e63c0ae 100644 --- a/en/native_sdk/ai/mindspore/format.h +++ b/en/native_sdk/ai/mindspore/format.h @@ -29,6 +29,7 @@ * * @brief Declares tensor data formats. * + * File to include: * @library libmindspore_lite_ndk.so * @since 9 */ diff --git a/en/native_sdk/ai/mindspore/model.h b/en/native_sdk/ai/mindspore/model.h index 19e3986f..cb6d6fce 100644 --- a/en/native_sdk/ai/mindspore/model.h +++ b/en/native_sdk/ai/mindspore/model.h @@ -29,6 +29,7 @@ * * @brief Provides model-related APIs for model creation and inference. * + * File to include: * @library libmindspore_lite_ndk.so * @since 9 */ @@ -52,7 +53,15 @@ extern "C" typedef void *OH_AI_ModelHandle; /** - * @brief Defines the tensor array structure, which is used to store the tensor array pointer and tensor array length. + * @brief Defines the pointer to a training configuration object. + * + * @since 11 + */ +typedef void *OH_AI_TrainCfgHandle; + +/** + * @brief Defines the tensor array structure, which is used to store the tensor array pointer + * and tensor array length. * * @since 9 */ @@ -65,11 +74,17 @@ typedef struct OH_AI_TensorHandleArray } OH_AI_TensorHandleArray; /** - * @brief Defines dimension information. The maximum dimension is set by {@link MS_MAX_SHAPE_NUM}. + * @brief Defines the maximum tensor dimension. * * @since 9 */ #define OH_AI_MAX_SHAPE_NUM 32 + +/** + * @brief Defines dimension information. The maximum dimension is set by {@link MS_MAX_SHAPE_NUM}. + * + * @since 9 + */ typedef struct OH_AI_ShapeInfo { /** Dimension array length */ @@ -96,9 +111,10 @@ typedef struct OH_AI_CallBackParam * * This pointer is used to set the two callback functions in {@link OH_AI_ModelPredict}. * Each callback function must contain three parameters, where **inputs** and **outputs** indicate - * the input and output tensors of the operator, and **kernel_Info** indicates information about the current operator. - * You can use the callback functions to monitor the operator execution status, for example, operator execution time - * and the operator correctness. + * the input and output tensors of the operator, and **kernel_Info** indicates information about + * the current operator. + * You can use the callback functions to monitor the operator execution status, for example, + * operator execution time and the operator correctness. * * @since 9 */ @@ -124,18 +140,18 @@ OH_AI_API void OH_AI_ModelDestroy(OH_AI_ModelHandle *model); /** * @brief Loads and builds a MindSpore model from the memory buffer. * - * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or - * {@link OH_AI_ModelBuildFromFile} only once. - * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects - * accordingly. + * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} + * or {@link OH_AI_ModelBuildFromFile} only once. + * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} + * objects accordingly. * * @param model Pointer to the model object. * @param model_data Address of the loaded model data in the memory. * @param data_size Length of the model data. * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. * @param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. - * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that - * the operation is successful. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** + * indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *model_data, size_t data_size, @@ -144,8 +160,8 @@ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *mod /** * @brief Loads and builds a MindSpore model from a model file. * - * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} or - * {@link OH_AI_ModelBuildFromFile} only once. + * Note that the same {@link OH_AI_ContextHandle} object can be passed to {@link OH_AI_ModelBuild} + * or {@link OH_AI_ModelBuildFromFile} only once. * If you call this function multiple times, make sure that you create multiple {@link OH_AI_ContextHandle} objects * accordingly. * @@ -153,8 +169,8 @@ OH_AI_API OH_AI_Status OH_AI_ModelBuild(OH_AI_ModelHandle model, const void *mod * @param model_path Path of the model file. * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. * @param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. - * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that - * the operation is successful. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** + * indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelBuildFromFile(OH_AI_ModelHandle model, const char *model_path, @@ -168,8 +184,8 @@ OH_AI_API OH_AI_Status OH_AI_ModelBuildFromFile(OH_AI_ModelHandle model, const c * @param shape_infos Input shape array, which consists of tensor shapes arranged in the model input sequence. * The model adjusts the tensor shapes in sequence. * @param shape_info_num Length of the input shape array. - * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** indicates that - * the operation is successful. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** + * indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelResize(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, @@ -183,8 +199,8 @@ OH_AI_API OH_AI_Status OH_AI_ModelResize(OH_AI_ModelHandle model, const OH_AI_Te * @param outputs Pointer to the tensor array structure corresponding to the model output. * @param before Callback function executed before model inference. * @param after Callback function executed after model inference. - * @return Status code enumerated by {@link OH_AI_Status}. - * The value **MSStatus::kMSStatusSuccess** indicates that the operation is successful. + * @return Status code enumerated by {@link OH_AI_Status}. The value **MSStatus::kMSStatusSuccess** + * indicates that the operation is successful. * @since 9 */ OH_AI_API OH_AI_Status OH_AI_ModelPredict(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray inputs, @@ -231,6 +247,238 @@ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHa */ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetOutputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); +/** + * @brief Creates the pointer to the training configuration object. This API is used only for on-device training. + * @return Pointer to the training configuration object. + * @since 11 + */ +OH_AI_API OH_AI_TrainCfgHandle OH_AI_TrainCfgCreate(); + +/** + * @brief Destroys the pointer to the training configuration object. This API is used only for on-device training. + * + * @param train_cfg Pointer to the training configuration object. + * @since 11 + */ +OH_AI_API void OH_AI_TrainCfgDestroy(OH_AI_TrainCfgHandle *train_cfg); + +/** + * @brief Obtains the list of loss functions, which are used only for on-device training. + * + * @param train_cfg Pointer to the training configuration object. + * @param num Number of loss functions. + * @return List of loss functions. + * @since 11 + */ +OH_AI_API char **OH_AI_TrainCfgGetLossName(OH_AI_TrainCfgHandle train_cfg, size_t *num); + +/** + * @brief Sets the list of loss functions, which are used only for on-device training. + * + * @param train_cfg Pointer to the training configuration object. + * @param loss_name List of loss functions. + * @param num Number of loss functions. + * @since 11 + */ +OH_AI_API void OH_AI_TrainCfgSetLossName(OH_AI_TrainCfgHandle train_cfg, const char **loss_name, size_t num); + +/** + * @brief Obtains the optimization level of the training configuration object. This API is used only for on-device training. + * + * @param train_cfg Pointer to the training configuration object. + * @return Optimization level. + * @since 11 + */ +OH_AI_API OH_AI_OptimizationLevel OH_AI_TrainCfgGetOptimizationLevel(OH_AI_TrainCfgHandle train_cfg); + +/** + * @brief Sets the optimization level of the training configuration object. This API is used only for on-device training. + * + * @param train_cfg Pointer to the training configuration object. + * @param level Optimization level. + * @since 11 + */ +OH_AI_API void OH_AI_TrainCfgSetOptimizationLevel(OH_AI_TrainCfgHandle train_cfg, OH_AI_OptimizationLevel level); + +/** + * @brief Loads a training model from the memory buffer and compiles the model to a state ready for running on the device. + * This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @param model_data Pointer to the buffer that stores the model file to read. + * @param data_size Buffer size. + * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. + * @param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. + * @param train_cfg Pointer to the training configuration object. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_TrainModelBuild(OH_AI_ModelHandle model, const void *model_data, size_t data_size, + OH_AI_ModelType model_type, const OH_AI_ContextHandle model_context, + const OH_AI_TrainCfgHandle train_cfg); + +/** + * @brief Loads the training model from the specified path and compiles the model to a state ready for running on the device. + * This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @param model_path Path of the model file. + * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. + * @param model_context Context for model running. For details, see {@link OH_AI_ContextHandle}. + * @param train_cfg Pointer to the training configuration object. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_TrainModelBuildFromFile(OH_AI_ModelHandle model, const char *model_path, + OH_AI_ModelType model_type, + const OH_AI_ContextHandle model_context, + const OH_AI_TrainCfgHandle train_cfg); + +/** + * @brief Defines a single-step training model. This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @param before Callback function executed before model inference. + * @param after Callback function executed after model inference. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_RunStep(OH_AI_ModelHandle model, const OH_AI_KernelCallBack before, + const OH_AI_KernelCallBack after); + +/** + * @brief Sets the learning rate for model training. This API is used only for on-device training. + * + * @param learning_rate Learning rate. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ModelSetLearningRate(OH_AI_ModelHandle model, float learning_rate); + +/** + * @brief Obtains the learning rate for model training. This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @return Learning rate. If no optimizer is set, the value is 0.0. + * @since 11 + */ +OH_AI_API float OH_AI_ModelGetLearningRate(OH_AI_ModelHandle model); + +/** + * @brief Obtains all weight tensors of a model. This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @return All weight tensors of the model. + * @since 11 + */ +OH_AI_API OH_AI_TensorHandleArray OH_AI_ModelGetWeights(OH_AI_ModelHandle model); + +/** + * @brief Updates the weight tensors of a model. This API is used only for on-device training. + * + * @param new_weights Weight tensors to update. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ModelUpdateWeights(OH_AI_ModelHandle model, const OH_AI_TensorHandleArray new_weights); + +/** + * @brief Obtains the training mode. + * + * @param model Pointer to the model object. + * @return Whether the training mode is used. + * @since 11 + */ +OH_AI_API bool OH_AI_ModelGetTrainMode(OH_AI_ModelHandle model); + +/** + * @brief Sets the training mode. This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @param train Whether the training mode is used. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ModelSetTrainMode(OH_AI_ModelHandle model, bool train); + +/** + * @brief Sets the virtual batch for training. This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @param virtual_batch_multiplier Virtual batch multiplier. If the value is less than 1, the virtual batch is disabled. + * @param lr Learning rate. The default value is -1.0f. + * @param momentum Momentum. The default value is -1.0f. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ModelSetupVirtualBatch(OH_AI_ModelHandle model, int virtual_batch_multiplier, float lr, + float momentum); + +/** + * @brief Exports a training model. This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. + * @param model_file Path of the exported model file. + * @param quantization_type Quantization type. + * @param export_inference_only Whether to export inference models. + * @param output_tensor_name Output tensor of the exported model. This parameter is left blank by default, + * which indicates full export. + * @param num Number of output tensors. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ExportModel(OH_AI_ModelHandle model, OH_AI_ModelType model_type, const char *model_file, + OH_AI_QuantizationType quantization_type, bool export_inference_only, + char **output_tensor_name, size_t num); + +/** + * @brief Exports the memory cache of the training model. This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. + * @param model_data Pointer to the buffer that stores the exported model file. + * @param data_size Buffer size. + * @param quantization_type Quantization type. + * @param export_inference_only Whether to export inference models. + * @param output_tensor_name Output tensor of the exported model. This parameter is left blank by default, + * which indicates full export. + * @param num Number of output tensors. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ExportModelBuffer(OH_AI_ModelHandle model, OH_AI_ModelType model_type, char **model_data, + size_t *data_size, OH_AI_QuantizationType quantization_type, + bool export_inference_only, char **output_tensor_name, size_t num); + +/** + * @brief Exports the weight file of the training model for micro inference. This API is used only for on-device training. + * + * @param model Pointer to the model object. + * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. + * @param weight_file Path of the exported weight file. + * @param is_inference Whether to export inference models. Currently, this parameter can only be set to true. + * @param enable_fp16 Whether to save floating-point weights in float16 format. + * @param changeable_weights_name Name of the weight tensor with a variable shape. + * @param num Number of weight tensors with a variable shape. + * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** + * indicates that the operation is successful. + * @since 11 + */ +OH_AI_API OH_AI_Status OH_AI_ExportWeightsCollaborateWithMicro(OH_AI_ModelHandle model, OH_AI_ModelType model_type, + const char *weight_file, bool is_inference, + bool enable_fp16, char **changeable_weights_name, + size_t num); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/ai/mindspore/status.h b/en/native_sdk/ai/mindspore/status.h index 80ad7936..cef72a14 100644 --- a/en/native_sdk/ai/mindspore/status.h +++ b/en/native_sdk/ai/mindspore/status.h @@ -17,18 +17,19 @@ /** * @addtogroup MindSpore * @{ - * + * * @brief Provides APIs related to MindSpore Lite model inference. - * + * * @Syscap SystemCapability.Ai.MindSpore * @since 9 */ /** * @file status.h - * + * * @brief Provides the status codes of MindSpore Lite. - * + * + * File to include: * @library libmindspore_lite_ndk.so * @since 9 */ @@ -43,7 +44,7 @@ extern "C" #endif /** * @brief Defines MinSpore component codes. - * + * * @since 9 */ enum OH_AI_CompCode @@ -56,7 +57,7 @@ extern "C" /** * @brief Defines MindSpore status codes. - * + * * @since 9 */ typedef enum OH_AI_Status diff --git a/en/native_sdk/ai/mindspore/tensor.h b/en/native_sdk/ai/mindspore/tensor.h index bff23591..0a702505 100644 --- a/en/native_sdk/ai/mindspore/tensor.h +++ b/en/native_sdk/ai/mindspore/tensor.h @@ -17,18 +17,19 @@ /** * @addtogroup MindSpore * @{ - * + * * @brief Provides APIs related to MindSpore Lite model inference. - * + * * @Syscap SystemCapability.Ai.MindSpore * @since 9 */ /** * @file tensor.h - * + * * @brief Provides APIs for creating and modifying tensor information. - * + * + * File to include: * @library libmindspore_lite_ndk.so * @since 9 */ @@ -47,7 +48,7 @@ extern "C" { /** * @brief Defines the handle of a tensor object. - * + * * @since 9 */ typedef void *OH_AI_TensorHandle; @@ -84,7 +85,7 @@ OH_AI_API void OH_AI_TensorDestroy(OH_AI_TensorHandle *tensor); * @param tensor Pointer to the tensor to clone. * * @return Handle of the new tensor object. - * + * * @since 9 */ OH_AI_API OH_AI_TensorHandle OH_AI_TensorClone(OH_AI_TensorHandle tensor); @@ -94,7 +95,7 @@ OH_AI_API OH_AI_TensorHandle OH_AI_TensorClone(OH_AI_TensorHandle tensor); * * @param tensor Handle of the tensor object. * @param name Tensor name. - * + * * @since 9 */ OH_AI_API void OH_AI_TensorSetName(OH_AI_TensorHandle tensor, const char *name); @@ -105,7 +106,7 @@ OH_AI_API void OH_AI_TensorSetName(OH_AI_TensorHandle tensor, const char *name); * @param tensor Handle of the tensor object. * * @return Tensor name. - * + * * @since 9 */ OH_AI_API const char *OH_AI_TensorGetName(const OH_AI_TensorHandle tensor); @@ -115,7 +116,7 @@ OH_AI_API const char *OH_AI_TensorGetName(const OH_AI_TensorHandle tensor); * * @param tensor Handle of the tensor object. * @param type Data type. For details, see {@link OH_AI_DataType}. - * + * * @since 9 */ OH_AI_API void OH_AI_TensorSetDataType(OH_AI_TensorHandle tensor, OH_AI_DataType type); @@ -126,7 +127,7 @@ OH_AI_API void OH_AI_TensorSetDataType(OH_AI_TensorHandle tensor, OH_AI_DataType * @param tensor Handle of the tensor object. * * @return Data type of the tensor. - * + * * @since 9 */ OH_AI_API OH_AI_DataType OH_AI_TensorGetDataType(const OH_AI_TensorHandle tensor); @@ -137,7 +138,7 @@ OH_AI_API OH_AI_DataType OH_AI_TensorGetDataType(const OH_AI_TensorHandle tensor * @param tensor Handle of the tensor object. * @param shape Tensor shape array. * @param shape_num Length of the tensor shape array. - * + * * @since 9 */ OH_AI_API void OH_AI_TensorSetShape(OH_AI_TensorHandle tensor, const int64_t *shape, size_t shape_num); @@ -149,7 +150,7 @@ OH_AI_API void OH_AI_TensorSetShape(OH_AI_TensorHandle tensor, const int64_t *sh * @param shape_num Length of the tensor shape array. * * @return Tensor shape array. - * + * * @since 9 */ OH_AI_API const int64_t *OH_AI_TensorGetShape(const OH_AI_TensorHandle tensor, size_t *shape_num); @@ -159,7 +160,7 @@ OH_AI_API const int64_t *OH_AI_TensorGetShape(const OH_AI_TensorHandle tensor, s * * @param tensor Handle of the tensor object. * @param format Tensor data format. - * + * * @since 9 */ OH_AI_API void OH_AI_TensorSetFormat(OH_AI_TensorHandle tensor, OH_AI_Format format); @@ -170,7 +171,7 @@ OH_AI_API void OH_AI_TensorSetFormat(OH_AI_TensorHandle tensor, OH_AI_Format for * @param tensor Handle of the tensor object. * * @return Tensor data format. - * + * * @since 9 */ OH_AI_API OH_AI_Format OH_AI_TensorGetFormat(const OH_AI_TensorHandle tensor); @@ -180,7 +181,7 @@ OH_AI_API OH_AI_Format OH_AI_TensorGetFormat(const OH_AI_TensorHandle tensor); * * @param tensor Handle of the tensor object. * @param data Data pointer. - * + * * @since 9 */ OH_AI_API void OH_AI_TensorSetData(OH_AI_TensorHandle tensor, void *data); @@ -191,7 +192,7 @@ OH_AI_API void OH_AI_TensorSetData(OH_AI_TensorHandle tensor, void *data); * @param tensor Handle of the tensor object. * * @return Pointer to tensor data. - * + * * @since 9 */ OH_AI_API const void *OH_AI_TensorGetData(const OH_AI_TensorHandle tensor); @@ -202,7 +203,7 @@ OH_AI_API const void *OH_AI_TensorGetData(const OH_AI_TensorHandle tensor); * @param tensor Handle of the tensor object. * * @return Pointer to tensor data. - * + * * @since 9 */ OH_AI_API void *OH_AI_TensorGetMutableData(const OH_AI_TensorHandle tensor); @@ -213,7 +214,7 @@ OH_AI_API void *OH_AI_TensorGetMutableData(const OH_AI_TensorHandle tensor); * @param tensor Handle of the tensor object. * * @return Number of tensor elements. - * + * * @since 9 */ OH_AI_API int64_t OH_AI_TensorGetElementNum(const OH_AI_TensorHandle tensor); @@ -224,7 +225,7 @@ OH_AI_API int64_t OH_AI_TensorGetElementNum(const OH_AI_TensorHandle tensor); * @param tensor Handle of the tensor object. * * @return Number of bytes of the tensor data. - * + * * @since 9 */ OH_AI_API size_t OH_AI_TensorGetDataSize(const OH_AI_TensorHandle tensor); diff --git a/en/native_sdk/ai/mindspore/types.h b/en/native_sdk/ai/mindspore/types.h index 24a2d929..43649470 100644 --- a/en/native_sdk/ai/mindspore/types.h +++ b/en/native_sdk/ai/mindspore/types.h @@ -29,6 +29,8 @@ * * @brief Provides the model file types and device types supported by MindSpore Lite. * + * File to include: + * @library libmindspore_lite_ndk.so * @since 9 */ @@ -193,6 +195,68 @@ typedef enum OH_AI_Priority { OH_AI_PRIORITY_HIGH = 3, } OH_AI_Priority; +/** + * @brief Enumerates optimization levels. + * + * @since 11 + */ +typedef enum OH_AI_OptimizationLevel { + /** No optimization level + * + * @since 11 + */ + OH_AI_KO0 = 0, + /** Convert the precision type of the network to float16 and keep the precision type + * of the batch normalization layer and loss function as float32. + * + * @since 11 + */ + OH_AI_KO2 = 2, + /** Convert the precision type of the network (including the batch normalization layer) to float16. + * + * @since 11 + */ + OH_AI_KO3 = 3, + /** Select an optimization level based on the device. + * + * @since 11 + */ + OH_AI_KAUTO = 4, + /** Invalid optimization level + * + * @since 11 + */ + OH_AI_KOPTIMIZATIONTYPE = 0xFFFFFFFF +} OH_AI_OptimizationLevel; + +/** + * @brief Enumerates quantization types. + * + * @since 11 + */ +typedef enum OH_AI_QuantizationType { + /** No quantification + * + * @since 11 + */ + OH_AI_NO_QUANT = 0, + /** Weight quantization + * + * @since 11 + */ + OH_AI_WEIGHT_QUANT = 1, + /** Full quantization + * + * @since 11 + */ + OH_AI_FULL_QUANT = 2, + /** Invalid quantization type + * + * @since 11 + */ + OH_AI_UNKNOWN_QUANT_TYPE = 0xFFFFFFFF +} OH_AI_QuantizationType; + /** * @brief Defines the NNRt device information, including the device ID and device name. * -- Gitee From e1545797521e15c97df69a4cc9d3d8ccde89a1d4 Mon Sep 17 00:00:00 2001 From: liuxiyao Date: Mon, 18 Dec 2023 15:17:07 +0800 Subject: [PATCH 0166/2135] update NDK interface Signed-off-by: liuxiyao --- ...native_net_conn_api.h => net_connection.h} | 205 +++---- ..._net_conn_type.h => net_connection_type.h} | 509 ++++++++---------- 2 files changed, 343 insertions(+), 371 deletions(-) rename zh-cn/native_sdk/net/dns/{native_net_conn_api.h => net_connection.h} (44%) rename zh-cn/native_sdk/net/dns/{native_net_conn_type.h => net_connection_type.h} (44%) diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_api.h b/zh-cn/native_sdk/net/dns/net_connection.h similarity index 44% rename from zh-cn/native_sdk/net/dns/native_net_conn_api.h rename to zh-cn/native_sdk/net/dns/net_connection.h index cbcf8a14..2e3b044d 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_api.h +++ b/zh-cn/native_sdk/net/dns/net_connection.h @@ -17,184 +17,195 @@ #define NATIVE_NET_CONN_API_H /** - * @addtogroup NetConn + * @addtogroup NetConnection * @{ * - * @brief 为网络管理数据网络连接模块儿提供C接口. + * @brief 为网络管理数据网络连接模块提供C接口。 * * @since 11 * @version 1.0 */ /** - * @file native_net_conn_api.h + * @file net_connection.h * - * @brief 为网络管理数据网络连接模块儿提供C接口. + * @brief 为网络管理数据网络连接模块提供C接口. * - * @library libnetconn_ndk.z.so * @syscap SystemCapability.Communication.NetManager.Core + * @library libnet_connection.so * @since 11 * @version 1.0 */ -#include "native_net_conn_type.h" -#include "netdb.h" +#include + +#include "net_connection_type.h" #ifdef __cplusplus extern "C" { #endif /** - * @brief 通过netId获取DNS结果. + * @brief 查询是否有默认激活的数据网络. * - * @param host 所需查询的host名. - * @param serv 服务名. - * @param hint 指向addrinfo结构体的指针. - * @param res 存放DNS查询结果,以链表形式返回. - * @param netId DNS查询netId 为0是使用默认netid查询. - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.INTERNET + * @param hasDefaultNet 是否有默认网络. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 -*/ -int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); + */ +int32_t OH_NetConn_HasDefaultNet(int32_t *hasDefaultNet); /** - * @brief 释放DNS结果. + * @brief 获取激活的默认的数据网络. * - * @param res DNS查询结果链表头. - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.INTERNET + * @param netHandle 存放网络ID. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. + * @permission ohos.permission.GET_NETWORK_INFO * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 -*/ -int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); + */ +int32_t OH_NetConn_GetDefaultNet(NetConn_NetHandle *netHandle); /** - * @brief 查询是否有默认激活的数据网络 - * - * @param hasDefaultNet 是否有默认网络 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @brief 查询默认数据网络是否记流量. + * + * @param isMetered 是否激活. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. * @permission ohos.permission.GET_NETWORK_INFO * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ -int32_t OH_NetConn_HasDefaultNet(int32_t *hasDefaultNet); +int32_t OH_NetConn_IsDefaultNetMetered(int32_t *isMetered); /** - * @brief 获取激活的默认的数据网络 - * - * @param netHandle 存放网络ID - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @brief 查询某个数据网络的链路信息. + * + * @param nethandle 存放网络ID. + * @param prop 存放链路信息. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. * @permission ohos.permission.GET_NETWORK_INFO * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetDefaultNet(OH_NetConn_NetHandle *netHandle); +int32_t OH_NetConn_GetConnectionProperties(NetConn_NetHandle *netHandle, NetConn_ConnectionProperties *prop); /** - * @brief 查询默认数据网络是否记流量 - * - * @param isMetered 是否激活 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @brief 查询某个网络的能力集. + * + * @param netHandle 存放网络ID. + * @param netCapacities 存放能力集. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. * @permission ohos.permission.GET_NETWORK_INFO * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ -int32_t OH_NetConn_IsDefaultNetMetered(int32_t *isMetered); +int32_t OH_NetConn_GetNetCapabilities(NetConn_NetHandle *netHandle, NetConn_NetCapabilities *netCapacities); /** - * @brief 查询所有激活的数据网络 - * - * @param netHandleList 网络信息列表 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.GET_NETWORK_INFO + * @brief 查询默认的网络代理. + * + * @param httpProxy 存放代理配置信息. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetAllNets(OH_NetConn_NetHandleList *netHandleList); +int32_t OH_NetConn_GetDefaultHttpProxy(NetConn_HttpProxy *httpProxy); /** - * @brief 查询某个数据网络的链路信息 - * - * @param netHandle 存放网络ID - * @param info 存放链路信息 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. - * @permission ohos.permission.GET_NETWORK_INFO + * @brief 通过netId获取DNS结果. + * + * @param host 所需查询的host名. + * @param serv 服务名. + * @param hint 指向addrinfo结构体的指针. + * @param res 存放DNS查询结果,以链表形式返回. + * @param netId DNS查询netId 为0是使用默认netid查询. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); + +/** + * @brief 释放DNS结果. + * + * @param res DNS查询结果链表头. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. + * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetConnectionProperties(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetLinkInfo *info); +int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); /** - * @brief 查询某个网络的能力集 - * - * @param netHandle 存放网络ID - * @param netAllCapacities 存放能力集 - * @return 0 - 成功. - * @return 201 - 缺少权限. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @brief 查询所有激活的数据网络. + * + * @param netHandleList 网络信息列表. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. * @permission ohos.permission.GET_NETWORK_INFO * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetNetCapabilities(OH_NetConn_NetHandle *netHandle, OH_NetConn_NetAllCapabilities *netAllCapacities); +int32_t OH_NetConn_GetAllNets(NetConn_NetHandleList *netHandleList); + +/** + * @brief 注册自定义 DNS 解析器. + * + * @param resolver 指向自定义 DNS 解析器的指针. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OHOS_NetConn_RegisterDnsResolver(OH_NetConn_CustomDnsResolver resolver); /** - * @brief 查询默认的网络代理 + * @brief 取消注册自定义 DNS 解析器. * - * @param httpProxy 存放代理配置信息 - * @return 0 - 成功. - * @return 401 - 参数错误. - * @return 2100002 - 无法连接到服务. - * @return 2100003 - 内部错误. + * @return 0 - 成功. 201 - 缺少权限. + * 401 - 参数错误. 2100002 - 无法连接到服务. + * 2100003 - 内部错误. + * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 */ -int32_t OH_NetConn_GetDefaultHttpProxy(OH_NetConn_HttpProxy *httpProxy); +int32_t OHOS_NetConn_UnregisterDnsResolver(void); #ifdef __cplusplus } #endif /** @} */ -#endif /* NATIVE_NET_CONN_API_H */ +#endif /* NATIVE_NET_CONN_API_H */ \ No newline at end of file diff --git a/zh-cn/native_sdk/net/dns/native_net_conn_type.h b/zh-cn/native_sdk/net/dns/net_connection_type.h similarity index 44% rename from zh-cn/native_sdk/net/dns/native_net_conn_type.h rename to zh-cn/native_sdk/net/dns/net_connection_type.h index 77b79d27..670ade42 100644 --- a/zh-cn/native_sdk/net/dns/native_net_conn_type.h +++ b/zh-cn/native_sdk/net/dns/net_connection_type.h @@ -1,274 +1,235 @@ -/* - * 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 NATIVE_NET_CONN_TYPE_H -#define NATIVE_NET_CONN_TYPE_H - -/** - * @addtogroup NetConn - * @{ - * - * @brief 为网络管理的数据网络连接模块的C接口提供数据结构 - * - * @since 11 - * @version 1.0 - */ - -/** - * @file native_net_conn_type.h - * @brief 定义网络连接模块的C接口需要的数据结构 - * - * @library libnetconn_ndk.z.so - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - * - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define OH_NETCONN_MAX_NET_SIZE 32 -#define OH_NETCONN_MAX_BEAR_TYPE_SIZE 32 -#define OH_NETCONN_MAX_CAP_SIZE 32 -#define OH_NETCONN_MAX_ADDR_SIZE 32 -#define OH_NETCONN_MAX_ROUTE_SIZE 64 -#define OH_NETCONN_MAX_EXCLUSION_SIZE 256 -#define OH_NETCONN_MAX_STR_LEN 256 - -/** - * @brief 网络能力集 - * - * @since 11 - * @version 1.0 - */ -typedef enum OH_NetConn_NetCap { - /** MMS */ - OH_NETCONN_NET_CAPABILITY_MMS = 0, - /** 非计量网络 */ - OH_NETCONN_NET_CAPABILITY_NOT_METERED = 11, - /** Internet */ - OH_NETCONN_NET_CAPABILITY_INTERNET = 12, - /** 非VPN */ - OH_NETCONN_NET_CAPABILITY_NOT_VPN = 15, - /** 已验证 */ - OH_NETCONN_NET_CAPABILITY_VALIDATED = 16, - /** 被捕获的门户 */ - OH_NETCONN_NET_CAPABILITY_CAPTIVE_PORTAL = 17, - /** 内部默认能力 */ - OH_NETCONN_NET_CAPABILITY_INTERNAL_DEFAULT -} OH_NetConn_NetCap; - -/** - * @brief 网络载体类型 - * - * @since 11 - * @version 1.0 - */ -typedef enum OH_NetConn_NetBearType { - /** 蜂窝网络 */ - OH_NETCONN_BEARER_CELLULAR = 0, - /** WIFI */ - OH_NETCONN_BEARER_WIFI = 1, - /** Bluetooth */ - OH_NETCONN_BEARER_BLUETOOTH = 2, - /** Ethernet */ - OH_NETCONN_BEARER_ETHERNET = 3, - /** VPN */ - OH_NETCONN_BEARER_VPN = 4, - /** WIFI aware */ - OH_NETCONN_BEARER_WIFI_AWARE = 5, - /** 默认的承载类型 */ - OH_NETCONN_BEARER_DEFAULT -} OH_NetConn_NetBearType; - -/** - * @brief 路由返回类型 - * - * @since 11 - * @version 1.0 - */ -typedef enum OH_NetConn_RtnType { - /** 单播 */ - OH_NETCONN_RTN_UNICAST = 1, - /** 不可达 */ - OH_NETCONN_RTN_UNREACHABLE = 7, - /** 抛出 */ - OH_NETCONN_RTN_THROW = 9 -} OH_NetConn_RtnType; - -/** - * @brief IP类型. - * - * @since 11 - * @version 1.0 - */ -typedef enum { - /** 未知 */ - OH_NETCONN_UNKNOWN = 0x00, - /** IPV4 */ - OH_NETCONN_IPV4 = 0x01, - /** IPV6 */ - OH_NETCONN_IPV6 = 0x02, -} OH_NetConn_IpType; - -/** - * @brief 存放网络ID. - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_NetHandle { - /** 网络标识符 */ - int32_t netId; -} OH_NetConn_NetHandle; - -/** - * @brief 网络列表 - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_NetHandleList { - /** netHandle列表 */ - OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; - /** netHandleList的实际大小 */ - int32_t netHandleListSize; -} OH_NetConn_NetHandleList; - -/** - * @brief 网络能力集 - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_NetAllCapabilities { - /** 上行带宽 */ - uint32_t linkUpBandwidthKbps; - /** 下行带宽 */ - uint32_t linkDownBandwidthKbps; - /** 网络能力列表 */ - OH_NetConn_NetCap netCaps[OH_NETCONN_MAX_CAP_SIZE]; - /** 网络能力列表的实际size */ - int32_t netCapsSize; - /** 承载类型列表 */ - OH_NetConn_NetBearType bearerTypes[OH_NETCONN_MAX_BEAR_TYPE_SIZE]; - /** 承载类型列表的实际size */ - int32_t bearerTypesSize; -} OH_NetConn_NetAllCapabilities; - -/** - * @brief 网络地址 - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_INetAddr { - /** Ip 类型 */ - OH_NetConn_IpType type; - /** 网络地址族 */ - uint8_t family; - /** 前缀长度 */ - uint8_t prefixlen; - /** 端口号 */ - uint8_t port; - /** 地址 */ - char address[OH_NETCONN_MAX_STR_LEN]; - /** 主机名 */ - char hostName[OH_NETCONN_MAX_STR_LEN]; -} OH_NetConn_INetAddr; - -/** - * @brief 路由配置信息 - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_Route { - /** 网络接口 */ - char iface[OH_NETCONN_MAX_STR_LEN]; - /** 目标地址 */ - OH_NetConn_INetAddr destination; - /** 网关地址 */ - OH_NetConn_INetAddr gateway; - /** 路由的类型 */ - OH_NetConn_RtnType rtnType; - /** MTU */ - int32_t mtu; - /** 是否是主机 */ - int32_t isHost; - /** 是否存在网关 */ - int32_t hasGateway; - /** 是否是默认路由 */ - int32_t isDefaultRoute; -} OH_NetConn_Route; - -/** - * @brief 代理配置信息 - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_HttpProxy { - /** 主机名 */ - char host[OH_NETCONN_MAX_STR_LEN]; - /** 代理服务器的排除列表 */ - char exclusionList[OH_NETCONN_MAX_EXCLUSION_SIZE][OH_NETCONN_MAX_STR_LEN]; - /** 排除列表的实际大小 */ - int32_t exclusionListSize; - /** 端口号 */ - uint16_t port; -} OH_NetConn_HttpProxy; - -/** - * @brief Network link information - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_NetLinkInfo { - /** 网络接口的名称 */ - char ifaceName[OH_NETCONN_MAX_STR_LEN]; - /** 网络连接的域名信息 */ - char domain[OH_NETCONN_MAX_STR_LEN]; - /** TCP 缓冲区大小 */ - char tcpBufferSizes[OH_NETCONN_MAX_STR_LEN]; - /** MTU */ - uint16_t mtu; - /** 地址列表 */ - OH_NetConn_INetAddr netAddrList[OH_NETCONN_MAX_ADDR_SIZE]; - /** 地址列表的实际size */ - int32_t netAddrListSize; - /** DNS 列表 */ - OH_NetConn_INetAddr dnsList[OH_NETCONN_MAX_ADDR_SIZE]; - /** DNS 列表的实际size */ - int32_t dnsListSize; - /** 路由列表 */ - OH_NetConn_Route routeList[OH_NETCONN_MAX_ROUTE_SIZE]; - /** 路由列表的实际大小 */ - int32_t routeListSize; - /** HTTP 代理信息 */ - OH_NetConn_HttpProxy httpProxy; -} OH_NetConn_NetLinkInfo; - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif /* NATIVE_NET_CONN_TYPE_H */ +/* + * 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 NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H + +/** + * @addtogroup NetConnection + * @{ + * + * @brief 为网络管理的数据网络连接模块的C接口提供数据结构. + * + * @since 11 + * @version 1.0 + */ + +/** + * @file net_connection_type.h + * @brief 定义网络连接模块的C接口需要的数据结构. + * + * @library libnet_connection.so + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + * + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define NETCONN_MAX_NET_SIZE 32 +#define NETCONN_MAX_BEARER_TYPE_SIZE 32 +#define NETCONN_MAX_CAP_SIZE 32 +#define NETCONN_MAX_ADDR_SIZE 32 +#define NETCONN_MAX_ROUTE_SIZE 64 +#define NETCONN_MAX_EXCLUSION_SIZE 256 +#define NETCONN_MAX_STR_LEN 256 + +/** + * @brief 网络能力集. + * + * @since 11 + * @version 1.0 + */ +typedef enum NetConn_NetCap { + /** MMS */ + NETCONN_NET_CAPABILITY_MMS = 0, + /** 非计量网络 */ + NETCONN_NET_CAPABILITY_NOT_METERED = 11, + /** Internet */ + NETCONN_NET_CAPABILITY_INTERNET = 12, + /** 非VPN */ + NETCONN_NET_CAPABILITY_NOT_VPN = 15, + /** 已验证 */ + NETCONN_NET_CAPABILITY_VALIDATED = 16, +} NetConn_NetCap; + +/** + * @brief 网络载体类型. + * + * @since 11 + * @version 1.0 + */ +typedef enum NetConn_NetBearerType { + /** 蜂窝网络 */ + NETCONN_BEARER_CELLULAR = 0, + /** WIFI */ + NETCONN_BEARER_WIFI = 1, + /** Ethernet */ + NETCONN_BEARER_ETHERNET = 3, +} NetConn_NetBearerType; + +/** + * @brief 存放网络ID. + * + * @since 11 + * @version 1.0 + */ +typedef struct NetConn_NetHandle { + /** 网络标识符 */ + int32_t netId; +} NetConn_NetHandle; + +/** + * @brief 网络能力集. + * + * @since 11 + * @version 1.0 + */ +typedef struct NetConn_NetCapabilities { + /** 上行带宽 */ + uint32_t linkUpBandwidthKbps; + /** 下行带宽 */ + uint32_t linkDownBandwidthKbps; + /** 网络能力列表 */ + NetConn_NetCap netCaps[NETCONN_MAX_CAP_SIZE]; + /** 网络能力列表的实际size */ + int32_t netCapsSize; + /** 承载类型列表 */ + NetConn_NetBearerType bearerTypes[NETCONN_MAX_BEARER_TYPE_SIZE]; + /** 承载类型列表的实际size */ + int32_t bearerTypesSize; +} NetConn_NetCapabilities; + +/** + * @brief 网络地址. + * + * @since 11 + * @version 1.0 + */ +typedef struct NetConn_NetAddr { + /** 网络地址族 */ + uint8_t family; + /** 前缀长度 */ + uint8_t prefixlen; + /** 端口号 */ + uint8_t port; + /** 地址 */ + char address[NETCONN_MAX_STR_LEN]; +} NetConn_NetAddr; + +/** + * @brief 路由配置信息. + * + * @since 11 + * @version 1.0 + */ +typedef struct NetConn_Route { + /** 网络接口 */ + char iface[NETCONN_MAX_STR_LEN]; + /** 目标地址 */ + NetConn_NetAddr destination; + /** 网关地址 */ + NetConn_NetAddr gateway; + /** 是否存在网关 */ + int32_t hasGateway; + /** 是否是默认路由 */ + int32_t isDefaultRoute; +} NetConn_Route; + +/** + * @brief 代理配置信息. + * + * @since 11 + * @version 1.0 + */ +typedef struct NetConn_HttpProxy { + /** 主机名 */ + char host[NETCONN_MAX_STR_LEN]; + /** 代理服务器的排除列表 */ + char exclusionList[NETCONN_MAX_EXCLUSION_SIZE][NETCONN_MAX_STR_LEN]; + /** 排除列表的实际大小 */ + int32_t exclusionListSize; + /** 端口号 */ + uint16_t port; +} NetConn_HttpProxy; + +/** + * @brief 网络链接信息. + * + * @since 11 + * @version 1.0 + */ +typedef struct NetConn_ConnectionProperties { + /** 网络接口的名称 */ + char ifaceName[NETCONN_MAX_STR_LEN]; + /** 网络连接的域名信息 */ + char domain[NETCONN_MAX_STR_LEN]; + /** TCP 缓冲区大小 */ + char tcpBufferSizes[NETCONN_MAX_STR_LEN]; + /** MTU */ + uint16_t mtu; + /** 地址列表 */ + NetConn_NetAddr netAddrList[NETCONN_MAX_ADDR_SIZE]; + /** 地址列表的实际size */ + int32_t netAddrListSize; + /** DNS 列表 */ + NetConn_NetAddr dnsList[NETCONN_MAX_ADDR_SIZE]; + /** DNS 列表的实际size */ + int32_t dnsListSize; + /** 路由列表 */ + NetConn_Route routeList[NETCONN_MAX_ROUTE_SIZE]; + /** 路由列表的实际大小 */ + int32_t routeListSize; + /** HTTP 代理信息 */ + NetConn_HttpProxy httpProxy; +} NetConn_ConnectionProperties; + +/** + * @brief 网络列表. + * + * @since 11 + * @version 1.0 + */ +typedef struct NetConn_NetHandleList { + /** netHandle列表t */ + NetConn_NetHandle netHandles[NETCONN_MAX_NET_SIZE]; + /** netHandleList的实际大小 */ + int32_t netHandleListSize; +} NetConn_NetHandleList; + +/** + * @brief 指向自定义 DNS 解析器的指针. + * + * @param host 要查询的主机名. + * @param serv 服务名称. + * @param hint 指向addrinfo结构的指针. + * @param res 存储DNS查询结果并以链表形式返回. + * + * @since 11 + * @version 1.0 + */ +typedef int (*OH_NetConn_CustomDnsResolver)(const char *host, const char *serv, + const struct addrinfo *hint, struct addrinfo **res); +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_TYPE_H */ \ No newline at end of file -- Gitee From 3bded0fb6a41743668a0bfd226bce155d7f5f52c Mon Sep 17 00:00:00 2001 From: shawn_he Date: Tue, 19 Dec 2023 11:36:21 +0800 Subject: [PATCH 0167/2135] update docs Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/model.h | 24 ++++++++++++++++-------- en/native_sdk/ai/mindspore/tensor.h | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/en/native_sdk/ai/mindspore/model.h b/en/native_sdk/ai/mindspore/model.h index cb6d6fce..73f8560e 100644 --- a/en/native_sdk/ai/mindspore/model.h +++ b/en/native_sdk/ai/mindspore/model.h @@ -248,14 +248,16 @@ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetInputByTensorName(const OH_AI_ModelHa OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetOutputByTensorName(const OH_AI_ModelHandle model, const char *tensor_name); /** - * @brief Creates the pointer to the training configuration object. This API is used only for on-device training. + * @brief Creates the pointer to the training configuration object. This API is used only for + * on-device training. * @return Pointer to the training configuration object. * @since 11 */ OH_AI_API OH_AI_TrainCfgHandle OH_AI_TrainCfgCreate(); /** - * @brief Destroys the pointer to the training configuration object. This API is used only for on-device training. + * @brief Destroys the pointer to the training configuration object. This API is used only for + * on-device training. * * @param train_cfg Pointer to the training configuration object. * @since 11 @@ -283,7 +285,8 @@ OH_AI_API char **OH_AI_TrainCfgGetLossName(OH_AI_TrainCfgHandle train_cfg, size_ OH_AI_API void OH_AI_TrainCfgSetLossName(OH_AI_TrainCfgHandle train_cfg, const char **loss_name, size_t num); /** - * @brief Obtains the optimization level of the training configuration object. This API is used only for on-device training. + * @brief Obtains the optimization level of the training configuration object. This API is used only for + * on-device training. * * @param train_cfg Pointer to the training configuration object. * @return Optimization level. @@ -292,7 +295,8 @@ OH_AI_API void OH_AI_TrainCfgSetLossName(OH_AI_TrainCfgHandle train_cfg, const c OH_AI_API OH_AI_OptimizationLevel OH_AI_TrainCfgGetOptimizationLevel(OH_AI_TrainCfgHandle train_cfg); /** - * @brief Sets the optimization level of the training configuration object. This API is used only for on-device training. + * @brief Sets the optimization level of the training configuration object. This API is used only + * for on-device training. * * @param train_cfg Pointer to the training configuration object. * @param level Optimization level. @@ -301,7 +305,8 @@ OH_AI_API OH_AI_OptimizationLevel OH_AI_TrainCfgGetOptimizationLevel(OH_AI_Train OH_AI_API void OH_AI_TrainCfgSetOptimizationLevel(OH_AI_TrainCfgHandle train_cfg, OH_AI_OptimizationLevel level); /** - * @brief Loads a training model from the memory buffer and compiles the model to a state ready for running on the device. + * @brief Loads a training model from the memory buffer and compiles the model to a state ready for + * running on the device. * This API is used only for on-device training. * * @param model Pointer to the model object. @@ -319,7 +324,8 @@ OH_AI_API OH_AI_Status OH_AI_TrainModelBuild(OH_AI_ModelHandle model, const void const OH_AI_TrainCfgHandle train_cfg); /** - * @brief Loads the training model from the specified path and compiles the model to a state ready for running on the device. + * @brief Loads the training model from the specified path and compiles the model to a state ready for + * running on the device. * This API is used only for on-device training. * * @param model Pointer to the model object. @@ -411,7 +417,8 @@ OH_AI_API OH_AI_Status OH_AI_ModelSetTrainMode(OH_AI_ModelHandle model, bool tra * @brief Sets the virtual batch for training. This API is used only for on-device training. * * @param model Pointer to the model object. - * @param virtual_batch_multiplier Virtual batch multiplier. If the value is less than 1, the virtual batch is disabled. + * @param virtual_batch_multiplier Virtual batch multiplier. If the value is less than 1, + * the virtual batch is disabled. * @param lr Learning rate. The default value is -1.0f. * @param momentum Momentum. The default value is -1.0f. * @return Status code enumerated by {@link OH_AI_Status}. The value **OH_AI_Status::OH_AI_STATUS_SUCCESS** @@ -461,7 +468,8 @@ OH_AI_API OH_AI_Status OH_AI_ExportModelBuffer(OH_AI_ModelHandle model, OH_AI_Mo bool export_inference_only, char **output_tensor_name, size_t num); /** - * @brief Exports the weight file of the training model for micro inference. This API is used only for on-device training. + * @brief Exports the weight file of the training model for micro inference. This API is used only for + * on-device training. * * @param model Pointer to the model object. * @param model_type Type of the model file. For details, see {@link OH_AI_ModelType}. diff --git a/en/native_sdk/ai/mindspore/tensor.h b/en/native_sdk/ai/mindspore/tensor.h index 0a702505..fdd94cde 100644 --- a/en/native_sdk/ai/mindspore/tensor.h +++ b/en/native_sdk/ai/mindspore/tensor.h @@ -29,7 +29,7 @@ * * @brief Provides APIs for creating and modifying tensor information. * - * File to include: + * File to include: * @library libmindspore_lite_ndk.so * @since 9 */ -- Gitee From ed8741e33ad5c4c2cd7ca4da21b54b1bdb865978 Mon Sep 17 00:00:00 2001 From: liuqian_herb <704938153@qq.com> Date: Tue, 19 Dec 2023 22:27:15 +0800 Subject: [PATCH 0168/2135] add hci codec Signed-off-by: liuqian_herb <704938153@qq.com> --- .../a2dp/v1_0/BluetoothAudioTypes.idl | 75 ++++++++++++++++ .../a2dp/v1_0/IBluetoothAudioCallback.idl | 74 ++++++++++++++++ .../a2dp/v1_0/IBluetoothAudioSession.idl | 86 +++++++++++++++++++ .../hdi/bluetooth/hci/v1_0/HciTypes.idl | 69 +++++++++++++++ .../hdi/bluetooth/hci/v1_0/IHciCallback.idl | 69 +++++++++++++++ .../hdi/bluetooth/hci/v1_0/IHciInterface.idl | 82 ++++++++++++++++++ .../a2dp/v1_0/BluetoothAudioTypes.idl | 73 ++++++++++++++++ .../a2dp/v1_0/IBluetoothAudioCallback.idl | 73 ++++++++++++++++ .../a2dp/v1_0/IBluetoothAudioSession.idl | 83 ++++++++++++++++++ .../hdi/bluetooth/hci/v1_0/HciTypes.idl | 68 +++++++++++++++ .../hdi/bluetooth/hci/v1_0/IHciCallback.idl | 68 +++++++++++++++ .../hdi/bluetooth/hci/v1_0/IHciInterface.idl | 79 +++++++++++++++++ 12 files changed, 899 insertions(+) create mode 100644 en/device_api/hdi/bluetooth/a2dp/v1_0/BluetoothAudioTypes.idl create mode 100644 en/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioCallback.idl create mode 100644 en/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioSession.idl create mode 100644 en/device_api/hdi/bluetooth/hci/v1_0/HciTypes.idl create mode 100644 en/device_api/hdi/bluetooth/hci/v1_0/IHciCallback.idl create mode 100644 en/device_api/hdi/bluetooth/hci/v1_0/IHciInterface.idl create mode 100644 zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/BluetoothAudioTypes.idl create mode 100644 zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioCallback.idl create mode 100644 zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioSession.idl create mode 100644 zh-cn/device_api/hdi/bluetooth/hci/v1_0/HciTypes.idl create mode 100644 zh-cn/device_api/hdi/bluetooth/hci/v1_0/IHciCallback.idl create mode 100644 zh-cn/device_api/hdi/bluetooth/hci/v1_0/IHciInterface.idl diff --git a/en/device_api/hdi/bluetooth/a2dp/v1_0/BluetoothAudioTypes.idl b/en/device_api/hdi/bluetooth/a2dp/v1_0/BluetoothAudioTypes.idl new file mode 100644 index 00000000..2e7fa0e2 --- /dev/null +++ b/en/device_api/hdi/bluetooth/a2dp/v1_0/BluetoothAudioTypes.idl @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiA2dp + * @{ + * + * @brief Provides unified APIs for the A2DP service. + * + * The Host can use the interface provided by the module to create an audio session, + * and exchange data with the audio subsystem. + * + * @since 4.0 + */ + +/* + * @file BluetoothAudioTypes.idl + * + * @brief Defines the data structure. + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.a2dp.v1_0; + +/* + * @brief Defines the operation. + * + * @since 4.0 + */ +enum Operation { + /** suspend render */ + SUSPEND_RENDER = 0, + /** start render */ + START_RENDER = 1, +}; + +/* + * @brief Defines the operation result of the interface. + * + * @since 4.0 + */ +enum Status { + /** status is success */ + SUCCESS = 0, + /** status is failure */ + FAILURE = 1, +}; + +/* + * @brief Defines the type of audio session. + * + * @since 4.0 + */ +enum SessionType { + /** unkown type */ + UNKNOWN_TYPE, + /** software encoding */ + SOFTWARE_ENCODING, + /** hardware encoding */ + HARDWARE_ENCODING, +}; \ No newline at end of file diff --git a/en/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioCallback.idl b/en/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioCallback.idl new file mode 100644 index 00000000..a73a7b81 --- /dev/null +++ b/en/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioCallback.idl @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiA2dp + * @{ + * + * @brief Provides unified APIs for the A2DP service. + * + * The Host can use the interface provided by the module to create an audio session, + * and exchange data with the audio subsystem. + * + * @since 4.0 + */ + +/** + * @file IBluetoothAudioCallback.idl + * + * @brief Defines the callback function, including the start, suspend, stop operations from audio. + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.a2dp.v1_0; + +/** + * @brief Defines the callback function to start, suspend, stop audio render. + * + * @since 4.0 + */ +[callback] interface IBluetoothAudioCallback { + /** + * @brief Start audio render callback function. + * + * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.0 + */ + StartRender(); + + /** + * @brief Suspend audio render callback function. + * + * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.0 + */ + SuspendRender(); + + /** + * @brief Stop audio render callback function. + * + * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.0 + */ + StopRender(); +} diff --git a/en/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioSession.idl b/en/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioSession.idl new file mode 100644 index 00000000..87205c77 --- /dev/null +++ b/en/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioSession.idl @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiA2dp + * @{ + * + * @brief Provides unified APIs for the A2DP service. + * + * The Host can use the interface provided by the module to create an audio session, + * and exchange data with the audio. + * + * @since 4.0 + */ + +/** + * @file IBluetoothAudioSession.idl + * + * @brief Defines the interfaces to start audio session, send render operation result, + * and stop the audio session. + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.a2dp.v1_0; + +import ohos.hdi.bluetooth.a2dp.v1_0.IBluetoothAudioCallback; +import ohos.hdi.bluetooth.a2dp.v1_0.BluetoothAudioTypes; + +/** + * @brief Defines the interfaces to start audio session, send render operation result, + * and stop the audio session. + * + * @since 4.0 + */ +interface IBluetoothAudioSession { + /** + * @brief Start audio session and register the callback function. + * + * @param sessionType Indicates the session type. + * @param callbackObj Indicates the callback function. For details, see {@link IBluetoothAudioCallback}. + * @param queue Returns sharedMemQueue for audio data. + * @return Returns 0 if the operation is successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.0 + */ + StartSession([in] enum SessionType sessionType, [in] IBluetoothAudioCallback callbackObj, + [out] SharedMemQueue queue); + + /** + * @brief Stop audio session. + * + * @param sessionType Indicates the session type. + * @return Returns 0 if the operation is successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.0 + */ + StopSession([in] enum SessionType sessionType); + + /** + * @brief send the render operation result. + * + * @param operation Indicates the render operation. + * @param Status SUCCESS or FAILURE for operation. + * @return Returns 0 if the operation is successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.0 + */ + RenderOperationResult([in] enum Operation operation, [in] enum Status status); +} diff --git a/en/device_api/hdi/bluetooth/hci/v1_0/HciTypes.idl b/en/device_api/hdi/bluetooth/hci/v1_0/HciTypes.idl new file mode 100644 index 00000000..43a75ef2 --- /dev/null +++ b/en/device_api/hdi/bluetooth/hci/v1_0/HciTypes.idl @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiHci + * @{ + * + * @brief Provides unified APIs for the HCI service. + * + * The Host can use the interface provided by the module to initialize the HCI(Host Controller Interface), + * and exchange data with the Controller through the service. + * + * @since 3.2 + */ + +/* + * @file HciTypes.idl + * + * @brief Defines the data structure used by the HCI module. + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.hci.v1_0; + +/* + * @brief Defines the operation result of the interface. + * + * @since 3.2 + */ +enum BtStatus { + /** status is success */ + SUCCESS = 0, + /** initial error */ + INITIAL_ERROR = 1, + /** unknown status */ + UNKNOWN = 2, +}; + +/* + * @brief Defines the data type transmitted over the HCI. + * + * @since 3.2 + */ +enum BtType { + /** HCI command */ + HCI_CMD = 1, + /** ACL data */ + ACL_DATA = 2, + /** SCO data */ + SCO_DATA = 3, + /** HCI event */ + HCI_EVENT = 4, + /** ISO data */ + ISO_DATA = 5, +}; \ No newline at end of file diff --git a/en/device_api/hdi/bluetooth/hci/v1_0/IHciCallback.idl b/en/device_api/hdi/bluetooth/hci/v1_0/IHciCallback.idl new file mode 100644 index 00000000..033c5ed3 --- /dev/null +++ b/en/device_api/hdi/bluetooth/hci/v1_0/IHciCallback.idl @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiHci + * @{ + * + * @brief Provides unified APIs for the HCI service. + * + * The Host can use the interface provided by the module to initialize the HCI(Host Controller Interface), + * and exchange data with the Controller through the service. + * + * @since 3.2 + */ + +/** + * @file IHciCallback.idl + * + * @brief Defines the HCI callback function, including the initialization result and data received from the controller. + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.hci.v1_0; + +import ohos.hdi.bluetooth.hci.v1_0.HciTypes; + +/** + * @brief Defines the HCI callback function, including the initialization result and data received from the controller. + * + * @since 3.2 + */ +[callback] interface IHciCallback { + /** + * @brief HCI initialization callback function. + * + * @param status Indicates the HCI initialization result. For details, see {@link BtStatus}. + * @return Returns 0 if the initialization result is returned successfully; returns a negative value otherwise. + * + * @since 3.2 + * @version 1.0 + */ + OnInited([in] enum BtStatus status); + + /** + * @brief Receives data packets sent by the controller.. + * + * @param type Indicates the HCI packet type. For details, see {@link BtType}. + * @param data Indicates the HCI data packets received from the Controller. + * @return Returns 0 if the data is received successfully; returns a negative value otherwise. + * + * @since 3.2 + * @version 1.0 + */ + OnReceivedHciPacket([in] enum BtType type, [in] unsigned char[] data); +} diff --git a/en/device_api/hdi/bluetooth/hci/v1_0/IHciInterface.idl b/en/device_api/hdi/bluetooth/hci/v1_0/IHciInterface.idl new file mode 100644 index 00000000..e6cc2c97 --- /dev/null +++ b/en/device_api/hdi/bluetooth/hci/v1_0/IHciInterface.idl @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiHci + * @{ + * + * @brief Provides unified APIs for the HCI service. + * + * The Host can use the interface provided by the module to initialize the HCI(Host Controller Interface), + * and exchange data with the Controller through the service. + * + * @since 3.2 + */ + +/** + * @file IHciInterface.idl + * + * @brief Defines the interfaces to initialize the HCI, send data to the Controller, + * and disable the HCI interface. + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.hci.v1_0; + +import ohos.hdi.bluetooth.hci.v1_0.IHciCallback; +import ohos.hdi.bluetooth.hci.v1_0.HciTypes; + +/** + * @brief Defines the interfaces to initialize the HCI, send data to the Controller, + * and disable the HCI interface. + * + * @since 3.2 + */ +interface IHciInterface { + /** + * @brief Initialize the HCI and register the callback function. + * + * @param callbackObj Indicates the callback function. For details, see {@link IHciCallback}. + * @return Returns 0 if the HCI is initialized successfully; returns a negative value otherwise. + * + * @since 3.2 + * @version 1.0 + */ + Init([in] IHciCallback callbackObj); + + /** + * @brief Sends data packets to the Controller. + * + * @param type Indicates the HCI packet type. For details, see {@link BtType}. + * @param data Indicates the HCI data packets sent to the Controller. + * @return Returns 0 if the HCI data packets is sent successfully; returns a negative value otherwise. + * + * @since 3.2 + * @version 1.0 + */ + SendHciPacket([in] enum BtType type, [in] unsigned char[] data); + + /** + * @brief Disable the HCI interface. + * + * @return Returns 0 if the HCI is disabled successfully; returns a negative value otherwise. + * + * @since 3.2 + * @version 1.0 + */ + Close(); +} diff --git a/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/BluetoothAudioTypes.idl b/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/BluetoothAudioTypes.idl new file mode 100644 index 00000000..19edf464 --- /dev/null +++ b/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/BluetoothAudioTypes.idl @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiA2dp + * @{ + * + * @brief HdiA2dp为A2DP服务提供统一接口。 + * + * 主机可以通过该模块提供的接口创建音频通话,与音频子系统交换数据。 + * + * @since 4.0 + */ + +/* + * @file BluetoothAudioTypes.idl + * + * @brief 声明数据结构。 + * + * @since 4.0 + * @version 1.0 + */ +package ohos.hdi.bluetooth.a2dp.v1_0; + +/* + * @brief 声明操作行为。 + * + * @since 4.0 + */ +enum Operation { + /** 暂停渲染。*/ + SUSPEND_RENDER = 0, + /** 开启渲染。*/ + START_RENDER = 1, +}; + +/* + * @brief 声明接口调用的操作结果。 + * + * @since 4.0 + */ +enum Status { + /** 调用成功。*/ + SUCCESS = 0, + /** 调用失败。*/ + FAILURE = 1, +}; + +/* + * @brief 声明音频会话的类型。 + * + * @since 4.0 + */ +enum SessionType { + /** 未知类型。*/ + UNKNOWN_TYPE, + /** 软件编码类型。*/ + SOFTWARE_ENCODING, + /** 硬件编码类型。*/ + HARDWARE_ENCODING, +}; \ No newline at end of file diff --git a/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioCallback.idl b/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioCallback.idl new file mode 100644 index 00000000..93cd9a30 --- /dev/null +++ b/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioCallback.idl @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiA2dp + * @{ + * + * @brief HdiA2dp为A2DP服务提供统一接口。 + * + * 主机可以通过该模块提供的接口创建音频通话,与音频子系统交换数据。 + * + * @since 4.0 + */ + +/** + * @file IBluetoothAudioCallback.idl + * + * @brief 声明回调函数,包含音频开始、暂停和结束操作。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.a2dp.v1_0; + +/** + * @brief 声明用于音频渲染开启、暂停,和结束的回调函数。 + * + * @since 4.0 + */ +[callback] interface IBluetoothAudioCallback { + /** + * @brief 启动音频渲染的回调函数。 + * + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + StartRender(); + + /** + * @brief 暂停音频渲染的回调函数。 + * + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + SuspendRender(); + + /** + * @brief 结束音频渲染的回调函数。 + * + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + StopRender(); +} diff --git a/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioSession.idl b/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioSession.idl new file mode 100644 index 00000000..4cacc351 --- /dev/null +++ b/zh-cn/device_api/hdi/bluetooth/a2dp/v1_0/IBluetoothAudioSession.idl @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiA2dp + * @{ + * + * @brief HdiA2dp为A2DP服务提供统一接口。 + * + * 主机可以通过该模块提供的接口创建音频通话,与音频子系统交换数据。 + * + * @since 4.0 + */ + +/** + * @file IBluetoothAudioSession.idl + * + * @brief 声明开启音频会话,发送渲染操作结果,和结束音频会话的接口。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.a2dp.v1_0; + +import ohos.hdi.bluetooth.a2dp.v1_0.IBluetoothAudioCallback; +import ohos.hdi.bluetooth.a2dp.v1_0.BluetoothAudioTypes; + +/** + * @brief 声明开启音频会话,发送渲染操作结果,和结束音频会话的接口。 + * + * @since 4.0 + */ +interface IBluetoothAudioSession { + /** + * @brief 开启音频会话并注册回调函数。 + * + * @param sessionType 表示会话类型。 + * @param callbackObj 表示回调函数。相关详细信息,请参考{@link IBluetoothAudioCallback}。 + * @param queue 返回音频数据的队列。 + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + StartSession([in] enum SessionType sessionType, [in] IBluetoothAudioCallback callbackObj, + [out] SharedMemQueue queue); + + /** + * @brief 结束音频会话。 + * + * @param SessionType 表示会话类型。 + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + StopSession([in] enum SessionType sessionType); + + /** + * @brief 发送渲染操作结果。 + * + * @param operation 表示渲染操作。 + * @param Status 表示渲染操作成功或失败。 + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + RenderOperationResult([in] enum Operation operation, [in] enum Status status); +} diff --git a/zh-cn/device_api/hdi/bluetooth/hci/v1_0/HciTypes.idl b/zh-cn/device_api/hdi/bluetooth/hci/v1_0/HciTypes.idl new file mode 100644 index 00000000..d1cbe3ea --- /dev/null +++ b/zh-cn/device_api/hdi/bluetooth/hci/v1_0/HciTypes.idl @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiHci + * @{ + * + * @brief HdiHci为HCI服务提供统一接口。 + * + * 主机可以使用该模块提供的接口来初始化HCI(主机控制器接口),并通过该服务与控制器交换数据。 + * + * @since 3.2 + */ + +/* + * @file HciTypes.idl + * + * @brief 声明HCI模块使用的数据结构。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.hci.v1_0; + +/* + * @brief 声明接口的操作结果。 + * + * @since 3.2 + */ +enum BtStatus { + /** 成功。*/ + SUCCESS = 0, + /** 初始化失败。*/ + INITIAL_ERROR = 1, + /** 未知。*/ + UNKNOWN = 2, +}; + +/* + * @brief 声明通过HCI传输的数据类型。 + * + * @since 3.2 + */ +enum BtType { + /** HCI命令。*/ + HCI_CMD = 1, + /** ACL数据。*/ + ACL_DATA = 2, + /** SCO数据。*/ + SCO_DATA = 3, + /** HCI事件。*/ + HCI_EVENT = 4, + /** ISO数据。*/ + ISO_DATA = 5, +}; \ No newline at end of file diff --git a/zh-cn/device_api/hdi/bluetooth/hci/v1_0/IHciCallback.idl b/zh-cn/device_api/hdi/bluetooth/hci/v1_0/IHciCallback.idl new file mode 100644 index 00000000..ff4951e0 --- /dev/null +++ b/zh-cn/device_api/hdi/bluetooth/hci/v1_0/IHciCallback.idl @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiHci + * @{ + * + * @brief HdiHci为HCI服务提供统一接口。 + * + * 主机可以使用该模块提供的接口来初始化HCI(主机控制器接口),并通过该服务与控制器交换数据。 + * + * @since 3.2 + */ + +/** + * @file IHciCallback.idl + * + * @brief 定义HCI回调函数,包含初始化结果和从控制器接收的数据。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.hci.v1_0; + +import ohos.hdi.bluetooth.hci.v1_0.HciTypes; + +/** + * @brief 定义HCI回调函数,包含初始化结果和从控制器接收的数据。 + * + * @since 3.2 + */ +[callback] interface IHciCallback { + /** + * @brief HCI 初始化回调函数。 + * + * @param status 声明HCI初始化结果。相关详细信息,请参考 {@link BtStatus}. + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + OnInited([in] enum BtStatus status); + + /** + * @brief 接收控制器发送的数据包。 + * + * @param type 声明HCI数据包类型。相关详细信息,请参考 {@link BtType}. + * @param data 表示从控制器接收的HCI数据包。 + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + OnReceivedHciPacket([in] enum BtType type, [in] unsigned char[] data); +} diff --git a/zh-cn/device_api/hdi/bluetooth/hci/v1_0/IHciInterface.idl b/zh-cn/device_api/hdi/bluetooth/hci/v1_0/IHciInterface.idl new file mode 100644 index 00000000..ae60ebb9 --- /dev/null +++ b/zh-cn/device_api/hdi/bluetooth/hci/v1_0/IHciInterface.idl @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiHci + * @{ + * + * @brief HdiHci为HCI服务提供统一接口。 + * + * 主机可以使用该模块提供的接口来初始化HCI(主机控制器接口),并通过该服务与控制器交换数据。 + * + * @since 3.2 + */ + +/** + * @file IHciInterface.idl + * + * @brief 声明接口以初始化HCI,向控制器发送数据及关闭HCI接口。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.bluetooth.hci.v1_0; + +import ohos.hdi.bluetooth.hci.v1_0.IHciCallback; +import ohos.hdi.bluetooth.hci.v1_0.HciTypes; + +/** + * @brief 声明接口以初始化HCI,向控制器发送数据及关闭HCI接口。 + * + * @since 3.2 + */ +interface IHciInterface { + /** + * @brief 初始化HCI并注册回调函数。 + * + * @param callbackObj 声明回调函数。相关详细信息,请参考 {@link IHciCallback}. + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + Init([in] IHciCallback callbackObj); + + /** + * @brief 向控制器发送数据包。 + * + * @param type 声明HCI数据包类型。相关详细信息,请参考 {@link BtType}. + * @param data 表示发送到控制器的HCI数据包。 + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + SendHciPacket([in] enum BtType type, [in] unsigned char[] data); + + /** + * @brief 关闭HCI接口。 + * + * @return 如果操作成功返回0;否则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + Close(); +} -- Gitee From e626764dbe7631472a14262de1c79a18ab75fb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Thu, 21 Dec 2023 15:29:21 +0800 Subject: [PATCH 0169/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9B=B4=E6=96=B0-vibrator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l30053696 --- .../hdi/sensor/v2_0/ISensorCallback.idl | 65 ++++++ .../hdi/sensor/v2_0/ISensorInterface.idl | 191 ++++++++++++++++++ .../hdi/sensor/v2_0/SensorTypes.idl | 144 +++++++++++++ 3 files changed, 400 insertions(+) create mode 100644 zh-cn/device_api/hdi/sensor/v2_0/ISensorCallback.idl create mode 100644 zh-cn/device_api/hdi/sensor/v2_0/ISensorInterface.idl create mode 100644 zh-cn/device_api/hdi/sensor/v2_0/SensorTypes.idl diff --git a/zh-cn/device_api/hdi/sensor/v2_0/ISensorCallback.idl b/zh-cn/device_api/hdi/sensor/v2_0/ISensorCallback.idl new file mode 100644 index 00000000..e30eabb5 --- /dev/null +++ b/zh-cn/device_api/hdi/sensor/v2_0/ISensorCallback.idl @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiSensor + * @{ + * + * @brief 传感器设备驱动对传感器服务提供通用的接口能力。 + * + * 模块提供传感器服务对传感器驱动访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现获取传感器设备信息、订阅/取消订阅传感器数据、 + * 使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file ISensorCallback.idl + * + * @brief Sensor模块为Sensor服务提供数据上报的回调函数。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Sensor模块接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.sensor.v2_0; + +import ohos.hdi.sensor.v2_0.SensorTypes; + +/** + * @brief 定义用于上报传感器数据的回调函数。 + * + * 传感器用户订阅传感器数据,只在使能传感器后,传感器数据订阅者才能接收传感器数据。详见{@link ISensorInterface}。 + * + * @since 4.1 + */ +[callback] interface ISensorCallback { + /** + * @param event 上报的传感器数据,详见{@link HdfSensorEvents}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + */ + OnDataEvent([in] struct HdfSensorEvents event); +} diff --git a/zh-cn/device_api/hdi/sensor/v2_0/ISensorInterface.idl b/zh-cn/device_api/hdi/sensor/v2_0/ISensorInterface.idl new file mode 100644 index 00000000..b93e2901 --- /dev/null +++ b/zh-cn/device_api/hdi/sensor/v2_0/ISensorInterface.idl @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiSensor + * @{ + * + * @brief Provides unified APIs for sensor services to access sensor drivers. + * + * @brief 传感器设备驱动对传感器服务提供通用的接口能力。 + * + * 模块提供传感器服务对传感器驱动访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现获取传感器设备信息、订阅/取消订阅传感器数据、 + * 使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置等。 + * + * @since 4.1 + */ + +/** + * @file ISensorInterface.idl + * + * @brief Sensor模块对外通用的接口声明文件,提供获取传感器设备信息、订阅/取消订阅传感器数据、 + * 使能/去使能传感器、设置传感器模式、设置传感器精度,量程等可选配置接口定义。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Sensor模块接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ + +package ohos.hdi.sensor.v2_0; + +import ohos.hdi.sensor.v2_0.SensorTypes; +import ohos.hdi.sensor.v2_0.ISensorCallback; + +/** + * @brief 提供Sensor设备基本控制操作接口。 + * + * 操作包括获取传感器设备信息、订阅/取消订阅传感器数据、使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置接口定义。 + * + * @since 4.1 + * @version 2.0 + */ +interface ISensorInterface { + /** + * @brief 获取当前系统中所有类型的传感器信息。 + * + * @param info 输出系统中注册的所有传感器信息,一种类型传感器信息包括传感器名字、设备厂商、 + * 固件版本号、硬件版本号、传感器类型编号、传感器标识、最大量程、精度、功耗,详见{@link HdfSensorInformation}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + * @version 1.0 + */ + GetAllSensorInfo([out] struct HdfSensorInformation[] info); + + /** + * @brief 根据传感器设备类型标识使能传感器信息列表里存在的设备,只有数据订阅者使能传感器后,才能获取订阅的传感器数据。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + * @version 1.0 + */ + Enable([in] int sensorId); + + /** + * @brief 根据传感器设备类型标识去使能传感器信息列表里存在的设备。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + * @version 1.0 + */ + Disable([in] int sensorId); + + /** + * @brief 设置指定传感器的数据上报模式,不同的工作模式,上报数据的方式不同。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * @param samplingInterval 设置指定传感器的数据采样间隔,单位纳秒。 + * @param reportInterval 表示传感器数据上报间隔,单位纳秒。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 2.2 + * @version 1.0 + */ + SetBatch([in] int sensorId,[in] long samplingInterval, [in] long reportInterval); + + /** + * @brief 设置指定传感器数据上报模式。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * @param mode 传感器的数据上报模式,详见{@link HdfSensorModeType}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + SetMode([in] int sensorId, [in] int mode); + + /** + * @brief 设置指定传感器量程、精度等可选配置。 + * + * @param sensorId 唯一标识一个传感器设备类型,详见{@link HdfSensorTypeTag}。 + * @param option 表示要设置的选项,如测量范围和精度。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + SetOption([in] int sensorId, [in] unsigned int option); + + /** + * @brief 订阅者注册传感器数据回调函数,系统会将获取到的传感器数据上报给订阅者。 + * + * @param groupId 传感器组ID。 + * groupId枚举值范围为128-160,表示已订阅医疗传感器服务,只需成功订阅一次,无需重复订阅。 + * groupId枚举值范围不在128-160之间,这意味着传统传感器已订阅,只需成功订阅一次,无需重复订阅。 + * @param callbackObj 要注册的回调函数,详见{@link ISensorCallback}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + Register([in] int groupId, [in] ISensorCallback callbackObj); + + /** + * @brief 订阅者取消注册传感器数据回调函数。 + * + * @param groupId 传感器组ID。 + * groupId枚举值范围为128-160,表示已订阅医疗传感器服务。只需成功取消订阅一次,无需重复取消订阅。 + * groupId枚举值范围不在128-160之间,这意味着传统传感器已订阅。并且成功取消订阅。 + * @param callbackObj 要取消注册的回调函数,详见{@link ISensorCallback}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 2.2 + * @version 1.0 + */ + Unregister([in] int groupId, [in] ISensorCallback callbackObj); + + /** + * @brief 订阅者取消注册传感器数据回调函数。 + * + * @param groupId 传感器组ID。 + * groupId枚举值范围为128-160,表示已订阅医疗传感器服务。只需成功取消订阅一次,无需重复取消订阅。 + * groupId枚举值范围不在128-160之间,这意味着传统传感器已订阅。并且成功取消订阅。 + * @param callbackObj 要取消注册的回调函数,详见{@link ISensorCallback}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负数。 + * + * @since 4.0 + * @version 1.1 + */ + ReadData([in] int sensorId, [out] struct HdfSensorEvents[] event); +} diff --git a/zh-cn/device_api/hdi/sensor/v2_0/SensorTypes.idl b/zh-cn/device_api/hdi/sensor/v2_0/SensorTypes.idl new file mode 100644 index 00000000..bfbea104 --- /dev/null +++ b/zh-cn/device_api/hdi/sensor/v2_0/SensorTypes.idl @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiSensor + * @{ + * + * @brief 传感器设备驱动对传感器服务提供通用的接口能力。 + * + * 模块提供传感器服务对传感器驱动访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法, + * 以传感器ID区分访问不同类型传感器设备,实现获取传感器设备信息、订阅/取消订阅传感器数据、 + * 使能/去使能传感器、设置传感器模式、设置传感器精度、量程等可选配置等。 + * + * @version 2.0 + */ + +/** + * @file SensorTypes.idl + * + * @brief 定义传感器模块所使用的传感器类型,传感器信息,传感器数据结构等数据类型。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Sensor模块接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.sensor.v2_0; + +/** + * @brief 定义传感器的基本信息。 + * + * 传感器的信息包括传感器名称、供应商、固件版本、硬件版本、传感器类型ID、传感器ID、最大测量范围、精度和功率。 + * + * @since 2.2 + */ +struct HdfSensorInformation { + String sensorName; /**< 传感器名称。 */ + String vendorName; /**< 传感器供应商。 */ + String firmwareVersion; /**< 传感器固件版本。 */ + String hardwareVersion; /**< 传感器硬件版本。 */ + int sensorTypeId; /**< 传感器类型ID(在{@link HdfSensorTypeTag}中描述)。 */ + int sensorId; /**< 传感器ID,由传感器驱动程序开发人员定义。 */ + float maxRange; /**< 传感器的最大测量范围。 */ + float accuracy; /**< 传感器精度。 */ + float power; /**< 传感器功率。 */ + long minDelay; /**< 允许的最小采样周期(微秒) */ + long maxDelay; /**< 允许的最大采样周期(微秒) */ + unsigned int fifoMaxEventCount; /**< 此传感器可批处理的最大事件数 */ + unsigned int reserved; /**< 保留字段 */ +}; + +/** + * @brief 定义传感器上报的数据。 + * + * 上报的传感器数据包括传感器ID、传感器算法版本号、数据生成时间、传感器类型ID、 + * 数据选项(如测量范围和精度)、数据上报模式、数据地址、数据长度。 + * + * @since 2.2 + */ +struct HdfSensorEvents { + int sensorId; /**< 传感器ID。 */ + int version; /**< 传感器算法版本号。 */ + long timestamp; /**< 传感器数据生成时间。 */ + unsigned int option; /**< 传感器数据选项,包括测量范围和精度。 */ + int mode; /**< 传感器数据上报模式。 */ + unsigned char[] data; /**< 传感器数据地址。 */ + unsigned int dataLen; /**< 传感器数据长度。 */ +}; + +/** + * @brief Enumerates sensor types. + * + * @since 4.0 + */ +enum HdfSensorTypeTag { + HDF_SENSOR_TYPE_NONE = 0, /**< 空传感器类型,用于测试。 */ + HDF_SENSOR_TYPE_ACCELEROMETER = 1, /**< 加速度传感器。 */ + HDF_SENSOR_TYPE_GYROSCOPE = 2, /**< 陀螺仪传感器。 */ + HDF_SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3, /**< 心率传感器。 */ + HDF_SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, /**< 心电传感器。 */ + HDF_SENSOR_TYPE_AMBIENT_LIGHT = 5, /**< 环境光传感器。 */ + HDF_SENSOR_TYPE_MAGNETIC_FIELD = 6, /**< 地磁传感器。 */ + HDF_SENSOR_TYPE_CAPACITIVE = 7, /**< 电容传感器。 */ + HDF_SENSOR_TYPE_BAROMETER = 8, /**< 气压计传感器。 */ + HDF_SENSOR_TYPE_TEMPERATURE = 9, /**< 温度传感器。 */ + HDF_SENSOR_TYPE_HALL = 10, /**< 霍尔传感器。 */ + HDF_SENSOR_TYPE_GESTURE = 11, /**< 手势传感器。 */ + HDF_SENSOR_TYPE_PROXIMITY = 12, /**< 接近光传感器。 */ + HDF_SENSOR_TYPE_HUMIDITY = 13, /**< 湿度传感器。 */ + HDF_SENSOR_TYPE_COLOR = 14, /**< 颜色传感器。 */ + HDF_SENSOR_TYPE_SAR = 15, /**< SAR传感器。 */ + HDF_SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /**< 辅助环境光传感器。 */ + HDF_SENSOR_TYPE_MEDICAL_BEGIN = 128, /**< 医疗传感器ID枚举值范围的开始。 */ + HDF_SENSOR_TYPE_MEDICAL_END = 160, /**< 医疗传感器ID枚举值范围的结束。 */ + HDF_SENSOR_TYPE_PHYSICAL_MAX = 255, /**< 物理传感器最大类型。 */ + HDF_SENSOR_TYPE_ORIENTATION = 256, /**< 方向传感器。 */ + HDF_SENSOR_TYPE_GRAVITY = 257, /**< 重力传感器。 */ + HDF_SENSOR_TYPE_LINEAR_ACCELERATION = 258, /**< 线性加速度传感器。 */ + HDF_SENSOR_TYPE_ROTATION_VECTOR = 259, /**< 旋转矢量传感器。 */ + HDF_SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, /**< 环境温度传感器。 */ + HDF_SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< 未校准磁场传感器。 */ + HDF_SENSOR_TYPE_GAME_ROTATION_VECTOR = 262, /**< 游戏旋转矢量传感器。 */ + HDF_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, /**< 未校准陀螺仪传感器。 */ + HDF_SENSOR_TYPE_SIGNIFICANT_MOTION = 264, /**< 大幅度动作传感器。 */ + HDF_SENSOR_TYPE_PEDOMETER_DETECTION = 265, /**< 计步器检测传感器。 */ + HDF_SENSOR_TYPE_PEDOMETER = 266, /**< 计步器传感器。 */ + HDF_SENSOR_TYPE_POSTURE = 267, /**< 姿态传感器 */ + HDF_SENSOR_TYPE_HEADPOSTURE = 268, /**< 头部姿势传感器 */ + HDF_SENSOR_TYPE_DROP_DETECT = 269, /**< 跌落检测传感器 */ + HDF_SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, /**< 地磁旋转矢量传感器。 */ + HDF_SENSOR_TYPE_HEART_RATE = 278, /**< 心率传感器。 */ + HDF_SENSOR_TYPE_DEVICE_ORIENTATION = 279, /**< 设备方向传感器。 */ + HDF_SENSOR_TYPE_WEAR_DETECTION = 280, /**< 佩戴检测传感器。 */ + HDF_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, /**< 未校准加速度传感器。 */ + HDF_SENSOR_TYPE_MAX, /**< 传感器类型最大个数标识。 */ +}; + +/** + * @brief 枚举传感器的硬件服务组。 + * + * @since 2.2 + */ +enum HdfSensorGroupType { + HDF_TRADITIONAL_SENSOR_TYPE = 0, /**< 传统传感器类型,传感器ID枚举值范围不在128-160之间。 */ + HDF_MEDICAL_SENSOR_TYPE = 1, /**< 医疗传感器类型,传感器ID枚举值范围在128-160之间。 */ + HDF_SENSOR_GROUP_TYPE_MAX, /**< 最大传感器类型。 */ +}; -- Gitee From 847af5ca684135aa004a9938530287a74f696822 Mon Sep 17 00:00:00 2001 From: xuweinan Date: Fri, 8 Dec 2023 10:37:14 +0800 Subject: [PATCH 0170/2135] =?UTF-8?q?Description:XComponent=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=94=AF=E6=8C=81=E5=B8=A7=E7=8E=87=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=8E=E6=98=BE=E7=A4=BA=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20Feature=20or=20Bugfix:Feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuweinan --- .../ace/native_interface_xcomponent.h | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index 53ed97ad..da9f47bd 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -297,6 +297,21 @@ struct OH_NativeXComponent_KeyEvent; */ typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent; +/** + * @brief 定义期望帧率范围。 + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** 期望帧率范围最小值。 */ + int32_t min; + /** 期望帧率范围最大值。 */ + int32_t max; + /** 期望帧率 */ + int32_t expected; +} OH_NativeXComponent_ExpectedRateRange; + /** * @brief 获取ArkUI XComponent的id。 * @@ -528,6 +543,40 @@ int32_t OH_NativeXComponent_GetKeyEventDeviceId(OH_NativeXComponent_KeyEvent* ke */ int32_t OH_NativeXComponent_GetKeyEventTimeStamp(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* timeStamp); +/** + * @brief 设置期望帧率范围。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param range 表示指向期望帧率范围的指针 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_SetExpectedFrameRateRange( + OH_NativeXComponent* component, OH_NativeXComponent_ExpectedRateRange* range); + +/** + * @brief 为此OH_NativeXComponent实例注册显示更新回调,并使能每帧回调此函数。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param callback 指示指向显示更新回调的指针。 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* component, + void (*callback)(OH_NativeXComponent* component, uint64_t timestamp, uint64_t targetTimestamp)); + +/** + * @brief 为此OH_NativeXComponent实例取消注册回调函数,并关闭每帧回调此函数。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @return 返回执行的状态代码。 + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* component); + #ifdef __cplusplus }; #endif -- Gitee From 15ebd27529a8452054bd37fba0c2afbdae5f0b28 Mon Sep 17 00:00:00 2001 From: weiwei Date: Thu, 14 Dec 2023 16:24:57 +0800 Subject: [PATCH 0171/2135] =?UTF-8?q?NNRt=20API=2011=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E4=BF=AE=E6=94=B9=EF=BC=8C=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E7=89=88=E6=9C=AC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: weiwei --- .../neural_network_core.h | 1094 ++++++++++++++++ .../neural_network_runtime.h | 719 ++++------ .../neural_network_runtime_type.h | 1166 ++++++++--------- .../neural_network_core.h | 486 +++---- .../neural_network_runtime.h | 292 ++++- .../neural_network_runtime_compat.h | 274 ---- .../neural_network_runtime_type.h | 68 +- 7 files changed, 2445 insertions(+), 1654 deletions(-) create mode 100644 en/native_sdk/ai/neural_network_runtime/neural_network_core.h delete mode 100644 zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_compat.h diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_core.h b/en/native_sdk/ai/neural_network_runtime/neural_network_core.h new file mode 100644 index 00000000..f0be18c2 --- /dev/null +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_core.h @@ -0,0 +1,1094 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup NeuralNeworkRuntime + * @{ + * + * @brief Provides APIs of Neural Network Runtime for accelerating the model inference. + * + * @since 9 + * @version 2.0 + */ + +/** + * @file neural_network_core.h + * + * @brief Defines the Neural Network Core APIs. The AI inference framework uses the Native APIs provided by + * Neural Network Core to compile models and perform inference and computing on acceleration hardware. + * + * Note: Currently, the APIs of Neural Network Core do not support multi-thread calling. \n + * + * include "neural_network_runtime/neural_network_core.h" + * @library libneural_network_core.so + * @Syscap SystemCapability.Ai.NeuralNetworkRuntime + * @since 11 + * @version 1.0 + */ + +#ifndef NEURAL_NETWORK_CORE_H +#define NEURAL_NETWORK_CORE_H + +#include "neural_network_runtime_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates a compilation instance of the {@link OH_NNCompilation} type. + * + * After the OH_NNModel module completes model construction, APIs provided by the OH_NNCompilation module pass the + * model to underlying device for compilation. This method creates a {@link OH_NNCompilation} instance + * based on the passed {@link OH_NNModel} instance. The {@link OH_NNCompilation_SetDevice} method is called + * to set the device to compile on, and {@link OH_NNCompilation_Build} is then called to complete compilation.\n + * + * In addition to computing device selection, the OH_NNCompilation module supports features such as model caching, + * performance preference, priority setting, and float16 computing, which can be implemented by the following methods:\n + * {@link OH_NNCompilation_SetCache}\n + * {@link OH_NNCompilation_SetPerformanceMode}\n + * {@link OH_NNCompilation_SetPriority}\n + * {@link OH_NNCompilation_EnableFloat16}\n + * + * After {@link OH_NNCompilation_Build} is called, the {@link OH_NNModel} instance can be released.\n + * + * @param model Pointer to the {@link OH_NNModel} instance. + * @return Pointer to a {@link OH_NNCompilation} instance, or NULL if it fails to create. + * @since 9 + * @version 1.0 + */ +OH_NNCompilation *OH_NNCompilation_Construct(const OH_NNModel *model); + +/** + * @brief Creates a compilation instance based on an offline model file. + * + * This method conflicts with the way of passing an online built model or an offline model file buffer, + * and you have to choose only one of the three construction methods. \n + * + * Offline model is a type of model that is offline compiled by the model converter provided by a device vendor. + * So that the offline model can only be used on the specified device, but the compilation time of offline model is usually + * much less than {@link OH_NNModel}. \n + * + * You should perform the offline compilation during your development and deploy the offline model in your app package. \n + * + * @param modelPath Offline model file path. + * @return Pointer to an {@link OH_NNCompilation} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +OH_NNCompilation *OH_NNCompilation_ConstructWithOfflineModelFile(const char *modelPath); + +/** + * @brief Creates a compilation instance based on an offline model file buffer. + * + * This method conflicts with the way of passing an online built model or an offline model file path, + * and you have to choose only one of the three construction methods. \n + * + * Note that the returned {@link OH_NNCompilation} instance only saves the modelBuffer pointer inside, instead of + * copying its data. You should not release modelBuffer before the {@link OH_NNCompilation} instance is destroied. \n + * + * @param modelBuffer Offline model file buffer. + * @param modelSize Offfline model buffer size. + * @return Pointer to an {@link OH_NNCompilation} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +OH_NNCompilation *OH_NNCompilation_ConstructWithOfflineModelBuffer(const void *modelBuffer, size_t modelSize); + +/** + * @brief Creates a empty compilation instance for restoration from cache later. + * + * See {@link OH_NNCompilation_SetCache} for the description of cache.\n + * + * The restoration time from the cache is less than compilation with {@link OH_NNModel}.\n + * + * You should call {@link OH_NNCompilation_SetCache} or {@link OH_NNCompilation_ImportCacheFromBuffer} first, + * and then call {@link OH_NNCompilation_Build} to complete the restoration.\n + * + * @return Pointer to an {@link OH_NNCompilation} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +OH_NNCompilation *OH_NNCompilation_ConstructForCache(); + +/** + * @brief Exports the cache to a given buffer. + * + * See {@link OH_NNCompilation_SetCache} for the description of cache.\n + * + * Note that the cache is the result of compilation building {@link OH_NNCompilation_Build}, + * so that this method must be called after {@link OH_NNCompilation_Build}.\n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @param buffer Pointer to the given buffer. + * @param length Buffer length. + * @param modelSize Byte size of the model cache. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_ExportCacheToBuffer(OH_NNCompilation *compilation, + const void *buffer, + size_t length, + size_t *modelSize); + +/** + * @brief Imports the cache from a given buffer. + * + * See {@link OH_NNCompilation_SetCache} for the description of cache.\n + * + * {@link OH_NNCompilation_Build} should be called to complete the restoration after + * {@link OH_NNCompilation_ImportCacheFromBuffer} is called.\n + * + * Note that compilation only saves the buffer pointer inside, instead of copying its data. You should not + * release buffer before compilation is destroied.\n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @param buffer Pointer to the given buffer. + * @param modelSize Byte size of the model cache. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_ImportCacheFromBuffer(OH_NNCompilation *compilation, + const void *buffer, + size_t modelSize); + +/** + * @brief Adds an extension config for a custom hardware attribute. + * + * Some devices have their own specific attributes which have not been opened in NNRt. This method provides an additional way for you + * to set these custom hardware attributes of the device. You should query their names and values from the device + * vendor's documents, and add them into compilation instance one by one. These attributes will be passed directly to device + * driver, and this method will return error code if the driver cannot parse them. \n + * + * After {@link OH_NNCompilation_Build} is called, the configName and configValue can be released. \n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @param configName Config name. + * @param configValue A byte buffer saving the config value. + * @param configValueSize Byte size of the config value. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_AddExtensionConfig(OH_NNCompilation *compilation, + const char *configName, + const void *configValue, + const size_t configValueSize); + +/** + * @brief Specifies the device for model compilation and computing. + * + * In the compilation phase, you need to specify the device for model compilation and computing. Call {@link OH_NNDevice_GetAllDevicesID} + * to obtain available device IDs. Call {@link OH_NNDevice_GetType} and {@link OH_NNDevice_GetName} to obtain device information + * and pass target device ID to this method for setting. \n + * + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @param deviceID Device id. If it is 0, the first device in the current device list will be used by default. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_SetDevice(OH_NNCompilation *compilation, size_t deviceID); + +/** + * @brief Set the cache directory and version of the compiled model. + * + * On the device that supports caching, a model can be saved as a cache file after being compiled on the device driver. + * The model can be directly read from the cache file in the next compilation, saving recompilation time. + * This method performs different operations based on the passed cache directory and version: \n + * + * - No file exists in the cache directory: + * Caches the compiled model to the directory and sets the cache version to version. \n + * + * - A complete cache file exists in the cache directory, and its version is version: + * Reads the cache file in the path and passes the data to the underlying device for conversion into executable model instances. \n + * + * - A complete cache file exists in the cache directory, and its version is earlier than version: + * When model compilation is complete on the underlying device, overwrites the cache file and changes the version number to version. \n + * + * - A complete cache file exists in the cache directory, and its version is later than version: + * Returns the {@link OH_NN_INVALID_PARAMETER} error code without reading the cache file. \n + * + * - The cache file in the cache directory is incomplete or you do not have the permission to access the cache file. + * Returns the {@link OH_NN_INVALID_FILE} error code. \n + * + * - The cache directory does not exist or you do not have the access permission. + * Returns the {@link OH_NN_INVALID_PATH} error code. \n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @param cachePath Directory for storing model cache files. This method creates directories for different devices in the cachePath directory. + * You are advised to use a separate cache directory for each model. + * @param version Cache version. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_SetCache(OH_NNCompilation *compilation, const char *cachePath, uint32_t version); + +/** + * @brief Sets the performance mode for model computing. + * + * Allows you to set the performance mode for model computing to meet the requirements of low power consumption + * and ultimate performance. If this method is not called to set the performance mode in the compilation phase, the compilation instance assigns + * the {@link OH_NN_PERFORMANCE_NONE} mode for the model by default. In this case, the device performs computing in the default performance mode. \n + * + * If this method is called on the device that does not support the setting of the performance mode, the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned. \n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @param performanceMode Performance mode. For details about the available performance modes, see {@link OH_NN_PerformanceMode}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_SetPerformanceMode(OH_NNCompilation *compilation, + OH_NN_PerformanceMode performanceMode); + +/** + * @brief Sets the model computing priority. + * + * Allows you to set computing priorities for models. + * The priorities apply only to models created by the process with the same UID. + * The settings will not affect models created by processes with different UIDs on different devices. \n + * + * If this method is called on the device that does not support the priority setting, the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned. \n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @param priority Priority. For details about the optional priorities, see {@link OH_NN_Priority}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_SetPriority(OH_NNCompilation *compilation, OH_NN_Priority priority); + +/** + * @brief Enables float16 for computing. + * + * Float32 is used by default for the model of float type. If this method is called on a device that supports float16, + * float16 will be used for computing the float32 model to reduce memory usage and execution time. \n + * + * This option is useless for the model of int type, e.g. int8 type. \n + * + * If this method is called on the device that does not support float16, the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned. \n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @param enableFloat16 Indicates whether to enable float16. If this parameter is set to true, float16 inference is performed. + * If this parameter is set to false, float32 inference is performed. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, an error code is returned. + * For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_EnableFloat16(OH_NNCompilation *compilation, bool enableFloat16); + +/** + * @brief Compiles a model. + * + * After the compilation configuration is complete, call this method to return the compilation result. The compilation instance pushes the model and + * compilation options to the device for compilation. After this method is called, additional compilation operations cannot be performed. \n + * + * If the {@link OH_NNCompilation_SetDevice}, {@link OH_NNCompilation_SetCache}, {@link OH_NNCompilation_SetPerformanceMode}, + * {@link OH_NNCompilation_SetPriority}, and {@link OH_NNCompilation_EnableFloat16} methods are called, {@link OH_NN_OPERATION_FORBIDDEN} is returned. \n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNCompilation_Build(OH_NNCompilation *compilation); + +/** + * @brief Releases the Compilation object. + * + * This method needs to be called to release the compilation instance created by {@link OH_NNCompilation_Construct}, + * {@link OH_NNCompilation_ConstructWithOfflineModelFile}, {@link OH_NNCompilation_ConstructWithOfflineModelBuffer} and + * {@link OH_NNCompilation_ConstructForCache}. Otherwise, the memory leak will occur. \n + * + * If compilation or *compilation is a null pointer, this method only prints warning logs and does not execute the release. \n + * + * @param compilation Double pointer to the {@link OH_NNCompilation} instance. After a compilation instance is destroyed, + * this method sets *compilation to a null pointer. + * @since 9 + * @version 1.0 + */ +void OH_NNCompilation_Destroy(OH_NNCompilation **compilation); + + +/** + * @brief Creates an {@link NN_TensorDesc} instance. + * + * The {@link NN_TensorDesc} describes various tensor attributes, such as name/data type/shape/format, etc.\n + * + * The following methods can be called to create a {@link NN_Tensor} instance based on the passed {@link NN_TensorDesc} + * instance:\n + * {@link OH_NNTensor_Create}\n + * {@link OH_NNTensor_CreateWithSize}\n + * {@link OH_NNTensor_CreateWithFd}\n + * + * Note that these methods will copy the {@link NN_TensorDesc} instance into {@link NN_Tensor}. Therefore you can create + * multiple {@link NN_Tensor} instances with the same {@link NN_TensorDesc} instance. And you should destroy the + * {@link NN_TensorDesc} instance by {@link OH_NNTensorDesc_Destroy} when it is no longer used.\n + * + * @return Pointer to a {@link NN_TensorDesc} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +NN_TensorDesc *OH_NNTensorDesc_Create(); + +/** + * @brief Releases an {@link NN_TensorDesc} instance. + * + * When the {@link NN_TensorDesc} instance is no longer used, this method needs to be called to release it. Otherwise, + * the memory leak will occur. \n + * + * If tensorDesc or *tensorDesc is a null pointer, this method will return error code and does not execute the release. \n + * + * @param tensorDesc Double pointer to the {@link NN_TensorDesc} instance. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_Destroy(NN_TensorDesc **tensorDesc); + +/** + * @brief Sets the name of a {@link NN_TensorDesc}. + * + * After the {@link NN_TensorDesc} instance is created, call this method to set the tensor name. + * The value of *name is a C-style string ended with '\0'.\n + * + * if tensorDesc or name is a null pointer, this method will return error code.\n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param name The name of the tensor that needs to be set. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_SetName(NN_TensorDesc *tensorDesc, const char *name); + +/** + * @brief Gets the name of a {@link NN_TensorDesc}. + * + * Call this method to obtain the name of the specified {@link NN_TensorDesc} instance. + * The value of *name is a C-style string ended with '\0'.\n + * + * if tensorDesc or name is a null pointer, this method will return error code. + * As an output parameter, *name must be a null pointer, otherwise the method will return an error code. + * Fou example, you should define char* tensorName = NULL, and pass &tensorName as the argument of name.\n + * + * You do not need to release the memory of name. It will be released when tensorDesc is destroied.\n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param name The retured name of the tensor. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetName(const NN_TensorDesc *tensorDesc, const char **name); + +/** + * @brief Sets the data type of a {@link NN_TensorDesc}. + * + * After the {@link NN_TensorDesc} instance is created, call this method to set the tensor data type. \n + * + * if tensorDesc is a null pointer, this method will return error code. \n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param dataType The data type of the tensor that needs to be set. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_SetDataType(NN_TensorDesc *tensorDesc, OH_NN_DataType dataType); + +/** + * @brief Gets the data type of a {@link NN_TensorDesc}. + * + * Call this method to obtain the data type of the specified {@link NN_TensorDesc} instance. \n + * + * if tensorDesc or dataType is a null pointer, this method will return error code. \n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param dataType The returned data type of the tensor. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetDataType(const NN_TensorDesc *tensorDesc, OH_NN_DataType *dataType); + +/** + * @brief Sets the shape of a {@link NN_TensorDesc}. + * + * After the {@link NN_TensorDesc} instance is created, call this method to set the tensor shape. \n + * + * if tensorDesc or shape is a null pointer, or shapeLength is 0, this method will return error code. \n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param shape The shape list of the tensor that needs to be set. + * @param shapeLength The length of the shape list that needs to be set. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_SetShape(NN_TensorDesc *tensorDesc, const int32_t *shape, size_t shapeLength); + +/** + * @brief Gets the shape of a {@link NN_TensorDesc}. + * + * Call this method to obtain the shape of the specified {@link NN_TensorDesc} instance. \n + * + * if tensorDesc, shape or shapeLength is a null pointer, this method will return error code. + * As an output parameter, *shape must be a null pointer, otherwise the method will return an error code. + * Fou example, you should define int32_t* tensorShape = NULL, and pass &tensorShape as the argument of shape. \n + * + * You do not need to release the memory of shape. It will be released when tensorDesc is destroied. \n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param shape Return the shape list of the tensor. + * @param shapeLength The returned length of the shape list. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetShape(const NN_TensorDesc *tensorDesc, int32_t **shape, size_t *shapeLength); + +/** + * @brief Sets the format of a {@link NN_TensorDesc}. + * + * After the {@link NN_TensorDesc} instance is created, call this method to set the tensor format. \n + * + * if tensorDesc is a null pointer, this method will return error code. \n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param format The format of the tensor that needs to be set. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_SetFormat(NN_TensorDesc *tensorDesc, OH_NN_Format format); + +/** + * @brief Gets the format of a {@link NN_TensorDesc}. + * + * Call this method to obtain the format of the specified {@link NN_TensorDesc} instance. \n + * + * if tensorDesc or format is a null pointer, this method will return error code. \n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param format The returned format of the tensor. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetFormat(const NN_TensorDesc *tensorDesc, OH_NN_Format *format); + +/** + * @brief Gets the element count of a {@link NN_TensorDesc}. + * + * Call this method to obtain the element count of the specified {@link NN_TensorDesc} instance. + * If you need to obtain byte size of the tensor data, call {@link OH_NNTensorDesc_GetByteSize}. \n + * + * If the tensor shape is dynamic, this method will return error code, and elementCount will be 0. \n + * + * if tensorDesc or elementCount is a null pointer, this method will return error code. \n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param elementCount The returned element count of the tensor. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetElementCount(const NN_TensorDesc *tensorDesc, size_t *elementCount); + +/** + * @brief Gets the byte size of a {@link NN_TensorDesc}. + * + * Call this method to obtain the byte size of the specified {@link NN_TensorDesc} instance. \n + * + * If the tensor shape is dynamic, this method will return error code, and byteSize will be 0. \n + * + * If you need to obtain element count of the tensor data, call {@link OH_NNTensorDesc_GetElementCount}. \n + * + * if tensorDesc or byteSize is a null pointer, this method will return error code. \n + * + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param byteSize The returned byte size of the tensor. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensorDesc_GetByteSize(const NN_TensorDesc *tensorDesc, size_t *byteSize); + +/** + * @brief Creates a {@link NN_Tensor} instance from {@link NN_TensorDesc}. + * + * This method use {@link OH_NNTensorDesc_GetByteSize} to calculate the byte size of tensor data and allocate shared + * memory on device for it. The device dirver will get the tensor data directly by the "zero-copy" way.\n + * + * Note that this method will copy the tensorDesc into {@link NN_Tensor}. Therefore you should destroy + * tensorDesc by {@link OH_NNTensorDesc_Destroy} if it is no longer used.\n + * + * If the tensor shape is dynamic, this method will return error code.\n + * + * deviceID indicates the selected device. If it is 0, the first device in the current device list will be used + * by default.\n + * + * tensorDesc must be provided, and this method will return an error code if it is a null pointer.\n + * + * Call {@link OH_NNTensor_Destroy} to release the {@link NN_Tensor} instance if it is no longer used.\n + * + * @param deviceID Device id. If it is 0, the first device in the current device list will be used by default. + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @return Pointer to a {@link NN_Tensor} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +NN_Tensor *OH_NNTensor_Create(size_t deviceID, NN_TensorDesc *tensorDesc); + +/** + * @brief Creates a {@link NN_Tensor} instance with specified size and {@link NN_TensorDesc}. + * + * This method use size as the byte size of tensor data and allocate shared memory on device for it. + * The device dirver will get the tensor data directly by the "zero-copy" way.\n + * + * Note that this method will copy the tensorDesc into {@link NN_Tensor}. Therefore you should destroy + * tensorDesc by {@link OH_NNTensorDesc_Destroy} if it is no longer used.\n + * + * deviceID indicates the selected device. If it is 0, the first device in the current device list will be used + * by default.\n + * + * tensorDesc must be provided, if it is a null pointer, the method returns an error code. + * size must be no less than the byte size of tensorDesc. Otherwise, this method will return an error code. + * If the tensor shape is dynamic, the size will not be checked.\n + * + * Call {@link OH_NNTensor_Destroy} to release the {@link NN_Tensor} instance if it is no longer used.\n + * + * @param deviceID Device id. If it is 0, the first device in the current device list will be used by default. + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param size Size of tensor data that need to be allocated. + * @return Pointer to a {@link NN_Tensor} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +NN_Tensor *OH_NNTensor_CreateWithSize(size_t deviceID, NN_TensorDesc *tensorDesc, size_t size); + +/** + * @brief Creates a {@link NN_Tensor} instance with specified file descriptor and {@link NN_TensorDesc}. + * + * This method reuses the shared memory corresponding to the file descriptor fd passed. It may comes from another + * {@link NN_Tensor} instance. When you call the {@link OH_NNTensor_Destroy} method to release the tensor created by + * this method, the tensor data memory will not be released.\n + * + * Note that this method will copy the tensorDesc into {@link NN_Tensor}. Therefore you should destroy + * tensorDesc by {@link OH_NNTensorDesc_Destroy} if it is no longer used.\n + * + * deviceID indicates the selected device. If it is 0, the first device in the current device list will be used + * by default.\n + * + * tensorDesc must be provided, if it is a null pointer, the method returns an error code.\n + * + * Call {@link OH_NNTensor_Destroy} to release the {@link NN_Tensor} instance if it is no longer used.\n + * + * @param deviceID Device id. If it is 0, the first device in the current device list will be used by default. + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. + * @param fd file descriptor of the shared memory to be resued. + * @param size Size of the shared memory to be resued. + * @param offset Offset of the shared memory to be resued. + * @return Pinter to a {@link NN_Tensor} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +NN_Tensor *OH_NNTensor_CreateWithFd(size_t deviceID, + NN_TensorDesc *tensorDesc, + int fd, + size_t size, + size_t offset); + +/** + * @brief Releases a {@link NN_Tensor} instance. + * + * When the {@link NN_Tensor} instance is no longer used, this method needs to be called to release the instance. + * Otherwise, the memory leak will occur.\n + * + * If tensor or *tensor is a null pointer, this method will return error code and does not execute the + * release.\n + * + * @param tensor Double pointer to the {@link NN_Tensor} instance. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensor_Destroy(NN_Tensor **tensor); + +/** + * @brief Gets the {@link NN_TensorDesc} instance of a {@link NN_Tensor}. + * + * Call this method to obtain the inner {@link NN_TensorDesc} instance pointer of the specified {@link NN_Tensor} + * instance. You can get various types of the tensor attributes such as name/format/data type/shape from the returned + * {@link NN_TensorDesc} instance.\n + * + * You should not destory the returned {@link NN_TensorDesc} instance because it points to the inner instance of + * {@link NN_Tensor}. Otherwise, a menory corruption of double free will occur when {@link OH_NNTensor_Destroy} + * is called.\n + * + * if tensor is a null pointer, this method will return null pointer.\n + * + * @param tensor Pointer to the {@link NN_Tensor} instance. + * @return Pointer to the {@link NN_TensorDesc} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +NN_TensorDesc *OH_NNTensor_GetTensorDesc(const NN_Tensor *tensor); + +/** + * @brief Gets the data buffer of a {@link NN_Tensor}. + * + * You can read/write data from/to the tensor data buffer. The buffer is mapped from a shared memory on device, + * so the device dirver will get the tensor data directly by this "zero-copy" way.\n + * + * Note that the real tensor data only uses the segment [offset, size) of the shared memory. The offset can be got by + * {@link OH_NNTensor_GetOffset} and the size can be got by {@link OH_NNTensor_GetSize}.\n + * + * if tensor is a null pointer, this method will return null pointer.\n + * + * @param tensor Pointer to the {@link NN_Tensor} instance. + * @return Pointer to data buffer of the tensor, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +void *OH_NNTensor_GetDataBuffer(const NN_Tensor *tensor); + +/** + * @brief Gets the file descriptor of the shared memory of a {@link NN_Tensor}. + * + * The file descriptor fd corresponds to the shared memory of the tensor data, and can be resued + * by another {@link NN_Tensor} through {@link OH_NNTensor_CreateWithFd}.\n + * + * if tensor or fd is a null pointer, this method will return error code.\n + * + * @param tensor Pointer to the {@link NN_Tensor} instance. + * @param fd The returned file descriptor of the shared memory. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensor_GetFd(const NN_Tensor *tensor, int *fd); + +/** + * @brief Gets the size of the shared memory of a {@link NN_Tensor}. + * + * The size corresponds to the shared memory of the tensor data, and can be resued by another {@link NN_Tensor} + * through {@link OH_NNTensor_CreateWithFd}.\n + * + * The size is as same as the argument size of {@link OH_NNTensor_CreateWithSize} and + * {@link OH_NNTensor_CreateWithFd}. But for a tensor created by {@link OH_NNTensor_Create}, + * it equals to the tensor byte size.\n + * + * Note that the real tensor data only uses the segment [offset, size) of the shared memory. The offset can be got by + * {@link OH_NNTensor_GetOffset} and the size can be got by {@link OH_NNTensor_GetSize}.\n + * + * if tensor or size is a null pointer, this method will return error code.\n + * + * @param tensor Pointer to the {@link NN_Tensor} instance. + * @param size The returned size of tensor data. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensor_GetSize(const NN_Tensor *tensor, size_t *size); + +/** + * @brief Get the data offset of a tensor. + * + * The offset corresponds to the shared memory of the tensor data, and can be resued by another {@link NN_Tensor} + * through {@link OH_NNTensor_CreateWithFd}.\n + * + * Note that the real tensor data only uses the segment [offset, size) of the shared memory. The offset can be got by + * {@link OH_NNTensor_GetOffset} and the size can be got by {@link OH_NNTensor_GetSize}.\n + * + * if tensor or offset is a null pointer, this method will return error code.\n + * + * @param tensor Pointer to the {@link NN_Tensor} instance. + * @param offset The returned offset of tensor data. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNTensor_GetOffset(const NN_Tensor *tensor, size_t *offset); + +/** + * @brief Creates an executor instance of the {@link OH_NNExecutor} type. + * + * This method constructs a model inference executor associated with the device based on the passed compilation. \n + * + * After the {@link OH_NNExecutor} instance is created, you can release the {@link OH_NNCompilation} + * instance if you do not need to create any other executors. \n + * + * @param compilation Pointer to the {@link OH_NNCompilation} instance. + * @return Pointer to a {@link OH_NNExecutor} instance, or NULL if it fails to create. + * @since 9 + * @version 1.0 + */ +OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); + +/** + * @brief Obtains the dimension information about the output tensor. + * + * After {@link OH_NNExecutor_Run} is called to complete a single inference, call this method to obtain the specified + * output dimension information and number of dimensions. It is commonly used in dynamic shape input and output + * scenarios.\n + * + * If the outputIndex is greater than or equal to the output tensor number, this method will return error code. + * The output tensor number can be got by {@link OH_NNExecutor_GetOutputCount}.\n + * + * As an output parameter, *shape must be a null pointer, otherwise the method will return an error code. + * Fou example, you should define int32_t* tensorShape = NULL, and pass &tensorShape as the argument of shape.\n + * + * You do not need to release the memory of shape. It will be released when executor is destroied.\n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param outputIndex Output Index value, which is in the same sequence of the data output when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * Assume that outputIndices is {4, 6, 8} when + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * When {@link OH_NNExecutor_GetOutputShape} is called to obtain dimension information about + * the output tensor, outputIndices is {0, 1, 2}. + * @param shape Pointer to the int32_t array. The value of each element in the array is the length of the output tensor + * in each dimension. + * @param shapeLength Pointer to the uint32_t type. The number of output dimensions is returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, + uint32_t outputIndex, + int32_t **shape, + uint32_t *shapeLength); + +/** + * @brief Destroys an executor instance to release the memory occupied by the executor. + * + * This method needs to be called to release the executor instance created by calling {@link OH_NNExecutor_Construct}. Otherwise, + * the memory leak will occur. \n + * + * If executor or *executor is a null pointer, this method only prints warning logs and does not execute the release. \n + * + * @param executor Double pointer to the {@link OH_NNExecutor} instance. + * @since 9 + * @version 1.0 + */ +void OH_NNExecutor_Destroy(OH_NNExecutor **executor); + +/** + * @brief Gets the input tensor count. + * + * You can get the input tensor count from the executor, and then create an input tensor descriptor with its index by + * {@link OH_NNExecutor_CreateInputTensorDesc}. \n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param inputCount Input tensor count returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_GetInputCount(const OH_NNExecutor *executor, size_t *inputCount); + +/** + * @brief Gets the output tensor count. + * + * You can get the output tensor count from the executor, and then create an output tensor descriptor with its index by + * {@link OH_NNExecutor_CreateOutputTensorDesc}. \n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param OutputCount Output tensor count returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_GetOutputCount(const OH_NNExecutor *executor, size_t *outputCount); + +/** + * @brief Creates an input tensor descriptor with its index. + * + * The input tensor descriptor contains all attributes of the input tensor. + * If the index is greater than or equal to the input tensor number, this method will return error code. + * The input tensor number can be got by {@link OH_NNExecutor_GetInputCount}.\n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param index Input tensor index. + * @return Pointer to {@link NN_TensorDesc} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +NN_TensorDesc *OH_NNExecutor_CreateInputTensorDesc(const OH_NNExecutor *executor, size_t index); + +/** + * @brief Creates an output tensor descriptor with its index. + * + * The output tensor descriptor contains all attributes of the output tensor. + * If the index is greater than or equal to the output tensor number, this method will return error code. + * The output tensor number can be got by {@link OH_NNExecutor_GetOutputCount}.\n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param index Output tensor index. + * @return Pointer to {@link NN_TensorDesc} instance, or NULL if it fails to create. + * @since 11 + * @version 1.0 + */ +NN_TensorDesc *OH_NNExecutor_CreateOutputTensorDesc(const OH_NNExecutor *executor, size_t index); + +/** + * @brief Gets the dimension ranges of an input tensor. + * + * The supported dimension ranges of an input tensor with dynamic shape may be different among various devices. + * You can call this method to get the dimension ranges of the input tensor supported by the device. + * *minInputDims contains the minimum demensions of the input tensor, and *maxInputDims contains the + * maximum, e.g. if an input tensor has dynamic shape [-1, -1, -1, 3], its *minInputDims may be [1, 10, 10, 3] + * and *maxInputDims may be [100, 1024, 1024, 3] on the device.\n + * + * If the index is greater than or equal to the input tensor number, this method will return error code. + * The input tensor number can be got by {@link OH_NNExecutor_GetInputCount}.\n + * + * As an output parameter, *minInputDims or *maxInputDims must be a null pointer, otherwise the method + * will return an error code. For example, you should define int32_t* minInDims = NULL, and pass &minInDims as the + * argument of minInputDims.\n + * + * You do not need to release the memory of *minInputDims or *maxInputDims. + * It will be released when executor is destroied.\n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param index Input tensor index. + * @param minInputDims Returned pointer to an array contains the minimum dimensions of the input tensor. + * @param maxInputDims Returned pointer to an array contains the maximum dimensions of the input tensor. + * @param shapeLength Returned length of the shape of input tensor. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_GetInputDimRange(const OH_NNExecutor *executor, + size_t index, + size_t **minInputDims, + size_t **maxInputDims, + size_t *shapeLength); + +/** + * @brief Sets the callback function handle for the post-process when the asynchronous execution has been done. + * + * The definition fo the callback function: {@link NN_OnRunDone}. \n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param onRunDone Callback function handle {@link NN_OnRunDone}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetOnRunDone(OH_NNExecutor *executor, NN_OnRunDone onRunDone); + +/** + * @brief Sets the callback function handle for the post-process when the device driver service is dead during asynchronous execution. + * + * The definition fo the callback function: {@link NN_OnServiceDied}. \n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param onServiceDied Callback function handle {@link NN_OnServiceDied}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetOnServiceDied(OH_NNExecutor *executor, NN_OnServiceDied onServiceDied); + +/** + * @brief Synchronous execution of the model inference. + * + * Input and output tensors should be created first by {@link OH_NNTensor_Create}, {@link OH_NNTensor_CreateWithSize} or + * {@link OH_NNTensor_CreateWithFd}. And then the input tensors data which is got by {@link OH_NNTensor_GetDataBuffer} must be filled. + * The executor will then yield out the results by inference execution and fill them into output tensors data for you to read. \n + * + * In the case of dynamic shape, you can get the real output shape directly by {@link OH_NNExecutor_GetOutputShape}, or you + * can create a tensor descriptor from an output tensor by {@link OH_NNTensor_GetTensorDesc}, and then read its real shape + * by {@link OH_NNTensorDesc_GetShape}. \n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param inputTensor An array of input tensors {@link NN_Tensor}. + * @param inputCount Number of input tensors. + * @param outputTensor An array of output tensors {@link NN_Tensor}. + * @param outputCount Number of output tensors. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_RunSync(OH_NNExecutor *executor, + NN_Tensor *inputTensor[], + size_t inputCount, + NN_Tensor *outputTensor[], + size_t outputCount); + +/** + * @brief Asynchronous execution of the model inference. + * + * Input and output tensors should be created first by {@link OH_NNTensor_Create}, {@link OH_NNTensor_CreateWithSize} or + * {@link OH_NNTensor_CreateWithFd}. And then the input tensors data which is got by {@link OH_NNTensor_GetDataBuffer} + * must be filled. The executor will yield out the results by inference execution and fill them into output tensors data + * for you to read.\n + * + * In the case of dynamic shape, you can get the real output shape directly by {@link OH_NNExecutor_GetOutputShape}, or + * you can create a tensor descriptor from an output tensor by {@link OH_NNTensor_GetTensorDesc}, and then read its real + * shape by {@link OH_NNTensorDesc_GetShape}.\n + * + * The method is non-blocked and will return immediately.\n + * + * The callback function handles are set by {@link OH_NNExecutor_SetOnRunDone} + * and {@link OH_NNExecutor_SetOnServiceDied}. The inference results and error code can be got by + * {@link NN_OnRunDone}. And you can deal with the abnormal termination of device driver service during + * asynchronous execution by {@link NN_OnServiceDied}.\n + * + * If the execution time reaches the timeout, the execution will be terminated + * with no outputs, and the errCode returned in callback function {@link NN_OnRunDone} will be + * {@link OH_NN_TIMEOUT}.\n + * + * The userData is asynchronous execution identifier and will be returned as the first parameter of the callback + * function. You can input any value you want as long as it can identify different asynchronous executions.\n + * + * @param executor Pointer to the {@link OH_NNExecutor} instance. + * @param inputTensor An array of input tensors {@link NN_Tensor}. + * @param inputCount Number of input tensors. + * @param outputTensor An array of output tensors {@link NN_Tensor}. + * @param outputCount Number of output tensors. + * @param timeout Time limit (millisecond) of the asynchronous execution, e.g. 1000. + * @param userData Asynchronous execution identifier. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 11 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_RunAsync(OH_NNExecutor *executor, + NN_Tensor *inputTensor[], + size_t inputCount, + NN_Tensor *outputTensor[], + size_t outputCount, + int32_t timeout, + void *userData); + +/** + * @brief Obtains the IDs of all devices connected. + * + * Each device has an unique and fixed ID. This method returns device IDs on the current device through the uint32_t + * array.\n + * + * Device IDs are returned through the size_t array. Each element of the array is the ID of a single device.\n + * + * The array memory is managed inside, so you do not need to care about it. + * The data pointer is valid before this method is called next time.\n + * + * @param allDevicesID Pointer to the size_t array. The input *allDevicesID must be a null pointer. + * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. + * @param deviceCount Pointer of the uint32_t type, which is used to return the length of *allDevicesID. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNDevice_GetAllDevicesID(const size_t **allDevicesID, uint32_t *deviceCount); + +/** + * @brief Obtains the name of the specified device. + * + * deviceID specifies the device whose name will be obtained. The device ID needs to be obtained by calling + * {@link OH_NNDevice_GetAllDevicesID}. + * If it is 0, the first device in the current device list will be used by default.\n + * + * The value of *name is a C-style string ended with '\0'. *name must be a null pointer. + * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. + * Fou example, you should define char* deviceName = NULL, and pass &deviceName as the argument of name.\n + * + * @param deviceID Device ID. If it is 0, the first device in the current device list will be used by default. + * @param name The device name returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNDevice_GetName(size_t deviceID, const char **name); + +/** + * @brief Obtains the type information of the specified device. + * + * deviceID specifies the device whose type will be obtained. If it is 0, the first device in the current device + * list will be used. Currently the following device types are supported: + * - OH_NN_CPU: CPU device. + * - OH_NN_GPU: GPU device. + * - OH_NN_ACCELERATOR: machine learning dedicated accelerator. + * - OH_NN_OTHERS: other hardware types. \n + * + * @param deviceID Device ID. If it is 0, the first device in the current device list will be used by default. + * @param deviceType The device type {@link OH_NN_DeviceType} returned. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. If the operation fails, + * an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNDevice_GetType(size_t deviceID, OH_NN_DeviceType *deviceType); + +#ifdef __cplusplus +} +#endif // __cplusplus + +/** @} */ +#endif // NEURAL_NETWORK_CORE_H diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index 894db513..a546eb31 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -19,425 +19,338 @@ * * @brief Provides APIs of Neural Network Runtime for accelerating the model inference. * - * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 - * @version 1.0 + * @version 2.0 */ /** * @file neural_network_runtime.h * - * @brief Defines the Neural Network Runtime APIs. The AI inference framework uses the Native APIs provided by Neural - * Network Runtime to construct and compile models and perform inference and computing on acceleration hardware. - * Note: Currently, the APIs of Neural Network Runtime do not support multi-thread calling.\n + * @brief Defines the Neural Network Runtime APIs. The AI inference framework uses the Native APIs provided by Neural Network Runtime + * to construct models. + * + * Note: Currently, the APIs of Neural Network Runtime do not support multi-thread calling. \n * + * include "neural_network_runtime/neural_network_runtime.h" * @library libneural_network_runtime.so + * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 - * @version 1.0 + * @version 2.0 */ #ifndef NEURAL_NETWORK_RUNTIME_H #define NEURAL_NETWORK_RUNTIME_H #include "neural_network_runtime_type.h" +#include "neural_network_core.h" +#include "neural_network_runtime_compat.h" #ifdef __cplusplus extern "C" { #endif /** - * @brief Creates a model instance of the {@link OH_NNModel} type and uses other APIs provided by OH_NNModel to - * construct the model instance. - * - * Before composition, call {@link OH_NNModel_Construct} to create a model instance. Based on the model topology, - * call the {@link OH_NNModel_AddTensor}, {@link OH_NNModel_AddOperation}, and {@link OH_NNModel_SetTensorData} - * methods to fill in the data and operator nodes of the model, and then call - * {@link OH_NNModel_SpecifyInputsAndOutputs} to specify the inputs and outputs of the model. - * After the model topology is constructed, call {@link OH_NNModel_Finish} to build the model.\n - * After a model instance is used, you need to destroy it by calling {@link OH_NNModel_Destroy} to avoid - * memory leak.\n - * - * @return Returns the pointer to a {@link OH_NNModel} instance. - * @since 9 - * @version 1.0 - */ -OH_NNModel *OH_NNModel_Construct(void); - -/** - * @brief Adds a tensor to a model instance. + * @brief Creates a {@link NN_QuantParam} instance. * - * The data node and operator parameters in the Neural Network Runtime model are composed of tensors of the model. - * This method is used to add tensors to a model instance based on the tensor parameter. - * The sequence of adding tensors is specified by the index value recorded in the model. The - * {@link OH_NNModel_SetTensorData}, {@link OH_NNModel_AddOperation}, and {@link OH_NNModel_SpecifyInputsAndOutputs} - * methods specifies tensors based on the index value.\n - * Neural Network Runtime supports inputs and outputs of the dynamic shape. When adding a data node with a dynamic shape, - * you need to set the dimensions that support dynamic changes in tensor.dimensions to -1. - * For example, if tensor.dimensions of a four-dimensional tensor is set to [1, -1, 2, 2], the second - * dimension supports dynamic changes.\n - * + * After the {@link NN_QuantParam} instance is created, call {@link OH_NNQuantParam_SetScales}, {@link OH_NNQuantParam_SetZeroPoints}, + * {@link OH_NNQuantParam_SetNumBits} to set its attributes, and then call {@link OH_NNModel_SetTensorQuantParams} to set it + * to a tensor. After that you should destroy it by calling {@link OH_NNQuantParam_Destroy} to avoid memory leak. \n * - * @param model Pointer to the {@link OH_NNModel} instance. - * @param tensor Pointer to the {@link OH_NN_Tensor} tensor. The tensor specifies the attributes of the tensor added to - * the model instance. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see - * {@link OH_NN_ReturnCode}. - * @since 9 + * @return Pointer to a {@link NN_QuantParam} instance, or NULL if it fails to create. + * @since 11 * @version 1.0 */ -OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *tensor); +NN_QuantParam *OH_NNQuantParam_Create(); /** - * \brief Sets the tensor value. + * @brief Sets the scales of the {@link NN_QuantParam} instance. * - * For tensors with constant values (such as model weights), you need to use this method in the composition phase. - * The index value of a tensor is determined by the sequence in which the tensor is added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n + * The parameter quantCount is the number of quantization parameters of a tensor, e.g. the quantCount is the + * channel count if the tensor is per-channel quantized.\n * - * @param model Pointer to the {@link OH_NNModel} instance. - * @param index Index value of a tensor. - * @param dataBuffer Pointer to real data. - * @param length Length of the data buffer. + * @param quantParams Pointer to the {@link NN_QuantParam} instance. + * @param scales An array of scales for all quantization parameters of the tensor. + * @param quantCount Number of quantization parameters of the tensor. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, * see {@link OH_NN_ReturnCode}. - * @since 9 + * @since 11 * @version 1.0 */ -OH_NN_ReturnCode OH_NNModel_SetTensorData(OH_NNModel *model, uint32_t index, const void *dataBuffer, size_t length); +OH_NN_ReturnCode OH_NNQuantParam_SetScales(NN_QuantParam *quantParams, const double *scales, size_t quantCount); /** - * @brief Adds an operator to a model instance. - * - * This method is used to add an operator to a model instance. The operator type is specified by op, and - * the operator parameters, inputs, and outputs are specified by paramIndices, inputIndices, and - * outputIndices respectively. - * This method verifies the attributes of operator parameters and the number of input and output parameters. - * These attributes must be correctly set when {@link OH_NNModel_AddTensor} is called to add tensors. - * For details about the expected parameters, input attributes, and output attributes of each operator, - * see {@link OH_NN_OperationType}.\n - * - * - * paramIndices, inputIndices, and outputIndices store index values of tensors. - * Index values are determined by the sequence in which tensors are added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n + * @brief Sets the zero points of the {@link NN_QuantParam} instance. * - * If unnecessary parameters are added for adding an operator, this method returns {@link OH_NN_INVALID_PARAMETER}. - * If no operator parameter is set, the operator uses the default parameter value. - * For details about the default values, see {@link OH_NN_OperationType}.\n + * The parameter quantCount is the number of quantization parameters of a tensor, e.g. the quantCount is the + * channel count if the tensor is per-channel quantized.\n * - * @param model Pointer to the {@link OH_NNModel} instance. - * @param op Specifies the type of an operator to be added. For details, see the enumerated values of - * {@link OH_NN_OperationType}. - * @param paramIndices Pointer to the OH_NN_UInt32Array instance, which is used to set operator parameters. - * @param inputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator input. - * @param outputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator output. + * @param quantParams Pointer to the {@link NN_QuantParam} instance. + * @param zeroPoints An array of zero points for all quantization parameters of the tensor. + * @param quantCount Number of quantization parameters of the tensor. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, * see {@link OH_NN_ReturnCode}. - * @since 9 + * @since 11 * @version 1.0 */ -OH_NN_ReturnCode OH_NNModel_AddOperation(OH_NNModel *model, - OH_NN_OperationType op, - const OH_NN_UInt32Array *paramIndices, - const OH_NN_UInt32Array *inputIndices, - const OH_NN_UInt32Array *outputIndices); +OH_NN_ReturnCode OH_NNQuantParam_SetZeroPoints(NN_QuantParam *quantParams, const int32_t *zeroPoints, size_t quantCount); /** - * @brief Specifies the inputs and outputs of a model. + * @brief Sets the number bits of the {@link NN_QuantParam} instance. * - * A tensor must be specified as the end-to-end inputs and outputs of a model instance. This type of tensor cannot - * be set using {@link OH_NNModel_SetTensorData}. The OH_NNExecutor method needs to be called in the execution - * phase to set the input and output data.\n + * The parameter quantCount is the number of quantization parameters of a tensor, e.g. the quantCount is the + * channel count if the tensor is per-channel quantized.\n * - * The index value of a tensor is determined by the sequence in which the tensor is added to the model. - * For details about how to add a tensor, see {@link OH_NNModel_AddTensor}.\n - * - * Currently, the model inputs and outputs cannot be set asynchronously.\n - * - * @param model Pointer to the {@link OH_NNModel} instance. - * @param inputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator input. - * @param outputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator output. + * @param quantParams Pointer to the {@link NN_QuantParam} instance. + * @param numBits An array of number bits for all quantization parameters of the tensor. + * @param quantCount Number of quantization parameters of the tensor. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, * see {@link OH_NN_ReturnCode}. - * @since 9 + * @since 11 * @version 1.0 */ -OH_NN_ReturnCode OH_NNModel_SpecifyInputsAndOutputs(OH_NNModel *model, - const OH_NN_UInt32Array *inputIndices, - const OH_NN_UInt32Array *outputIndices); +OH_NN_ReturnCode OH_NNQuantParam_SetNumBits(NN_QuantParam *quantParams, const uint32_t *numBits, size_t quantCount); /** - * @brief Completes model composition. + * @brief Releases a {@link NN_QuantParam} instance. * - * After the model topology is set up, call this method to indicate that the composition is complete. After this method - * additional composition operations cannot be performed. If {@link OH_NNModel_AddTensor}, {@link OH_NNModel_AddOperation}, - * is called, {@link OH_NNModel_SetTensorData}, and {@link OH_NNModel_SpecifyInputsAndOutputs} are called, - * {@link OH_NN_OPERATION_FORBIDDEN} is returned.\n - * - * Before calling {@link OH_NNModel_GetAvailableOperations} and {@link OH_NNCompilation_Construct}, - * you must call this method to complete composition.\n + * The {@link NN_QuantParam} instance needs to be released to avoid memory leak after it is set to a {@link NN_TensorDesc}. \n + * + * If quantParams or *quantParams is a null pointer, this method only prints warning logs and does not + * execute the release. \n * - * @param model Pointer to the {@link OH_NNModel} instance. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. - * @since 9 + * @param quantParams Double pointer to the {@link NN_QuantParam} instance. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 * @version 1.0 */ -OH_NN_ReturnCode OH_NNModel_Finish(OH_NNModel *model); +OH_NN_ReturnCode OH_NNQuantParam_Destroy(NN_QuantParam **quantParams); /** - * @brief Releases a model instance. + * @brief Creates a model instance of the {@link OH_NNModel} type and uses other APIs provided by OH_NNModel to construct the model instance. * - * This method needs to be called to release the model instance created by calling {@link OH_NNModel_Construct}. - * Otherwise, memory leak will occur.\n + * Before composition, call {@link OH_NNModel_Construct} to create a model instance. Based on the model topology, + * call the {@link OH_NNModel_AddTensorToModel}, {@link OH_NNModel_AddOperation}, and {@link OH_NNModel_SetTensorData} methods + * to fill in the data and operator nodes of the model, and then call {@link OH_NNModel_SpecifyInputsAndOutputs} to specify the inputs and outputs of the model. + * After the model topology is constructed, call {@link OH_NNModel_Finish} to build the model. \n * - * If model or *model is a null pointer, this method only prints warning logs and does not execute the - * release logic.\n + * After a model instance is no longer used, you need to destroy it by calling {@link OH_NNModel_Destroy} to avoid memory leak. \n * - * @param model Level-2 pointer to the {@link OH_NNModel} instance. After a model instance is destroyed, - * this method sets *model to a null pointer. + * @return Pointer to a {@link OH_NNModel} instance, or NULL if it fails to create. * @since 9 * @version 1.0 */ -void OH_NNModel_Destroy(OH_NNModel **model); +OH_NNModel *OH_NNModel_Construct(void); /** - * @brief Queries whether the device supports operators in the model. The support status is indicated by the - * Boolean value. + * @brief Adds a tensor to the model instance. * - * Queries whether underlying device supports operators in a model instance. The device is specified by deviceID, - * and the result is represented by the array pointed by isSupported. If the ith operator is supported, - * the value of (*isSupported)[i] is true. Otherwise, the value is false.\n + * The data node and operator parameters in the Neural Network Runtime model are composed of tensors of the model. + * This method is used to add tensors to a model instance based on the tensorDesc parameter with type of {@link NN_TensorDesc}. + * {@link NN_TensorDesc} contains some attributes such as shape, format, data type and provides corresponding APIs to access them. + * The order of adding tensors is specified by the indices recorded in the model. The {@link OH_NNModel_SetTensorData}, {@link OH_NNModel_AddOperation}, + * and {@link OH_NNModel_SpecifyInputsAndOutputs} methods specify tensors based on the indices. \n * - * After this method is successfully executed, (*isSupported) points to the bool array that records the operator - * support status. - * The operator quantity for the array length is the same as that for the model instance. The memory corresponding to - * this array is managed by Neural Network Runtime and is automatically destroyed after the model instance is destroyed - * or this method is called again.\n + * Neural Network Runtime supports inputs and outputs of the dynamic shape. When adding a data node with a dynamic shape, + * you need to set the dimensions that support dynamic changes to -1. + * For example, if the shape of a four-dimensional tensor is set to [1, -1, 2, 2], the second dimension supports dynamic changes. \n * * @param model Pointer to the {@link OH_NNModel} instance. - * @param deviceID Device ID to be queried, which can be obtained by using {@link OH_NNDevice_GetAllDevicesID}. - * @param isSupported Pointer to the bool array. When this method is called, (*isSupported) must be a null pointer. - * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. - * - * @param opCount Number of operators in a model instance, corresponding to the length of the (*isSupported) array. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. - * - * @since 9 + * @param tensorDesc Pointer to the {@link NN_TensorDesc} instance. The tensor descriptor specifies the attributes of the tensor added to the model instance. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 * @version 1.0 */ -OH_NN_ReturnCode OH_NNModel_GetAvailableOperations(OH_NNModel *model, - size_t deviceID, - const bool **isSupported, - uint32_t *opCount); - +OH_NN_ReturnCode OH_NNModel_AddTensorToModel(OH_NNModel *model, const NN_TensorDesc *tensorDesc); /** - * @brief Creates a compilation instance of the {@link OH_NNCompilation} type. - * - * After the OH_NNModel module completes model construction, APIs provided by the OH_NNCompilation module pass the - * model to underlying device for compilation. This method creates a {@link OH_NNCompilation} instance - * based on the passed {@link OH_NNModel} instance. The {@link OH_NNCompilation_SetDevice} method is called - * to set the device to compile on, and {@link OH_NNCompilation_Build} is then called to complete compilation.\n - * - * In addition to computing device selection, the OH_NNCompilation module supports features such as model caching, - * performance preference, priority setting, and float16 computing, which can be implemented by the following methods: - * - {@link OH_NNCompilation_SetCache} - * - {@link OH_NNCompilation_SetPerformanceMode} - * - {@link OH_NNCompilation_SetPriority} - * - {@link OH_NNCompilation_EnableFloat16}\n + * @brief Sets the tensor value. * - * After {@link OH_NNCompilation} is created by calling this method, the {@link OH_NNModel} instance can be released.\n + * For tensors with constant values (such as model weights), you need to use this method to set their data. + * The index of a tensor is determined by the order in which the tensor is added to the model. + * For details about how to add a tensor, see {@link OH_NNModel_AddTensorToModel}. \n * * @param model Pointer to the {@link OH_NNModel} instance. - * @return Returns the pointer to a {@link OH_NNCompilation} instance. + * @param index Index of a tensor. + * @param dataBuffer Pointer to real data. + * @param length Length of the data buffer. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ -OH_NNCompilation *OH_NNCompilation_Construct(const OH_NNModel *model); +OH_NN_ReturnCode OH_NNModel_SetTensorData(OH_NNModel *model, uint32_t index, const void *dataBuffer, size_t length); /** - * @brief Specifies the device for model compilation and computing. + * @brief Sets the quantization parameter of a tensor. * - * In the compilation phase, you need to specify the device for model compilation and computing. - * Call {@link OH_NNDevice_GetAllDevicesID} to obtain available device IDs. Call {@link OH_NNDevice_GetType} - * and {@link OH_NNDevice_GetName} to obtain device information and pass target device IDs to this method - * for setting.\n - * - * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param deviceID Device ID. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. - * @since 9 + * @param model Pointer to the {@link OH_NNModel} instance. + * @param index Index of a tensor. + * @param quantParam Pointer to the quantization parameter instance. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 * @version 1.0 */ -OH_NN_ReturnCode OH_NNCompilation_SetDevice(OH_NNCompilation *compilation, size_t deviceID); +OH_NN_ReturnCode OH_NNModel_SetTensorQuantParams(OH_NNModel *model, uint32_t index, NN_QuantParam *quantParam); /** - * @brief Set the cache directory and version of the compiled model. - * - * On the device that supports caching, a model can be saved as a cache file after being compiled at the - * device driver layer. - * The model can be directly read from the cache file in the next compilation, saving recompilation time. - * This method performs different operations based on the passed cache directory and version:\n - * - * - No file exists in the cache directory: - * Caches the compiled model to the directory and sets the cache version to version.\n - * - * - A complete cache file exists in the cache directory, and its version is version: - * Reads the cache file in the path and passes the data to the underlying device for conversion into - * executable model instances.\n - * - * - A complete cache file exists in the cache directory, and its version is earlier than version: - * When model compilation is complete on the underlying device, overwrites the cache file and changes the version - * number to version.\n + * @brief Sets the tensor type. See {@link OH_NN_TensorType} for details. * - * - A complete cache file exists in the cache directory, and its version is later than version: - * Returns the {@link OH_NN_INVALID_PARAMETER} error code without reading the cache file.\n - * - * - The cache file in the cache directory is incomplete or you do not have the permission to access the cache file. - * Returns the {@link OH_NN_INVALID_FILE} error code.\n - * - * - The cache directory does not exist or you do not have the access permission. - * Returns the {@link OH_NN_INVALID_PATH} error code.\n - * - * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param cachePath Directory for storing model cache files. This method creates directories for different devices in - * the cachePath directory. You are advised to use a separate cache directory for each model. - * @param version Cache version. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. - * @since 9 + * @param model Pointer to the {@link OH_NNModel} instance. + * @param index Index of a tensor. + * @param tensorType Tensor type of {@link OH_NN_TensorType}. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * @since 11 * @version 1.0 */ -OH_NN_ReturnCode OH_NNCompilation_SetCache(OH_NNCompilation *compilation, const char *cachePath, uint32_t version); +OH_NN_ReturnCode OH_NNModel_SetTensorType(OH_NNModel *model, uint32_t index, OH_NN_TensorType tensorType); /** - * @brief Sets the performance mode for model computing. + * @brief Adds an operator to a model instance. * - * Neural Network Runtime allows you to set the performance mode for model computing to meet the requirements of low - * power consumption and ultimate performance. If this method is not called to set the performance mode in the - * compilation phase, the compilation instance assigns the {@link OH_NN_PERFORMANCE_NONE} mode for the model by default. - * In this case, the device performs computing in the default performance mode.\n + * This method is used to add an operator to a model instance. The operator type is specified by op, and + * the operator parameters, inputs, and outputs are specified by paramIndices, inputIndices, and outputIndices respectively. + * This method verifies the attributes of operator parameters and the number of input and output parameters. + * These attributes must be correctly set when {@link OH_NNModel_AddTensorToModel} is called to add tensors. + * For details about the expected parameters, input attributes, and output attributes of each operator, see {@link OH_NN_OperationType}. \n * - * If this method is called on the device that does not support the setting of the performance mode, - * the {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned.\n + * paramIndices, inputIndices, and outputIndices store the indices of tensors. + * The indices are determined by the order in which tensors are added to the model. + * For details about how to add a tensor, see {@link OH_NNModel_AddTensorToModel}. \n * - * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param performanceMode Performance mode. For details about the available performance modes, - * see {@link OH_NN_PerformanceMode}. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. + * If unnecessary parameters are added when adding an operator, this method returns {@link OH_NN_INVALID_PARAMETER}. + * If no operator parameter is set, the operator uses the default parameter value. + * For details about the default values, see {@link OH_NN_OperationType}. \n + * + * @param model Pointer to the {@link OH_NNModel} instance. + * @param op Specifies the type of an operator to be added. For details, see the enumerated values of {@link OH_NN_OperationType}. + * @param paramIndices Pointer to the OH_NN_UInt32Array instance, which is used to set operator parameters. + * @param inputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator input. + * @param outputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator output. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ -OH_NN_ReturnCode OH_NNCompilation_SetPerformanceMode(OH_NNCompilation *compilation, - OH_NN_PerformanceMode performanceMode); +OH_NN_ReturnCode OH_NNModel_AddOperation(OH_NNModel *model, + OH_NN_OperationType op, + const OH_NN_UInt32Array *paramIndices, + const OH_NN_UInt32Array *inputIndices, + const OH_NN_UInt32Array *outputIndices); /** - * @brief Sets the model computing priority. + * @brief Specifies the inputs and outputs of a model. * - * Neural Network Runtime allows you to set computing priorities for models. - * The priorities apply only to models created by the process with the same UID. - * The settings will not affect models created by processes with different UIDs on different devices.\n + * A tensor must be specified as the end-to-end inputs and outputs of a model instance. This type of tensor cannot be set + * using {@link OH_NNModel_SetTensorData}. \n * - * If this method is called on the device that does not support the priority setting, the - * {@link OH_NN_UNAVALIDABLE_DEVICE} error code is returned.\n + * The index of a tensor is determined by the order in which the tensor is added to the model. + * For details about how to add a tensor, see {@link OH_NNModel_AddTensorToModel}. \n * - * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param priority Priority. For details about the optional priorities, see {@link OH_NN_Priority}. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. + * Currently, the model inputs and outputs cannot be set asynchronously. \n + * + * @param model Pointer to the {@link OH_NNModel} instance. + * @param inputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator input. + * @param outputIndices Pointer to the OH_NN_UInt32Array instance, which is used to set the operator output. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ -OH_NN_ReturnCode OH_NNCompilation_SetPriority(OH_NNCompilation *compilation, OH_NN_Priority priority); +OH_NN_ReturnCode OH_NNModel_SpecifyInputsAndOutputs(OH_NNModel *model, + const OH_NN_UInt32Array *inputIndices, + const OH_NN_UInt32Array *outputIndices); /** - * @brief Enables float16 for computing. + * @brief Completes model composition. * - * Currently, Neural Network Runtime supports only float32 and int8. If this method is called on a device that - * supports float16, float16 will be used for computing the float32 model to reduce memory usage and execution time.\n + * After the model topology is set up, call this method to indicate that the composition is complete. After this method is called, + * additional composition operations cannot be performed. If {@link OH_NNModel_AddTensorToModel}, {@link OH_NNModel_AddOperation}, + * {@link OH_NNModel_SetTensorData}, and {@link OH_NNModel_SpecifyInputsAndOutputs} are called, + * {@link OH_NN_OPERATION_FORBIDDEN} is returned. \n * - * If this method is called on the device that does not support float16, the {@link OH_NN_UNAVALIDABLE_DEVICE} - * error code is returned.\n + * Before calling {@link OH_NNModel_GetAvailableOperations} and {@link OH_NNCompilation_Construct}, + * you must call this method to complete composition. \n * - * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @param enableFloat16 Whether to enable float16. If this parameter is set to true, float16 inference - * is performed. - * If this parameter is set to false, float32 inference is performed. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. + * @param model Pointer to the {@link OH_NNModel} instance. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ -OH_NN_ReturnCode OH_NNCompilation_EnableFloat16(OH_NNCompilation *compilation, bool enableFloat16); +OH_NN_ReturnCode OH_NNModel_Finish(OH_NNModel *model); /** - * @brief Compiles a model. + * @brief Releases a model instance. * - * After the compilation configuration is complete, call this method to return the compilation result. The compilation - * instance pushes the model and compilation options to the device for compilation. After this method is called, - * additional compilation operations cannot be performed. - * If the {@link OH_NNCompilation_SetDevice}, {@link OH_NNCompilation_SetCache}, - * {@link OH_NNCompilation_SetPerformanceMode}, {@link OH_NNCompilation_SetPriority}, and - * {@link OH_NNCompilation_EnableFloat16} methods are called, {@link OH_NN_OPERATION_FORBIDDEN} is returned.\n + * This method needs to be called to release the model instance created by calling {@link OH_NNModel_Construct}. Otherwise, memory leak will occur. \n * - * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. + * If model or *model is a null pointer, this method only prints warning logs and does not execute the release. \n + * + * @param model Double pointer to the {@link OH_NNModel} instance. After a model instance is destroyed, this method sets *model to a null pointer. * @since 9 * @version 1.0 */ -OH_NN_ReturnCode OH_NNCompilation_Build(OH_NNCompilation *compilation); +void OH_NNModel_Destroy(OH_NNModel **model); /** - * @brief Releases the Compilation object. + * @brief Queries whether the device supports operators in the model. The support status is indicated by the Boolean value. * - * This method needs to be called to release the compilation instance created by calling - * {@link OH_NNCompilation_Construct}. Otherwise, memory leak will occur.\n + * Queries whether underlying device supports operators in a model instance. The device is specified by deviceID, + * and the result is represented by the array pointed by isSupported. If the ith operator is supported, + * the value of (*isSupported)[i] is true. Otherwise, the value is false. \n * - * If compilation or *compilation is a null pointer, this method only prints warning logs and - * does not execute the release logic.\n + * After this method is successfully executed, (*isSupported) points to the bool array that records the operator support status. + * The operator quantity for the array length is the same as that for the model instance. The memory corresponding to this array is + * managed by Neural Network Runtime and is automatically destroyed after the model instance is destroyed or this method is called again. \n * - * @param compilation Level-2 pointer to the {@link OH_NNCompilation} instance. After a compilation instance is - * destroyed, this method sets *compilation to a null pointer. + * @param model Pointer to the {@link OH_NNModel} instance. + * @param deviceID Device ID to be queried, which can be obtained by using {@link OH_NNDevice_GetAllDevicesID}. + * @param isSupported Pointer to the bool array. When this method is called, (*isSupported) must be a null pointer. + * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. + * @param opCount Number of operators in a model instance, corresponding to the length of the (*isSupported) array. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. * @since 9 * @version 1.0 */ -void OH_NNCompilation_Destroy(OH_NNCompilation **compilation); - +OH_NN_ReturnCode OH_NNModel_GetAvailableOperations(OH_NNModel *model, + size_t deviceID, + const bool **isSupported, + uint32_t *opCount); /** - * @brief Creates an executor instance of the {@link OH_NNExecutor} type. + * @brief Adds a tensor to a model instance. * - * This method constructs a model inference executor associated with the device based on the passed compiler. - * Use {@link OH_NNExecutor_SetInput} to set the model input data. After the input data is set, call - * {@link OH_NNExecutor_Run} to perform inference and then call {@link OH_NNExecutor_SetOutput} to obtain the - * computing result.\n + * The data node and operator parameters in the Neural Network Runtime model are composed of tensors of the model. + * This method is used to add tensors to a model instance based on the tensor parameter. + * The sequence of adding tensors is specified by the index value recorded in the model. + * The {@link OH_NNModel_SetTensorData}, {@link OH_NNModel_AddOperation}, + * and {@link OH_NNModel_SpecifyInputsAndOutputs} methods specifies tensors based on the index value.\n * - * After calling this method to create the {@link OH_NNExecutor} instance, you can release the - * {@link OH_NNCompilation} instance if you do not need to create any other executors.\n + * Neural Network Runtime supports inputs and outputs of the dynamic shape. When adding a data node with a dynamic + * shape, you need to set the dimensions that support dynamic changes in tensor.dimensions to -1. + * For example, if tensor.dimensions of a four-dimensional tensor is set to [1, -1, 2, 2], + * the second dimension supports dynamic changes.\n * - * @param compilation Pointer to the {@link OH_NNCompilation} instance. - * @return Pointer to a {@link OH_NNExecutor} instance. + * @param model Pointer to the {@link OH_NNModel} instance. + * @param tensor Pointer to the {@link OH_NN_Tensor} tensor. The tensor specifies the attributes of the tensor added to + * the model instance. + * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @deprecated since 11 + * @useinstead {@link OH_NNModel_AddTensorToModel} * @since 9 * @version 1.0 */ -OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); +OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *tensor); /** * @brief Sets the single input data for a model. @@ -445,37 +358,33 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); * This method copies the data whose length is specified by length (in bytes) in dataBuffer to the shared * memory of the underlying device. inputIndex specifies the input to be set and tensor sets information * such as the input shape, type, and quantization parameters.\n - * * * Neural Network Runtime supports models with dynamical shape input. For fixed shape input and dynamic shape input - * scenarios, this method uses different processing policies. + * scenarios, this method uses different processing policies.\n * - * - Fixed shape input: The attributes of tensor must be the same as those of the tensor added by - * calling {@link OH_NNModel_AddTensor} in the composition phase. + * - Fixed shape input: The attributes of tensor must be the same as those of the tensor added by calling + * {@link OH_NNModel_AddTensor} in the composition phase. * - Dynamic shape input: In the composition phase, because the shape is not fixed, each value in - * tensor.dimensions must be greater than 0 in the method calls to determine the shape input - * in the calculation phase. - * When setting the shape, you can modify only the dimension whose value is -1. Assume that - * [-1, 224, 224, 3] is input as the the dimension of A in the composition phase. - * When this method is called, only the size of the first dimension can be modified, for example, to - * [3, 224, 224, 3]. If other dimensions are adjusted, {@link OH_NN_INVALID_PARAMETER} is returned.\n - * - * - * + * tensor.dimensions must be greater than 0 in the method calls to determine the shape input in the + * calculation phase. When setting the shape, you can modify only the dimension whose value is -1. + * Assume that [-1, 224, 224, 3] is input as the the dimension of A in the composition phase. + * When this method is called, only the size of the first dimension can be modified, e.g. to [3, 224, 224, 3]. + * If other dimensions are adjusted, {@link OH_NN_INVALID_PARAMETER} is returned.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param inputIndex Input index value, which is in the same sequence of the data input when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of inputIndices is {1, 5, 9} when - * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. In input settings, the index value - * for the three inputs is {0, 1, 2}. - * + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * In input settings, the index value for the three inputs is {0, 1, 2}.\n * @param tensor Sets the tensor corresponding to the input data. * @param dataBuffer Pointer to the input data. * @param length Length of the data buffer, in bytes. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, - * see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} * @since 9 * @version 1.0 */ @@ -491,29 +400,28 @@ OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, * This method binds the buffer to which dataBuffer points to the output specified by outputIndex. * The length of the buffer is specified by length.\n * - * After {@link OH_NNExecutor_Run} is called to complete a single model inference, Neural Network Runtime compares - * the length of the buffer to which dataBuffer points with the length of the output data and returns different results - * based on the actual situation.\n - * + * After {@link OH_NNExecutor_Run} is called to complete a single model inference, Neural Network Runtime compares + * the length of the buffer to which dataBuffer points with the length of the output data and returns different + * results based on the actual situation.\n * * - If the buffer length is greater than or equal to the data length, the inference result is copied to the buffer and - * {@link OH_NN_SUCCESS} is returned. You can read the inference result from dataBuffer. - * - If the buffer length is smaller than the data length, {@link OH_NNExecutor_Run} returns {@link OH_NN_INVALID_PARAMETER} - * and generates a log indicating that the buffer is too small.\n - * + * {@link OH_NN_SUCCESS} is returned. You can read the inference result from dataBuffer. + * - If the buffer length is smaller than the data length, {@link OH_NNExecutor_Run} returns + * {@link OH_NN_INVALID_PARAMETER} and generates a log indicating that the buffer is too small.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param outputIndex Output Index value, which is in the same sequence of the data output when - * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of outputIndices is {4, 6, 8} when - * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. In output buffer settings, the index value - * for the three outputs is {0, 1, 2}. - * + * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. + * In output buffer settings, the index value for the three outputs is {0, 1, 2}. * @param dataBuffer Pointer to the output data. * @param length Length of the data buffer, in bytes. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, * see {@link OH_NN_ReturnCode}. + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} * @since 9 * @version 1.0 */ @@ -522,33 +430,6 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, void *dataBuffer, size_t length); -/** - * @brief Obtains the dimension information about the output tensor. - * - * After {@link OH_NNExecutor_Run} is called to complete a single inference, call this method to obtain the specified - * output dimension information and number of dimensions. It is commonly used in dynamic shape input and output - * scenarios.\n - * - * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param outputIndex Output Index value, which is in the same sequence of the data output when - * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * Assume that outputIndices is {4, 6, 8} when {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * When {@link OH_NNExecutor_GetOutputShape} is called to obtain dimension information about the output tensor, - * outputIndices is {0, 1, 2}. - * - * @param shape Pointer to the int32_t array. The value of each element in the array is the length of the output tensor - * in each dimension. - * @param shapeLength Pointer to the uint32_t type. The number of output dimensions is returned. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, - uint32_t outputIndex, - int32_t **shape, - uint32_t *shapeLength); - /** * @brief Performs inference. * @@ -558,6 +439,8 @@ OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. * If the operation fails, an error code is returned. For details about the error codes, * see {@link OH_NN_ReturnCode}. + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} * @since 9 * @version 1.0 */ @@ -566,21 +449,21 @@ OH_NN_ReturnCode OH_NNExecutor_Run(OH_NNExecutor *executor); /** * @brief Allocates shared memory to a single input on a device. * - * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the - * executor and input index value, this method allocates shared memory whose size is specified by length on the - * device associated with a single input and returns the operation result through the {@link OH_NN_Memory} instance.\n - * + * Neural Network Runtime provides a method for proactively allocating shared memory on a device. + * By specifying the executor and input index value, this method allocates shared memory whose size is specified by + * length on the device associated with a single input and returns the operation result through the + * {@link OH_NN_Memory} instance.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param inputIndex Input index value, which is in the same sequence of the data input when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of inputIndices is {1, 5, 9} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In the memory input application, the index value for the three inputs is - * {0, 1, 2}. - * + * In the memory input application, the index value for the three inputs is {0, 1, 2}. * @param length Memory size to be applied for, in bytes. - * @return Pointer to a {@link OH_NN_Memory} instance. + * @return Pointer to a {@link OH_NN_Memory} instance, or NULL if it fails to create. + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_CreateWithSize} * @since 9 * @version 1.0 */ @@ -589,11 +472,10 @@ OH_NN_Memory *OH_NNExecutor_AllocateInputMemory(OH_NNExecutor *executor, uint32_ /** * @brief Allocates shared memory to a single output on a device. * - * Neural Network Runtime provides a method for proactively allocating shared memory on a device. By specifying the - * executor and output index value, this method allocates shared memory whose size is specified by length on - * the device associated with a single output and returns the operation result through the {@link OH_NN_Memory} - * instance.\n - * + * Neural Network Runtime provides a method for proactively allocating shared memory on a device. + * By specifying the executor and output index value, this method allocates shared memory whose size is specified by + * length on the device associated with a single output and returns the operation result through the + * {@link OH_NN_Memory} instance.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param outputIndex Output Index value, which is in the same sequence of the data output when @@ -601,9 +483,10 @@ OH_NN_Memory *OH_NNExecutor_AllocateInputMemory(OH_NNExecutor *executor, uint32_ * Assume that the value of outputIndices is {4, 6, 8} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * In output memory application, the index value for the three outputs is {0, 1, 2}. - * * @param length Memory size to be applied for, in bytes. - * @return Pointer to a {@link OH_NN_Memory} instance. + * @return Pointer to a {@link OH_NN_Memory} instance, or NULL if it fails to create. + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_CreateWithSize} * @since 9 * @version 1.0 */ @@ -624,11 +507,11 @@ OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32 * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of inputIndices is {1, 5, 9} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * In memory input release, the index value for the three inputs is - * {0, 1, 2}. - * - * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, - * this method sets *memory to a null pointer. + * In memory input release, the index value for the three inputs is {0, 1, 2}. + * @param memory Double pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, + * this method sets *memory to a null pointer. + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_Destroy} * @since 9 * @version 1.0 */ @@ -641,18 +524,19 @@ void OH_NNExecutor_DestroyInputMemory(OH_NNExecutor *executor, uint32_t inputInd * {@link OH_NNExecutor_AllocateOutputMemory}. Otherwise, memory leak will occur. * The mapping between outputIndex and memory must be the same as that in memory instance creation.\n * - * If memory or *memory is a null pointer, this method only prints warning logs and does not - * execute the release logic.\n + * If memory or *memory is a null pointer, this method only prints warning logs and does not execute + * the release logic.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param outputIndex Output index value, which is in the same sequence of the data output when + * @param outputIndex Output Index value, which is in the same sequence of the data output when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of outputIndices is {4, 6, 8} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * In output memory release, the index value for the three outputs is {0, 1, 2}. - * - * @param memory Level-2 pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, + * @param memory Double pointer to the {@link OH_NN_Memory} instance. After shared memory is destroyed, * this method sets *memory to a null pointer. + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_Destroy} * @since 9 * @version 1.0 */ @@ -660,13 +544,12 @@ void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputI /** * @brief Specifies the hardware shared memory pointed to by the {@link OH_NN_Memory} instance as the shared memory - * used by a single input. + * used by a single input. * * In scenarios where memory needs to be managed by yourself, this method binds the execution input to the - * {@link OH_NN_Memory} memory instance. - * During computing, the underlying device reads the input data from the shared memory pointed to by the memory instance. - * By using this method, concurrent execution of input setting, computing, and read can be implemented to - * improve inference efficiency of a data flow.\n + * {@link OH_NN_Memory} memory instance. During computing, the underlying device reads the input data from the shared + * memory pointed to by the memory instance. By using this method, concurrent execution of input setting, computing, + * and read can be implemented to improve inference efficiency of a data flow.\n * * @param executor Pointer to the {@link OH_NNExecutor} instance. * @param inputIndex Input index value, which is in the same sequence of the data input when @@ -675,11 +558,13 @@ void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputI * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * When the input shared memory is specified, the index value for the three inputs is * {0, 1, 2}. - * * @param tensor Pointer to {@link OH_NN_Tensor}, used to set the tensor corresponding to a single input. * @param memory Pointer to {@link OH_NN_Memory}. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} * @since 9 * @version 1.0 */ @@ -690,25 +575,26 @@ OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, /** * @brief Specifies the hardware shared memory pointed to by the {@link OH_NN_Memory} instance as the shared memory - * used by a single output. + * used by a single output. * - * In scenarios where memory needs to be managed by yourself, this method binds the execution output to - * the {@link OH_NN_Memory} memory instance. - * When computing is performed, the underlying hardware directly writes the computing result to the shared memory to - * which the memory instance points. - * By using this method, concurrent execution of input setting, computing, and read can be implemented to improve - * inference efficiency of a data flow.\n + * In scenarios where memory needs to be managed by yourself, this method binds the execution output to the + * {@link OH_NN_Memory} memory instance. When computing is performed, the underlying hardware directly writes the + * computing result to the shared memory to which the memory instance points. By using this method, concurrent execution + * of input setting, computing, and read can be implemented to improve inference efficiency of a data flow.\n * * @param executor Executor. * @param outputIndex Output Index value, which is in the same sequence of the data output when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. * Assume that the value of outputIndices is {4, 6, 8} when * {@link OH_NNModel_SpecifyInputsAndOutputs} is called. - * When output shared memory is specified, the index value for the three outputs is {0, 1, 2}. - * + * When the output shared memory is specified, the index value for the three outputs is + * {0, 1, 2}. * @param memory Pointer to {@link OH_NN_Memory}. * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. + * If the operation fails, an error code is returned. For details about the error codes, + * see {@link OH_NN_ReturnCode}. + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} * @since 9 * @version 1.0 */ @@ -716,79 +602,6 @@ OH_NN_ReturnCode OH_NNExecutor_SetOutputWithMemory(OH_NNExecutor *executor, uint32_t outputIndex, const OH_NN_Memory *memory); -/** - * @brief Destroys an executor instance to release the memory occupied by the executor. - * - * This method needs to be called to release the executor instance created by calling {@link OH_NNExecutor_Construct}. - * Otherwise, memory leak will occur.\n - * - * If executor or *executor is a null pointer, this method only prints warning logs and does not - * execute the release logic.\n - * - * @param executor Level-2 pointer to the {@link OH_NNExecutor} instance. - * @since 9 - * @version 1.0 - */ -void OH_NNExecutor_Destroy(OH_NNExecutor **executor); - - -/** - * @brief Obtains the ID of the device connected to Neural Network Runtime. - * - * Each device has a unique and fixed ID in Neural Network Runtime. This method returns device IDs on the current - * device through the uint32_t array.\n - * - * Device IDs are returned through the size_t array. Each element of the array is the ID of a single device. - * The array memory is managed by Neural Network Runtime. - * The data pointer is valid before this method is called next time.\n - * - * @param allDevicesID Pointer to the size_t array. The input *allDevicesID must be a null pointer. - * Otherwise, {@link OH_NN_INVALID_PARAMETER} is returned. - * - * @param deviceCount Pointer of the uint32_t type, which is used to return the length of (*allDevicesID). - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNDevice_GetAllDevicesID(const size_t **allDevicesID, uint32_t *deviceCount); - -/** - * @brief Obtains the name of the specified device. - * - * deviceID specifies the device whose name will be obtained. The device ID needs to be obtained by calling - * {@link OH_NNDevice_GetAllDevicesID}.\n - * - * @param deviceID Device ID. - * @param name Pointer to the char array. The passed (*char) must be a null pointer. Otherwise, - * {@link OH_NN_INVALID_PARAMETER} is returned. - * The value of (*name) is a C-style string ended with '\0'. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNDevice_GetName(size_t deviceID, const char **name); - -/** - * @brief Obtains the type information of the specified device. - * - * deviceID specifies the device whose type will be obtained. Currently, Neural Network Runtime supports the - * following device types:\n - * - OH_NN_CPU: CPU device. - * - OH_NN_GPU: GPU device. - * - OH_NN_ACCELERATOR: machine learning dedicated accelerator. - * - OH_NN_OTHERS: other hardware types.\n - * - * @param deviceID Device ID. - * @param deviceType Pointer to the {@link OH_NN_DeviceType} instance. The device type information is returned. - * @return Execution result of the function. If the operation is successful, OH_NN_SUCCESS is returned. - * If the operation fails, an error code is returned. For details about the error codes, see {@link OH_NN_ReturnCode}. - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNDevice_GetType(size_t deviceID, OH_NN_DeviceType *deviceType); - #ifdef __cplusplus } #endif // __cplusplus diff --git a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index 63ba6493..3601a9ec 100644 --- a/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/en/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -19,19 +19,20 @@ * * @brief Provides APIs for accelerating the Neural Network Runtime model inference. * - * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 - * @version 1.0 + * @version 2.0 */ /** * @file neural_network_runtime_type.h * - * @brief Defines the structure and enumeration for Neural Network Runtime. - * + * @brief Defines the structure and enumeration. + * + * include "neural_network_runtime/neural_network_runtime_type.h" * @library libneural_network_runtime.so + * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 - * @version 1.0 + * @version 2.0 */ #ifndef NEURAL_NETWORK_RUNTIME_TYPE_H @@ -45,7 +46,7 @@ extern "C" { #endif /** - * @brief Defines the handles of models for Neural Network Runtime. + * @brief Defines the handles of models. * * @since 9 * @version 1.0 @@ -53,7 +54,7 @@ extern "C" { typedef struct OH_NNModel OH_NNModel; /** - * @brief Defines the compiler handle for Neural Network Runtime. + * @brief Defines the compilation handle. * * @since 9 * @version 1.0 @@ -61,13 +62,37 @@ typedef struct OH_NNModel OH_NNModel; typedef struct OH_NNCompilation OH_NNCompilation; /** - * @brief Defines the executor handle for Neural Network Runtime. + * @brief Defines the executor handle. * * @since 9 * @version 1.0 */ typedef struct OH_NNExecutor OH_NNExecutor; +/** + * @brief Defines the quantization parameter handle. + * + * @since 11 + * @version 1.0 + */ +typedef struct NN_QuantParam NN_QuantParam; + +/** + * @brief Defines the tensor descriptor handle. + * + * @since 11 + * @version 1.0 + */ +typedef struct NN_TensorDesc NN_TensorDesc; + +/** + * @brief Defines the tensor handle. + * + * @since 11 + * @version 1.0 + */ +typedef struct NN_Tensor NN_Tensor; + /** * @brief Defines the hardware performance mode. * @@ -105,10 +130,10 @@ typedef enum { } OH_NN_Priority; /** - * @brief Defines error codes for Neural Network Runtime. + * @brief Defines error codes. * * @since 9 - * @version 1.0 + * @version 2.0 */ typedef enum { /** The operation is successful. */ @@ -117,7 +142,7 @@ typedef enum { OH_NN_FAILED = 1, /** Invalid parameter. */ OH_NN_INVALID_PARAMETER = 2, - /** Memory-related error, for example, insufficient memory, or memory data copy or memory application failure. */ + /** Memory-related error, for example, insufficient memory, memory data copy failure, or memory application failure. */ OH_NN_MEMORY_ERROR = 3, /** Invalid operation. */ OH_NN_OPERATION_FORBIDDEN = 4, @@ -125,14 +150,81 @@ typedef enum { OH_NN_NULL_PTR = 5, /** Invalid file. */ OH_NN_INVALID_FILE = 6, - /** A hardware error occurs, for example, HDL service crash. */ + /** A hardware error occurs, for example, HDL service crash. + * @deprecated since 11 + * @useinstead {@link OH_NN_UNAVAILABLE_DEVICE} + */ OH_NN_UNAVALIDABLE_DEVICE = 7, /** Invalid path. */ - OH_NN_INVALID_PATH = 8 + OH_NN_INVALID_PATH = 8, + /** Timeout. + * @since 11 + */ + OH_NN_TIMEOUT = 9, + /** Unsupported. + * @since 11 + */ + OH_NN_UNSUPPORTED = 10, + /** Connection Exception. + * @since 11 + */ + OH_NN_CONNECTION_EXCEPTION = 11, + /** Save cache exception. + * @since 11 + */ + OH_NN_SAVE_CACHE_EXCEPTION = 12, + /** Dynamic shape. + * @since 11 + */ + OH_NN_DYNAMIC_SHAPE = 13, + /** A hardware error occurs, for example, HDL service crash. + * @since 11 + */ + OH_NN_UNAVAILABLE_DEVICE = 14 } OH_NN_ReturnCode; + +/** + * @brief Defines the callback function handle for the post-process when the asynchronous execution has been done. + * + * Use userData to identify the asynchronous execution you want to get. + * It is the argument userData passed to {@link OH_NNExecutor_RunAsync}.\n + * + * Use errCode of type {@link OH_NN_ReturnCode} to get the error code returned by the asynchronous execution.\n + * + * The outputTensor and outputCount are the inference results, which is the same as ones passed to + * {@link OH_NNExecutor_RunAsync}.\n + * + * @param userData Asynchronous execution identifier, which is the argument userData passed to + * {@link OH_NNExecutor_RunAsync}. + * @param errCode Error code {@link OH_NN_ReturnCode} returned by the asynchronous execution. + * @param outputTensor An array of output tensors {@link NN_Tensor} of the model, which is the same as the argument + * outputTensor passed to {@link OH_NNExecutor_RunAsync}. + * @param outputCount Output tensor count, which is the same as the argument outputCount passed to + * {@link OH_NNExecutor_RunAsync}. + * @since 11 + * @version 1.0 + */ +typedef void (*NN_OnRunDone)(void *userData, OH_NN_ReturnCode errCode, void *outputTensor[], int32_t outputCount); + +/** + * @brief Defines the callback function handle for the post-process when the device driver service is dead during + * asynchronous execution. + * + * You should recompile the model if this callback function is called.\n + * + * Use userData to identify the asynchronous execution you want to get. + * It is the argument userData passed to {@link OH_NNExecutor_RunAsync}.\n + * + * @param userData Asynchronous execution identifier, which is the argument userData passed to + * {@link OH_NNExecutor_RunAsync}. + * @since 11 + * @version 1.0 + */ +typedef void (*NN_OnServiceDied)(void *userData); + /** - * @brief Defines activation function types in the fusion operator for Neural Network Runtime. + * @brief Defines activation function types in the fusion operator. * * @since 9 * @version 1.0 @@ -150,7 +242,7 @@ typedef enum : int8_t { * @brief Defines the layout type of tensor data. * * @since 9 - * @version 1.0 + * @version 2.0 */ typedef enum { /** The tensor does not have a specific layout type (such as scalar or vector). */ @@ -158,11 +250,15 @@ typedef enum { /** The tensor arranges data in NCHW format.*/ OH_NN_FORMAT_NCHW = 1, /** The tensor arranges data in NHWC format.*/ - OH_NN_FORMAT_NHWC = 2 + OH_NN_FORMAT_NHWC = 2, + /** The tensor arranges data in ND format. + * @since 11 + */ + OH_NN_FORMAT_ND = 3 } OH_NN_Format; /** - * @brief Defines device types supported by Neural Network Runtime. + * @brief Defines device types. * * @since 9 * @version 1.0 @@ -179,7 +275,7 @@ typedef enum { } OH_NN_DeviceType; /** - * @brief Defines tensor data types supported by Neural Network Runtime. + * @brief Defines tensor data types. * * @since 9 * @version 1.0 @@ -215,7 +311,7 @@ typedef enum { /** - * @brief Defines operator types supported by Neural Network Runtime. + * @brief Defines operator types. * * @since 9 * @version 1.0 @@ -232,19 +328,18 @@ typedef enum { * Parameters: * * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * - * * output: sum of input1 and input2. - * The data shape is the same as that of the input after broadcasting, - * and the data type is the same as that of the input with a higher precision. + * * output: sum of input1 and input2. + * The data shape is the same as that of the input after broadcasting, + * and the data type is the same as that of the input with a higher precision. */ OH_NN_OPS_ADD = 1, /** - * Apply 2D average pooling to the input tensor, which now must be in NHWC format. The int8 quantization input - * is supported. + * Apply 2D average pooling to the input tensor, which now must be in NHWC format. The int8 quantization input is supported. * * If the input contains the padMode parameter: * @@ -254,25 +349,18 @@ typedef enum { * * Parameters: * - * * kernelSize indicates the kernel size used to obtain the average value. It is an int array - * [kernel_height, kernel_width]. - * The first number indicates the kernel height, and the second number indicates the kernel width. - * * strides indicates the distance of kernel moving. The value is an int array - * [stride_height, stride_width]. - * The first number indicates the moving step in height, and the second number indicates the moving step - * in width. - * * padMode: padding mode, which is optional. The value is of the int type and can be 0 (same) - * or 1 (valid). - * The nearest neighbor value is used for padding. - * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, - * bottom, left, and right if possible. - * Otherwise, the last additional padding will be completed from the bottom and right. - * 1 (valid): The possible maximum height and width of the output will be returned in case of - * no padding. - * Excessive pixels will be discarded. + * * kernelSize indicates the kernel size used to obtain the average value. It is an int array [kernel_height, kernel_width]. + * The first number indicates the kernel height, and the second number indicates the kernel width. + * * strides indicates the distance of kernel moving. The value is an int array [stride_height, stride_width]. + * The first number indicates the moving step in height, and the second number indicates the moving step in width. + * * padMode: padding mode, which is optional. The value is of the int type and can be 0 (same) or 1 (valid). + * The nearest neighbor value is used for padding. + * 0 (same): The height and width of the output are the same as those of the input. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * Otherwise, the last additional padding will be completed from the bottom and right. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. Excessive pixels will be discarded. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * If the input contains the padList parameter: * @@ -282,17 +370,13 @@ typedef enum { * * Parameters: * - * * kernelSize indicates the kernel size used to obtain the average value. It is an int array - * [kernel_height, kernel_width]. - * The first number indicates the kernel height, and the second number indicates the kernel width. - * * strides indicates the distance of kernel moving. The value is an int array - * [stride_height, stride_width]. - * The first number indicates the moving step in height, and the second number indicates the moving step - * in width. - * * padList: padding around input. It is an int array [top, bottom, left, right], and the nearest - * neighbor values are used for padding. + * * kernelSize indicates the kernel size used to obtain the average value. It is an int array [kernel_height, kernel_width]. + * The first number indicates the kernel height, and the second number indicates the kernel width. + * * strides indicates the distance of kernel moving. The value is an int array [stride_height, stride_width]. + * The first number indicates the moving step in height, and the second number indicates the moving step in width. + * * padList: padding around input. It is an int array [top, bottom, left, right], and the nearest neighbor values are used for padding. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * @@ -301,19 +385,15 @@ typedef enum { OH_NN_OPS_AVG_POOL = 2, /** - * Batch normalization is performed on a tensor to scale and shift tensor elements, relieving potential covariate - * shift in a batch of data. + * Batch normalization is performed on a tensor to scale and shift tensor elements, relieving potential covariate shift in a batch of data. * * Inputs: * - * * input: n-dimensional tensor of shape [N, ..., C]. The nth dimension is the number - * of channels. + * * input: n-dimensional tensor of shape [N, ..., C]. The nth dimension is the number of channels. * * scale: 1D tensor of the scaling factor used to scale the first normalized tensor. * * offset: 1D tensor used to move to the first normalized tensor. - * * mean: 1D tensor of the overall mean value. It is used only for inference. In case of training, - * this parameter must be left empty. - * * variance: 1D tensor used for the overall variance. It is used only for inference. In case of training, - * this parameter must be left empty. + * * mean: 1D tensor of the overall mean value. It is used only for inference. In case of training, this parameter must be left empty. + * * variance: 1D tensor used for the overall variance. It is used only for inference. In case of training, this parameter must be left empty. * * Parameters: * @@ -326,30 +406,26 @@ typedef enum { OH_NN_OPS_BATCH_NORM = 3, /** - * Divides the batch dimension of a 4D tensor into small blocks by block_shape, and interleaves these blocks - * back into the spatial dimension. + * Divides the batch dimension of a 4D tensor into small blocks by block_shape, and interleaves these blocks back into the spatial dimension. * * Parameters: * - * * input: input tensor. The dimension will be divided into small blocks, and these blocks will be - * interleaved into the spatial dimension. + * * input: input tensor. The dimension will be divided into small blocks, and these blocks will be interleaved into the spatial dimension. * * Outputs: * - * * blockSize: size of each block to be interleaved into the spatial dimension. The value is an array - * [height_block, width_block]. - * * crops: elements truncated from the spatial dimension of the output. The value is a 2D array - * [[crop0_start, crop0_end], [crop1_start, crop1_end]] with the shape of (2, 2). + * * blockSize: size of each block to be interleaved into the spatial dimension. The value is an array [height_block, width_block]. + * * crops: elements truncated from the spatial dimension of the output. The value is a 2D array [[crop0_start, crop0_end], + * [crop1_start, crop1_end]] with the shape of (2, 2). * * * Outputs: * - * * output. Assume that the shape of input is (n,h,w,c) and the shape of output - * is (n',h',w',c'): - * n' = n / (block_shape[0] * block_shape[1]) - * h' = h * block_shape[0] - crops[0][0] - crops[0][1] - * w' = w * block_shape[1] - crops[1][0] - crops[1][1] - * c'= c + * * output. Assume that the shape of input is (n,h,w,c) and the shape of output is (n',h',w',c'): + * n' = n / (block_shape[0] * block_shape[1]) + * h' = h * block_shape[0] - crops[0][0] - crops[0][1] + * w' = w * block_shape[1] - crops[1][0] - crops[1][1] + * c'= c */ OH_NN_OPS_BATCH_TO_SPACE_ND = 4, @@ -407,38 +483,29 @@ typedef enum { * * * input: input tensor. * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. - * The value of inChannel must be exactly divided by the value of group. - * + * The value of inChannel must be exactly divided by the value of group. + * * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. - * The actual quantization parameters are determined by input and weight. + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. + * The actual quantization parameters are determined by input and weight. * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. - * It is an int array [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array - * [dilationHeight, dilationWidth]. - * The value must be greater than or equal to 1 and cannot exceed the height and width of input. - * - * * padMode: padding mode of input. The value is of the int type and can be 0 (same) - * or 1 (valid). - * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, - * bottom, left, and right if possible. - * Otherwise, the last additional padding will be completed from the bottom and right. + * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * - * 1 (valid): The possible maximum height and width of the output will be returned in case of no - * padding. The excessive pixels will be discarded. - * * group: number of groups in which the input is divided by in_channel. The value is of the int - * type. - * If group is 1, it is a conventional convolution. If group is greater than 1 - * and less than or equal to in_channel, it is a group convolution. - * * activationType is an integer constant which is contained in FuseType. The specified activation - * function is called before output. - * - * + * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or 1 (valid). + * 0 (same): The height and width of the output are the same as those of the input. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * Otherwise, the last additional padding will be completed from the bottom and right. + * + * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. The excessive pixels will be discarded. + * * group: number of groups in which the input is divided by in_channel. The value is of the int type. + * If group is 1, it is a conventional convolution. If group is greater than 1 and + * less than or equal to in_channel, it is a group convolution. + * * activationType is an integer constant which is contained in FuseType. The specified activation function is called before output. * * If the input contains the padList parameter: * @@ -446,32 +513,25 @@ typedef enum { * * * input: input tensor. * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. - * The value of inChannel must be exactly divided by the value of group. - * + * The value of inChannel must be exactly divided by the value of group. + * * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. - * The actual quantization parameters are determined by input and weight. - * + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. + * The actual quantization parameters are determined by input and weight. * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array - * [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array - * [dilationHeight, dilationWidth]. - * The value must be greater than or equal to 1 and cannot exceed the height and width of - * input. + * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * * padList: padding around input. It is an int array [top, bottom, left, right]. - * * group: number of groups in which the input is divided by in_channel. The value is of the - * int type. - * If group is 1, it is a conventional convolution. - * If group is in_channel, it is depthwiseConv2d. In this case, - * group==in_channel==out_channel. - * If group is greater than 1 and less than in_channel, it is a group convolution. - * In this case, out_channel==group. + * * group: number of groups in which the input is divided by in_channel. The value is of the int type. + * If group is 1, it is a conventional convolution. + * If group is in_channel, it is depthwiseConv2d. In this case, group==in_channel==out_channel. + * If group is greater than 1 and less than in_channel, it is a group convolution. In this case, out_channel==group. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * @@ -488,72 +548,65 @@ typedef enum { * * * input: input tensor. * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. - * The value of inChannel must be exactly divided by the value of group. - * + * The value of inChannel must be exactly divided by the value of group. + * * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. - * The actual quantization parameters are determined by input and weight. - * - * * stride: movement stride of the convolution kernel in height and width. It is an int array - * [strideHeight, strideWidth]. + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. + * The actual quantization parameters are determined by input and weight. + * + * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. * * Parameters: * - * * dilation: dilation size of the convolution kernel in height and width. It is an int array - * [dilationHeight, dilationWidth]. - * The value must be greater than or equal to 1 and cannot exceed the height and width of input. - * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or - * 1 (valid). - * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, - * bottom, left, and right if possible. - * Otherwise, the last additional padding will be completed from the bottom and right. - * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. - * The excessive pixels will be discarded. - * * group: number of groups in which the input is divided by in_channel. The value is of the int type. - * If group is 1, it is a conventional convolution. If group is greater than 1 - * and less than or equal to in_channel, it is a group convolution. - * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. - * It can be a single integer to specify the same value for all spatial dimensions. The amount of output - * padding along a dimension must be less than the stride along this dimension. - * + * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of input. + * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or 1 (valid). + * 0 (same): The height and width of the output are the same as those of the input. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * Otherwise, the last additional padding will be completed from the bottom and right. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. The excessive pixels will be discarded. + * * group: number of groups in which the input is divided by in_channel. The value is of the int type. + * If group is 1, it is a conventional convolution. If group is greater than 1 and + * less than or equal to in_channel, it is a group convolution. + * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. + * It can be a single integer to specify the same value for all spatial dimensions. The amount of output + * padding along a dimension must be less than the stride along this dimension. + * * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * If the input contains the padList parameter: * * Inputs: * * * input: input tensor. - * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. - * The value of inChannel must be exactly divided by the value of group. - * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. - * The actual quantization parameters are determined by input and weight. - * + * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. + * The value of inChannel must be exactly divided by the value of group. + * * bias: bias of the convolution. It is an array with a length of [outChannel]. + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. + * The actual quantization parameters are determined by input and weight. + * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array - * [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array - * [dilationHeight, dilationWidth]. - * The value must be greater than or equal to 1 and cannot exceed the height and width of input. + * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * * padList: padding around input. It is an int array [top, bottom, left, right]. - * * group: number of groups in which the input is divided by in_channel. The value is of the int type. - * If group is 1, it is a conventional convolution. If group is greater than 1 + * * group: number of groups in which the input is divided by in_channel. The value is of the int type. + * If group is 1, it is a conventional convolution. If group is greater than 1 * and less than or equal to in_channel, it is a group convolution. - * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. - * It can be a single integer to specify the same value for all spatial dimensions. The amount of output - * padding along a dimension must be less than the stride along this dimension. - * + * * outputPads: padding along the height and width of the output tensor. The value is an int or a tuple. + * It can be a single integer to specify the same value for all spatial dimensions. The amount of output padding + * along a dimension must be less than the stride along this dimension. + * * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * - output: computing result after convolution and transposition. + * * output: computing result after convolution and transposition. */ OH_NN_OPS_CONV2D_TRANSPOSE = 9, @@ -565,57 +618,47 @@ typedef enum { * Inputs: * * * input: input tensor. - * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, 1] format. - * outChannel is equal to channelMultiplier multiplied by inChannel. - * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. - * The actual quantization parameters are determined by input and weight. - * + * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, 1] format. + * outChannel is equal to channelMultiplier multiplied by inChannel. + * * bias: bias of the convolution. It is an array with a length of [outChannel]. + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. + * The actual quantization parameters are determined by input and weight. * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array - * [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array - * [dilationHeight, dilationWidth]. - * The value must be greater than or equal to 1 and cannot exceed the height and width of input. - * * padMode: padding mode of input. The value is of the int type and can be 0 (same) - * or 1 (valid). - * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, - * bottom, left, and right if possible. - * Otherwise, the last additional padding will be completed from the bottom and right. + * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of input. + * * padMode: padding mode of input. The value is of the int type and can be 0 (same) or 1 (valid). + * 0 (same): The height and width of the output are the same as those of the input. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * Otherwise, the last additional padding will be completed from the bottom and right. * - * 1 (valid): The possible maximum height and width of the output will be returned in case of no - * padding. - * The excessive pixels will be discarded. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. The excessive pixels will be discarded. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * If the input contains the padList parameter: * * Inputs: * * * input: input tensor. - * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, 1] format. - * outChannel is equal to channelMultiplier multiplied by inChannel. - * * bias: bias of the convolution. It is an array with a length of [outChannel]. - * In quantization scenarios, the bias parameter does not require quantization parameters. - * The quantization version requires data input of the OH_NN_INT32 type. - * The actual quantization parameters are determined by input and weight. - * + * * weight: convolution weight in [outChannel, kernelHeight, kernelWidth, 1] format. + * outChannel is equal to channelMultiplier multiplied by inChannel. + * * bias: bias of the convolution. It is an array with a length of [outChannel]. + * In quantization scenarios, the bias parameter does not require quantization parameters. + * The quantization version requires data input of the OH_NN_INT32 type. + * The actual quantization parameters are determined by input and weight. * * Parameters: * - * * stride: movement stride of the convolution kernel in height and width. It is an int array - * [strideHeight, strideWidth]. - * * dilation: dilation size of the convolution kernel in height and width. It is an int array - * [dilationHeight, dilationWidth]. - * The value must be greater than or equal to 1 and cannot exceed the height and width of input. + * * stride: movement stride of the convolution kernel in height and width. It is an int array [strideHeight, strideWidth]. + * * dilation: dilation size of the convolution kernel in height and width. It is an int array [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of input. * * padList: padding around input. It is an int array [top, bottom, left, right]. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * @@ -630,15 +673,13 @@ typedef enum { * * * input1: first input, which is a number, a bool, or a tensor whose data type is number or Boolean. * * input2: second input, which must meet the following requirements: - * If the first input is a tensor, the second input can be a real number, a Boolean value, or - * a tensor whose data type is real number or Boolean value. - * If the first input is a real number or Boolean value, the second input must be a tensor whose data type - * is real number or Boolean value. + * If the first input is a tensor, the second input can be a real number, a Boolean value, or a tensor whose data type is real number or Boolean value. + * If the first input is a real number or Boolean value, the second input must be a tensor whose data type is real number or Boolean value. * * Parameters: * * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * @@ -647,8 +688,7 @@ typedef enum { OH_NN_OPS_DIV = 11, /** - * Sets parameters to perform product (dot product), sum (addition and subtraction), or max (larger value) - * on the input. + * Sets parameters to perform product (dot product), sum (addition and subtraction), or max (larger value) on the input. * * Inputs: * @@ -662,7 +702,6 @@ typedef enum { * Outputs: * * * output: computing result, which has the same data type and shape of output and input1. - * */ OH_NN_OPS_ELTWISE = 12, @@ -672,8 +711,7 @@ typedef enum { * Inputs: * * * input: input tensor. - * * axis: index of the dimension to be added. The value is of the int32_t type and must be - * a constant in the range [-dim-1, dim]. + * * axis: index of the dimension to be added. The value is of the int32_t type and must be a constant in the range [-dim-1, dim]. * * Outputs: * @@ -691,8 +729,7 @@ typedef enum { * * Outputs: * - * * output: generated tensor, which has the same data type as value. - * The tensor shape is specified by the shape parameter. + * * output: generated tensor, which has the same data type as value. The tensor shape is specified by the shape parameter. */ OH_NN_OPS_FILL = 14, @@ -703,39 +740,35 @@ typedef enum { * * * input: full-connection input tensor. * * weight: weight tensor for a full connection. - * * bias: full-connection bias. In quantization scenarios, no quantized parameter is required for - * this parameter. - * If quantization is required, the data must be of the OH_NN_INT32 type. - * The actual quantization parameters are determined by input and weight. - * + * * bias: full-connection bias. In quantization scenarios, no quantized parameter is required for this parameter. + * If quantization is required, the data must be of the OH_NN_INT32 type. + * The actual quantization parameters are determined by input and weight. * * Parameters: * * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * * * output: computed tensor. - + * * If the input contains the axis parameter: * * Inputs: * * * input: full-connection input tensor. * * weight: weight tensor for a full connection. - * * bias: full-connection bias. In quantization scenarios, no quantized parameter is required for - * this parameter. - * If quantization is required, the data must be of the OH_NN_INT32 type. The actual quantization - * parameters are determined by input and weight. - * + * * bias: full-connection bias. In quantization scenarios, no quantized parameter is required for this parameter. + * If quantization is required, the data must be of the OH_NN_INT32 type. The actual quantization parameters + * are determined by input and weight. * * Parameters: * - * * axis: axis in which the full connection is applied. The specified axis and its following axes - * are converted into a 1D tensor for applying the full connection. + * * axis: axis in which the full connection is applied. The specified axis and its following axes are + * converted into a 1D tensor for applying the full connection. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * @@ -750,9 +783,8 @@ typedef enum { * * * input: tensor to be sliced. * * inputIndices: indices of the specified input on the axis. The value is an array of the int type - * and must be in the range [0,input.shape[axis]). - * * axis: axis on which input is sliced. The value is an array with one element of the int32_t - * type. + * and must be in the range [0,input.shape[axis]). + * * axis: axis on which input is sliced. The value is an array with one element of the int32_t type. * * Outputs: * @@ -769,25 +801,24 @@ typedef enum { * * Outputs: * - * * n-dimensional Hswish activation value. The data type is the same as that of shape - * and input. + * * output: n-dimensional Hswish activation value. The data type is the same as that of shape and input. */ OH_NN_OPS_HSWISH = 17, /** * For input1 and input2, calculate the result of input1[i]<=input2[i] for each pair of elements, - * where i is the index of each element in the input tensor. + * where i is the index of each element in the input tensor. * * Inputs: * * * input1, which can be a real number, Boolean value, or tensor whose data type is real number or NN_BOOL. * * input2, which can be a real number or a Boolean value if input1 is a tensor and must be a tensor - * with the data type of real number or NN_BOOL if input1 is not a tensor. + * with the data type of real number or NN_BOOL if input1 is not a tensor. * * Outputs: * * * A tensor of the data type NN_BOOL. When a quantization model is used, the quantization parameters of the output - * cannot be omitted. However, values of the quantization parameters do not affect the result. + * cannot be omitted. However, values of the quantization parameters do not affect the result. */ OH_NN_OPS_LESS_EQUAL = 18, @@ -807,29 +838,27 @@ typedef enum { * Outputs: * * * output: inner product obtained after calculation. In case of type!=NN_UNKNOWN, the output data type is - * determined by type. In case of type==NN_UNKNOWN, the output data type depends on the data type - * converted during computing of inputX and inputY. + * determined by type. In case of type==NN_UNKNOWN, the output data type depends on the data type + * converted during computing of inputX and inputY. * */ OH_NN_OPS_MATMUL = 19, /** - * Calculates the maximum of input1 and input2 element-wise. The inputs of input1 and - * input2 comply with the implicit type conversion rules to make the data types consistent. - * The inputs must be two tensors or one tensor and one scalar. - * When the inputs are two tensors, their data types cannot be both NN_BOOL. Their shapes can be broadcast to the - * same size. + * Calculates the maximum of input1 and input2 element-wise. The inputs of input1 and input2 + * comply with the implicit type conversion rules to make the data types consistent. * The inputs must be two tensors or one tensor and one scalar. + * When the inputs are two tensors, their data types cannot be both NN_BOOL. Their shapes can be broadcast to the same size. * When the inputs are one tensor and one scalar, the scalar must be a constant. * * Inputs: * - * * input1: n-dimensional input tensor of the real number or NN_BOOL type. - * * input2: n-dimensional input tensor of the real number or NN_BOOL type. + * * input1: n-dimensional input tensor of the real number or NN_BOOL type. + * * input2: n-dimensional input tensor of the real number or NN_BOOL type. * * Outputs: * * * output: n-dimensional output tensor. The shape and data type of - * output are the same as those of the two inputs with a higher precision. + * output are the same as those of the two inputs with a higher precision. */ OH_NN_OPS_MAXIMUM = 20, @@ -845,21 +874,17 @@ typedef enum { * Parameters: * * * kernelSize: kernel size used to obtain the maximum. It is an int array [kernel_height, kernel_width]. - * The first number indicates the kernel height, and the second number indicates the kernel width. + * The first number indicates the kernel height, and the second number indicates the kernel width. * * strides indicates the distance of kernel moving. The value is an int array [stride_height, stride_width]. - * The first number indicates the moving step in height, and the second number indicates the moving step - * in width. + * The first number indicates the moving step in height, and the second number indicates the moving step in width. * * padMode: padding mode, which is optional. The value is of the int type and can be 0 (same) - * or 1 (valid). The nearest neighbor value is used for padding. - * 0 (same): The height and width of the output are the same as those of the input. - * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, - * bottom, left, and right if possible. - * Otherwise, the last additional padding will be completed from the bottom and right. - * - * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. - * The excessive pixels will be discarded. + * or 1 (valid). The nearest neighbor value is used for padding. + * 0 (same): The height and width of the output are the same as those of the input. + * The total padding quantity is calculated horizontally and vertically and evenly distributed to the top, bottom, left, and right if possible. + * Otherwise, the last additional padding will be completed from the bottom and right. + * 1 (valid): The possible maximum height and width of the output will be returned in case of no padding. The excessive pixels will be discarded. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * If the input contains the padList parameter: * @@ -869,17 +894,14 @@ typedef enum { * * Parameters: * - * * kernelSize: kernel size used to obtain the maximum. It is an int array - * [kernel_height, kernel_width]. - * The first number indicates the kernel height, and the second number indicates the kernel width. - * * strides indicates the distance of kernel moving. The value is an int array - * [stride_height, stride_width]. - * The first number indicates the moving step in height, and the second number indicates the moving step - * in width. + * * kernelSize: kernel size used to obtain the maximum. It is an int array [kernel_height, kernel_width]. + * The first number indicates the kernel height, and the second number indicates the kernel width. + * * strides indicates the distance of kernel moving. The value is an int array [stride_height, stride_width]. + * The first number indicates the moving step in height, and the second number indicates the moving step in width. * * padList: padding around input. It is an int array [top, bottom, left, right], - * and the nearest neighbor values are used for padding. + * and the nearest neighbor values are used for padding. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * @@ -889,9 +911,8 @@ typedef enum { /** * Multiplies elements in the same positions of inputX and inputY to obtain the output. - * If inputX and inputY have different shapes, expand them to the same shape - * through broadcast and then perform multiplication. - * + * If inputX and inputY have different shapes, expand them to the same shape + * through broadcast and then perform multiplication. * * Inputs: * @@ -901,7 +922,7 @@ typedef enum { * Parameters: * * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * @@ -910,23 +931,22 @@ typedef enum { OH_NN_OPS_MUL = 22, /** - * Generates a one-hot tensor based on the positions specified by indices. The positions specified by - * indices are determined by on_value, and other positions are determined by off_value. + * Generates a one-hot tensor based on the positions specified by indices. The positions specified by indices + * are determined by on_value, and other positions are determined by off_value. * * Inputs: * - * * indices: n-dimensional tensor. Each element in indices determines the position of - * on_value in each one-hot vector. + * * indices: n-dimensional tensor. Each element in indices determines the position of + * on_value in each one-hot vector. * * depth: integer scalar that determines the depth of the one-hot vector. The value of depth - * must be greater than 0. + * must be greater than 0. * * on_value: scalar that specifies a valid value in the one-hot vector. - * * off_value: scalar that specifies the values of other posistions in the one-hot vector except the - * valid value. + * * off_value: scalar that specifies the values of other posistions in the one-hot vector except the valid value. * * Parameters: * * * axis: integer scalar that specifies the dimension for inserting the one-hot. Assume that the shape - * of indices is [N, C], and the value of depth is D. + * of indices is [N, C], and the value of depth is D. * When axis is 0, the shape of the output is [D, N, C]. * When axis is -1, the shape of the output is [N, C, D]. * When axis is 1, the shape of the output is [N, D, C]. @@ -934,7 +954,7 @@ typedef enum { * Outputs: * * * output: (n+1)-dimensional tensor if indices is an n-dimensional tensor. - * The output shape is determined by indices and axis. + * The output shape is determined by indices and axis. */ OH_NN_OPS_ONE_HOT = 23, @@ -945,30 +965,24 @@ typedef enum { * * * inputX: n-dimensional tensor in [BatchSize, ...] format. * * paddings: 2D tensor that specifies the length to pad in each dimension. The shape is [n, 2]. - * For example, paddings[i][0] indicates the number of paddings to be added preceding - * inputX in the ith dimension. - * paddings[i][1] indicates the number of paddings to be added following inputX - * in the ith dimension. + * For example, paddings[i][0] indicates the number of paddings to be added preceding inputX in the ith dimension. + * paddings[i][1] indicates the number of paddings to be added following inputX in the ith dimension. * * Parameters: * - * * padValues: value to be added to the pad operation. The value is a constant with the same - * data type as inputX. + * * padValues: value to be added to the pad operation. The value is a constant with the same data type as inputX. * * Outputs: * - * * output: n-dimensional tensor after padding, with the same dimensions and data type - * as inputX. - * The shape is determined by inputX and paddings. - * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1] + * * output: n-dimensional tensor after padding, with the same dimensions and data type as inputX. + * The shape is determined by inputX and paddings. + * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1] */ OH_NN_OPS_PAD = 24, /** - * Calculates the y power of each element in input. The inputs must be two tensors or - * one tensor and one scalar. - * When the inputs are two tensors, their data types cannot be both NN_BOOL, and their shapes must be - * the same. + * Calculates the y power of each element in input. The inputs must be two tensors or one tensor and one scalar. + * When the inputs are two tensors, their data types cannot be both NN_BOOL, and their shapes must be the same. * When the inputs are one tensor and one scalar, the scalar must be a constant. * * Inputs: @@ -978,8 +992,7 @@ typedef enum { * * Outputs: * - * * output: tensor, whose shape is determined by the shape of input and y after - * broadcasting. + * * output: tensor, whose shape is determined by the shape of input and y after broadcasting. */ OH_NN_OPS_POW = 25, @@ -996,12 +1009,12 @@ typedef enum { * * * axis: dimensions to be scaled. * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * - * * output: scaled n-dimensional tensor, whose data type is the same as that of input - * and shape is determined by axis. + * * output: scaled n-dimensional tensor, whose data type is the same as that of input and + * shape is determined by axis. */ OH_NN_OPS_SCALE = 26, @@ -1028,7 +1041,7 @@ typedef enum { * Outputs: * * * output: result of the sigmoid operation. It is an n-dimensional tensor - * with the same data type and shape as input. + * with the same data type and shape as input. */ OH_NN_OPS_SIGMOID = 28, @@ -1040,12 +1053,12 @@ typedef enum { * * input: n-dimensional input tensor. * * begin: start of the slice, which is an array of integers greater than or equal to 0. * * size: slice length, which is an array of integers greater than or equal to 0. - * Assume that a dimension is i and 1<=size[i]<=input.shape[i]-begin[i]. + * Assume that a dimension is i and 1<=size[i]<=input.shape[i]-begin[i]. * * Outputs: * * * output: n-dimensional tensor obtained by slicing. - * The TensorType, shape, and size of the output are the same as those of the input. + * The TensorType, shape, and size of the output are the same as those of the input. */ OH_NN_OPS_SLICE = 29, @@ -1059,18 +1072,18 @@ typedef enum { * Parameters: * * * axis: dimension in which the softmax operation is performed. - * The value is of the int64 type. It is an integer in the range [-n, n). + * The value is of the int64 type. It is an integer in the range [-n, n). * * Outputs: * * * output: result of the softmax operation. It is an n-dimensional tensor with - * the same data type and shape as input. + * the same data type and shape as input. */ OH_NN_OPS_SOFTMAX = 30, /** * Divides a 4D tensor into small blocks and combines these blocks in the original batch. - * The number of blocks is blockShape[0] multiplied by blockShape[1]. + * The number of blocks is blockShape[0] multiplied by blockShape[1]. * * Inputs: * @@ -1079,29 +1092,27 @@ typedef enum { * Parameters: * * * blockShape: a pair of integers. Each of them is greater than or equal to 1. - * * paddings: a pair of arrays. Each of them consists of two integers. The four integers that form - * paddings must be greater than or equal to 0. paddings[0][0] and paddings[0][1] - * specify the number of paddings in the third dimension, and paddings[1][0] and paddings[1][1] - * specify the number of paddings in the fourth dimension. - * + * * paddings: a pair of arrays. Each of them consists of two integers. The four integers that form paddings + * must be greater than or equal to 0. paddings[0][0] and paddings[0][1] + * specify the number of paddings in the third dimension, and paddings[1][0] and paddings[1][1] + * specify the number of paddings in the fourth dimension. * * Outputs: * * * output: 4D tensor with the same data type as input. The shape is determined by input, - * blockShape, and paddings. Assume that the input shape is [n,c,h,w], then: - * output.shape[0] = n * blockShape[0] * blockShape[1] - * output.shape[1] = c - * output.shape[2] = (h + paddings[0][0] + paddings[0][1]) / blockShape[0] - * output.shape[3] = (w + paddings[1][0] + paddings[1][1]) / blockShape[1] - * (h + paddings[0][0] + paddings[0][1]) and (w + paddings[1][0] + paddings[1][1]) is exactly divisible by - * (h + paddings[0][0] + paddings[0][1]) and (w + paddings[1][0] + paddings[1][1]). + * blockShape, and paddings. Assume that the input shape is [n,c,h,w], then: + * output.shape[0] = n * blockShape[0] * blockShape[1] + * output.shape[1] = c + * output.shape[2] = (h + paddings[0][0] + paddings[0][1]) / blockShape[0] + * output.shape[3] = (w + paddings[1][0] + paddings[1][1]) / blockShape[1] + * (h + paddings[0][0] + paddings[0][1]) and (w + paddings[1][0] + paddings[1][1]) is exactly divisible by + * (h + paddings[0][0] + paddings[0][1]) and (w + paddings[1][0] + paddings[1][1]). * */ OH_NN_OPS_SPACE_TO_BATCH_ND = 31, /** - * Splits the input into multiple tensors along the axis dimension. The number of tensors is specified by - * outputNum. + * Splits the input into multiple tensors along the axis dimension. The number of tensors is specified by outputNum. * * Inputs: * @@ -1111,15 +1122,15 @@ typedef enum { * * * outputNum: number of output tensors. The data type is long. * * size_splits: size of each tensor split from the input. The value is a 1D tensor of the int type. - * If size_splits is empty, the input will be evenly split into tensors of the same size. - * In this case, input.shape[axis] can be exactly divisible by outputNum. - * If size_splits is not empty, the sum of all its elements must be equal to input.shape[axis]. + * If size_splits is empty, the input will be evenly split into tensors of the same size. In this case, + * input.shape[axis] can be exactly divisible by outputNum. + * If size_splits is not empty, the sum of all its elements must be equal to input.shape[axis]. * * axis: splitting dimension of the int type. * * Outputs: * * * outputs: array of n-dimensional tensors, with the same data type and dimensions. - * The data type of each tensor is the same as that of input. + * The data type of each tensor is the same as that of input. */ OH_NN_OPS_SPLIT = 32, @@ -1132,18 +1143,14 @@ typedef enum { * * Outputs: * - * * output: square root of the input. It is an n-dimensional tensor with the same data type - * and shape as input. + * * output: square root of the input. It is an n-dimensional tensor with the same data type and shape as input. */ OH_NN_OPS_SQRT = 33, /** - * Calculates the square of the difference between two tensors. The SquaredDifference operator supports - * tensor and tensor subtraction. - * If two tensors have different TensorTypes, the Sub operator converts the low-precision tensor to a - * high-precision one. - * If two tensors have different shapes, the two tensors can be extended to tensors with the same shape through - * broadcast. + * Calculates the square of the difference between two tensors. The SquaredDifference operator supports tensor and tensor subtraction. + * If two tensors have different TensorTypes, the Sub operator converts the low-precision tensor to a high-precision one. + * If two tensors have different shapes, the two tensors can be extended to tensors with the same shape through broadcast. * * Inputs: * @@ -1152,19 +1159,17 @@ typedef enum { * * Outputs: * - * * output: square of the difference between two inputs. The output shape is determined by - * input1 and input2. If they have the same shape, the output tensor has the same shape as them. - * If they have different shapes, perform the broadcast operation on input1 and input2 and - * perform subtraction. - * TensorType of the output is the same as that of the input tensor with higher precision. + * * output: square of the difference between two inputs. The output shape is determined + * byinput1 and input2. If they have the same shape, the output tensor has the same shape as them. + * If they have different shapes, perform the broadcast operation on input1 and input2 and perform subtraction. + * TensorType of the output is the same as that of the input tensor with higher precision. */ OH_NN_OPS_SQUARED_DIFFERENCE = 34, /** * Removes the dimension with a length of 1 from the specified axis. The int8 quantization input is supported. - * Assume that the input shape is [2, 1, 1, 2, 2] and axis is [0,1], the output shape is [2, 1, 2, 2], - * which means the dimension whose length is 0 between dimensions 0 and dimension 1 is removed. - * + * Assume that the input shape is [2, 1, 1, 2, 2] and axis is [0,1], the output shape is [2, 1, 2, 2], + * which means the dimension whose length is 0 between dimensions 0 and dimension 1 is removed. * * Inputs: * @@ -1172,8 +1177,7 @@ typedef enum { * * Parameters: * - * * axis: dimension to be removed. The value is of int64_t type and can be an integer in the range [-n, n) - * or an array. + * * axis: dimension to be removed. The value is of int64_t type and can be an integer in the range [-n, n) or an array. * * Outputs: * @@ -1183,22 +1187,22 @@ typedef enum { /** * Stacks multiple tensors along the specified axis. If each tensor has n dimensions before stacking, - * the output tensor will have n+1 dimensions. + * the output tensor will have n+1 dimensions. * * Inputs: * * * input: input for stacking, which can contain multiple n-dimensional tensors. - * Each of them must have the same shape and type. + * Each of them must have the same shape and type. * * Parameters: * * * axis: dimension for tensor stacking, which is an integer. The value range is [-(n+1),(n+1)), - * which means a negative number is allowed. + * which means a negative number is allowed. * * Outputs: * - * * output: stacking result of the input along the axis dimension. The value is an - * n+1-dimensional tensor and has the same TensorType as the input. + * * output: stacking result of the input along the axis dimension. The value is an n+1-dimensional tensor + * and has the same TensorType as the input. */ OH_NN_OPS_STACK = 36, @@ -1209,41 +1213,35 @@ typedef enum { * * * input: n-dimensional input tensor. * * begin: start of slicing, which is a 1D tensor. The length of begin is n. - * begin[i] specifies the start of slicing in the ith dimension. + * begin[i] specifies the start of slicing in the ith dimension. * * end: end of slicing, which is a 1D tensor. The length of end is n. - * end[i] specifies the end of slicing in the ith dimension. + * end[i] specifies the end of slicing in the ith dimension. * * strides: slicing stride, which is a 1D tensor. The length of strides is n. - * strides[i] specifies the stride at which the tensor is sliced in the ith dimension. + * strides[i] specifies the stride at which the tensor is sliced in the ith dimension. * * Parameters: * - * * beginMask: an integer used to mask begin. beginMask is represented in binary code. - * In case of binary(beginMask)[i]==1, for the ith dimension, elements are sliced from the first - * element at strides[i] until the end[i]-1 element. - * - * * endMask: an integer used to mask end. endMask is represented in binary code. - * In case of binary(endMask)[i]==1, elements are sliced from the element at the begin[i] position - * in the ith dimension until the tensor boundary at strides[i]. - * - * * ellipsisMask: integer used to mask begin and end. ellipsisMask is represented - * in binary code. - * In case of binary(ellipsisMask)[i]==1, elements are sliced from the first element at strides[i] - * in the ith dimension until the tensor boundary. Only one bit of binary(ellipsisMask) can be - * a non-zero value. - * - * * newAxisMask: new dimension, which is an integer. newAxisMask is represented in binary code. - * In case of binary(newAxisMask)[i]==1, a new dimension whose length is 1 is inserted into the - * ith dimension. - * * shrinkAxisMask: shrinking dimension, which is an integer. * shrinkAxisMask is represented - * in binary code. - * In the case of binary(shrinkAxisMask)[i]==1, all elements in the ith dimension will be discarded, - * and the length of the ith dimension is shrunk to 1. - * + * * beginMask: an integer used to mask begin. beginMask is represented in binary code. + * In case of binary(beginMask)[i]==1, for the ith dimension, elements are sliced from the first element + * at strides[i] until the end[i]-1 element. + * + * * endMask: an integer used to mask end. endMask is represented in binary code. + * In case of binary(endMask)[i]==1, elements are sliced from the element at the begin[i] position + * in the ith dimension until the tensor boundary at strides[i]. + * + * * ellipsisMask: integer used to mask begin and end. ellipsisMask is represented in binary code. + * In case of binary(ellipsisMask)[i]==1, elements are sliced from the first element at strides[i] in the ith dimension + * until the tensor boundary. Only one bit of binary(ellipsisMask) can be a non-zero value. + * + * * newAxisMask: new dimension, which is an integer. newAxisMask is represented in binary code. + * In case of binary(newAxisMask)[i]==1, a new dimension whose length is 1 is inserted into the ith dimension. + * * shrinkAxisMask: shrinking dimension, which is an integer. * shrinkAxisMask is represented in binary code. + * In the case of binary(shrinkAxisMask)[i]==1, all elements in the ith dimension will be discarded, + * and the length of the ith dimension is shrunk to 1. * * Outputs: * - * * A tensor, with the same data type as input. The number of dimensions of the output tensor is - * rank(input[0])+1. + * * A tensor, with the same data type as input. The number of dimensions of the output tensor is rank(input[0])+1. */ OH_NN_OPS_STRIDED_SLICE = 37, @@ -1258,16 +1256,14 @@ typedef enum { * Parameters: * * * activationType is an integer constant which is contained in FuseType. - * The specified activation function is called before output. + * The specified activation function is called before output. * * Outputs: * - * * output: difference between the two tensors. The output shape is determined byinput1 - * and input2. - * If they have the same shape, the output tensor has the same shape as them. - * If they have different shapes, perform the broadcast operation on input1 and input2 and - * perform subtraction. - * TensorType of the output is the same as that of the input tensor with higher precision. + * * output: difference between the two tensors. The output shape is determined byinput1 and input2. + * If they have the same shape, the output tensor has the same shape as them. + * If they have different shapes, perform the broadcast operation on input1 and input2 and perform subtraction. + * TensorType of the output is the same as that of the input tensor with higher precision. */ OH_NN_OPS_SUB = 38, @@ -1280,8 +1276,7 @@ typedef enum { * * Outputs: * - * * output: hyperbolic tangent of the input. The TensorType and tensor shape are the same as those - * of the input. + * * output: hyperbolic tangent of the input. The TensorType and tensor shape are the same as those of the input. */ OH_NN_OPS_TANH = 39, @@ -1291,15 +1286,13 @@ typedef enum { * Inputs: * * input: n-dimensional tensor. * * multiples: number of times that the input tensor is copied in each dimension. The value is a 1D tensor. - * The length m is not less than the number of dimensions, that is, n. + * The length m is not less than the number of dimensions, that is, n. * * Outputs: * * An m-dimensional tensor whose TensorType is the same as that of the input. If input and - * multiples have the same length, input and output have the same number of dimensions. - * If the length of multiples is greater than n, 1 is used to fill the input dimension, - * and then the input is copied in each dimension the specified times to obtain the m-dimensional tensor. - * - * + * multiples have the same length, input and output have the same number of dimensions. + * If the length of multiples is greater than n, 1 is used to fill the input dimension, + * and then the input is copied in each dimension the specified times to obtain the m-dimensional tensor. */ OH_NN_OPS_TILE = 40, @@ -1309,35 +1302,32 @@ typedef enum { * Inputs: * * * input: n-dimensional tensor to be transposed. - * * permutation: The value is a 1D tensor whose length is the same as the number of dimensions of - * input 0. + * * permutation: The value is a 1D tensor whose length is the same as the number of dimensions of input 0. * * Outputs: * - * * output: n-dimensional tensor. TensorType of output 0 is the same as that of - * input 0, and the output shape is determined by the shape and permutation of input 0. + * * output: n-dimensional tensor. TensorType of output 0 is the same as that of input 0, + * and the output shape is determined by the shape and permutation of input 0. */ OH_NN_OPS_TRANSPOSE = 41, /** - * Calculates the average value in the specified dimension. If keepDims is set to false, the number - * of dimensions is reduced for the input; if keepDims is set to true, the number of dimensions - * is retained. + * Calculates the average value in the specified dimension. If keepDims is set to false, the number of dimensions + * is reduced for the input; if keepDims is set to true, the number of dimensions is retained. * * Inputs: * * * input: n-dimensional input tensor, where n is less than 8. - * * axis: dimension used to calculate the average value. The value is a 1D tensor. The value range of - * each element in axis is [–n, n). + * * axis: dimension used to calculate the average value. The value is a 1D tensor. The value range of each element in axis is [–n, n). * * Parameters: * - * * keepDims: indicates whether to retain the dimension. The value is a Boolean value. + * * keepDims: indicates whether to retain the dimension. The value is a Boolean value. * * Outputs: * - * * output: m-dimensional output tensor whose data type is the same as that of the input. - * If keepDims is false, m==n. If keepDims is true, moutput: m-dimensional output tensor whose data type is the same as that of the input. If keepDims is + * false, m==n. If keepDims is true, minput: 4D input tensor. Each element in the input cannot be less than 0. The input layout must be - * [batchSize, height, width, channels]. + * * input: 4D input tensor. Each element in the input cannot be less than 0. The input layout must be [batchSize, height, width, channels]. * * Parameters: * * * newHeight: resized height of the 4D tensor. * * newWidth: resized width of the 4D tensor. - * * preserveAspectRatio: indicates whether to maintain the height/width ratio of input - * after resizing. - * * coordinateTransformMode: coordinate transformation method used by the resize operation. - * The value is an int32 integer. Currently, the following methods are supported: - * * excludeOutside: an int64 floating point number. When its value is 1, the sampling weight of the - * part that exceeds the boundary of input is set to 0, and other weights are normalized. + * * preserveAspectRatio: indicates whether to maintain the height/width ratio of input after resizing. + * * coordinateTransformMode: coordinate transformation method used by the resize operation. The value is an int32 integer. + * Currently, the following methods are supported: + * * excludeOutside: an int64 floating point number. When its value is 1, the sampling weight of the part that + * exceeds the boundary of input is set to 0, and other weights are normalized. * * Outputs: * @@ -1366,33 +1354,30 @@ typedef enum { */ OH_NN_OPS_RESIZE_BILINEAR = 43, - /** + /** * Calculates the reciprocal of the square root of a tensor. * * Inputs: * - * * input: n-dimensional tensor, where n is less than 8. Each element of the tensor cannot be - * less than 0. + * * input: n-dimensional tensor, where n is less than 8. Each element of the tensor cannot be less than 0. * * Outputs: * - * * output: n-dimensional tensor, with the same shape and data type as input. - + * * output: n-dimensional tensor, with the same shape and data type as input. */ OH_NN_OPS_RSQRT = 44, - /** + /** * Reshapes a tensor. * * Inputs: * - * * input: n-dimensional input tensor. + * * input: n-dimensional input tensor. * * InputShape: shape of the output tensor. The value is a 1D constant tensor. * * Outputs: * - * * output: tensor whose data type is the same as that of input and shape is determined - * by InputShape. + * * output: tensor whose data type is the same as that of input and shape is determined by InputShape. */ OH_NN_OPS_RESHAPE = 45, @@ -1401,17 +1386,16 @@ typedef enum { * * Inputs: * - * * input: n-dimensional tensor. If n is greater than or equal to 2, - * inputX must be [BatchSize, ..., Channels]. - * The second dimension is the number of channels. - * * weight: 1D tensor. The length of weight must be 1 or equal to the number of channels. - * If the length of weight is 1, all channels share the same weight. - * If the length of weight is equal to the number of channels, each channel exclusively has a weight. - * If n is less than 2 for inputX, the weight length must be 1. + * * input: n-dimensional tensor. If n is greater than or equal to 2, inputX must be [BatchSize, ..., Channels]. + * The second dimension is the number of channels. + * * weight: 1D tensor. The length of weight must be 1 or equal to the number of channels. If the length of weight is 1, + * all channels share the same weight. + * If the length of weight is equal to the number of channels, each channel exclusively has a weight. + * If n is less than 2 for inputX, the weight length must be 1. * * Outputs: * - * output: PReLU activation value of x, with the same shape and data type as inputX. + * * output: PReLU activation value of x, with the same shape and data type as inputX. */ OH_NN_OPS_PRELU = 46, @@ -1429,12 +1413,11 @@ typedef enum { OH_NN_OPS_RELU = 47, /** - * Calculates the Relu6 activation value of the input, that is, calculate min(max(x, 0), 6) for - * each element x in the input. + * Calculates the Relu6 activation value of the input, that is, calculate min(max(x, 0), 6) for each element x in the input. * * Inputs: * - * * input: n-dimensional input tensor. + * * input: n-dimensional input tensor. * * Outputs: * @@ -1447,17 +1430,15 @@ typedef enum { * * Inputs: * - * * input: n-dimensional input tensor. + * * input: n-dimensional input tensor. * * gamma: m-dimensional tensor. The dimensions of gamma must be the same as - * the shape of the part of the input tensor to normalize. - * * beta: m-dimensional tensor with the same shape as gamma. + * the shape of the part of the input tensor to normalize. + * * beta: m-dimensional tensor with the same shape as gamma. * * Parameters: * - * * beginAxis is an NN_INT32 scalar that specifies the axis from which normalization starts. - * The value range is [1, rank(input)). - * * epsilon is a scalar of NN_FLOAT32. It is a tiny amount in the normalization formula. - * The common value is 1e-7. + * * beginAxis is an NN_INT32 scalar that specifies the axis from which normalization starts. The value range is [1, rank(input)). + * * epsilon is a scalar of NN_FLOAT32. It is a tiny amount in the normalization formula. The common value is 1e-7. * * Outputs: * @@ -1471,40 +1452,36 @@ typedef enum { * Inputs: * * * input: n-dimensional input tensor, where n is less than 8. - * * axis: dimension used to calculate the product. The value is a 1D tensor. - * The value range of each element in axis is [–n, n). + * * axis: dimension used to calculate the product. The value is a 1D tensor. The value range of each element in axis is [–n, n). * * Parameters: * - * * keepDims: indicates whether to retain the dimension. The value is a Boolean value. + * * keepDims: indicates whether to retain the dimension. The value is a Boolean value. * When its value is true, the number of output dimensions is the same as that of the input. * When its value is false, the number of output dimensions is reduced. - * * * Outputs: * - * * output: m-dimensional output tensor whose data type is the same as that of the input. - * If keepDims is false, m==n. If keepDims is true, moutput: m-dimensional output tensor whose data type is the same as that of the input. + * If keepDims is false, m==n. If keepDims is true, mkeepDims is set to false, - * the number of dimensions is reduced for the input; if keepDims is set to true, - * the number of dimensions is retained. + * Operates the logical OR in the specified dimension. If keepDims is set to false, + * the number of dimensions is reduced for the input; if keepDims is set to true, the number of dimensions is retained. * * Inputs: * * * A n-dimensional input tensor, where n is less than 8. - * * A 1D tensor specifying the dimension used to operate the logical OR. - * The value range of each element in axis is [–n, n). + * * A 1D tensor specifying the dimension used to operate the logical OR. The value range of each element in axis is [–n, n). * * Parameters: * - * * keepDims: indicates whether to retain the dimension. The value is a Boolean value. + * * keepDims: indicates whether to retain the dimension. The value is a Boolean value. * * Outputs: - * * output: m-dimensional output tensor whose data type is the same as that of the input. + * * output: m-dimensional output tensor whose data type is the same as that of the input. * If keepDims is false, m==n. If keepDims is true, minput: n-dimensional tensor. + * * input: n-dimensional tensor. * * Parameters: * - * * src_t: data type of the input. - * * dst_t: data type of the output. + * * src_t: data type of the input. + * * dst_t: data type of the output. * * Outputs: * * * output: n-dimensional tensor. The data type is determined by input2. - * The output shape is the same as the input shape. + * The output shape is the same as the input shape. */ OH_NN_OPS_QUANT_DTYPE_CAST = 52, @@ -1533,13 +1510,12 @@ typedef enum { * * Inputs: * - * * input: n-dimensional tensor. + * * input: n-dimensional tensor. * * input k: first k records of data and their indices. * * Parameters: * - * * sorted: order of sorting. The value true means descending and false means - * ascending. + * * sorted: order of sorting. The value true means descending and false means ascending. * * Outputs: * @@ -1553,15 +1529,15 @@ typedef enum { * * Inputs: * - * * input: n-dimensional tensor (N, ∗), where ∗ means any number of additional dimensions. + * * input: n-dimensional tensor (N, ∗), where ∗ means any number of additional dimensions. * * Parameters: * - * * axis: dimension for calculating the index of the maximum. + * * axis: dimension for calculating the index of the maximum. * * keep_dims: indicates whether to maintain the input tensor dimension. The value is a Boolean value. * * Outputs: - * * output: index of the maximum input tensor on the axis. The value is a tensor. + * * output: index of the maximum input tensor on the axis. The value is a tensor. */ OH_NN_OPS_ARG_MAX = 54, @@ -1574,7 +1550,7 @@ typedef enum { * Parameters: * * * axis: dimension to be added. The value of axis can be an integer or an array of integers. - * The value range of the integer is [-n, n). + * The value range of the integer is [-n, n). * * Outputs: * * output: output tensor. @@ -1582,8 +1558,7 @@ typedef enum { OH_NN_OPS_UNSQUEEZE = 55, /** - * Gaussian error linear unit activation function. The int quantization input is not supported. - * output=0.5∗input∗(1+tanh(input/2)) + * Gaussian error linear unit activation function. The int quantization input is not supported. output=0.5∗input∗(1+tanh(input/2)) * * Inputs: * * An n-dimensional input tensor. @@ -1597,15 +1572,13 @@ typedef enum { /** * @brief Enumerates the tensor data types. * - * Tensors are usually used to set the input, output, and operator parameters of a model. When a tensor is used - * as the input or output of a model (or operator), set the tensor type to {@link OH_NN_TENSOR}. - * When the tensor is used as an operator parameter, select an enumerated value other than {@link OH_NN_TENSOR} - * as the tensor type. - * Assume that the pad parameter of the {@link OH_NN_OPS_CONV2D} operator is being set. + * Tensors are usually used to set the input, output, and operator parameters of a model. When a tensor is used + * as the input or output of a model (or operator), set the tensor type to {@link OH_NN_TENSOR}. + * When the tensor is used as an operator parameter, select an enumerated value other than {@link OH_NN_TENSOR} as the tensor type. + * Assume that the pad parameter of the {@link OH_NN_OPS_CONV2D} operator is being set. * You need to set the type attribute of the {@link OH_NN_Tensor} instance to {@link OH_NN_CONV2D_PAD}. * The settings of other operator parameters are similar. The enumerated values are named * in the format OH_NN_{Operator name}_{Attribute name}. - * * * @since 9 * @version 1.0 @@ -1614,268 +1587,191 @@ typedef enum { /** This enumerated value is used when the tensor is used as the input or output of a model (or operator). */ OH_NN_TENSOR = 0, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - Add operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the Add operator. */ OH_NN_ADD_ACTIVATIONTYPE = 1, - /** This enumerated value is used when the tensor is used as the kernel_size parameter of the - AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the kernel_size parameter of the AvgPool operator. */ OH_NN_AVG_POOL_KERNEL_SIZE = 2, - /** This enumerated value is used when the tensor is used as the stride parameter of the - AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the stride parameter of the AvgPool operator. */ OH_NN_AVG_POOL_STRIDE = 3, - /** This enumerated value is used when the tensor is used as the pad_mode parameter of the - AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the pad_mode parameter of the AvgPool operator. */ OH_NN_AVG_POOL_PAD_MODE = 4, - /** This enumerated value is used when the tensor is used as the pad parameter of the - AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the AvgPool operator. */ OH_NN_AVG_POOL_PAD = 5, - /** This enumerated value is used when the tensor is used as the activation_type parameter of the - AvgPool operator. */ + /** This enumerated value is used when the tensor is used as the activation_type parameter of the AvgPool operator. */ OH_NN_AVG_POOL_ACTIVATION_TYPE = 6, - /** This enumerated value is used when the tensor is used as the eosilon parameter of the - BatchNorm operator. */ + /** This enumerated value is used when the tensor is used as the eosilon parameter of the BatchNorm operator. */ OH_NN_BATCH_NORM_EPSILON = 7, - /** This enumerated value is used when the tensor is used as the blockSize parameter of the - BatchToSpaceND operator. */ + /** This enumerated value is used when the tensor is used as the blockSize parameter of the BatchToSpaceND operator. */ OH_NN_BATCH_TO_SPACE_ND_BLOCKSIZE = 8, - /** This enumerated value is used when the tensor is used as the crops parameter of the - BatchToSpaceND operator. */ + /** This enumerated value is used when the tensor is used as the crops parameter of the BatchToSpaceND operator. */ OH_NN_BATCH_TO_SPACE_ND_CROPS = 9, - /** This enumerated value is used when the tensor is used as the axis parameter of the - Concat operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the Concat operator. */ OH_NN_CONCAT_AXIS = 10, - /** This enumerated value is used when the tensor is used as the strides parameter of the - Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the strides parameter of the Conv2D operator. */ OH_NN_CONV2D_STRIDES = 11, - /** This enumerated value is used when the tensor is used as the pad parameter of the - Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the Conv2D operator. */ OH_NN_CONV2D_PAD = 12, - /** This enumerated value is used when the tensor is used as the dilation parameter of the - Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the dilation parameter of the Conv2D operator. */ OH_NN_CONV2D_DILATION = 13, - /** This enumerated value is used when the tensor is used as the padMode parameter of the - Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the padMode parameter of the Conv2D operator. */ OH_NN_CONV2D_PAD_MODE = 14, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the Conv2D operator. */ OH_NN_CONV2D_ACTIVATION_TYPE = 15, - /** This enumerated value is used when the tensor is used as the group parameter of the - Conv2D operator. */ + /** This enumerated value is used when the tensor is used as the group parameter of the Conv2D operator. */ OH_NN_CONV2D_GROUP = 16, - /** This enumerated value is used when the tensor is used as the strides parameter of the - Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the strides parameter of the Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_STRIDES = 17, - /** This enumerated value is used when the tensor is used as the pad parameter of the - Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_PAD = 18, - /** This enumerated value is used when the tensor is used as the dilation parameter of the - Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the dilation parameter of the Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_DILATION = 19, - /** This enumerated value is used when the tensor is used as the outputPaddings parameter of the - Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the outputPaddings parameter of the Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_OUTPUT_PADDINGS = 20, - /** This enumerated value is used when the tensor is used as the padMode parameter of the - Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the padMode parameter of the Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_PAD_MODE = 21, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_ACTIVATION_TYPE = 22, - /** This enumerated value is used when the tensor is used as the group parameter of the - Conv2DTranspose operator. */ + /** This enumerated value is used when the tensor is used as the group parameter of the Conv2DTranspose operator. */ OH_NN_CONV2D_TRANSPOSE_GROUP = 23, - /** This enumerated value is used when the tensor is used as the strides parameter of the - DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the strides parameter of the DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_STRIDES = 24, - /** This enumerated value is used when the tensor is used as the pad parameter of the - DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_PAD = 25, - /** This enumerated value is used when the tensor is used as the dilation parameter of the - DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the dilation parameter of the DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_DILATION = 26, - /** This enumerated value is used when the tensor is used as the padMode parameter of the - DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the padMode parameter of the DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_PAD_MODE = 27, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - DepthwiseConv2dNative operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the DepthwiseConv2dNative operator. */ OH_NN_DEPTHWISE_CONV2D_NATIVE_ACTIVATION_TYPE = 28, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - Div operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the Div operator. */ OH_NN_DIV_ACTIVATIONTYPE = 29, - /** This enumerated value is used when the tensor is used as the mode parameter of the - Eltwise operator. */ + /** This enumerated value is used when the tensor is used as the mode parameter of the Eltwise operator. */ OH_NN_ELTWISE_MODE = 30, - /** This enumerated value is used when the tensor is used as the axis parameter of the - FullConnection operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the FullConnection operator. */ OH_NN_FULL_CONNECTION_AXIS = 31, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - FullConnection operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the FullConnection operator. */ OH_NN_FULL_CONNECTION_ACTIVATIONTYPE = 32, - /** This enumerated value is used when the tensor is used as the transposeA parameter of the - Matmul operator. */ + /** This enumerated value is used when the tensor is used as the transposeA parameter of the Matmul operator. */ OH_NN_MATMUL_TRANSPOSE_A = 33, - /** This enumerated value is used when the tensor is used as the transposeB parameter of the - Matmul operator. */ + /** This enumerated value is used when the tensor is used as the transposeB parameter of the Matmul operator. */ OH_NN_MATMUL_TRANSPOSE_B = 34, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - Matmul operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the Matmul operator. */ OH_NN_MATMUL_ACTIVATION_TYPE = 35, - /** This enumerated value is used when the tensor is used as the kernel_size parameter of the - MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the kernel_size parameter of the MaxPool operator. */ OH_NN_MAX_POOL_KERNEL_SIZE = 36, - /** This enumerated value is used when the tensor is used as the stride parameter of the - MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the stride parameter of the MaxPool operator. */ OH_NN_MAX_POOL_STRIDE = 37, - /** This enumerated value is used when the tensor is used as the pad_mode parameter of the - MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the pad_mode parameter of the MaxPool operator. */ OH_NN_MAX_POOL_PAD_MODE = 38, - /** This enumerated value is used when the tensor is used as the pad parameter of the - MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the pad parameter of the MaxPool operator. */ OH_NN_MAX_POOL_PAD = 39, - /** This enumerated value is used when the tensor is used as the activation_type parameter of the - MaxPool operator. */ + /** This enumerated value is used when the tensor is used as the activation_type parameter of the MaxPool operator. */ OH_NN_MAX_POOL_ACTIVATION_TYPE = 40, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - Mul operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the Mul operator. */ OH_NN_MUL_ACTIVATION_TYPE = 41, - /** This enumerated value is used when the tensor is used as the axis parameter of the - OneHot operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the OneHot operator. */ OH_NN_ONE_HOT_AXIS = 42, - /** This enumerated value is used when the tensor is used as the constant_value parameter of the - Pad operator. */ + /** This enumerated value is used when the tensor is used as the constant_value parameter of the Pad operator. */ OH_NN_PAD_CONSTANT_VALUE = 43, - /** This enumerated value is used when the tensor is used as the activationType parameter of the - Scale operator. */ + /** This enumerated value is used when the tensor is used as the activationType parameter of the Scale operator. */ OH_NN_SCALE_ACTIVATIONTYPE = 44, - /** This enumerated value is used when the tensor is used as the axis parameter of the - Scale operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the Scale operator. */ OH_NN_SCALE_AXIS = 45, - /** This enumerated value is used when the tensor is used as the axis parameter of the - Softmax operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the Softmax operator. */ OH_NN_SOFTMAX_AXIS = 46, - /** This enumerated value is used when the tensor is used as the BlockShape parameter of the - SpaceToBatchND operator. */ + /** This enumerated value is used when the tensor is used as the BlockShape parameter of the SpaceToBatchND operator. */ OH_NN_SPACE_TO_BATCH_ND_BLOCK_SHAPE = 47, - /** This enumerated value is used when the tensor is used as the Paddings parameter of the - SpaceToBatchND operator. */ + /** This enumerated value is used when the tensor is used as the Paddings parameter of the SpaceToBatchND operator. */ OH_NN_SPACE_TO_BATCH_ND_PADDINGS = 48, - /** This enumerated value is used when the tensor is used as the Axis parameter of the - Split operator. */ + /** This enumerated value is used when the tensor is used as the Axis parameter of the Split operator. */ OH_NN_SPLIT_AXIS = 49, - /** This enumerated value is used when the tensor is used as the OutputNum parameter of the - Split operator. */ + /** This enumerated value is used when the tensor is used as the OutputNum parameter of the Split operator. */ OH_NN_SPLIT_OUTPUT_NUM = 50, - /** This enumerated value is used when the tensor is used as the SizeSplits parameter of the - Split operator. */ + /** This enumerated value is used when the tensor is used as the SizeSplits parameter of the Split operator. */ OH_NN_SPLIT_SIZE_SPLITS = 51, - /** This enumerated value is used when the tensor is used as the Axis parameter of the - Squeeze operator. */ + /** This enumerated value is used when the tensor is used as the Axis parameter of the Squeeze operator. */ OH_NN_SQUEEZE_AXIS = 52, - /** This enumerated value is used when the tensor is used as the Axis parameter of the - Stack operator. */ + /** This enumerated value is used when the tensor is used as the Axis parameter of the Stack operator. */ OH_NN_STACK_AXIS = 53, - /** This enumerated value is used when the tensor is used as the BeginMask parameter of the - StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the BeginMask parameter of the StridedSlice operator. */ OH_NN_STRIDED_SLICE_BEGIN_MASK = 54, - /** This enumerated value is used when the tensor is used as the EndMask parameter of the - StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the EndMask parameter of the StridedSlice operator. */ OH_NN_STRIDED_SLICE_END_MASK = 55, - /** This enumerated value is used when the tensor is used as the EllipsisMask parameter of the - StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the EllipsisMask parameter of the StridedSlice operator. */ OH_NN_STRIDED_SLICE_ELLIPSIS_MASK = 56, - /** This enumerated value is used when the tensor is used as the NewAxisMask parameter of the - StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the NewAxisMask parameter of the StridedSlice operator. */ OH_NN_STRIDED_SLICE_NEW_AXIS_MASK = 57, - /** This enumerated value is used when the tensor is used as the ShrinkAxisMask parameter of the - StridedSlice operator. */ + /** This enumerated value is used when the tensor is used as the ShrinkAxisMask parameter of the StridedSlice operator. */ OH_NN_STRIDED_SLICE_SHRINK_AXIS_MASK = 58, - /** This enumerated value is used when the tensor is used as the ActivationType parameter of the - Sub operator. */ + /** This enumerated value is used when the tensor is used as the ActivationType parameter of the Sub operator. */ OH_NN_SUB_ACTIVATIONTYPE = 59, - /** This enumerated value is used when the tensor is used as the keep_dims parameter of the - ReduceMean operator. */ + /** This enumerated value is used when the tensor is used as the keep_dims parameter of the ReduceMean operator. */ OH_NN_REDUCE_MEAN_KEEP_DIMS = 60, - /** This enumerated value is used when the tensor is used as the new_height parameter of the - ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the new_height parameter of the ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_NEW_HEIGHT = 61, - /** This enumerated value is used when the tensor is used as the new_width parameter of the - ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the new_width parameter of the ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_NEW_WIDTH = 62, - /** This enumerated value is used when the tensor is used as the preserve_aspect_ratio parameter of the - ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the preserve_aspect_ratio parameter of the ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_PRESERVE_ASPECT_RATIO = 63, - /** This enumerated value is used when the tensor is used as the coordinate_transform_mode parameter of the - ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the coordinate_transform_mode parameter of the ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_COORDINATE_TRANSFORM_MODE = 64, - /** This enumerated value is used when the tensor is used as the exclude_outside parameter of the - ResizeBilinear operator. */ + /** This enumerated value is used when the tensor is used as the exclude_outside parameter of the ResizeBilinear operator. */ OH_NN_RESIZE_BILINEAR_EXCLUDE_OUTSIDE = 65, - /** This enumerated value is used when the tensor is used as the beginNormAxis parameter of the - LayerNorm operator. */ + /** This enumerated value is used when the tensor is used as the beginNormAxis parameter of the LayerNorm operator. */ OH_NN_LAYER_NORM_BEGIN_NORM_AXIS = 66, - /** This enumerated value is used when the tensor is used as the epsilon parameter of the - LayerNorm operator. */ + /** This enumerated value is used when the tensor is used as the epsilon parameter of the LayerNorm operator. */ OH_NN_LAYER_NORM_EPSILON = 67, - /** This enumerated value is used when the tensor is used as the beginParamsAxis parameter of the - LayerNorm operator. */ + /** This enumerated value is used when the tensor is used as the beginParamsAxis parameter of the LayerNorm operator. */ OH_NN_LAYER_NORM_BEGIN_PARAM_AXIS = 68, - /** This enumerated value is used when the tensor is used as the elementwiseAffine parameter of the - LayerNorm operator. */ + /** This enumerated value is used when the tensor is used as the elementwiseAffine parameter of the LayerNorm operator. */ OH_NN_LAYER_NORM_ELEMENTWISE_AFFINE = 69, - /** This enumerated value is used when the tensor is used as the keep_dims parameter of the - ReduceProd operator. */ + /** This enumerated value is used when the tensor is used as the keep_dims parameter of the ReduceProd operator. */ OH_NN_REDUCE_PROD_KEEP_DIMS = 70, - /** This enumerated value is used when the tensor is used as the keep_dims parameter of the - ReduceAll operator. */ + /** This enumerated value is used when the tensor is used as the keep_dims parameter of the ReduceAll operator. */ OH_NN_REDUCE_ALL_KEEP_DIMS = 71, - /** This enumerated value is used when the tensor is used as the src_t parameter of the - QuantDTypeCast operator. */ + /** This enumerated value is used when the tensor is used as the src_t parameter of the QuantDTypeCast operator. */ OH_NN_QUANT_DTYPE_CAST_SRC_T = 72, - /** This enumerated value is used when the tensor is used as the dst_t parameter of the - QuantDTypeCast operator. */ + /** This enumerated value is used when the tensor is used as the dst_t parameter of the QuantDTypeCast operator. */ OH_NN_QUANT_DTYPE_CAST_DST_T = 73, - /** This enumerated value is used when the tensor is used as the Sorted parameter of the - Topk operator. */ + /** This enumerated value is used when the tensor is used as the Sorted parameter of the Topk operator. */ OH_NN_TOP_K_SORTED = 74, - /** This enumerated value is used when the tensor is used as the axis parameter of the - ArgMax operator. */ + /** This enumerated value is used when the tensor is used as the axis parameter of the ArgMax operator. */ OH_NN_ARG_MAX_AXIS = 75, - /** This enumerated value is used when the tensor is used as the keepDims parameter of the - ArgMax operator. */ + /** This enumerated value is used when the tensor is used as the keepDims parameter of the ArgMax operator. */ OH_NN_ARG_MAX_KEEPDIMS = 76, - /** This enumerated value is used when the tensor is used as the Axis parameter of the - Unsqueeze operator. */ + /** This enumerated value is used when the tensor is used as the Axis parameter of the Unsqueeze operator. */ OH_NN_UNSQUEEZE_AXIS = 77, } OH_NN_TensorType; @@ -1895,15 +1791,13 @@ typedef struct OH_NN_UInt32Array { /** * @brief Quantization information. * - * In quantization scenarios, the 32-bit floating-point data type is quantized into the fixed-point data type - * according to the following formula: + * In quantization scenarios, the 32-bit floating-point data type is quantized into the fixed-point data type according to the following formula: \f[ q = clamp(round(\frac{r}{s}+z), q_{min}, q_{max}) \f] - * s and z are quantization parameters, which are stored by scale and zeroPoint in - * {@link OH_NN_QuantParam}. - * r is a floating point number, q is the quantization result, q_min is the lower bound of the quantization result, - * and q_max is an upper bound of a quantization result. The calculation method is as follows: + * s and z are quantization parameters, which are stored by scale and zeroPoint in {@link OH_NN_QuantParam}. + * r is a floating point number, q is the quantization result, q_min is the lower bound of the quantization result, and + * q_max is an upper bound of a quantization result. The calculation method is as follows: * \f[ \text{clamp}(x,min,max) = @@ -1922,13 +1816,14 @@ typedef struct OH_NN_UInt32Array { \end{cases} \f] * + * @deprecated since 11 + * @useinstead {@link NN_QuantParam} * @since 9 * @version 1.0 */ typedef struct OH_NN_QuantParam { /** Specifies the length of the numBits, scale, and zeroPoint arrays. In the per-layer quantization scenario, - * quantCount is usually set to 1. That is, all channels of a tensor share a set of quantization - * parameters. + * quantCount is usually set to 1. That is, all channels of a tensor share a set of quantization parameters. * In the per-channel quantization scenario, quantCount is usually the same as the number of tensor channels, * and each channel uses its own quantization parameters. */ @@ -1947,6 +1842,8 @@ typedef struct OH_NN_QuantParam { * It is usually used to construct data nodes and operator parameters in a model graph. When constructing a tensor, * you need to specify the data type, number of dimensions, dimension information, and quantization information. * + * @deprecated since 11 + * @useinstead {@link NN_TensorDesc} * @since 9 * @version 1.0 */ @@ -1961,8 +1858,7 @@ typedef struct OH_NN_Tensor { const OH_NN_QuantParam *quantParam; /** Specifies the tensor type. The value of type is related to the tensor usage. * When the tensor is used as the input or output of the model, set type to {@link OH_NN_TENSOR}. - * When a tensor is used as an operator parameter, select any enumerated value except {@link OH_NN_TENSOR} - * from {@link OH_NN_TensorType}. + * When a tensor is used as an operator parameter, select any enumerated value except {@link OH_NN_TENSOR} from {@link OH_NN_TensorType}. */ OH_NN_TensorType type; } OH_NN_Tensor; @@ -1970,6 +1866,8 @@ typedef struct OH_NN_Tensor { /** * @brief Defines the memory structure. * + * @deprecated since 11 + * @useinstead {@link NN_Tensor} * @since 9 * @version 1.0 */ diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_core.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_core.h index 1724d9ba..a857a0bf 100644 --- a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_core.h +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_core.h @@ -29,7 +29,8 @@ * @brief Neural Network Core模块接口定义,AI推理框架使用Neural Network Core提供的Native接口,完成模型编译,并在加速硬件上执行推理和计算。 * * 注意:Neural Network Core的接口目前均不支持多线程并发调用.\n - * + * + * 引用文件"neural_network_runtime/neural_network_core.h" * @library libneural_network_core.so * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 11 @@ -46,23 +47,22 @@ extern "C" { #endif /** -* @brief @brief 创建{@link OH_NNCompilation}类型的编译实例 +* @brief @brief 创建{@link OH_NNCompilation}类型的编译实例。 * - * 使用OH_NNModel模块完成模型的构造后,借助OH_NNCompilation模块提供的接口,将模型传递到底层硬件完成编译。本方法接受一个 - * {@link OH_NNModel}实例,创建出{@link OH_NNCompilation}实例;通过 - * {@link OH_NNCompilation_SetDevice}方法,设置编译的设备,最后调用 - * {@link OH_NNCompilation_Build}完成编译。\n + * 使用OH_NNModel模块完成模型的构造后,借助OH_NNCompilation模块提供的接口,将模型传递到底层硬件完成编译。该接口接受一个 + * {@link OH_NNModel}实例,创建出{@link OH_NNCompilation}实例;通过{@link OH_NNCompilation_SetDevice}接口,设置编译的设备, + * 最后调用{@link OH_NNCompilation_Build}完成编译。\n * - * 除了计算硬件的选择,OH_NNCompilation模块支持模型缓存、性能偏好、优先级设置、float16计算等特性,参考以下方法: - * - {@link OH_NNCompilation_SetCache} - * - {@link OH_NNCompilation_SetPerformanceMode} - * - {@link OH_NNCompilation_SetPriority} - * - {@link OH_NNCompilation_EnableFloat16}\n + * 除了计算硬件的选择,OH_NNCompilation模块支持模型缓存、性能偏好、优先级设置、float16计算等特性,参考以下接口:\n + * {@link OH_NNCompilation_SetCache} \n + * {@link OH_NNCompilation_SetPerformanceMode} \n + * {@link OH_NNCompilation_SetPriority} \n + * {@link OH_NNCompilation_EnableFloat16} \n * - * 调用本方法创建{@link OH_NNCompilation}后,{@link OH_NNModel}实例可以释放。\n + * 调用该接口创建{@link OH_NNCompilation}后,{@link OH_NNModel}实例就可以释放了。\n * * @param model 指向{@link OH_NNModel}实例的指针。 - * @return 返回一个指向{@link OH_NNCompilation}实例的指针。 + * @return 指向{@link OH_NNCompilation}实例的指针,如果创建失败就返回NULL。 * @since 9 * @version 1.0 */ @@ -71,59 +71,64 @@ OH_NNCompilation *OH_NNCompilation_Construct(const OH_NNModel *model); /** * @brief 基于离线模型文件创建编译实例。 * - * 此方法与传递在线构建模型或离线模型文件缓存的方式冲突,并且您只需要选择三种构建方法中的一种。\n + * 该接口与传递在线构建模型或离线模型文件内存的方式冲突,您只能选择三种构建接口中的一种。\n * - * 离线模型是由硬件供应商提供的模型转换器离线编译的模型类型。所以离线模型只能在指定的设备上使用,但离线模型的编译时间通常 - * 远少于{@link OH_NNModel}。\n + * 离线模型是由硬件供应商提供的模型转换器离线编译的模型类型,所以离线模型只能在指定的设备上使用,但离线模型的编译时间通常 + * 远小于构图实例{@link OH_NNModel}的编译时间。\n * * 在开发过程中需要离线执行编译,并在应用包中部署离线模型。\n * * @param modelPath 离线模型文件路径。 - * @return 指向{@link OH_NNCompilation}实例的指针。 + * @return 指向{@link OH_NNCompilation}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ OH_NNCompilation *OH_NNCompilation_ConstructWithOfflineModelFile(const char *modelPath); /** - * @brief 基于离线模型文件缓存创建编译实例。 + * @brief 基于离线模型文件内存创建编译实例。 * - * 此方法与传递在线构建模型或离线模型文件路径的方式冲突,并且您只需要选择三种构建方法中的一种。\n + * 该接口与传递在线构建模型或离线模型文件路径的方式冲突,您只能选择三种构建接口中的一种。\n * - * 请注意,返回的{@link OH_NNCompilation}实例只将modelBuffer指针保存在里面,而不是复制其数据。 + * 注意:返回的{@link OH_NNCompilation}实例只将modelBuffer指针保存在里面,而不是复制其数据。 * 在销毁{@link OH_NNCompilation}实例之前,不应释放modelBuffer。\n * - * @param modelBuffer 离线模型文件缓存。 - * @param modelSize 离线模型缓存大小。 - * @return 指向{@link OH_NNCompilation}实例的指针。 + * @param modelBuffer 离线模型文件内存。 + * @param modelSize 离线模型内存大小。 + * @return 指向{@link OH_NNCompilation}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ OH_NNCompilation *OH_NNCompilation_ConstructWithOfflineModelBuffer(const void *modelBuffer, size_t modelSize); /** -* @brief 创建一个空的编译实例,以便稍后从缓存中恢复。 +* @brief 创建一个空的编译实例,以便稍后从模型缓存中恢复。 * - * 从缓存恢复的时间少于使用{@link OH_NNModel}进行编译的时间。\n + * 模型缓存的相关描述参考{@link OH_NNCompilation_SetCache}。\n + * + * 从模型缓存恢复的时间少于使用{@link OH_NNModel}进行编译的时间。\n * * 应该先调用{@link OH_NNCompilation_SetCache}或{@link OH_NNCompilation_ImportCacheFromBuffer}, * 然后调用{@link OH_NNCompilation_Build}完成恢复。\n * + * @return 指向{@link OH_NNCompilation}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ OH_NNCompilation *OH_NNCompilation_ConstructForCache(); /** - * @brief 将缓存导出到给定的缓冲区。 + * @brief 将模型缓存写入到指定内存区域。 + * + * 模型缓存的相关描述参考{@link OH_NNCompilation_SetCache}。\n * - * 缓存是编译构建的结果{@link OH_NNCompilation_Build},因此必须在{@link OH_NNCompilation_Build}之后调用此方法。\n + * 注意:模型缓存是编译构建的结果{@link OH_NNCompilation_Build},因此必须在{@link OH_NNCompilation_Build}之后调用该接口。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @param buffer 指向给定缓冲区的指针。 - * @param length 缓冲区长度。 + * @param buffer 指向给定内存的指针。 + * @param length 内存长度。 * @param modelSize 模型缓存的字节大小。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -133,16 +138,19 @@ OH_NN_ReturnCode OH_NNCompilation_ExportCacheToBuffer(OH_NNCompilation *compilat size_t *modelSize); /** - * @brief 从给定模型缓存导入。 + * @brief 从指定内存区域读取模型缓存。 + * + * 模型缓存的相关描述参考{@link OH_NNCompilation_SetCache}。\n * * 调用{@link OH_NNCompilation_ImportCacheFromBuffer}后,应调用{@link OH_NNCompilation_Build}完成恢复。\n * - * 请注意,compilation只将buffer指针保存在里面,而不是复制其数据。您不能在compilation被销毁之前释放缓存buffer。\n + * 注意:compilation只将buffer指针保存在里面,而不是复制其数据。 + * 您不能在compilation被销毁之前释放内存buffer。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @param buffer 指向给定缓存的指针。 + * @param buffer 指向给定内存的指针。 * @param modelSize 模型缓存的字节大小。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -153,17 +161,17 @@ OH_NN_ReturnCode OH_NNCompilation_ImportCacheFromBuffer(OH_NNCompilation *compil /** * @brief 为自定义硬件属性添加扩展配置。 * - * 某些设备有自己的特定属性,这些属性尚未在NNRt中打开。此方法为您提供了另一种方式设置设备的这些自定义硬件属性。 + * 某些设备有自己的特定属性,这些属性尚未在NNRt中打开。该接口为您提供了另一种方式设置设备的这些自定义硬件属性。 * 您应该从设备供应商的文档查询它们的名称和值,并将它们逐一添加到编译实例中。这些属性将直接传递给设备驱动程序, - * 如果驱动程序无法解析它们,此方法将返回错误码。\n + * 如果驱动程序无法解析它们,该接口将返回错误码。\n * - * 调用{@link OH_NNCompilation_Build}后,configNameconfigValue可以释放。\n + * 调用{@link OH_NNCompilation_Build}后,configNameconfigValue就可以释放了。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 * @param configName 配置名称。 * @param configValue 保存配置值的地址。 * @param configValueSize 配置值的字节大小。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -177,7 +185,7 @@ OH_NN_ReturnCode OH_NNCompilation_AddExtensionConfig(OH_NNCompilation *compilati * * 编译阶段,需要指定模型编译和执行计算的硬件设备。先调用{@link OH_NNDevice_GetAllDevicesID}获取可用的设备ID, * 通过{@link OH_NNDevice_GetType}和{@link OH_NNDevice_GetType}获取设备信息后,将期望编译执行的 - * 设备ID传入本方法进行设置。\n + * 设备ID传入该接口进行设置。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 * @param deviceID 指定的硬件ID。如果为0,则默认使用当前设备列表中的第1台设备。 @@ -190,30 +198,30 @@ OH_NN_ReturnCode OH_NNCompilation_SetDevice(OH_NNCompilation *compilation, size_ /** * @brief 设置编译模型的缓存目录和版本。 * - * 在支持缓存的硬件上,模型在硬件驱动层编译后可以保存为缓存文件,下次编译时直接从缓存文件读取模型,减少重新编译的耗时。本方法接受缓存路径和版本,根据缓存 - * 路径中和版本的不同情况,本方法采取不同的行为:\n + * 在支持模型缓存的硬件上,模型在硬件驱动层编译后可以保存为模型缓存文件,下次编译时直接从模型缓存文件读取模型,减少重新编译的耗时。 + * 该接口接受模型缓存路径和版本,根据缓存路径中和版本的不同情况,该接口采取不同的行为:\n * - * - 缓存路径指定的目录下没有文件: + * - 模型缓存路径指定的目录下没有文件: * 将编译后的模型缓存到目录下,设置缓存版本等于version。\n * - * - 缓存路径指定的目录下存在完整的缓存文件,且版本号 == version: + * - 模型缓存路径指定的目录下存在完整的缓存文件,且版本号 == version: * 读取路径下的缓存文件,传递到底层硬件中转换为可以执行的模型实例。\n * - * - 缓存路径指定的目录下存在完整的缓存文件,但版本号 < version: + * - 模型缓存路径指定的目录下存在完整的缓存文件,但版本号 < version: * 路径下的缓存文件需要更新,模型在底层硬件完成编译后,覆写路径下的缓存文件,将版本号更新为version。\n * - * - 缓存路径指定的目录下存在完整的缓存文件,但版本号 > version: + * - 模型缓存路径指定的目录下存在完整的缓存文件,但版本号 > version: * 路径下的缓存文件版本高于version,不读取缓存文件,同时返回{@link OH_NN_INVALID_PARAMETER}错误码。\n * - * - 缓存路径指定的目录下的缓存文件不完整或没有缓存文件的访问权限: + * - 模型缓存路径指定的目录下的缓存文件不完整或没有缓存文件的访问权限: * 返回{@link OH_NN_INVALID_FILE}错误码。\n * - * - 缓存目录不存在,或者没有访问权限: + * - 模型缓存目录不存在,或者没有访问权限: * 返回{@link OH_NN_INVALID_PATH}错误码。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @param cachePath 模型缓存文件目录,本方法在cachePath目录下为不同的硬件创建缓存目录。建议每个模型使用单独的缓存目录。 - * @param version 缓存版本。 + * @param cachePath 模型缓存文件目录,该接口在cachePath目录下为不同的硬件创建模型缓存目录。建议每个模型使用单独的模型缓存目录。 + * @param version 模型缓存版本。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 9 * @version 1.0 @@ -223,11 +231,11 @@ OH_NN_ReturnCode OH_NNCompilation_SetCache(OH_NNCompilation *compilation, const /** * @brief 设置模型计算的性能模式。 * - * Neural Network Runtime 支持为模型计算设置性能模式,满足低功耗到极致性能的需求。如果编译阶段没有调用本方法设置性能模式, + * Neural Network Runtime 支持为模型计算设置性能模式,满足低功耗到极致性能的需求。如果编译阶段没有调用该接口设置性能模式, * 编译实例为模型默认分配{@link OH_NN_PERFORMANCE_NONE}模式。在{@link OH_NN_PERFORMANCE_NONE} * 模式下,硬件按默认的性能模式执行计算。\n * - * 在不支持性能模式设置的硬件上调用本方法,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n + * 在不支持性能模式设置的硬件上调用该接口,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 * @param performanceMode 指定性能模式,可选的性能模式参考{@link OH_NN_PerformanceMode}。 @@ -244,7 +252,7 @@ OH_NN_ReturnCode OH_NNCompilation_SetPerformanceMode(OH_NNCompilation *compilati * Neural Network Runtime 支持为模型设置计算优先级,优先级仅作用于相同uid进程创建的模型,不同uid进程、不同设备的优先级不会 * 相互影响。\n * - * 在不支持优先级设置的硬件上调用本方法,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n + * 在不支持优先级设置的硬件上调用该接口,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 * @param priority 指定优先级,可选的优先级参考{@link OH_NN_Priority}。 @@ -257,9 +265,12 @@ OH_NN_ReturnCode OH_NNCompilation_SetPriority(OH_NNCompilation *compilation, OH_ /** * @brief 是否以float16的浮点数精度计算。 * - * 默认使用float32或int8,在支持float16精度的硬件上调用本方法,float32浮点数精度的模型将以float16的精度执行计算,以减少内存占用和执行时间。\n + * 浮点模型默认使用float32精度计算。如果在支持float16精度的硬件上调用该接口,float32浮点数精度的模型将以float16的精度执行计算, + * 可减少内存占用和执行时间。\n + * + * 该选项对于定点模型是无效的,例如int8类型的定点模型。\n * - * 在不支持float16精度计算的硬件上调用本方法,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n + * 在不支持float16精度计算的硬件上调用该接口,将返回{@link OH_NN_UNAVAILABLE_DEVICE}错误码。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 * @param enableFloat16 Float16低精度计算标志位。设置为true时,执行Float16推理;设置为false时,执行float32推理。 @@ -270,13 +281,14 @@ OH_NN_ReturnCode OH_NNCompilation_SetPriority(OH_NNCompilation *compilation, OH_ OH_NN_ReturnCode OH_NNCompilation_EnableFloat16(OH_NNCompilation *compilation, bool enableFloat16); /** - * @brief 进行模型编译 + * @brief 执行模型编译。 * - * 完成编译配置后,调用本方法指示模型编译已完成。编译实例将模型和编译选项推送至硬件设备进行编译。在调用本方法后,无法进行额外的编译操作,调用 + * 完成编译配置后,调用该接口执行模型编译。编译实例将模型和编译选项推送至硬件设备进行编译。 + * 在调用该接口后,无法进行额外的编译操作,调用 * {@link OH_NNCompilation_SetDevice}、{@link OH_NNCompilation_SetCache}、 * {@link OH_NNCompilation_SetPerformanceMode}、 * {@link OH_NNCompilation_SetPriority}和{@link OH_NNCompilation_EnableFloat16} - * 方法将返回{@link OH_NN_OPERATION_FORBIDDEN}。\n + * 接口将返回{@link OH_NN_OPERATION_FORBIDDEN}。\n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 @@ -286,14 +298,15 @@ OH_NN_ReturnCode OH_NNCompilation_EnableFloat16(OH_NNCompilation *compilation, b OH_NN_ReturnCode OH_NNCompilation_Build(OH_NNCompilation *compilation); /** - * @brief 释放Compilation对象。 + * @brief 销毁Compilation实例。 * * 调用{@link OH_NNCompilation_Construct}、{@link OH_NNCompilation_ConstructWithOfflineModelFile}、 - * {@link OH_NNCompilation_ConstructWithOfflineModelBuffer}、{@link OH_NNCompilation_ConstructForCache}创建的编译实例需要调用本方法主动释放。\n + * {@link OH_NNCompilation_ConstructWithOfflineModelBuffer}、{@link OH_NNCompilation_ConstructForCache} + * 创建的编译实例需要调用该接口主动销毁。\n * - * 如果compilation为空指针或者*compilation为空指针,本方法只打印warning日志,不执行释放逻辑。\n + * 如果compilation为空指针或者*compilation为空指针,该接口仅打印警告日志,不执行销毁操作。\n * - * @param compilation 指向{@link OH_NNCompilation}实例的二级指针。编译实例销毁后,本方法将*compilation主动设置为空指针。 + * @param compilation 指向{@link OH_NNCompilation}实例的二级指针。编译实例销毁后,该接口将*compilation主动设置为空指针。 * @since 9 * @version 1.0 */ @@ -303,16 +316,18 @@ void OH_NNCompilation_Destroy(OH_NNCompilation **compilation); /** * @brief 创建一个{@link NN_TensorDesc}实例。 * - * {@link NN_TensorDesc}描述了各种张量属性,如名称/数据类型/形状/格式等。 + * {@link NN_TensorDesc}描述了各种张量属性,如名称/数据类型/形状/格式等。 \n * - * 可以调用以下方法,基于传入的{@link NN_TensorDesc}实例创建{@link NN_Tensor}实例: - * - {@link OH_NNTensor_Create} - * - {@link OH_NNTensor_CreateWithSize} - * - {@link OH_NNTensor_CreateWithFd}\n - * 请注意,此方法会将{@link NN_TensorDesc}实例复制到{@link NN_Tensor}中,因此,您可以创建多个{@link NN_Tensor}个实例, - * 并持有相同的{@link NN_TensorDesc}实例。当{@link NN_TensorDesc}实例不再使用时,您应该调用{@link OH_NNTensorDesc_Destroy}方法销毁它。\n + * 可以调用以下接口,基于传入的{@link NN_TensorDesc}实例创建{@link NN_Tensor}实例:\n + * {@link OH_NNTensor_Create} \n + * {@link OH_NNTensor_CreateWithSize} \n + * {@link OH_NNTensor_CreateWithFd} \n + * + * 注意:该接口会将{@link NN_TensorDesc}实例复制到{@link NN_Tensor}中,因此您可以创建多个{@link NN_Tensor}个实例, + * 并持有相同的{@link NN_TensorDesc}实例。当{@link NN_TensorDesc}实例不再使用时, + * 您应该调用{@link OH_NNTensorDesc_Destroy}接口销毁它。\n * - * @return 指向{@link NN_TensorDesc}实例的指针 + * @return 指向{@link NN_TensorDesc}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ @@ -321,12 +336,12 @@ NN_TensorDesc *OH_NNTensorDesc_Create(); /** * @brief 释放一个{@link NN_TensorDesc}实例。 * - * 当{@link NN_TensorDesc}实例不再使用时,需要调用该方法释放。否则将发生内存泄漏。\n + * 当{@link NN_TensorDesc}实例不再使用时,需要调用该接口销毁,否则将发生内存泄漏。\n * - * 如果tensorDesc*tensorDesc为空指针,则此方法将返回错误码,并且不会执行释放。\n + * 如果tensorDesc*tensorDesc为空指针,则该接口将返回错误码,并且不会执行销毁操作。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的二级指针。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -335,13 +350,13 @@ OH_NN_ReturnCode OH_NNTensorDesc_Destroy(NN_TensorDesc **tensorDesc); /** * @brief 设置{@link NN_TensorDesc}的名称。 * - * {@link NN_TensorDesc}实例创建完成后,调用该方法设置张量的名称,(*name)的值是以'\0'结尾的C样式字符串。\n + * {@link NN_TensorDesc}实例创建完成后,调用该接口设置张量的名称,*name的值是以'\0'结尾的C风格字符串。\n * - * 如果tensorDescname为空指针,则此方法将返回错误码。\n + * 如果tensorDescname为空指针,则该接口将返回错误码。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 * @param name 需要设置的张量名称。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -350,17 +365,17 @@ OH_NN_ReturnCode OH_NNTensorDesc_SetName(NN_TensorDesc *tensorDesc, const char * /** * @brief 获取{@link NN_TensorDesc}的名称。 * - * 调用该方法获取指定{@link NN_TensorDesc}实例的名称,(*name)的值是以'\0'结尾的C样式字符串。\n + * 调用该接口获取指定{@link NN_TensorDesc}实例的名称,*name的值是以'\0'结尾的C风格字符串。\n * - * 如果tensorDescname为空指针,则此方法将返回错误码。 - * 作为输出参数,*name必须为空指针,否则该方法将返回错误码。 - * 例如,您应该定义char* tensorName = NULL,并传递&tensorName作为name的参数。\n + * 如果tensorDescname为空指针,则该接口将返回错误码。 + * 作为输出参数,*name必须为空指针,否则该接口将返回错误码。 + * 例如您应该定义char* tensorName = NULL,并传递&tensorName作为name的参数。\n * - * 您不需要释放name的内存。当tensorDesc被销毁时,它会自动释放。\n + * 您不需要释放name的内存,当tensorDesc被销毁时,它会被自动释放。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 * @param name 返回的张量名称。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -369,13 +384,13 @@ OH_NN_ReturnCode OH_NNTensorDesc_GetName(const NN_TensorDesc *tensorDesc, const /** * @brief 设置{@link NN_TensorDesc}的数据类型。 * - * {@link NN_TensorDesc}实例创建完成后,调用该方法设置张量数据类型。\n + * {@link NN_TensorDesc}实例创建完成后,调用该接口设置张量数据类型。\n * - * 如果tensorDesc为空指针,则此方法将返回错误码。\n + * 如果tensorDesc为空指针,则该接口将返回错误码。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 * @param dataType 需要设置的张量数据类型。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -384,13 +399,13 @@ OH_NN_ReturnCode OH_NNTensorDesc_SetDataType(NN_TensorDesc *tensorDesc, OH_NN_Da /** * @brief 获取{@link NN_TensorDesc}的数据类型。 * - * 调用此方法获取指定{@link NN_TensorDesc}实例的数据类型。\n + * 调用该接口获取指定{@link NN_TensorDesc}实例的数据类型。\n * - * 如果tensorDescdataType为空指针,则此方法将返回错误码。\n + * 如果tensorDescdataType为空指针,则该接口将返回错误码。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 - * @param dataType 张量返回的数据类型。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS,失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @param dataType 返回的张量数据类型。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -399,14 +414,14 @@ OH_NN_ReturnCode OH_NNTensorDesc_GetDataType(const NN_TensorDesc *tensorDesc, OH /** * @brief 设置{@link NN_TensorDesc}的数据形状。 * - * {@link NN_TensorDesc}实例创建完成后,调用该方法设置张量形状。\n + * {@link NN_TensorDesc}实例创建完成后,调用该接口设置张量形状。\n * - * 如果tensorDescshape为空指针,或shapeLength为0,则此方法将返回错误码。\n + * 如果tensorDescshape为空指针,或shapeLength为0,则该接口将返回错误码。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 - * @param shape 需要设置的张量的形状列表。 - * @param shapeLength 需要设置的形状列表的长度。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @param shape 需要设置的张量形状列表。 + * @param shapeLength 需要设置的张量形状列表长度。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -415,48 +430,48 @@ OH_NN_ReturnCode OH_NNTensorDesc_SetShape(NN_TensorDesc *tensorDesc, const int32 /** * @brief 获取{@link NN_TensorDesc}的形状。 * - * 调用此方法获取指定{@link NN_TensorDesc}实例的形状。\n + * 调用该接口获取指定{@link NN_TensorDesc}实例的形状。\n * - * 如果tensorDescshapeshapeLength为空指针,则该方法将返回错误码。 - * 作为输出参数,*shape必须为空指针,否则该方法将返回错误码。 - * 例如,您应该定义 int32_t* tensorShape = NULL,并传递&tensorShape作为shape的参数。 + * 如果tensorDescshapeshapeLength为空指针,则该接口将返回错误码。 + * 作为输出参数,*shape必须为空指针,否则该接口将返回错误码。 + * 例如您应该定义 int32_t* tensorShape = NULL,并传递&tensorShape作为shape的参数。 * * 您不需要释放shape的内存。当tensorDesc被销毁时,它会自动释放。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 * @param shape 返回的张量形状列表。 * @param shapeLength 返回的形状列表长度。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ OH_NN_ReturnCode OH_NNTensorDesc_GetShape(const NN_TensorDesc *tensorDesc, int32_t **shape, size_t *shapeLength); /** - * @brief 设置{@link NN_TensorDesc}的格式。 + * @brief 设置{@link NN_TensorDesc}的数据布局。 * - * {@link NN_TensorDesc}实例创建完成后,调用该方法设置张量的格式。\n + * {@link NN_TensorDesc}实例创建完成后,调用该接口设置张量的数据布局{@link OH_NN_Format}。\n * - * 如果tensorDesc为空指针,则此方法将返回错误码。\n + * 如果tensorDesc为空指针,则该接口将返回错误码。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 - * @param format 需要设置的张量格式。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @param format 需要设置的张量数据布局。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ OH_NN_ReturnCode OH_NNTensorDesc_SetFormat(NN_TensorDesc *tensorDesc, OH_NN_Format format); /** - * @brief 获取{@link NN_TensorDesc}的格式。 + * @brief 获取{@link NN_TensorDesc}的数据布局。 * - * 调用此方法获取指定{@link NN_TensorDesc}实例的格式。\n + * 调用该接口获取指定{@link NN_TensorDesc}实例的数据布局{@link OH_NN_Format}。\n * - * 如果tensorDescformat为空指针,则此方法将返回错误码。\n + * 如果tensorDescformat为空指针,则该接口将返回错误码。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 - * @param format 返回的张量格式。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @param format 返回的张量数据布局。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -465,34 +480,35 @@ OH_NN_ReturnCode OH_NNTensorDesc_GetFormat(const NN_TensorDesc *tensorDesc, OH_N /** * @brief 获取{@link NN_TensorDesc}的元素个数。 * - * 调用该方法获取指定{@link NN_TensorDesc}实例的元素个数。如果需要获取张量数据的字节大小,请调用{@link OH_NNTensorDesc_GetByteSize}。\n + * 调用该接口获取指定{@link NN_TensorDesc}实例的元素个数。如果需要获取张量数据的字节大小, + * 请调用{@link OH_NNTensorDesc_GetByteSize}。\n * - * 如果张量形状是动态可变的,则此方法将返回错误码,elementCount将为0。\n + * 如果张量形状是动态可变的,则该接口将返回错误码,elementCount将为0。\n * - * 如果tensorDescelementCount为空指针,则此方法将返回错误码。\n + * 如果tensorDescelementCount为空指针,则该接口将返回错误码。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 * @param elementCount 张量返回的元素个数。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ OH_NN_ReturnCode OH_NNTensorDesc_GetElementCount(const NN_TensorDesc *tensorDesc, size_t *elementCount); /** - * @brief 获取{@link NN_TensorDesc}的字节大小。 + * @brief 获取基于{@link NN_TensorDesc}的形状和数据类型计算的数据占用字节数。 * - * 调用该方法可获取指定{@link NN_TensorDesc}实例的字节大小。\n + * 调用该接口可基于{@link NN_TensorDesc}的形状和数据类型计算得到的数据占用字节数。\n * - * 如果张量形状是动态可变的,该方法将返回错误码,byteSize将为0。\n + * 如果张量形状是动态可变的,该接口将返回错误码,byteSize将为0。\n * * 如果需要获取张量数据的元素个数,请调用{@link OH_NNTensorDesc_GetElementCount}。\n * - * 如果tensorDescbyteSize为空指针,则此方法将返回错误码。\n + * 如果tensorDescbyteSize为空指针,则该接口将返回错误码。\n * * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 - * @param byteSize 返回的张量字节大小。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅{@link OH_NN_ReturnCode}。 + * @param byteSize 返回的数据字节数。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -501,93 +517,92 @@ OH_NN_ReturnCode OH_NNTensorDesc_GetByteSize(const NN_TensorDesc *tensorDesc, si /** * @brief 从{@link NN_TensorDesc}创建一个{@link NN_Tensor}实例。 * - * 该方法使用{@link OH_NNTensorDesc_GetByteSize}计算张量数据的字节大小,并为其分配设备内存。设备驱动将直接通过“零拷贝”方式获取张量数据。 + * 该接口使用{@link OH_NNTensorDesc_GetByteSize}计算张量数据的字节数,并为其分配设备内存。 + * 设备驱动将直接通过“零拷贝”方式获取张量数据。\n * - * 请注意,此方法会将tensorDesc复制到{@link NN_Tensor}中,因此,当tensorDesc不再使用时, - * 您应该调用{@link OH_NNTensorDesc_Destroy}方法销毁它。\n + * 注意:该接口会将tensorDesc复制到{@link NN_Tensor}中,因此当tensorDesc不再使用时, + * 您应该调用{@link OH_NNTensorDesc_Destroy}接口销毁它。\n * - * 如果张量形状是动态的,此方法将返回错误码。\n + * 如果张量形状是动态的,该接口将返回错误码。\n * * deviceID表示所选设备。如果为0,则默认使用设备列表中的第1台设备。\n * * 必须提供tensorDesc,如果它是空指针,则返回错误码。\n * - * 调用{@link OH_NNTensor_DestroyTensor}释放{@link NN_Tensor}实例。\n + * 当{@link NN_Tensor}实例不再使用时,需要调用{@link OH_NNTensor_Destroy}销毁它。\n * * @param deviceID 设备 ID。如果为0,则默认使用当前设备列表中的第1台设备。 * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 - * @return 指向{@link NN_Tensor}实例的指针。 + * @return 指向{@link NN_Tensor}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ -NN_Tensor* OH_NNTensor_Create(size_t deviceID, NN_TensorDesc *tensorDesc); +NN_Tensor *OH_NNTensor_Create(size_t deviceID, NN_TensorDesc *tensorDesc); /** -* @brief 创建一个指定大小的{@link NN_Tensor}实例。 +* @brief 按照指定内存大小和{@link NN_TensorDesc}创建{@link NN_Tensor}实例。 * - * 此方法使用size作为张量数据的字节大小,并为其分配设备内存。设备将直接通过“零拷贝”方式获取张量数据。 + * 该接口使用size作为张量数据的字节数,并为其分配设备内存。设备将直接通过“零拷贝”方式获取张量数据。 * - * 注意,此方法会将tensorDesc复制到{@link NN_Tensor}中。因此,当tensorDesc不再使用时, - * 您应该调用{@link OH_NNTensorDesc_Destroy}方法销毁它。\n + * 注意,该接口会将tensorDesc复制到{@link NN_Tensor}中。因此当tensorDesc不再使用时, + * 您应该调用{@link OH_NNTensorDesc_Destroy}接口销毁它。\n * - * deviceID表示所选设备ID。如果为0,则使用第1台设备。\n + * deviceID表示所选设备ID,如果为0,则使用第1台设备。\n * - * tensorDesc必须提供,如果它是空指针,则该方法返回错误码。 - * size必须不小于tensorDesc的字节大小。否则,此方法将返回错误码。如果张量形状是动态的,不会检查size。\n + * tensorDesc必须提供,如果它是空指针,则该接口返回错误码。 + * size必须不小于tensorDesc的数据占用字节数(可由{@link OH_NNTensorDesc_GetByteSize}获取), + * 否则该接口将返回错误码。如果张量形状是动态的,不会检查size。\n * - * 调用{@link OH_NNTensor_DestroyTensor}释放{@link NN_Tensor}实例。\n + * 当{@link NN_Tensor}实例不再使用时,需要调用{@link OH_NNTensor_Destroy}销毁它。\n * - * @param deviceID 设备id。如果为0,则默认使用当前设备列表中的第1台设备。 + * @param deviceID 设备ID。如果为0,则默认使用当前设备列表中的第1台设备。 * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 * @param size 需要分配的张量数据的大小。 - * @return 指向{@link NN_Tensor}实例的指针。 + * @return 指向{@link NN_Tensor}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ -NN_Tensor* OH_NNTensor_CreateWithSize(size_t deviceID, NN_TensorDesc *tensorDesc, size_t size); +NN_Tensor *OH_NNTensor_CreateWithSize(size_t deviceID, NN_TensorDesc *tensorDesc, size_t size); /** - * @brief 创建一个具有指定fd的{@link NN_Tensor}实例。 - * - * 此方法复用传递参数fd对应的共享内存。它可能来自另一个{@link NN_Tensor}实例。 - * 当调用{@link OH_NNTensor_DestroyTensor}方法释放该方法创建的张量时,不会释放该张量数据的内存。\n + * @brief 按照指定共享内存的文件描述符和{@link NN_TensorDesc}创建{@Link NN_Tensor}实例。 * - * 请注意,此方法会将tensorDesc复制到{@link NN_Tensor}中。因此,当tensorDesc不再使用时, - * 您应该调用{@link OH_NNTensorDesc_Destroy}方法销毁它。\n + * 该接口复用文件描述符fd对应的共享内存,fd可能来自另一个{@link NN_Tensor}实例。 + * 当调用{@link OH_NNTensor_Destroy}接口销毁该接口创建的张量时,不会释放该张量数据的内存。\n * - * 请注意,tensorDesc会与{@link NN_Tensor}实例一起释放。因此,您创建的每一个{@link NN_Tensor}实例必须使用一个新的、 - * 尚未被另一个{@link NN_Tensor}实例使用过的tensorDesc;否则,tensorDesc将被释放两次,这将会导致双重释放的内存崩溃。 + * 注意:该接口会将tensorDesc复制到{@link NN_Tensor}中。因此当tensorDesc不再使用时, + * 您应该调用{@link OH_NNTensorDesc_Destroy}接口销毁它。\n * * deviceID表示所选设备。如果为0,则默认使用当前设备列表中的第1台设备。\n * - * 必须提供tensorDesc,如果为空指针,则该方法返回错误码。\n + * 必须提供tensorDesc,如果为空指针,则该接口返回错误码。\n * - * 调用{@link OH_NNTensor_DestroyTensor}释放{@link NN_Tensor}实例。\n + * 当{@link NN_Tensor}实例不再使用时,需要调用{@link OH_NNTensor_Destroy}销毁它。\n * * @param deviceID 设备 ID,如果为0,则默认使用当前设备列表中的第1台设备。 * @param tensorDesc 指向{@link NN_TensorDesc}实例的指针。 - * @param fd 要使用的共享内存的Fd。 + * @param fd 要使用的共享内存的文件描述符。 * @param size 要使用的共享内存的大小。 * @param offset 要使用的共享内存的偏移量。 - * @return 指向{@link NN_Tensor}实例的指针。 + * @return 指向{@link NN_Tensor}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ -NN_Tensor* OH_NNTensor_CreateWithFd(size_t deviceID, +NN_Tensor *OH_NNTensor_CreateWithFd(size_t deviceID, NN_TensorDesc *tensorDesc, int fd, size_t size, size_t offset); /** - * @brief 释放一个{@link NN_Tensor}实例。 + * @brief 销毁一个{@link NN_Tensor}实例。 * - * 当不再使用{@link NN_Tensor}实例时,需要调用该方法释放该实例。否则,将发生内存泄漏。\n + * 当不再使用{@link NN_Tensor}实例时,需要调用该接口销毁该实例,否则将发生内存泄漏。\n * - * 如果tensor*tensor为空指针,则此方法将返回错误码,并且不执行释放。\n + * 如果tensor*tensor为空指针,则该接口将返回错误码,并且不执行销毁操作。\n * - * @param 指向{@link NN_Tensor}实例的tensorDesc二级指针。 - * @return 函数的执行结果。如果操作成功,则返回OH_NN_SUCCESS;失败则返回错误码。有关错误码的详细信息,请参阅 @link OH_NN_ReturnCode}。 + * @param tensor 指向{@link NN_Tensor}实例的二级指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 */ @@ -596,46 +611,47 @@ OH_NN_ReturnCode OH_NNTensor_Destroy(NN_Tensor **tensor); /** * @brief 获取{@link NN_Tensor}的{@link NN_TensorDesc}实例。 * - * 调用该方法获取指定{@link NN_Tensor}实例的内部{@link NN_TensorDesc}实例指针。 - * 您可以从返回的{@link NN_TensorDesc}实例中获取各种类型的张量属性,例如名称/格式/数据类型/形状。\n + * 调用该接口获取指定{@link NN_Tensor}实例的内部{@link NN_TensorDesc}实例指针。 + * 您可以从返回的{@link NN_TensorDesc}实例中获取各种类型的张量属性,例如名称/数据布局/数据类型/形状等。\n * - * 您不应将返回的{@link NN_TensorDesc}实例销毁,因为它指向了{@link NN_Tensor}的内部实例。 - * 否则,一旦调用{@link OH_NNTensor_Destroy}将会发生双重释放的内存崩溃。 + * 您不应销毁返回的{@link NN_TensorDesc}实例,因为它指向了{@link NN_Tensor}的内部实例,否则一旦调用{@link OH_NNTensor_Destroy} + * 将会发生双重释放的内存崩溃。\n * - * 如果Tensor是空指针,则此方法将会返回空指针。\n + * 如果Tensor是空指针,则该接口将会返回空指针。\n * * @param tensor 指向{@link NN_Tensor}实例的指针。 - * @return 指向{@link NN_TensorDesc}实例的指针,如果执行失败,则返回空指针。 + * @return 指向{@link NN_TensorDesc}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ -NN_TensorDesc* OH_NNTensor_GetTensorDesc(const NN_Tensor *tensor); +NN_TensorDesc *OH_NNTensor_GetTensorDesc(const NN_Tensor *tensor); /** - * @brief 获取{@link NN_Tensor}的数据缓存。 + * @brief 获取{@link NN_Tensor}数据的内存地址。 * - * 您可以从张量数据缓存读取/写入数据。数据缓存是从设备上的共享内存映射的,因此设备驱动将通过这种“零拷贝”方式直接获取张量数据。 + * 您可以从张量数据内存读取/写入数据。数据内存是从设备上的共享内存映射的,因此设备驱动可通过这种“零拷贝”方式直接获取张量数据。 * - * 请注意,您只能访问长度为(size - offset)的张量数据缓存,否则可能会发生堆崩溃的错误。\n + * 注意:张量数据仅能使用对应共享内存中的[offset, size)一段,其中offset是共享内存上的偏移量,可以通过 + * {@link OH_NNTensor_GetOffset}获取,而size是共享内存的总大小,可以通过{@link OH_NNTensor_GetSize}获取。 \n * - * 如果Tensor是空指针,则此方法将会返回空指针。\n + * 如果Tensor是空指针,则该接口将会返回空指针。\n * * @param tensor 指向{@link NN_Tensor}实例的指针。 - * @return 指向张量数据缓冲区的指针。如果操作失败,则返回空指针。 + * @return 指向张量数据内存的指针。如果操作失败,则返回空指针。 * @since 11 * @version 1.0 */ -void* OH_NNTensor_GetDataBuffer(const NN_Tensor *tensor); +void *OH_NNTensor_GetDataBuffer(const NN_Tensor *tensor); /** - * @brief 获取{@link NN_Tensor}的数据内存Fd。 + * @brief 获取{@link NN_Tensor}数据所在共享内存的文件描述符。 * - * fd 对应了一块设备共享内存,可以通过{@link OH_NNTensor_CreateWithFd}被另外一个{@link NN_Tensor}使用。 \n + * 文件描述符fd对应了一块设备共享内存,可以通过{@link OH_NNTensor_CreateWithFd}被另外一个{@link NN_Tensor}使用。 \n * * 如果tensorfd为空指针,该接口将返回错误。 \n * * @param tensor 指向{@link NN_Tensor}实例的指针。 - * @param fd 返回的张量内存Fd。 + * @param fd 返回的共享内存文件描述符。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 @@ -643,17 +659,19 @@ void* OH_NNTensor_GetDataBuffer(const NN_Tensor *tensor); OH_NN_ReturnCode OH_NNTensor_GetFd(const NN_Tensor *tensor, int *fd); /** - * @brief 获取{@link NN_Tensor}的数据内存Fd的大小。 + * @brief 获取{@link NN_Tensor}数据所在共享内存的大小。 * * size与接口{@link OH_NNTensor_CreateWithSize}和{@link OH_NNTensor_CreateWithFd}的参数size相同, - * 但对于通过{@link OH_NNTensor_Create}创建的张量,size等于张量数据实际占用字节数。 \n + * 但对于通过{@link OH_NNTensor_Create}创建的张量,size等于张量数据实际占用字节数 + * (可由{@link OH_NNTensorDesc_GetByteSize}获取)。 \n * - * 注意张量数据仅能使用共享内存Fd中的[offset, size]一段。 \n + * 注意:张量数据仅能使用文件描述符fd对应的共享内存中的[offset, size)一段,其中offset是共享内存上的偏移量,可以通过 + * {@link OH_NNTensor_GetOffset}获取,而size是共享内存的总大小,可以通过{@link OH_NNTensor_GetSize}获取。 \n * * 如果tensorsize为空指针,该接口将返回错误。 \n * * @param tensor 指向{@link NN_Tensor}实例的指针。 - * @param size 返回的张量内存Fd的大小。 + * @param size 返回的数据所在共享内存的大小。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 @@ -661,16 +679,18 @@ OH_NN_ReturnCode OH_NNTensor_GetFd(const NN_Tensor *tensor, int *fd); OH_NN_ReturnCode OH_NNTensor_GetSize(const NN_Tensor *tensor, size_t *size); /** - * @brief 获取{@link NN_Tensor}数据内存Fd的偏移量。 + * @brief 获取{@link NN_Tensor}数据所在共享内存上的偏移量。 * - * 偏移量offset 对应于张量的共享内存Fd,可以通过{@link OH_NNTensor_CreateWithFd}接口,连同Fd、size一起被另外的{@link NN_Tensor}使用。 \n + * offset是张量数据在对应共享内存上的偏移量,可以通过{@link OH_NNTensor_CreateWithFd}接口,连同共享内存文件描述符、 + * 共享内存总大小一起被另外的{@link NN_Tensor}使用。 \n * - * 如果tensoroffset为空指针,该接口将返回错误。 \n + * 注意:张量数据仅能使用文件描述符fd对应的共享内存中的[offset, size)一段,其中offset是共享内存上的偏移量,可以通过 + * {@link OH_NNTensor_GetOffset}获取,而size是共享内存的总大小,可以通过{@link OH_NNTensor_GetSize}获取。 \n * - * 注意张量数据仅能使用共享内存Fd中的[offset, size]一段。 \n + * 如果tensoroffset为空指针,该接口将返回错误。 \n * * @param tensor 指向{@link NN_Tensor}实例的指针。 - * @param offset 返回的张量内存Fd的偏移量。 + * @param offset 返回的张量内存fd的偏移量。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 @@ -678,16 +698,18 @@ OH_NN_ReturnCode OH_NNTensor_GetSize(const NN_Tensor *tensor, size_t *size); OH_NN_ReturnCode OH_NNTensor_GetOffset(const NN_Tensor *tensor, size_t *offset); /** - * @brief 创建{@link OH_NNExecutor}类型的执行器实例 + * @brief 创建{@link OH_NNExecutor}执行器实例。 * - * 该接口接受一个{@link OH_NNCompilation}实例,构造一个与硬件关联的模型推理执行器。通过{@link OH_NNExecutor_SetInput}设置模型输入数据, - * 设置输入数据后,调用{@link OH_NNExecutor_Run}方法执行推理,最后通过 + * 该接口接受一个{@link OH_NNCompilation}实例,构造一个与硬件关联的模型推理执行器。 + * 通过{@link OH_NNExecutor_SetInput}设置模型输入数据, + * 设置输入数据后,调用{@link OH_NNExecutor_Run}接口执行推理,最后通过 * {@link OH_NNExecutor_SetOutput}获取计算结果。 \n * - * 调用该接口创建{@link OH_NNExecutor}实例后,如果不需要创建其他执行器,可以安全释放{@link OH_NNCompilation}实例。 \n + * 通过{@link OH_NNCompilation}实例创建一个{@link OH_NNExecutor}实例后,如果不再使用{@link OH_NNCompilation}实例 + * 创建其他{@link OH_NNExecutor}实例,就可以销毁{@link OH_NNCompilation}实例了。 \n * * @param compilation 指向{@link OH_NNCompilation}实例的指针。 - * @return 返回指向{@link OH_NNExecutor}实例的指针。 + * @return 指向{@link OH_NNExecutor}实例的指针,如果创建失败就返回NULL。 * @since 9 * @version 1.0 */ @@ -698,10 +720,13 @@ OH_NNExecutor *OH_NNExecutor_Construct(OH_NNCompilation *compilation); * * 调用{@link OH_NNExecutor_Run}完成单次推理后,该接口获取指定输出的维度信息和维数。在动态形状输入、输出的场景中常用。 \n * - * 作为输出参数,*shape不能为空指针,否则会返回错误。例如你应该定义int32_t* tensorShape = NULL,然后将&tensorShape + * 注意:如果索引值outputIndex达到或超过输出张量的数量,接口将返回错误。输出张量的数量可以通过 + * {@link OH_NNExecutor_GetOutputCount}获取。 \n + * + * 作为输出参数,*shape不能为空指针,否则会返回错误。例如您应该定义int32_t* tensorShape = NULL,然后将&tensorShape * 作为参数传入。 \n * - * 你无需释放shape的内存,它会随executor一起被释放。 + * 您无需释放shape的内存,它会随executor一起被释放。 * * @param executor 指向{@link OH_NNExecutor}实例的指针。 * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 @@ -721,7 +746,7 @@ OH_NN_ReturnCode OH_NNExecutor_GetOutputShape(OH_NNExecutor *executor, /** * @brief 销毁执行器实例,释放执行器占用的内存。 * - * 调用{@link OH_NNExecutor_Construct}创建的执行器实例需要调用该接口主动释放,否则将造成内存泄漏。 \n + * 调用{@link OH_NNExecutor_Construct}创建的执行器实例需要调用该接口主动销毁,否则将造成内存泄漏。 \n * * 如果executor为空指针或者*executor为空指针,该接口仅打印警告日志,不执行销毁操作。 \n * @@ -760,49 +785,52 @@ OH_NN_ReturnCode OH_NNExecutor_GetOutputCount(const OH_NNExecutor *executor, siz /** * @brief 由指定索引值创建一个输入张量的描述。 * - * 输入张量描述包含了该张量的所有属性值。如果索引值超出了inputCount - 1,接口将返回错误。 \n + * 输入张量描述包含了该张量所有类型的属性值。如果索引值index达到或超过输入张量的数量,接口将返回错误码。输入张量的数量可以通过 + * {@link OH_NNExecutor_GetInputCount}获取。 \n * * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param index 输入张量的索引值 - * @return 指向{@link NN_TensorDesc}实例的指针. + * @param index 输入张量的索引值。 + * @return 指向{@link NN_TensorDesc}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ -NN_TensorDesc* OH_NNExecutor_CreateInputTensorDesc(const OH_NNExecutor *executor, size_t index); +NN_TensorDesc *OH_NNExecutor_CreateInputTensorDesc(const OH_NNExecutor *executor, size_t index); /** * @brief 由指定索引值创建一个输出张量的描述。 * - * 输出张量描述包含了该张量的所有属性值。如果索引值超出了outputCount - 1,接口将返回错误。 \n + * 输出张量描述包含了该张量所有类型的属性值。如果索引值index达到或超过输出张量的数量,接口将返回错误码。输出张量的数量可以通过 + * {@link OH_NNExecutor_GetOutputCount}获取。 \n * * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param index 输出张量的索引值 - * @return 指向{@link NN_TensorDesc}实例的指针. + * @param index 输出张量的索引值。 + * @return 指向{@link NN_TensorDesc}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ -NN_TensorDesc* OH_NNExecutor_CreateOutputTensorDesc(const OH_NNExecutor *executor, size_t index); +NN_TensorDesc *OH_NNExecutor_CreateOutputTensorDesc(const OH_NNExecutor *executor, size_t index); /** * @brief 获取所有输入张量的维度范围。 * - * 当输入张量具有动态shape时,它在不同硬件上支持的维度范围可能是不同的,可以通过该接口获取当前设备上支持的维度范围。 - * *minInputDims保存了指定输入张量的最小维度(维度数与shape匹配),而*maxInputDims则保存了最大维度。 - * 例如,一个输入张量具有动态shape [-1, -1, -1, 3],那么当前设备上它的*minInputDims可以是[1, 10, 10, 3],而*maxInputDims - * 可以是[100, 1024, 1024, 3]。 \n + * 当输入张量具有动态形状时,它在不同硬件上支持的维度范围可能是不同的,可以通过该接口获取当前设备上支持的维度范围。 + * *minInputDims保存了指定输入张量的最小维度(维度数与形状匹配),而*maxInputDims则保存了最大维度。 + * 例如,一个输入张量具有动态形状 [-1, -1, -1, 3],那么当前设备上它的*minInputDims可以是[1, 10, 10, 3], + * 而*maxInputDims可以是[100, 1024, 1024, 3]。 \n * - * 注意,如果索引值超出了inputCount - 1,接口将返回错误。 \n + * 注意:如果索引值index达到或超过输入张量的数量,接口将返回错误。输入张量的数量可以通过 + * {@link OH_NNExecutor_GetInputCount}获取。 \n * - * 作为输出参数,*minInputDims*maxInputDims不能为空指针,否则会返回错误。例如,你应该定义int32_t* minInDims = NULL,然后将&minInDims - * 作为参数传入。 \n + * 作为输出参数,*minInputDims*maxInputDims不能为空指针,否则会返回错误。 + * 例如您应该定义int32_t* minInDims = NULL,然后将&minInDims作为参数传入。 \n * - * 你无需释放*minInputDims*maxInputDims的内存,它会随executor一起被释放。 \n + * 您无需释放*minInputDims*maxInputDims的内存,它会随executor一起被释放。 \n * * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param index 输入张量的索引值 - * @param minInputDims 返回的数组的指针,保存了指定输入张量的最小维度(维度数与shape匹配) - * @param maxInputDims 返回的数组的指针,保存了指定输入张量的最大维度(维度数与shape匹配) - * @param shapeLength 返回的输入张量的维度数量,与shape一致。 + * @param index 输入张量的索引值。 + * @param minInputDims 返回的数组的指针,保存了指定输入张量的最小维度(维度数与形状匹配)。 + * @param maxInputDims 返回的数组的指针,保存了指定输入张量的最大维度(维度数与形状匹配)。 + * @param shapeLength 返回的输入张量的维度数量,与形状一致。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 @@ -816,7 +844,7 @@ OH_NN_ReturnCode OH_NNExecutor_GetInputDimRange(const OH_NNExecutor *executor, /** * @brief 设置异步推理结束后的回调处理函数。 * - * 回调函数的定义见{@link NN_OnRunDone}。 \n + * 回调函数的定义详见{@link NN_OnRunDone}。 \n * * @param executor 指向{@link OH_NNExecutor}实例的指针。 * @param onRunDone 回调函数句柄{@link NN_OnRunDone}。 @@ -829,7 +857,7 @@ OH_NN_ReturnCode OH_NNExecutor_SetOnRunDone(OH_NNExecutor *executor, NN_OnRunDon /** * @brief 设置异步推理执行期间设备驱动服务突然死亡时的回调处理函数。 * - * 回调函数的定义见{@link NN_OnServiceDied}。 \n + * 回调函数的定义详见{@link NN_OnServiceDied}。 \n * * @param executor 指向{@link OH_NNExecutor}实例的指针。 * @param onServiceDied 回调函数句柄{@link NN_OnServiceDied}。 @@ -844,10 +872,11 @@ OH_NN_ReturnCode OH_NNExecutor_SetOnServiceDied(OH_NNExecutor *executor, NN_OnSe * * 需要先通过{@link OH_NNTensor_Create}、{@link OH_NNTensor_CreateWithSize}或{@link OH_NNTensor_CreateWithFd}接口创建 * 输入和输出张量。然后由{@link OH_NNTensor_GetDataBuffer}获取张量数据指针并向其拷贝输入数据。执行器会通过执行推理产生推理结果, - * 然后将结果写入输出张量中。 \n + * 并将结果写入输出张量中。 \n * - * 如果输出张量具有动态shape,可以通过{@link OH_NNExecutor_GetOutputShape}接口获取输出张量的实际shape。或者通过 - * {@link OH_NNTensor_GetTensorDesc}接口从输入张量中获取张量描述,然后通过{@link OH_NNTensorDesc_GetShape}接口获取实际shape。 \n + * 如果输出张量具有动态形状,可以通过{@link OH_NNExecutor_GetOutputShape}接口获取输出张量的实际形状。或者通过 + * {@link OH_NNTensor_GetTensorDesc}接口从输入张量中获取张量描述, + * 然后通过{@link OH_NNTensorDesc_GetShape}接口获取实际形状。 \n * * @param executor 指向{@link OH_NNExecutor}实例的指针。 * @param inputTensor 输入张量的数组。 @@ -869,15 +898,22 @@ OH_NN_ReturnCode OH_NNExecutor_RunSync(OH_NNExecutor *executor, * * 需要先通过{@link OH_NNTensor_Create}、{@link OH_NNTensor_CreateWithSize}或{@link OH_NNTensor_CreateWithFd}接口创建 * 输入和输出张量。然后由{@link OH_NNTensor_GetDataBuffer}获取张量数据指针并向其拷贝输入数据。执行器会通过执行推理产生推理结果, - * 然后将结果写入输出张量中。 \n + * 并将结果写入输出张量中。 \n + * + * 如果输出张量具有动态形状,可以通过{@link OH_NNExecutor_GetOutputShape}接口获取输出张量的实际形状。或者通过 + * {@link OH_NNTensor_GetTensorDesc}接口从输入张量中获取张量描述, + * 然后通过{@link OH_NNTensorDesc_GetShape}接口获取实际形状。 \n + * + * 该接口是非阻塞式的,调用后会立刻返回,而推理结果、执行返回状态可以通过回调函数{@link NN_OnRunDone}来获取。 + * 如果设备驱动服务在执行过程中异常终止,可以通过回调函数{@link NN_OnServiceDied}来处理。 \n * - * 如果输出张量具有动态shape,可以通过{@link OH_NNExecutor_GetOutputShape}接口获取输出张量的实际shape。或者通过 - * {@link OH_NNTensor_GetTensorDesc}接口从输入张量中获取张量描述,然后通过{@link OH_NNTensorDesc_GetShape}接口获取实际shape。 \n + * 可以通过接口{@link OH_NNExecutor_SetOnRunDone}和{@link OH_NNExecutor_SetOnServiceDied}设置回调函数 + * {@link NN_OnRunDone}和{@link NN_OnServiceDied}。 \n * - * 该接口是非阻塞式的,调用后会立刻返回。回调函数句柄可以通过{@link OH_NNExecutor_SetOnRunDone}和{@link OH_NNExecutor_SetOnServiceDied} - * 来设置。如果推理时长超过了timeout,会立刻终止推理,{@link NN_OnRunDone}的errCode参数会返回{@link OH_NN_TIMEOUT}错误。 \n + * 如果推理时长超过了timeout,会立刻终止推理,回调函数{@link NN_OnRunDone}的errCode参数会 + * 返回{@link OH_NN_TIMEOUT}错误。 \n * - * userData是区分不同次异步执行的标识符,会作为回调函数的第一个参数返回,你可使用能够区分不同次执行的任意数据作为标识符。 + * userData是区分不同次异步执行的标识符,会作为回调函数的第一个参数返回,您可以使用能够区分不同次执行的任意数据作为标识符。 * * @param executor 指向{@link OH_NNExecutor}实例的指针。 * @param inputTensor 输入张量的数组。 @@ -896,7 +932,7 @@ OH_NN_ReturnCode OH_NNExecutor_RunAsync(OH_NNExecutor *executor, NN_Tensor *outputTensor[], size_t outputCount, int32_t timeout, - void* userData); + void *userData); /** * @brief 获取对接到 Neural Network Runtime 的硬件ID。 @@ -905,8 +941,8 @@ OH_NN_ReturnCode OH_NNExecutor_RunAsync(OH_NNExecutor *executor, * * 硬件ID通过size_t数组返回,数组的每个元素是单个硬件的ID值。数组内存由内部进行管理,在下次调用该接口前,数据指针将一直有效。 \n * - * @param allDevicesID 指向size_t数组的指针。要求传入的(*allDevicesID)为空指针,否则返回{@link OH_NN_INVALID_PARAMETER}。 - * @param deviceCount uint32_t类型的指针,用于返回(*allDevicesID)的长度。 + * @param allDevicesID 指向size_t数组的指针。要求传入的*allDevicesID为空指针,否则将返回错误码{@link OH_NN_INVALID_PARAMETER}。 + * @param deviceCount uint32_t类型的指针,用于返回*allDevicesID的长度。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 9 * @version 1.0 @@ -916,12 +952,12 @@ OH_NN_ReturnCode OH_NNDevice_GetAllDevicesID(const size_t **allDevicesID, uint32 /** * @brief 获取指定硬件的名称。 * - * 通过deviceID指定计算硬件,获取硬件的名称。硬件ID需要调用{@link OH_NNDevice_GetAllDevicesID}获取。如果deviceID是0,那么会默认 - * 使用设备列表中的第一个设备。 \n + * 通过deviceID指定计算硬件,获取硬件的名称。硬件ID需要调用{@link OH_NNDevice_GetAllDevicesID}获取。如果deviceID是0, + * 那么会默认使用设备列表中的第一个设备。 \n * - * (*name)是一个C风格的字符串,以'\0'作为结束符。 \n + * *name是一个C风格的字符串,以'\0'作为结束符。 \n * - * *name必须是一个空指针,否则接口会返回{@link OH_NN_INVALID_PARAMETER}错误。例如,你应该定义char* deviceName = NULL, + * *name必须是一个空指针,否则接口会返回{@link OH_NN_INVALID_PARAMETER}错误。例如您应该定义char* deviceName = NULL, * 然后将&deviceName作为参数传入。 \n * * @param deviceID 指定硬件ID。如果deviceID是0,那么会默认使用设备列表中的第一个设备。 diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h index 91646b7d..d8b60946 100644 --- a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime.h @@ -19,7 +19,6 @@ * * @brief 提供Neural Network Runtime加速模型推理的相关接口。 * - * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 * @version 2.0 */ @@ -30,8 +29,10 @@ * @brief Neural Network Runtime模块接口定义,AI推理框架使用Neural Network Runtime提供的Native接口,完成模型构建。 * * 注意:Neural Network Runtime的接口目前均不支持多线程并发调用.\n - * + * + * 引用文件"neural_network_runtime/neural_network_runtime_type.h" * @library libneural_network_runtime.so + * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 * @version 2.0 */ @@ -48,13 +49,13 @@ extern "C" { #endif /** - * @brief 创建一个{@link NN_QuantParam}实例。 + * @brief 创建一个{@link NN_QuantParam}量化参数实例。 * - * 创建{@link NN_QuantParam}实例后,调用{@link OH_NNQuantParam_SetScales}、{@link OH_NNQuantParam_SetZeroPoints}或 - * {@link OH_NNQuantParam_SetNumBits}设置它的属性值,并调用{@link OH_NNModel_SetTensorQuantParams}将它设置到Tensor中。 - * 最后需要调用{@link OH_NNQuantParam_Destroy}销毁它,以避免内存泄露。 \n + * 创建{@link NN_QuantParam}量化参数实例后,调用{@link OH_NNQuantParam_SetScales}、{@link OH_NNQuantParam_SetZeroPoints}或 + * {@link OH_NNQuantParam_SetNumBits}设置它的属性值,并调用{@link OH_NNModel_SetTensorQuantParams}将它设置到 + * {@link NN_Tensor}中。最后再调用{@link OH_NNQuantParam_Destroy}销毁它,以避免内存泄露。 \n * - * @return 指向{@link NN_QuantParam}实例的指针。 + * @return 指向{@link NN_QuantParam}实例的指针,如果创建失败就返回NULL。 * @since 11 * @version 1.0 */ @@ -63,11 +64,11 @@ NN_QuantParam *OH_NNQuantParam_Create(); /** * @brief 设置{@link NN_QuantParam}的缩放系数。 * - * 参数quantCount<\b>是Tensor中量化参数的数量,例如对于per-channel量化,quantCount<\b>就是通道数量。 \n + * 参数quantCount是张量中量化参数的数量,例如对于per-channel量化,quantCount就是通道数量。 \n * * @param quantParams 指向{@link NN_QuantParam}实例的指针。 - * @param scales Tensor所有量化参数的缩放系数构成的数组。 - * @param quantCount Tensor量化参数的数量。 + * @param scales 张量中所有量化参数的缩放系数构成的数组。 + * @param quantCount 张量中量化参数的数量。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 @@ -77,11 +78,11 @@ OH_NN_ReturnCode OH_NNQuantParam_SetScales(NN_QuantParam *quantParams, const dou /** * @brief 设置{@link NN_QuantParam}的零点。 * - * 参数quantCount<\b>是Tensor中量化参数的数量,例如对于per-channel量化,quantCount<\b>就是通道数量。 \n + * 参数quantCount是张量中量化参数的数量,例如对于per-channel量化,quantCount就是通道数量。 \n * * @param quantParams 指向{@link NN_QuantParam}实例的指针。 - * @param zeroPoints Tensor所有量化参数的零点构成的数组。 - * @param quantCount Tensor量化参数的数量。 + * @param zeroPoints 张量中所有量化参数的零点构成的数组。 + * @param quantCount 张量中量化参数的数量。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 @@ -91,11 +92,11 @@ OH_NN_ReturnCode OH_NNQuantParam_SetZeroPoints(NN_QuantParam *quantParams, const /** * @brief 设置{@link NN_QuantParam}的量化位数。 * - * 参数quantCount<\b>是Tensor中量化参数的数量,例如对于per-channel量化,quantCount<\b>就是通道数量。 \n + * 参数quantCount是张量中量化参数的数量,例如对于per-channel量化,quantCount就是通道数量。 \n * * @param quantParams 指向{@link NN_QuantParam}实例的指针。 - * @param numBits Tensor所有量化参数的量化位数构成的数组。 - * @param quantCount Tensor量化参数的数量。 + * @param numBits 张量中所有量化参数的量化位数构成的数组。 + * @param quantCount 张量中量化参数的数量。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 @@ -105,11 +106,11 @@ OH_NN_ReturnCode OH_NNQuantParam_SetNumBits(NN_QuantParam *quantParams, const ui /** * @brief 销毁{@link NN_QuantParam}实例。 * - * 当设置{@link NN_QuantParam}实例到一个Tensor中后,如果不再使用该实例,就需要销毁它以避免内存泄漏。 \n + * 当设置{@link NN_QuantParam}实例到一个{@link NN_Tensor}中后,如果不再使用该实例,需要销毁它以避免内存泄漏。 \n * * 如果quantParams*quantParams是空指针,那么该接口仅打印警告日志,不会执行销毁操作。 \n * - * @param quantParams 指向{@link NN_QuantParam}实例的双指针。 + * @param quantParams 指向{@link NN_QuantParam}实例的二级指针。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 11 * @version 1.0 @@ -127,7 +128,7 @@ OH_NN_ReturnCode OH_NNQuantParam_Destroy(NN_QuantParam **quantParams); * * 模型实例使用完毕后,需要调用{@link OH_NNModel_Destroy}销毁模型实例,避免内存泄漏。\n * - * @return 返回一个指向{@link OH_NNModel}实例的指针。 + * @return 返回一个指向{@link OH_NNModel}实例的指针,如果创建失败就返回NULL。 * @since 9 * @version 1.0 */ @@ -137,11 +138,11 @@ OH_NNModel *OH_NNModel_Construct(void); * @brief 向模型实例中添加张量。 * * Neural Network Runtime模型中的数据节点和算子参数均由模型的张量构成。该接口根据{@link NN_TensorDesc}向model实 - * 例中添加张量。张量添加的顺序是模型中记录张量的索引值,{@link OH_NNModel_SetTensorData}、 + * 例中添加张量,张量添加的顺序是模型中记录张量的索引值。{@link OH_NNModel_SetTensorData}、 * {@link OH_NNModel_AddOperation}和{@link OH_NNModel_SpecifyInputsAndOutputs}接口根据该索引值,指定不同的张量。\n * - * Neural Network Runtime支持动态形状输入和输出。在添加动态形状的数据节点时,需要将tensor.dimensions中支持动态 - * 变化的维度设置为-1。例如:一个四维tensor,将tensor.dimensions设置为[1, -1, 2, 2],表示其第二个维度支持 + * Neural Network Runtime支持动态形状的输入和输出张量。在添加动态形状的数据节点时,需要将tensor.dimensions中支持动态 + * 变化的维度设置为-1。例如可将一个四维tensor的dimensions设置为[1, -1, 2, 2],表示其第二个维度支持 * 动态变化。\n * * @param model 指向{@link OH_NNModel}实例的指针。 @@ -160,8 +161,8 @@ OH_NN_ReturnCode OH_NNModel_AddTensorToModel(OH_NNModel *model, const NN_TensorD * * @param model 指向{@link OH_NNModel}实例的指针。 * @param index 张量的索引值。 - * @param dataBuffer 指向真实数据的指针。 - * @param length 数据缓冲区的长度。 + * @param dataBuffer 指向真实数据内存的指针。 + * @param length 数据内存的长度。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 9 * @version 1.0 @@ -169,7 +170,7 @@ OH_NN_ReturnCode OH_NNModel_AddTensorToModel(OH_NNModel *model, const NN_TensorD OH_NN_ReturnCode OH_NNModel_SetTensorData(OH_NNModel *model, uint32_t index, const void *dataBuffer, size_t length); /** - * @brief 设置张量的量化参数。 + * @brief 设置张量的量化参数,参考{@link NN_QuantParam}。 * * @param model 指向{@link OH_NNModel}实例的指针。 * @param index 张量的索引值。 @@ -196,8 +197,8 @@ OH_NN_ReturnCode OH_NNModel_SetTensorType(OH_NNModel *model, uint32_t index, OH_ * @brief 向模型实例中添加算子。 * * 该接口向模型实例中添加算子,算子类型由op指定,算子的参数、输入和输出由paramIndices、inputIndices和 - * outputIndices指定。该接口将对算子参数的属性和输入输出的数量进行校验,这些属性需要在调用 - * {@link OH_NNModel_AddTensorToModel}添加张量的时候正确设置。每个算子期望的参数、输入和输出属性请参考 + * outputIndices指定。该接口将对算子参数的属性和输入、输出张量的数量进行校验,这些属性需要在调用 + * {@link OH_NNModel_AddTensorToModel}添加张量时正确设置。每个算子期望的参数、输入和输出属性请参考 * {@link OH_NN_OperationType}。\n * * paramIndices、inputIndices和outputIndices中存储的是张量的索引值,每个索引值根据张量添加进模型的顺序决定,正确 @@ -208,9 +209,9 @@ OH_NN_ReturnCode OH_NNModel_SetTensorType(OH_NNModel *model, uint32_t index, OH_ * * @param model 指向{@link OH_NNModel}实例的指针。 * @param op 指定添加的算子类型,取值请参考{@link OH_NN_OperationType}的枚举值。 - * @param paramIndices OH_NN_UInt32Array实例的指针,设置算子的参数。 - * @param inputIndices OH_NN_UInt32Array实例的指针,指定算子的输入。 - * @param outputIndices OH_NN_UInt32Array实例的指针,设置算子的输出。 + * @param paramIndices OH_NN_UInt32Array实例的指针,设置算子的参数张量索引。 + * @param inputIndices OH_NN_UInt32Array实例的指针,指定算子的输入张量索引。 + * @param outputIndices OH_NN_UInt32Array实例的指针,设置算子的输出张量索引。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 * @since 9 * @version 1.0 @@ -224,7 +225,7 @@ OH_NN_ReturnCode OH_NNModel_AddOperation(OH_NNModel *model, /** * @brief 指定模型的输入和输出张量的索引值。 * - * 模型实例需要指定张量作为端到端的输入和输出张量。注意设置一个张量为输入或输出的张量后,就不能再通过调用{@link OH_NNModel_SetTensorData} + * 模型实例需要指定张量作为端到端的输入和输出张量。注意设置一个张量为输入或输出张量后,就不能再通过调用{@link OH_NNModel_SetTensorData} * 设置张量数据,而需要在执行阶段调用OH_NNExecutor的方法设置输入或输出张量数据。\n * * 张量的索引值根据张量添加进模型的顺序决定,张量的添加参考{@link OH_NNModel_AddTensorToModel}。\n @@ -251,8 +252,7 @@ OH_NN_ReturnCode OH_NNModel_SpecifyInputsAndOutputs(OH_NNModel *model, * {@link OH_NNModel_SpecifyInputsAndOutputs}将返回 * {@link OH_NN_OPERATION_FORBIDDEN}。\n * - * 在调用{@link OH_NNModel_GetAvailableOperations}和{@link OH_NNCompilation_Construct} - * 之前,必须先调用该接口完成构图。\n + * 在调用{@link OH_NNModel_GetAvailableOperations}和{@link OH_NNCompilation_Construct}之前,必须先调用该接口完成构图。\n * * @param model 指向{@link OH_NNModel}实例的指针。 * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 @@ -262,9 +262,9 @@ OH_NN_ReturnCode OH_NNModel_SpecifyInputsAndOutputs(OH_NNModel *model, OH_NN_ReturnCode OH_NNModel_Finish(OH_NNModel *model); /** - * @brief 释放模型实例。 + * @brief 销毁模型实例。 * - * 调用{@link OH_NNModel_Construct}创建的模型实例需要调用该接口主动释放,否则将造成内存泄漏。\n + * 调用{@link OH_NNModel_Construct}创建的模型实例需要调用该接口主动销毁,否则将造成内存泄漏。\n * * 如果model为空指针或者*model为空指针,该接口仅打印警告日志,不执行销毁操作。\n * @@ -278,7 +278,7 @@ void OH_NNModel_Destroy(OH_NNModel **model); * @brief 查询硬件对模型内所有算子的支持情况,通过布尔值序列指示支持情况。 * * 查询底层硬件对模型实例内每个算子的支持情况,硬件由deviceID指定,结果将通过isSupported指向的数组表示。如果支持第i个算子,则 - * (*isSupported)[i] == true,否则为 false。\n + * (*isSupported)[i] == true,否则为false。\n * * 该接口成功执行后,(*isSupported)将指向记录算子支持情况的bool数组,数组长度和模型实例的算子数量相等。该数组对应的内存由 * Neural Network Runtime管理,在模型实例销毁或再次调用该接口后自动销毁。\n @@ -297,6 +297,226 @@ OH_NN_ReturnCode OH_NNModel_GetAvailableOperations(OH_NNModel *model, const bool **isSupported, uint32_t *opCount); +/** + * @brief 向模型实例中添加张量。 + * + * Neural Network Runtime模型中的数据节点和算子参数均由模型的张量构成,该接口根据tensor,向model实 + * 例中添加张量。张量添加的顺序由模型中记录张量的索引值来确定,{@link OH_NNModel_SetTensorData}、 + * {@link OH_NNModel_AddOperation}和{@link OH_NNModel_SpecifyInputsAndOutputs} + * 接口根据该索引值,指定不同的张量。\n + * + * Neural Network Runtime支持动态形状输入和输出。在添加动态形状的数据节点时,需要将tensor.dimensions中支持动态 + * 变化的维度设置为-1。例如可将一个四维tensor的dimensions设置为[1, -1, 2, 2],表示其第二个维度支持 + * 动态变化。\n + * + * @param model 指向{@link OH_NNModel}实例的指针。 + * @param tensor {@link OH_NN_Tensor}张量的指针,tensor指定了添加到模型实例中张量的属性。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNModel_AddTensorToModel} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *tensor); + +/** + * @brief 设置模型单个输入的数据。 + * + * 该接口将dataBuffer中,长度为length个字节的数据,拷贝到底层硬件的共享内存。inputIndex指定设置的输入,tensor用于设置输入张量的 + * 形状、数据类型、量化参数等信息。\n + * + * 由于Neural Network Runtime支持动态输入形状的模型,在固定形状输入和动态形状输入的场景下,该接口采取不同的处理策略: + * + * - 固定形状输入的场景:tensor各属性必须和构图阶段调用{@link OH_NNModel_AddTensor}添加的张量保持一致; + * - 动态形状输入的场景:在构图阶段,由于动态输入的形状不确定,调用该接口时,要求tensor.dimensions中的每个值必须大于0, + * 以确定执行计算阶段输入的形状。设置形状时,只允许调整数值为-1的维度。假设在构图阶段,输入A的维度为 + * [-1, 224, 224, 3],调用该接口时,只能调整第一个维度的尺寸,如:[3, 224, 224, 3]。调整其他维度将返回 + * {@link OH_NN_INVALID_PARAMETER}。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在设置输入的阶段, + * 三个输入的索引值分别为{0, 1, 2}。 + * @param tensor 设置输入数据对应的张量。 + * @param dataBuffer 指向输入数据的指针。 + * @param length 数据内存的字节长度。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, + uint32_t inputIndex, + const OH_NN_Tensor *tensor, + const void *dataBuffer, + size_t length); + +/** + * @brief 设置模型单个输出的内存。 + * + * 该接口将dataBuffer指向的内存与outputIndex指定的输出绑定,内存的长度由length指定。\n + * + * 调用{@link OH_NNExecutor_Run}完成单次模型推理后,Neural Network Runtime将比对dataBuffer指向的内存与 + * 输出数据的长度,根据不同情况,返回不同结果:\n + * + * - 如果内存大小大于或等于数据长度:则推理后的结果将拷贝至内存,并返回{@link OH_NN_SUCCESS},可以通过访问dataBuffer读取推理结果。 + * - 如果内存大小小于数据长度:则{@link OH_NNExecutor_Run}将返回{@link OH_NN_INVALID_PARAMETER}, + * 并输出日志告知内存太小的信息。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在设置输出内存时, + * 三个输出的索引值分别为{0, 1, 2}。 + * @param dataBuffer 指向输出数据的指针。 + * @param length 数据内存的字节长度。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, + uint32_t outputIndex, + void *dataBuffer, + size_t length); + +/** + * @brief 执行推理。 + * + * 在执行器关联的硬件上,执行模型的端到端推理计算。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_Run(OH_NNExecutor *executor); + +/** + * @brief 在硬件上为单个输入申请共享内存。 + * + * Neural Network Runtime 提供主动申请硬件共享内存的方法。通过指定执行器和输入索引值,该接口在单个输入关联的硬件 + * 上,申请大小为length的共享内存,通过{@link OH_NN_Memory}实例返回。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在申请输入内存时, + * 三个输入的索引值分别为{0, 1, 2}。 + * @param length 申请的内存字节。 + * @return 指向{@link OH_NN_Memory}实例的指针,如果创建失败就返回NULL。 + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_CreateWithSize} + * @since 9 + * @version 1.0 + */ +OH_NN_Memory *OH_NNExecutor_AllocateInputMemory(OH_NNExecutor *executor, uint32_t inputIndex, size_t length); + +/** + * @brief 在硬件上为单个输出申请共享内存。 + * + * Neural Network Runtime 提供主动申请硬件共享内存的方法。通过指定执行器和输出索引值,该接口在单个输出关联的硬件 + * 上,申请大小为length的共享内存,通过{@link OH_NN_Memory}实例返回。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在申请输出内存时, + * 三个输出的索引值分别为{0, 1, 2}。 + * @param length 申请的内存字节。 + * @return 指向{@link OH_NN_Memory}实例的指针,如果创建失败就返回NULL。 + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_CreateWithSize} + * @since 9 + * @version 1.0 + */ +OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, size_t length); + +/** + * @brief 释放{@link OH_NN_Memory}实例指向的输入内存。 + * + * 调用{@link OH_NNExecutor_AllocateInputMemory}创建的内存实例,需要主动调用该接口进行释放,否则将造成内存泄漏。 + * inputIndex和memory的对应关系需要和创建内存实例时保持一致。\n + * + * 如果memory或*memory为空指针,该接口仅打印警告日志,不执行释放操作。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在释放输入内存时, + * 三个输入的索引值分别为{0, 1, 2}。 + * @param memory 指向{@link OH_NN_Memory}实例的二级指针。共享内存释放后,该接口将*memory主动设置为空指针。 + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_Destroy} + * @since 9 + * @version 1.0 + */ +void OH_NNExecutor_DestroyInputMemory(OH_NNExecutor *executor, uint32_t inputIndex, OH_NN_Memory **memory); + +/** + * @brief 释放{@link OH_NN_Memory}实例指向的输出内存。 + * + * 调用{@link OH_NNExecutor_AllocateOutputMemory}创建的内存实例,需要主动调用该接口进行释放,否则将造成内存泄漏。 + * outputIndex和memory的对应关系需要和创建内存实例时保持一致。\n + * + * 如果memory或*memory为空指针,该接口仅打印警告日志,不执行释放操作。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在释放输出内存时, + * 三个输出的索引值分别为{0, 1, 2}。 + * @param memory 指向{@link OH_NN_Memory}实例的二级指针。共享内存释放后,该接口将*memory主动设置为空指针。 + * @deprecated since 11 + * @useinstead {@link OH_NNTensor_Destroy} + * @since 9 + * @version 1.0 + */ +void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, OH_NN_Memory **memory); + +/** + * @brief 将{@link OH_NN_Memory}实例指向的硬件共享内存,并指定为单个输入使用的内存。 + * + * 在需要自行管理内存的场景下,该接口将执行输入和{@link OH_NN_Memory}内存实例绑定。执行计算时,底层硬件从内存实例指向的共享内存 + * 中读取输入数据。通过该接口,可以实现设置输入、执行计算、读取输出的并发执行,提升数据流的推理效率。\n + * + * @param executor 指向{@link OH_NNExecutor}实例的指针。 + * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在指定输入的共享 + * 内存时,三个输入的索引值分别为{0, 1, 2}。 + * @param tensor 指向{@link OH_NN_Tensor}的指针,设置单个输入所对应的张量。 + * @param memory 指向{@link OH_NN_Memory}的指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, + uint32_t inputIndex, + const OH_NN_Tensor *tensor, + const OH_NN_Memory *memory); + +/** + * @brief 将{@link OH_NN_Memory}实例指向的硬件共享内存,并指定为单个输出使用的内存。 + * + * 在需要自行管理内存的场景下,该接口将执行输出和{@link OH_NN_Memory}内存实例绑定。执行计算时,底层硬件将计算结果直接写入内存实例指向 + * 的共享内存。通过该接口,可以实现设置输入、执行计算、读取输出的并发执行,提升数据流的推理效率。\n + * + * @param executor 执行器。 + * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 + * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在指定输出的共享 + * 内存时,三个输出的索引值分别为{0, 1, 2}。 + * @param memory 指向{@link OH_NN_Memory}的指针。 + * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 + * @deprecated since 11 + * @useinstead {@link OH_NNExecutor_RunSync} + * @since 9 + * @version 1.0 + */ +OH_NN_ReturnCode OH_NNExecutor_SetOutputWithMemory(OH_NNExecutor *executor, + uint32_t outputIndex, + const OH_NN_Memory *memory); + #ifdef __cplusplus } #endif // __cplusplus diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_compat.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_compat.h deleted file mode 100644 index 2c3b722f..00000000 --- a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_compat.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup NeuralNeworkRuntime - * @{ - * - * @brief 提供Neural Network Runtime加速模型推理的相关接口。 - * - * @Syscap SystemCapability.Ai.NeuralNetworkRuntime - * @since 9 - * @version 2.0 - */ - -/** - * @file neural_network_runtime_compat.h - * - * @brief 该文件中定义的接口均为兼容先前版本的保留接口,会标记为“deprecated”并在5个版本后删除。建议使用neural_network_core.h和 - * neural_network_runtime.h定义的替代接口实现对应功能。 - * - * 注意:Neural Network Runtime的接口目前均不支持多线程并发调用.\n - * - * @library libneural_network_runtime.so - * @since 11 - * @version 1.0 - */ - -#ifndef NEURAL_NETWORK_RUNTIME_COMPAT_H -#define NEURAL_NETWORK_RUNTIME_COMPAT_H - -#include "neural_network_runtime_type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief 向模型实例中添加张量 - * - * Neural Network Runtime模型中的数据节点和算子参数均由模型的张量构成,该接口根据tensor,向model实 - * 例中添加张量。张量添加的顺序由模型中记录张量的索引值来确定,{@link OH_NNModel_SetTensorData}、 - * {@link OH_NNModel_AddOperation}和{@link OH_NNModel_SpecifyInputsAndOutputs} - * 接口根据该索引值,指定不同的张量。\n - * - * Neural Network Runtime支持动态形状输入和输出。在添加动态形状的数据节点时,需要将tensor.dimensions中支持动态 - * 变化的维度设置为-1。例如:一个四维tensor,将tensor.dimensions设置为[1, -1, 2, 2],表示其第二个维度支持 - * 动态变化。\n - * - * @param model 指向{@link OH_NNModel}实例的指针。 - * @param tensor {@link OH_NN_Tensor}张量的指针,tensor指定了添加到模型实例中张量的属性。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @deprecated since 11 - * @useinstead {@link OH_NNModel_AddTensorToModel} - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNModel_AddTensor(OH_NNModel *model, const OH_NN_Tensor *tensor); - -/** - * @brief 设置模型单个输入的数据。 - * - * 该接口将dataBuffer中,长度为length个字节的数据,拷贝到底层硬件的共享内存。inputIndex指定设置的输入,tensor用于设置输入的 - * 形状、类型、量化参数等信息。\n - * - * 由于Neural Network Runtime支持动态输入形状的模型,在固定形状输入和动态形状输入的场景下,该接口采取不同的处理策略: - * - * - 固定形状输入的场景:tensor各属性必须和构图阶段调用{@link OH_NNModel_AddTensor}添加的张量保持一致; - * - 动态形状输入的场景:在构图阶段,由于动态输入的形状不确定,调用该接口时,要求tensor.dimensions中的每个值必须大于0, - * 以确定执行计算阶段输入的形状。设置形状时,只允许调整数值为-1的维度。假设在构图阶段,输入A的维度为 - * [-1, 224, 224, 3],调用该接口时,只能调整第一个维度的尺寸,如:[3, 224, 224, 3]。调整其他维度将返回 - * {@link OH_NN_INVALID_PARAMETER}。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在设置输入的阶段, - * 三个输入的索引值分别为{0, 1, 2}。 - * @param tensor 设置输入数据对应的张量。 - * @param dataBuffer 指向输入数据的指针。 - * @param length 数据缓冲区的字节长度。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @deprecated since 11 - * @useinstead {@link OH_NNExecutor_RunSync} - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_SetInput(OH_NNExecutor *executor, - uint32_t inputIndex, - const OH_NN_Tensor *tensor, - const void *dataBuffer, - size_t length); - -/** - * @brief 设置模型单个输出的缓冲区。 - * - * 该接口将dataBuffer指向的缓冲区与outputIndex指定的输出绑定,缓冲区的长度由length指定。\n - * - * 调用{@link OH_NNExecutor_Run}完成单次模型推理后,Neural Network Runtime将比对dataBuffer指向的缓冲区与 - * 输出数据的长度,根据不同情况,返回不同结果:\n - * - * - 如果缓冲区大于或等于数据长度:则推理后的结果将拷贝至缓冲区,并返回{@link OH_NN_SUCCESS},可以通过访问dataBuffer读取推理结果。 - * - 如果缓冲区小于数据长度:则{@link OH_NNExecutor_Run}将返回{@link OH_NN_INVALID_PARAMETER}, - * 并输出日志告知缓冲区太小的信息。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在设置输出缓冲区时, - * 三个输出的索引值分别为{0, 1, 2}。 - * @param dataBuffer 指向输出数据的指针。 - * @param length 数据缓冲区的字节长度。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @deprecated since 11 - * @useinstead {@link OH_NNExecutor_RunSync} - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_SetOutput(OH_NNExecutor *executor, - uint32_t outputIndex, - void *dataBuffer, - size_t length); - -/** - * @brief 执行推理。 - * - * 在执行器关联的硬件上,执行模型的端到端推理计算。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @deprecated since 11 - * @useinstead {@link OH_NNExecutor_RunSync} - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_Run(OH_NNExecutor *executor); - -/** - * @brief 在硬件上为单个输入申请共享内存。 - * - * Neural Network Runtime 提供主动申请硬件共享内存的方法。通过指定执行器和输入索引值,该接口在单个输入关联的硬件 - * 上,申请大小为length的共享内存,通过{@link OH_NN_Memory}实例返回。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在申请输入内存时, - * 三个输入的索引值分别为{0, 1, 2}。 - * @param length 申请的内存字节。 - * @return 指向{@link OH_NN_Memory}实例的指针。 - * @deprecated since 11 - * @useinstead {@link OH_NNTensor_CreateWithSize} - * @since 9 - * @version 1.0 - */ -OH_NN_Memory *OH_NNExecutor_AllocateInputMemory(OH_NNExecutor *executor, uint32_t inputIndex, size_t length); - -/** - * @brief 在硬件上为单个输出申请共享内存。 - * - * Neural Network Runtime 提供主动申请硬件共享内存的方法。通过指定执行器和输出索引值,该接口在单个输出关联的硬件 - * 上,申请大小为length的共享内存,通过{@link OH_NN_Memory}实例返回。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在申请输出内存时, - * 三个输出的索引值分别为{0, 1, 2}。 - * @param length 申请的内存字节。 - * @return 指向{@link OH_NN_Memory}实例的指针。 - * @deprecated since 11 - * @useinstead {@link OH_NNTensor_CreateWithSize} - * @since 9 - * @version 1.0 - */ -OH_NN_Memory *OH_NNExecutor_AllocateOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, size_t length); - -/** - * @brief 释放{@link OH_NN_Memory}实例指向的输入内存。 - * - * 调用{@link OH_NNExecutor_AllocateInputMemory}创建的内存实例,需要主动调用该接口进行释放,否则将造成内存泄漏。 - * inputIndex和memory的对应关系需要和创建内存实例时保持一致。\n - * - * 如果memory或*memory为空指针,该接口仅打印警告日志,不执行销毁操作。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在释放输入内存时, - * 三个输入的索引值分别为{0, 1, 2}。 - * @param memory 指向{@link OH_NN_Memory}实例的二级指针。共享内存销毁后,该接口将*memory主动设置为空指针。 - * @deprecated since 11 - * @useinstead {@link OH_NNTensor_Destroy} - * @since 9 - * @version 1.0 - */ -void OH_NNExecutor_DestroyInputMemory(OH_NNExecutor *executor, uint32_t inputIndex, OH_NN_Memory **memory); - -/** - * @brief 释放{@link OH_NN_Memory}实例指向的输出内存。 - * - * 调用{@link OH_NNExecutor_AllocateOutputMemory}创建的内存实例,需要主动调用该接口进行释放,否则将造成内存泄漏。 - * outputIndex和memory的对应关系需要和创建内存实例时保持一致。\n - * - * 如果memory或*memory为空指针,该接口仅打印警告日志,不执行销毁操作。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在释放输出内存时, - * 三个输出的索引值分别为{0, 1, 2}。 - * @param memory 指向{@link OH_NN_Memory}实例的二级指针。共享内存销毁后,该接口将*memory主动设置为空指针。 - * @deprecated since 11 - * @useinstead {@link OH_NNTensor_Destroy} - * @since 9 - * @version 1.0 - */ -void OH_NNExecutor_DestroyOutputMemory(OH_NNExecutor *executor, uint32_t outputIndex, OH_NN_Memory **memory); - -/** - * @brief 将{@link OH_NN_Memory}实例指向的硬件共享内存,指定为单个输入使用的共享内存。 - * - * 在需要自行管理内存的场景下,该接口将执行输入和{@link OH_NN_Memory}内存实例绑定。执行计算时,底层硬件从内存实例指向的共享内存 - * 中读取输入数据。通过该接口,可以实现设置输入、执行计算、读取输出的并发执行,提升数据流的推理效率。\n - * - * @param executor 指向{@link OH_NNExecutor}实例的指针。 - * @param inputIndex 输入的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输入数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,inputIndices为{1,5,9},则在指定输入的共享 - * 内存时,三个输入的索引值分别为{0, 1, 2}。 - * @param tensor 指向{@link OH_NN_Tensor}的指针,设置单个输入所对应的张量。 - * @param memory 指向{@link OH_NN_Memory}的指针。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @deprecated since 11 - * @useinstead {@link OH_NNExecutor_RunSync} - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_SetInputWithMemory(OH_NNExecutor *executor, - uint32_t inputIndex, - const OH_NN_Tensor *tensor, - const OH_NN_Memory *memory); - -/** - * @brief 将{@link OH_NN_Memory}实例指向的硬件共享内存,指定为单个输出使用的共享内存。 - * - * 在需要自行管理内存的场景下,该接口将执行输出和{@link OH_NN_Memory}内存实例绑定。执行计算时,底层硬件将计算结果直接写入内存实例指向 - * 的共享内存。通过该接口,可以实现设置输入、执行计算、读取输出的并发执行,提升数据流的推理效率。\n - * - * @param executor 执行器。 - * @param outputIndex 输出的索引值,与调用{@link OH_NNModel_SpecifyInputsAndOutputs}时输出数据的顺序一致。 - * 假设调用{@link OH_NNModel_SpecifyInputsAndOutputs}时,outputIndices为{4,6,8},则在指定输出的共享 - * 内存时,三个输出的索引值分别为{0, 1, 2}。 - * @param memory 指向{@link OH_NN_Memory}的指针。 - * @return 函数执行的结果状态。执行成功返回OH_NN_SUCCESS;失败返回具体错误码,具体失败错误码可参考{@link OH_NN_ReturnCode}。 - * @deprecated since 11 - * @useinstead {@link OH_NNExecutor_RunSync} - * @since 9 - * @version 1.0 - */ -OH_NN_ReturnCode OH_NNExecutor_SetOutputWithMemory(OH_NNExecutor *executor, - uint32_t outputIndex, - const OH_NN_Memory *memory); - -#ifdef __cplusplus -} -#endif // __cplusplus - -/** @} */ -#endif // NEURAL_NETWORK_RUNTIME_COMPAT_H diff --git a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h index 443029b6..e5da6327 100644 --- a/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/zh-cn/native_sdk/ai/neural_network_runtime/neural_network_runtime_type.h @@ -19,7 +19,6 @@ * * @brief 提供Neural Network Runtime加速模型推理的相关接口。 * - * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 * @version 2.0 */ @@ -29,7 +28,9 @@ * * @brief Neural Network Runtime定义的结构体和枚举值。 * + * 引用文件"neural_network_runtime/neural_network_runtime_type.h" * @library libneural_network_runtime.so + * @Syscap SystemCapability.Ai.NeuralNetworkRuntime * @since 9 * @version 2.0 */ @@ -45,7 +46,7 @@ extern "C" { #endif /** - * @brief 模型句柄 + * @brief 模型句柄。 * * @since 9 * @version 1.0 @@ -53,7 +54,7 @@ extern "C" { typedef struct OH_NNModel OH_NNModel; /** - * @brief 编译器句柄 + * @brief 编译器句柄。 * * @since 9 * @version 1.0 @@ -61,7 +62,7 @@ typedef struct OH_NNModel OH_NNModel; typedef struct OH_NNCompilation OH_NNCompilation; /** - * @brief 执行器句柄 + * @brief 执行器句柄。 * * @since 9 * @version 1.0 @@ -69,7 +70,7 @@ typedef struct OH_NNCompilation OH_NNCompilation; typedef struct OH_NNExecutor OH_NNExecutor; /** - * @brief 量化参数的句柄. + * @brief 量化参数的句柄。 * * @since 11 * @version 1.0 @@ -77,7 +78,7 @@ typedef struct OH_NNExecutor OH_NNExecutor; typedef struct NN_QuantParam NN_QuantParam; /** - * @brief Tensor描述的句柄. + * @brief Tensor描述的句柄。 * * @since 11 * @version 1.0 @@ -85,7 +86,7 @@ typedef struct NN_QuantParam NN_QuantParam; typedef struct NN_TensorDesc NN_TensorDesc; /** - * @brief Tensor句柄. + * @brief Tensor句柄。 * * @since 11 * @version 1.0 @@ -93,7 +94,7 @@ typedef struct NN_TensorDesc NN_TensorDesc; typedef struct NN_Tensor NN_Tensor; /** - * @brief 硬件的性能模式 + * @brief 硬件的性能模式。 * * @since 9 * @version 1.0 @@ -112,7 +113,7 @@ typedef enum { } OH_NN_PerformanceMode; /** - * @brief 模型推理任务优先级 + * @brief 模型推理任务优先级。 * * @since 9 * @version 1.0 @@ -129,7 +130,7 @@ typedef enum { } OH_NN_Priority; /** - * @brief Neural Network Runtime 定义的错误码类型 + * @brief Neural Network Runtime 定义的错误码类型。 * * @since 9 * @version 2.0 @@ -185,31 +186,34 @@ typedef enum { /** * @brief 异步推理结束后的回调处理函数句柄。 * - * 使用第一个参数userData来辨别希望获取哪一次异步推理执行,userData和调用异步推理{@link OH_NNExecutor_RunAsync}接口时 - * 传入的参数userData是一致的。使用第二个参数errCode({@link OH_NN_ReturnCode}类型)来获取该次异步推理的返回状态。 \n + * 使用参数userData来查询希望获取的那次异步推理执行。userData与调用异步推理{@link OH_NNExecutor_RunAsync}接口时 + * 传入的参数userData是一致的。使用参数errCode({@link OH_NN_ReturnCode}类型)来获取该次异步推理的返回状态。 \n * - * @param userData 异步推理执行的标识符,和调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数userData一致。 + * @param userData 异步推理执行的标识符,与调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数userData一致。 * @param errCode 该次异步推理的返回状态({@link OH_NN_ReturnCode}类型)。 - * @param output 异步推理的输出Tensor,和调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数outputTensor一致 - * @param outputCount 异步推理输出Tensor的数量,和调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数outputCount一致 + * @param outputTensor 异步推理的输出张量,与调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数outputTensor一致。 + * @param outputCount 异步推理输出张量的数量,与调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数outputCount一致。 * @since 11 * @version 1.0 */ -typedef void (*NN_OnRunDone)(void*, OH_NN_ReturnCode, void* [], int32_t); +typedef void (*NN_OnRunDone)(void *userData, OH_NN_ReturnCode errCode, void *outputTensor[], int32_t outputCount); /** - * @brief 异步推理执行期间设备驱动服务突然死亡时的回调处理函数句柄。 + * @brief 异步推理执行期间设备驱动服务异常终止时的回调处理函数句柄。 + * + * 如果该回调函数被调用,您需要重新编译模型。 \n * - * You should recompile the model if this callback function is called. 如果该回调函数被调用,你需要重新编译模型。 \n + * 使用参数userData来查询希望获取的那次异步推理执行。userData与调用异步推理{@link OH_NNExecutor_RunAsync}接口时 + * 传入的参数userData是一致的。 \n * - * @param userData 异步推理执行的标识符,和调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数userData一致。 + * @param userData 异步推理执行的标识符,与调用异步推理{@link OH_NNExecutor_RunAsync}接口时传入的参数userData一致。 * @since 11 * @version 1.0 */ -typedef void (*NN_OnServiceDied)(void*); +typedef void (*NN_OnServiceDied)(void *userData); /** - * @brief Neural Network Runtime 融合算子中激活函数的类型 + * @brief Neural Network Runtime 融合算子中激活函数的类型。 * * @since 9 * @version 1.0 @@ -224,7 +228,7 @@ typedef enum : int8_t { } OH_NN_FuseType; /** - * @brief 张量数据的排布类型 + * @brief 张量数据的排布类型。 * * @since 9 * @version 2.0 @@ -235,15 +239,15 @@ typedef enum { /** 当张量按照NCHW的格式排布数据时,使用本枚举值 */ OH_NN_FORMAT_NCHW = 1, /** 当张量按照NHWC的格式排布数据时,使用本枚举值 */ - OH_NN_FORMAT_NHWC = 2 - /** 当张量按照ND的格式排布数据时,使用本枚举值. + OH_NN_FORMAT_NHWC = 2, + /** 当张量按照ND的格式排布数据时,使用本枚举值 * @since 11 */ OH_NN_FORMAT_ND = 3 } OH_NN_Format; /** - * @brief Neural Network Runtime 支持的设备类型 + * @brief Neural Network Runtime 支持的设备类型。 * * @since 9 * @version 1.0 @@ -260,7 +264,7 @@ typedef enum { } OH_NN_DeviceType; /** - * @brief Neural Network Runtime 支持的数据类型 + * @brief Neural Network Runtime 支持的数据类型。 * * @since 9 * @version 1.0 @@ -296,7 +300,7 @@ typedef enum { /** - * @brief Neural Network Runtime 支持算子的类型 + * @brief Neural Network Runtime 支持算子的类型。 * * @since 9 * @version 1.0 @@ -1448,7 +1452,7 @@ typedef enum { } OH_NN_OperationType; /** - * @brief 张量的类型 + * @brief 张量的类型。 * * 张量通常用于设置模型的输入、输出和算子参数。作为模型(或算子)的输入和输出时,需要将张量类型设置为{@link OH_NN_TENSOR};当张量 * 作为算子参数时,需要选择除{@link OH_NN_TENSOR}以外合适的枚举值,作为张量的类型。假设正在设置{@link OH_NN_OPS_CONV2D} @@ -1651,7 +1655,7 @@ typedef enum { } OH_NN_TensorType; /** - * @brief 该结构体用于存储32位无符号整型数组 + * @brief 该结构体用于存储32位无符号整型数组。 * * @since 9 * @version 1.0 @@ -1664,7 +1668,7 @@ typedef struct OH_NN_UInt32Array { } OH_NN_UInt32Array; /** - * @brief 量化信息 + * @brief 量化信息。 * * 在量化的场景中,32位浮点型数据根据以下公式量化为定点数据: \f[ @@ -1708,7 +1712,7 @@ typedef struct OH_NN_QuantParam { } OH_NN_QuantParam; /** - * @brief 张量结构体 + * @brief 张量结构体。 * * 通常用于构造模型图中的数据节点和算子参数,在构造张量时需要明确数据类型、维数、维度信息和量化信息。 * @@ -1733,7 +1737,7 @@ typedef struct OH_NN_Tensor { } OH_NN_Tensor; /** - * @brief 内存结构体 + * @brief 内存结构体。 * * @deprecated since 11 * @useinstead {@link NN_Tensor} -- Gitee From d51ab839eb382c8921f419fb0c72883d29ecf0b1 Mon Sep 17 00:00:00 2001 From: lin-jianwu Date: Thu, 21 Dec 2023 20:52:20 +0800 Subject: [PATCH 0172/2135] update interface Signed-off-by: lin-jianwu --- zh-cn/native_sdk/graphic/external_window.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index 59036fdd..2b7ae2c5 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -352,11 +352,14 @@ int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNative * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param window 一个OHNativeWindow的结构体实例的指针 * @param buffer 一个OHNativeWindowBuffer结构体指针的指针 + * @param fenceFd 一个文件描述符的指针 + * @param matrix 表示检索到的4*4变换矩阵 * @return 返回值为0表示执行成功 * @since 11 * @version 1.0 */ -int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer); +int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer, + int *fenceFd, float matrix[16]); /** * @brief 通过OHNativeWindow将之前申请出来的OHNativeWindowBuffer返还到Buffer队列中,供下次再申请 -- Gitee From c4c00182bdbda15937f374118018f971cf354320 Mon Sep 17 00:00:00 2001 From: chengfeng27 Date: Fri, 22 Dec 2023 14:05:17 +0800 Subject: [PATCH 0173/2135] fix doc Signed-off-by: chengfeng27 --- zh-cn/native_sdk/ai/mindspore/context.h | 4 ++-- zh-cn/native_sdk/ai/mindspore/status.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/ai/mindspore/context.h b/zh-cn/native_sdk/ai/mindspore/context.h index cd236641..776b661a 100644 --- a/zh-cn/native_sdk/ai/mindspore/context.h +++ b/zh-cn/native_sdk/ai/mindspore/context.h @@ -181,10 +181,10 @@ OH_AI_API OH_AI_DeviceInfoHandle OH_AI_DeviceInfoCreate(OH_AI_DeviceType device_ OH_AI_API void OH_AI_DeviceInfoDestroy(OH_AI_DeviceInfoHandle *device_info); /** - * @brief 设置供应商的名称。 + * @brief 设置生产商的名称。 * * @param device_info 指向设备信息实例的{@link OH_AI_DeviceInfoHandle}。 - * @param provider 供应商的名称。 + * @param provider 生产商的名称。 * @since 9 */ OH_AI_API void OH_AI_DeviceInfoSetProvider(OH_AI_DeviceInfoHandle device_info, const char *provider); diff --git a/zh-cn/native_sdk/ai/mindspore/status.h b/zh-cn/native_sdk/ai/mindspore/status.h index 992223ef..72a54b2d 100644 --- a/zh-cn/native_sdk/ai/mindspore/status.h +++ b/zh-cn/native_sdk/ai/mindspore/status.h @@ -49,9 +49,15 @@ extern "C" */ enum OH_AI_CompCode { - /** Minspore Core的代码 */ + /** MindSpore Core的代码 */ OH_AI_COMPCODE_CORE = 0x00000000u, - /** Minspore Lite的代码 */ + /** MindSpore MindData的代码 */ + OH_AI_COMPCODE_MD = 0x10000000u, + /** MindSpore MindExpression的代码 */ + OH_AI_COMPCODE_ME = 0x20000000u, + /** MindSpore的代码 */ + OH_AI_COMPCODE_MC = 0x30000000u, + /** MindSpore Lite的代码 */ OH_AI_COMPCODE_LITE = 0xF0000000u, }; -- Gitee From d55952eaa3eb82c95c7acb9d3622f8fc0155dd77 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Fri, 22 Dec 2023 15:41:58 +0800 Subject: [PATCH 0174/2135] commit msg Signed-off-by: xuxuehai --- .../device_api/hdi/audio/v1_1/AudioTypes.idl | 597 ----------------- .../hdi/audio/v1_1/IAudioAdapter.idl | 333 ---------- .../hdi/audio/v1_1/IAudioCallback.idl | 88 --- .../hdi/audio/v1_1/IAudioCapture.idl | 479 -------------- .../hdi/audio/v1_1/IAudioManager.idl | 114 ---- .../hdi/audio/v1_1/IAudioRender.idl | 602 ------------------ .../hdi/codec/image/v1_0/CodecImageType.idl | 154 +++++ .../hdi/codec/image/v1_0/ICodecImage.idl | 147 +++++ .../hdi/codec/v2_0/CodecExtTypes.idl | 284 +++++++++ .../device_api/hdi/codec/v2_0/CodecTypes.idl | 376 +++++++++++ .../hdi/codec/v2_0/ICodecCallback.idl | 121 ++++ .../hdi/codec/v2_0/ICodecComponent.idl | 396 ++++++++++++ .../hdi/codec/v2_0/ICodecComponentManager.idl | 129 ++++ 13 files changed, 1607 insertions(+), 2213 deletions(-) delete mode 100644 zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioCallback.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioCapture.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioManager.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1_1/IAudioRender.idl create mode 100644 zh-cn/device_api/hdi/codec/image/v1_0/CodecImageType.idl create mode 100644 zh-cn/device_api/hdi/codec/image/v1_0/ICodecImage.idl create mode 100644 zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl create mode 100644 zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl create mode 100644 zh-cn/device_api/hdi/codec/v2_0/ICodecCallback.idl create mode 100644 zh-cn/device_api/hdi/codec/v2_0/ICodecComponent.idl create mode 100644 zh-cn/device_api/hdi/codec/v2_0/ICodecComponentManager.idl diff --git a/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl deleted file mode 100644 index 5b63e5da..00000000 --- a/zh-cn/device_api/hdi/audio/v1_1/AudioTypes.idl +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file AudioTypes.idl - * - * @brief Audio模块接口定义中使用的数据类型。 - * - * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - -/** - * @brief 音频端口的类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortDirection { - PORT_OUT = 1, /**< 音频输出端口。*/ - PORT_IN = 2, /**< 音频输入端口。 */ - PORT_OUT_IN = 3, /**< 音频输出输入端口。 */ -}; - -/** - * @brief 音频端口上的Pin脚。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortPin { - PIN_NONE = 0, /**< 无效端口。*/ - PIN_OUT_SPEAKER = 1 << 0, /**< 喇叭输出。 */ - PIN_OUT_HEADSET = 1 << 1, /**< 有线耳机输出。 */ - PIN_OUT_LINEOUT = 1 << 2, /**< Lineout输出。 */ - PIN_OUT_HDMI = 1 << 3, /**< HDMI输出。 */ - PIN_OUT_USB = 1 << 4, /**< USB输出。*/ - PIN_OUT_USB_EXT = 1 << 5, /**< USB外部声卡输出。*/ - PIN_OUT_EARPIECE = 1 << 5 | 1 << 4, /**< 有线耳机输出。 */ - PIN_OUT_BLUETOOTH_SCO = 1 << 6, /**< 蓝牙SCO输出 */ - PIN_OUT_DAUDIO_DEFAULT = 1 << 7, /**< 音频默认输出 */ - PIN_OUT_HEADPHONE = 1 << 8, /**< 有线耳机输出。*/ - PIN_OUT_USB_HEADSET = 1 << 9, /**< ARM USB输出 */ - PIN_OUT_BLUETOOTH_A2DP = 1 << 10, /**< 蓝牙A2DP输出 */ - PIN_IN_MIC = 1 << 27 | 1 << 0, /**< 麦克风输入 */ - PIN_IN_HS_MIC = 1 << 27 | 1 << 1, /**< 耳机麦克风输入 */ - PIN_IN_LINEIN = 1 << 27 | 1 << 2, /**< Linein输入。 */ - PIN_IN_USB_EXT = 1 << 27 | 1 << 3, /**< USB外部声卡输入。*/ - PIN_IN_BLUETOOTH_SCO_HEADSET = 1 << 27 | 1 << 4, /**< 蓝牙SCO耳机输入 */ - PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5, /**< 音频默认输入 */ - PIN_IN_USB_HEADSET = 1 << 27 | 1 << 6, /**< ARM USB输入 */ -}; - -/** - * @brief 音频类型(场景)。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioCategory { - AUDIO_IN_MEDIA = 0, /**< 媒体。 */ - AUDIO_IN_COMMUNICATION = 1, /**< 通信。 */ - AUDIO_IN_RINGTONE = 2, /**< 电话铃声。 */ - AUDIO_IN_CALL = 3, /**< 呼叫。 */ - AUDIO_MMAP_NOIRQ = 4, /**< Mmap模式 */ - AUDIO_OFFLOAD = 5, /**< 低功耗 */ - AUDIO_MULTI_CHANNEL = 6, /**< 多声道 */ -}; - -/** - * @brief 音频格式。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioFormat { - AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8bit位宽PCM(Pulse Code Modulation)格式。*/ - AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16bit位宽PCM格式。 */ - AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24bit位宽PCM格式。 */ - AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32bit位宽PCM格式。*/ - AUDIO_FORMAT_TYPE_PCM_FLOAT = 1 << 2 | 1 << 0, /**< PCM浮点格式 */ - AUDIO_FORMAT_TYPE_MP3 = 1 << 24, /**< MP3格式 */ - AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main格式 */ - AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC格式 */ - AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD格式 */ - AUDIO_FORMAT_TYPE_AAC_ELD = 1 << 24 | 1 << 2, /**< AAC ELD格式 */ - AUDIO_FORMAT_TYPE_AAC_HE_V1 = 1 << 24 | 1 << 2 | 1 << 0, /**< AAC HE_V1格式 */ - AUDIO_FORMAT_TYPE_AAC_HE_V2 = 1 << 24 | 1 << 2 | 1 << 1, /**< AAC HE_V2格式 */ - AUDIO_FORMAT_TYPE_G711A = 1 << 25 | 1 << 0, /**< PCM G711A格式 */ - AUDIO_FORMAT_TYPE_G711U = 1 << 25 | 1 << 1, /**< PCM G711u格式 */ - AUDIO_FORMAT_TYPE_G726 = 1 << 25 | 1 << 1 | 1 << 0, /**< PCM G726格式 */ -}; - -/** - *@brief 音频通道掩码。 - * - * 定义音频声道的位置掩码。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioChannelMask { - AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。 */ - AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< 声道布局前右。*/ - AUDIO_CHANNEL_MONO = 1, /**< 单声道。 */ - AUDIO_CHANNEL_STEREO = 3, /**< 立体声,由左右声道组成。 */ -}; - -/** - * @brief 音频采样频率掩码。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioSampleRatesMask { - AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< 无效的采样频率。 */ -}; - -/** - * @brief 音频端口的数据透传模式。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortPassthroughMode { - PORT_PASSTHROUGH_LPCM = 1 << 0, /**< 立体声PCM。*/ - PORT_PASSTHROUGH_RAW = 1 << 1, /**< HDMI透传。 */ - PORT_PASSTHROUGH_HBR2LBR = 1 << 2, /**< 蓝光次世代音频降规格输出。 */ - PORT_PASSTHROUGH_AUTO = 1 << 3, /**< 根据HDMI EDID能力自动匹配。 */ -}; - -/** - * @brief 原始音频样本格式。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioSampleFormat { - AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 32bit位宽浮点型非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F64P = 23, /**< 64bit位宽双精度浮点型非交织样本。 **/ -}; - -/** - * @brief 音频播放的通道模式。 - * - * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioChannelMode { - AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。 */ - AUDIO_CHANNEL_BOTH_LEFT = 1, /**< 两个声道全部为左声道声音。 */ - AUDIO_CHANNEL_BOTH_RIGHT = 2, /**< 两个声道全部为右声道声音。 */ - AUDIO_CHANNEL_EXCHANGE = 3, /**< 左右声道数据互换,左声道为右声道声音,右声道为左声道声音。*/ - AUDIO_CHANNEL_MIX = 4, /**< 左右两个声道输出为左右声道相加(混音)。 */ - AUDIO_CHANNEL_LEFT_MUTE = 5, /**< 左声道静音,右声道播放原右声道声音。 */ - AUDIO_CHANNEL_RIGHT_MUTE = 6, /**< 右声道静音,左声道播放原左声道声音。 */ - AUDIO_CHANNEL_BOTH_MUTE = 7, /**< 左右声道均静音。*/ -}; - -/** - * @brief 音频数据结束类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioDrainNotifyType { - AUDIO_DRAIN_NORMAL_MODE = 0, /**< 曲目的所有数据播放完就结束。 */ - AUDIO_DRAIN_EARLY_MODE = 1, /**< 曲目的所有数据未播放完就结束,以便给音频服务做连续性曲目切换留出时间。 */ -}; - -/** - * @brief 回调函数通知事件类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioCallbackType { - AUDIO_NONBLOCK_WRITE_COMPELETED = 0, /**< 非阻塞式写完成。 */ - AUDIO_DRAIN_COMPELETED = 1, /**< DrainBuffer完成,详情参考{@link DrainBuffer}。 */ - AUDIO_FLUSH_COMPLETED = 2, /**< Flush完成,详情参考{@link Flush}。 */ - AUDIO_RENDER_FULL = 3, /**< 录音缓冲区已满。 */ - AUDIO_ERROR_OCCUR = 4, /**< 发生了错误。 */ -}; - -/** - * @brief 音频端口角色。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortRole { - AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。 */ - AUDIO_PORT_SOURCE_ROLE = 1, /**< 指定端口为发送端角色。 */ - AUDIO_PORT_SINK_ROLE = 2, /**< 指定端口为接受端角色。 */ -}; - -/** - * @brief 音频端口类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortType { - AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。 */ - AUDIO_PORT_DEVICE_TYPE = 1, /**< 指定端口为设备类型。 */ - AUDIO_PORT_MIX_TYPE = 2, /**< 指定端口为复合类型。 */ - AUDIO_PORT_SESSION_TYPE = 3, /**< 指定端口为会话类型。 */ -}; - -/** - * @brief 端口会话类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioSessionType { - AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。 */ - AUDIO_OUTPUT_MIX_SESSION = 1, /**< 会话绑定到特定音轨。 */ - AUDIO_ALLOCATE_SESSION = 2, /**< 会话ID需重新申请。 */ - AUDIO_INVALID_SESSION = 3, /**< 无效会话类型。 */ -}; - -/** - * @brief 音频设备类型。 - */ -enum AudioDeviceType { - AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。 */ - AUDIO_HEADPHONE = 1 << 1, /**< 耳机。 */ - AUDIO_HEADSET = 1 << 2, /**< 头戴式耳机。 */ - AUDIO_USB_HEADSET = 1 << 3, /**< USB头戴式耳机。 */ - AUDIO_USB_HEADPHONE = 1 << 4, /**< USB耳机。 */ - AUDIO_USBA_HEADSET = 1 << 5, /**< USB模拟头戴式耳机。 */ - AUDIO_USBA_HEADPHONE = 1 << 6, /**< USB模拟耳机。 */ - AUDIO_PRIMARY_DEVICE = 1 << 7, /**< 主音频设备。 */ - AUDIO_USB_DEVICE = 1 << 8, /**< USB音频设备。 */ - AUDIO_A2DP_DEVICE = 1 << 9, /**< 蓝牙音频设备。 */ - AUDIO_HDMI_DEVICE = 1 << 10, /**< HDMI音频设备 */ - AUDIO_ADAPTER_DEVICE = 1 << 11, /**< 声卡设备 */ - AUDIO_DEVICE_UNKNOWN, /**< 未知设备。 */ -}; - -/** - * @brief 音频事件类型。 - */ -enum AudioEventType { - AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。 */ - AUDIO_DEVICE_REMOVE = 2, /**< 音频设备移除。 */ - AUDIO_LOAD_SUCCESS = 3, /**< 声卡加载成功。 */ - AUDIO_LOAD_FAILURE = 4, /**< 声卡加载失败。 */ - AUDIO_UNLOAD = 5, /**< 声卡卸载。 */ - AUDIO_SERVICE_VALID = 7, /**< 音频服务可用。 */ - AUDIO_SERVICE_INVALID = 8, /**< 音频服务不可用。 */ - AUDIO_CAPTURE_THRESHOLD = 9, /**< 录音阈值上报。 */ - AUDIO_EVENT_UNKNOWN = 10, /**< 未知事件。 */ -}; - -/** - * @brief 音频扩展参数键类型。 - */ -enum AudioExtParamKey { - AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。 */ - AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< 分布式音频-音量事件。 */ - AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< 分布式音频-焦点事件。 */ - AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< 分布式音频-媒体按钮事件。 */ - AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< 分布式音频-音频效果事件。 */ - AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< 分布式音频-设备状态事件。 */ - AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< USB设备类型( ARM 或 HIFI)*/ - AUDIO_EXT_PARAM_KEY_PERF_INFO = 201, /**< 分布式音频-dsp加载事件。 */ - AUDIO_EXT_PARAM_KEY_MMI = 301, /**< 分布式音频-主机接口测试。 */ - AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< 低电量事件。 */ -}; - -/** - * @brief 音频设备状态。 - */ -struct AudioDeviceStatus { - unsigned int pnpStatus; /**< PnP设备状态,详情参考{@link AudioDeviceType},{@link AudioEventType}。 */ -}; - -/** - * @brief 音频场景描述。 - */ -union SceneDesc { - unsigned int id; /**< 音频场景的ID,详情参考{@link AudioCategory}。*/ -}; - -/** - * @brief 音频端口。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioPort { - enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。 */ - unsigned int portId; /**< 音频端口的ID。 */ - String portName; /**< 音频端口的名称。 */ -}; - -/** - * @brief 音频适配器描述符。 - * - * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, - * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioAdapterDescriptor { - String adapterName; /**< 音频适配器的名称。 */ - struct AudioPort[] ports; /**< 一个音频适配器支持的端口列表,详情参考{@link AudioPort}。 */ -}; - -/** - * @brief 音频设备描述符。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioDeviceDescriptor { - unsigned int portId; /**< 音频端口ID。 */ - enum AudioPortPin pins; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ - String desc; /**< 以字符串命名的音频设备。 */ -}; - -/** - * @brief 音频场景描述符。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioSceneDescriptor { - union SceneDesc scene; /**< 音频场景描述,详情参考{@link SceneDesc}。 */ - struct AudioDeviceDescriptor desc; /**< 音频设备描述符,详情参考{@link AudioDeviceDescriptor}。 */ -}; - -/** - * @brief 音频输入类型. - */ -enum AudioInputType { - AUDIO_INPUT_DEFAULT_TYPE = 0, /**< 默认输入 */ - AUDIO_INPUT_MIC_TYPE = 1 << 0, /**< 麦克风输入 */ - AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, /**< 语音唤醒输入 */ - AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, /**< 通话 */ - AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< 声音识别 */ - AUDIO_INPUT_VOICE_UPLINK_TYPE = 1 << 4, /**< 上行输入 */ - AUDIO_INPUT_VOICE_DOWNLINK_TYPE = 1 << 5, /**< 下行输入 */ - AUDIO_INPUT_VOICE_CALL_TYPE = 1 << 6, /**< 电话 */ - AUDIO_INPUT_CAMCORDER_TYPE = 1 << 7, /**< 摄像机输入 */ -}; - -/** - * @brief 音频低功耗属性 - */ -struct AudioOffloadInfo -{ - unsigned int sampleRate; /**< 采样率 */ - unsigned int channelCount; /**< 声道数 */ - unsigned int bitRate; /**< 比特率 */ - unsigned int bitWidth; /**< 比特位宽 */ - enum AudioFormat format; /**< 音频格式 */ - unsigned int offloadBufferSize; /**< 音频数据缓存长度 */ - unsigned long duration; /** 音频持续时间,单位纳秒*/ -}; - -/** - * @brief 音频采样属性。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioSampleAttributes { - enum AudioCategory type; /**< 音频类型,详情参考{@link AudioCategory}。 */ - boolean interleaved; /**< 音频数据交织的标记。 */ - enum AudioFormat format; /**< 音频数据格式,详情参考{@link AudioFormat}。 */ - unsigned int sampleRate; /**< 音频采样频率。 */ - unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。*/ - unsigned int period; /**< 音频采样周期,单位赫兹。 */ - unsigned int frameSize; /**< 音频数据的帧大小。 */ - boolean isBigEndian; /**< 音频数据的大端标志。 */ - boolean isSignedData; /**< 音频数据有符号或无符号标志。 */ - unsigned int startThreshold; /**< 音频播放起始阈值。 */ - unsigned int stopThreshold; /**< 音频播放停止阈值。 */ - unsigned int silenceThreshold; /**< 录音缓冲区阈值。 */ - int streamId; /**< 录音或播放的标识符。 */ - int sourceType; /**< 播放或录音的音源类型 */ - struct AudioOffloadInfo offloadInfo; /**< offload流信息 */ -}; - -/** - * @brief 音频时间戳。 - * - * 时间定义,POSIX timespec的替代品。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioTimeStamp { - long tvSec; /**< tvSec时间,单位:秒。 */ - long tvNSec; /**< tvNSec时间,单位:纳秒。 */ -}; - -/** - * @brief 音频子端口的支持能力。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioSubPortCapability { - unsigned int portId; /**< 子端口ID。 */ - String desc; /**< 以字符串命名的子端口。 */ - enum AudioPortPassthroughMode mask; /**< 数据透传模式,详情参考{@link AudioPortPassthroughMode}。 */ -}; - -/** - * @brief 音频端口的支持能力。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioPortCapability { - unsigned int deviceType; /**< 设备输出、输入类型。 */ - unsigned int deviceId; /**< 设备ID,唯一的设备识别符。 */ - boolean hardwareMode; /**< 是否支持设备绑定处理。 */ - unsigned int formatNum; /**< 支持的音频格式数目。 */ - enum AudioFormat[] formats; /**< 支持的音频格式,详情参考{@link AudioFormat}。 */ - unsigned int sampleRateMasks; /**< 支持的音频采样频率(8k、16k、32k、48k)。 */ - enum AudioChannelMask channelMasks; /**< 设备的声道布局掩码,详情参考{@link AudioChannelMask}。 */ - unsigned int channelCount; /**< 最大支持的声道总数。 */ - struct AudioSubPortCapability[] subPorts; /**< 支持的子端口列表,详情参考{@link AudioSubPortCapability}。 */ - enum AudioSampleFormat[] supportSampleFormats; /**< 支持的采样率列表,详情参考{@link AudioSampleFormat}。 */ -}; - -/** - * @brief mmap缓冲区描述符。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioMmapBufferDescripter { - byte[] memoryAddress; /**< 指向mmap缓冲区的指针。 */ - FileDescriptor memoryFd; /**< mmap缓冲区的文件描述符。 */ - int totalBufferFrames; /**< 缓冲区总大小,单位:帧。 */ - int transferFrameSize; /**< 传输大小,单位:帧。 */ - int isShareable; /**< mmap缓冲区是否可以在进程间共享。 */ - unsigned int offset; /**< 文件偏移。 */ - String filePath; /**< mmap文件路径。 */ -}; - -/** - * @brief 音频设备拓展信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioDevExtInfo { - int moduleId; /**< 音频流绑定的模块ID。 */ - enum AudioPortPin type; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ - String desc; /**< 地址描述。 */ -}; - -/** - * @brief 音轨拓展信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioMixExtInfo { - int moduleId; /**< 流所属模块标识符。 */ - int streamId; /**< 由调用者传递的Render或Capture标识符。 */ -}; - -/** - * @brief 会话拓展信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioSessionExtInfo { - enum AudioSessionType sessionType; /**< 音频会话类型,详情参考{@link AudioSessionType}。 */ -}; - -/** - * @brief 音频端口特定信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioInfo { - struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。 */ - struct AudioMixExtInfo mix; /**< 音轨特定信息,详情参考{@link AudioMixExtInfo}。 */ - struct AudioSessionExtInfo session; /**< 会话特定信息,详情参考{@link AudioSessionExtInfo}。 */ -}; - -/** - * @brief 音频路由节点。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioRouteNode { - int portId; /**< 音频端口ID。 */ - enum AudioPortRole role; /**< 指定端口角色为发送端或接收端,详情参考{@link AudioPortRole}。 */ - enum AudioPortType type; /**< 指定端口类型可以为设备类型、复合类型、绘画类型,详情参考{@link AudioPortType}。 */ - struct AudioInfo ext; /**< 音频端口特定信息,详情参考{@link AudioInfo}。 */ -}; - -/** - * @brief 音频路由信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioRoute { - struct AudioRouteNode[] sources; /**< 发送端列表,详情参考{@link AudioRouteNode}。 */ - struct AudioRouteNode[] sinks; /**< 接受端列表,详情参考{@link AudioRouteNode}。 */ -}; - -/** - * @brief 音频事件。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioEvent { - unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。 */ - unsigned int deviceType; /**< 设备类型,详情参考{@link enum AudioDeviceType}。 */ -}; -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl deleted file mode 100644 index 22c45510..00000000 --- a/zh-cn/device_api/hdi/audio/v1_1/IAudioAdapter.idl +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioAdapter.idl - * - * @brief Audio适配器的接口定义文件。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioRender; -import ohos.hdi.audio.v1_1.IAudioCapture; -import ohos.hdi.audio.v1_1.IAudioCallback; - -/** - * @brief AudioAdapter音频适配器接口。 - * - * 提供音频适配器(声卡)对外支持的驱动能力,包括初始化端口、创建放音、创建录音、获取端口能力集等。 - * - * @see IAudioRender - * @see IAudioCapture - * - * @since 4.1 - * @version 1.1 - */ -interface IAudioAdapter { - /** - * @brief 初始化一个音频适配器所有的端口驱动。 - * 在音频服务中,调用其他驱动接口前需要先调用该接口检查端口是否已经初始化完成,如果端口没有初始化完成, - * 则需要等待一段时间(例如100ms)后重新进行检查,直到端口初始化完成后再继续操作。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * - * @return 初始化完成返回值0,初始化失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - InitAllPorts(); - - /** - * @brief 创建一个音频播放接口的对象。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 - * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 - * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@link IAudioRender}。 - * @param renderId 获取的音频播放接口序号。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetPortCapability - * @see DestroyRender - * - * @since 4.1 - * @version 1.1 - */ - CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, - [out] IAudioRender render, [out] unsigned int renderId); - - /** - * @brief 销毁一个音频播放接口的对象。 - * - * @attention 在音频播放过程中,不能销毁该接口对象。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param renderId 待销毁的音频播放接口的序号 - * - * @return 成功返回值0,失败返回负值。 - * @see CreateRender - * - * @since 4.1 - * @version 1.1 - */ - DestroyRender([in] unsigned int renderId); - - /** - * @brief 创建一个音频录音接口的对象。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 - * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 - * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@link IAudioCapture}。 - * @param captureId 获取的音频录音接口的序号 - * @return 成功返回值0,失败返回负值。 - * - * @see GetPortCapability - * @see DestroyCapture - - * @since 4.1 - * @version 1.1 - */ - CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, - [out] IAudioCapture capture, [out] unsigned int captureId); - - /** - * @brief 销毁一个音频录音接口的对象。 - * - * @attention 在音频录音过程中,不能销毁该接口对象。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param captureId 待销毁的音频录音接口的序号 - * - * @return 成功返回值0,失败返回负值。 - * @see CreateCapture - * - * @since 4.1 - * @version 1.1 - */ - DestroyCapture([in] unsigned int captureId); - - /** - * @brief 获取一个音频适配器的端口驱动的能力集。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param port 待获取的端口,详请参考{@link AudioPort}。 - * @param capability 获取的端口能力保存到capability中,详请参考{@link AudioPortCapability}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); - - /** - * @brief 设置音频端口驱动的数据透传模式。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param port 待设置的端口,详请参考{@link AudioPort}。 - * @param mode 待设置的传输模式,详请参考{@link AudioPortPassthroughMode}。 - * @return 成功返回值0,失败返回负值。 - * @see GetPassthroughMode - * - * @since 4.1 - * @version 1.1 - */ - SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); - - /** - * @brief 获取音频端口驱动的数据透传模式。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param port 待获取的端口,详请参考{@link AudioPort}。 - * @param mode 获取的传输模式保存到mode中,详请参考{@link AudioPortPassthroughMode}。 - * @return 成功返回值0,失败返回负值。 - * @see SetPassthroughMode - * - * @since 4.1 - * @version 1.1 - */ - GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); - - /** - * @brief 获取一个音频适配器的设备状态。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param status 获取的设备状态保存到status中,详请参考{@link AudioDeviceStatus}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetDeviceStatus([out] struct AudioDeviceStatus status); - - /** - * @brief 更新音频路由。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param route 待更新的路由,详请参考{@link AudioRoute}。 - * @param routeHandle 更新后的音频路由句柄保存到routeHandle中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); - - /** - * @brief 释放音频路由。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param routeHandle 待释放的音频路由句柄。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - ReleaseAudioRoute([in] int routeHandle); - - /** - * @brief 设置音频静音。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param mute 表示是否将音频静音,true表示静音,false表示非静音。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetMicMute - * - * @since 4.1 - * @version 1.1 - */ - SetMicMute([in] boolean mute); - - /** - * @brief 获取音频静音状态。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param mute 获取的静音状态保存到mute中,true表示静音,false表示非静音。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetMicMute - * - * @since 4.1 - * @version 1.1 - */ - GetMicMute([out] boolean mute); - - /** - * @brief 设置语音呼叫的音量。 - * - * 音量范围从0.0到1.0。如果音频服务中的音量水平在0到15的范围内, - * 0.0表示音频静音,1.0指示最大音量级别(15)。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param volume 待设置的音量值,范围为(0.0-1.0),0.0表示最小音量值,1.0表示最大音量值。 - * @return 成功返回值0,失败返回负值。 - * @see GetVolume - * - * @since 4.1 - * @version 1.1 - */ - SetVoiceVolume([in] float volume); - - /** - * @brief 根据指定的条件设置音频拓展参数。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 - * @param condition 指定的扩展参数查询条件。 - * @param value 指定的扩展参数条件值。 - * - * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 - * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: - * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" - * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 - * VOLUME_GROUP_ID 表示待设置的音频扩展参数相关的音量组。 - * AUDIO_VOLUME_TYPE 表示待设置的音频扩展参数相关的音量类型。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); - - /** - * @brief 根据指定条件获取音频扩展参数的取值。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 - * @param condition 指定的扩展参数查询条件。 - * @param value 待返回的指定扩展参数条件的当前值。 - * @param lenth value的长度 - * - * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 - * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: - * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" - * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 - * VOLUME_GROUP_ID 表示待查询的音频扩展参数相关的音量组。 - * AUDIO_VOLUME_TYPE 表示待查询的音频扩展参数相关的音量类型。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); - - /** - * @brief 注册扩展参数回调函数。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param callback 待注册的回调函数,详请参考{@link AudioCallback}。 - * @param cookie 用于传递数据。 - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); -} -/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioCallback.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioCallback.idl deleted file mode 100644 index 295010ef..00000000 --- a/zh-cn/device_api/hdi/audio/v1_1/IAudioCallback.idl +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audioģӿڶ塣 - * - * Ƶӿ漰͡ؽӿڡӿڡƵŽӿڡƵ¼ӿڵȡ - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioCallback.idl - * - * @brief AudioŵĻصļ - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief Ƶӿڵİ· - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - -import ohos.hdi.audio.v1_1.AudioTypes; - -/** - * @brief Audioصӿڡ - * - * @since 4.1 - * @version 1.1 - */ -[callback] interface IAudioCallback { - - /** - * @brief ص - * - * @param type ص֪ͨ¼ͣο{@link AudioCallbackType} - * @param reserved ֶΡ - * @param cookie ڴݡ - * - * @return ɹֵ0ʧܷظֵ - * - * @see RegCallback - * - * @since 4.1 - * @version 1.1 - */ - RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); - /** - * @brief Ƶչص - * - * @param key չͣο{@link AudioExtParamKey} - * @param condition չ - * @param value չֵ - * @param reserved ֶΡ - * @param cookie ڴݡ - * - * @return ɹֵ0ʧܷظֵ - * - * @see ParamCallback - * - * @since 4.1 - * @version 1.1 - */ - ParamCallback([in] enum AudioExtParamKey key, [in] byte condition, [in] byte value, [out] byte reserved, [out] byte cookie); -} -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioCapture.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioCapture.idl deleted file mode 100644 index d99f4491..00000000 --- a/zh-cn/device_api/hdi/audio/v1_1/IAudioCapture.idl +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audioģӿڶ塣 - * - * Ƶӿ漰͡ؽӿڡӿڡƵŽӿڡƵ¼ӿڵȡ - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioCapture.idl - * - * @brief Audio¼Ľӿڶļ - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief Ƶӿڵİ· - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_0; - -import ohos.hdi.audio.v1_1.AudioTypes; - - -/** - * @brief AudioCaptureƵ¼ӿڡ - * - * ṩƵ¼ֵ֧ƵơƵԡƵƵ¼Ƶ֡ݵȡ - * - * @since 4.1 - * @version 1.1 - */ -interface IAudioCapture { - /** - * @brief Ƶ¼һ֡ݣ¼Ƶݣ - * - * @param capture õǰIAudioCaptureָ - * @param frame ݵƵframe - * @param requestBytes ݵƵframeСֽ - * @param replyBytes ָҪȡƵݵʵʳȣֽΪλָ롣 - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); - - /** - * @brief Obtains the last number of input audio frames. - * - * @param capture õǰIAudioCaptureָ - * @param frames ȡƵ֡浽framesС - * @param time ȡĹʱ浽timeУο{@link AudioTimeStamp} - * @return ɹֵ0ʧܷظֵ - * @see CaptureFrame - * - * @since 4.1 - * @version 1.1 - */ - GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief жijƵǷ֧֡ - * - * @param scene жϵƵο{@link AudioSceneDescriptor} - * @param supported Ƿֵ֧״̬浽supportedУtrueʾ֧֣falseʾ֧֡ - * - * @return ɹֵ0ʧܷظֵ - * - * @see SelectScene - * - * @since 4.1 - * @version 1.1 - */ - CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); - - /** - * @brief ѡƵ - * - *
      - *
    • ѡһdzƵӦó豸ϣͬʹֻеΪ豸 - *
        - *
      • ý岥ųУsceneΪmedia_speaker
      • - *
      • ͨ᳡УsceneΪvoice_speaker
      • - *
      - *
    • ֻѡһƵʹóΪý岥ţmediaӰţmovieϷţgame
    • - *
    • ֻѡһƵ豸豸ΪͲreceiverȣspeaker߶headset
    • - *
    - * - * @param scene õƵο{@link AudioSceneDescriptor} - * - * @return ɹֵ0ʧܷظֵ - * - * @see CheckSceneCapability - * - * @since 4.1 - * @version 1.1 - */ - SelectScene([in] struct AudioSceneDescriptor scene); - - /** - * @brief Ƶľ״̬ - * - * @param mute õľ״̬trueʾfalseʾȡ - * - * @return ɹֵ0ʧܷظֵ - * - * @see GetMute - * - * @since 4.1 - * @version 1.1 - */ - SetMute([in] boolean mute); - - /** - * @brief ȡƵľ״̬ - * - * @param mute ȡľ״̬浽muteУtrueʾfalseʾȡ - * - * @return ɹֵ0ʧܷظֵ - * - * @see SetMute - * - * @since 4.1 - * @version 1.1 - */ - GetMute([out] boolean mute); - - /** - * @brief һƵ - * - * ȡֵΧ0.0~1.0ƵеȼΧ0 ~ 15 - * ӳϵΪ0.00ʾ1.015ʾȼ - * - * @param volume õΧ0.0~1.0 - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - SetVolume([in] float volume); - - /** - * @brief ȡһƵ - * - * @param volume ȡ浽volumeУΧ0.0~1.0 - * - * @return ɹֵ0ʧܷظֵ - * - * @see SetVolume - * - * @since 4.1 - * @version 1.1 - */ - GetVolume([out] float volume); - - /** - * @brief ȡƵֵ - * - * ھĹʵУԸоƬƽ̨ʵд - * - *
      - *
    • ʹʵʵֵķΧΪ-50db ~ 6db
    • - *
    • ҲԽ淶Χ趨Ϊ0.0~1.0ķΧΪ-50db ~ 6db - * ӳϵΪ0.0ʾ-50db1.0ʾ棨6db
    • - *
    - * - * @param min ȡƵֵޱ浽minС - * @param max ȡƵֵޱ浽maxС - * - * @return ɹֵ0ʧܷظֵ - * - * @see GetGain - * @see SetGain - * - * @since 4.1 - * @version 1.1 - */ - GetGainThreshold([out] float min, [out] float max); - - /** - * @brief ȡƵ档 - * - * @param gain 浱ǰȡ浽gainС - * - * @return ɹֵ0ʧܷظֵ - * - * @see GetGainThreshold - * @see SetGain - * - * @since 4.1 - * @version 1.1 - */ - GetGain([out] float gain); - - /** - * @brief Ƶ档 - * - * @param gain õ棬СΪ0.0Ϊ1.0 - * - * @return ɹֵ0ʧܷظֵ - * - * @see GetGainThreshold - * @see GetGain - * - * @since 4.1 - * @version 1.1 - */ - SetGain([in] float gain); - - /** - * @brief ȡһ֡ƵݵijȣֽС - * - * @param size ȡƵ֡Сֽ浽sizeС - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - GetFrameSize([out] unsigned long size); - - /** - * @brief ȡƵbufferеƵ֡ - * - * @param count һƵbufferаƵ֡ȡ󱣴浽countС - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - GetFrameCount([out] unsigned long count); - - /** - * @brief ƵԲ - * - * @param attrs õƵԣƵʡȡͨο{@link AudioSampleAttributes} - * - * @return ɹֵ0ʧܷظֵ - * - * @see GetSampleAttributes - * - * @since 4.1 - * @version 1.1 - */ - SetSampleAttributes([in] struct AudioSampleAttributes attrs); - - /** - * @brief ȡƵԲ - * - * @param attrs ȡƵԣƵʡȡͨ浽attrsУο{@link AudioSampleAttributes} - * - * @return ɹֵ0ʧܷظֵ - * - * @see SetSampleAttributes - * - * @since 4.1 - * @version 1.1 - */ - GetSampleAttributes([out] struct AudioSampleAttributes attrs); - - /** - * @brief ȡƵͨID - * - * @param channelId ȡͨID浽channelIdС - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - GetCurrentChannelId([out] unsigned int channelId); - - /** - * @brief Ƶչ - * - * @param keyValueList չֵַбʽΪkey=valueֵֺͨŷָ - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - SetExtraParams([in] String keyValueList); - - /** - * @brief ȡƵչ - * - * @param keyValueList չֵַбʽΪkey=valueֵֺͨŷָ - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - GetExtraParams([out] String keyValueList); - - /** - * @brief mmap - * - * @param reqSize 󻺳ĴСλֽڡ - * @param desc ο{@link AudioMmapBufferDescripter} - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); - - /** - * @brief ȡǰmmapĶ/дλá - * - * @param frames ȡƵ֡浽framesС - * @param time ȡĹʱ浽timeУο{@link AudioTimeStamp} - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief ƵЧ - * - * @param effectid ӵƵЧʵʶ - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - AddAudioEffect([in] unsigned long effectid); - - /** - * @brief ƳƵЧ - * - * @param effectid ƳƵЧʵʶ - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - RemoveAudioEffect([in] unsigned long effectid); - - /** - * @brief ȡС - * - * @param bufferSize ȡĻСbufferSizeУλΪֽڡ - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - GetFrameBufferSize([out] unsigned long bufferSize); - - /** - * @brief һƵݼ - * - * @return ɹֵ0ʧܷظֵ - * - * @see Stop - * - * @since 4.1 - * @version 1.1 - */ - Start(); - - /** - * @brief ֹͣһƵݼ - * - * @return ɹֵ0ʧܷظֵ - * - * @see Start - * - * @since 4.1 - * @version 1.1 - */ - Stop(); - - /** - * @brief ͣһƵݼ - * - * @return ɹֵ0ʧܷظֵ - * - * @see Resume - * - * @since 4.1 - * @version 1.1 - */ - Pause(); - - /** - * @brief ָһƵݼ - * - * @return ɹֵ0ʧܷظֵ - * - * @see Pause - * - * @since 4.1 - * @version 1.1 - */ - Resume(); - - /** - * @brief ˢƵbufferеݡ - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - Flush(); - - /** - * @brief ûȥ豸Ĵģʽ - * - * @return 豸ģʽɹֵ0ٴִкȥôģʽɹֵʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - TurnStandbyMode(); - - /** - * @brief Ƶ豸Ϣ - * - * @param range ҪϢΧ3 ~ 5ΪҪϢ3һϢ4ȫϢ5 - * @param fd 浽ָĿļ - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - AudioDevDump([in] int range, [in] int fd); - - /** - * @brief жǷ֧Ƶ¼Ƶͣͻָܡ - * - * @param supportPause Ƿ֧ͣܵ״̬浽supportPauseУtrueʾ֧֣falseʾ֧֡ - * @param supportResume Ƿָֻ֧ܵ״̬浽supportResumeУtrueʾ֧֣falseʾ֧֡ - * - * @return ɹֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); -} -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioManager.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioManager.idl deleted file mode 100644 index cb182f4c..00000000 --- a/zh-cn/device_api/hdi/audio/v1_1/IAudioManager.idl +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audioģӿڶ塣 - * - * Ƶӿ漰͡ؽӿڡӿڡƵŽӿڡƵ¼ӿڵȡ - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioManager.idl - * - * @brief AudioصĽӿڶļ - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief Ƶӿڵİ· - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_0; - -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioAdapter; - -/** - * @brief AudioManagerƵӿڡ - * - * Ƶ·ƵһƵ - * - * @see IAudioAdapter - * - * @since 4.1 - * @version 1.1 - */ -interface IAudioManager { - - /** - * @brief ȡƵֵ֧б - * - * @param descs ȡƵб浽descsУο{@link AudioAdapterDescriptor} - * - * @return ɹֵ0ʧܷظֵ - * - * @see LoadAdapter - * - * @since 4.1 - * @version 1.1 - */ - GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); - - /** - * @brief һƵ - * - * һƵusbھʵпܼصһ̬ӿ⣨*.so - * - * @param desc صƵο{@link AudioAdapterDescriptor} - * @param adapter ȡƵӿڵĶʵ浽adapterУο{@link IAudioAdapter} - * - * @return ɹֵ0ʧܷظֵ - * - * @see GetAllAdapters - * @see UnloadAdapter - * - * @since 4.1 - * @version 1.1 - */ - LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); - - /** - * @brief жƵ - * - * @param adapterName жصƵӿڵĶơ - * - * @see LoadAdapter - * - * @since 4.1 - * @version 1.1 - */ - UnloadAdapter([in] String adapterName); - - /** - * @brief ͷƵӿڶ - * - * @return ֵ0ʧܷظֵ - * - * @since 4.1 - * @version 1.1 - */ - ReleaseAudioManagerObject(); -} -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_1/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1_1/IAudioRender.idl deleted file mode 100644 index 5d17a989..00000000 --- a/zh-cn/device_api/hdi/audio/v1_1/IAudioRender.idl +++ /dev/null @@ -1,602 +0,0 @@ -/* - * 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. - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - -/** - * @addtogroup Audio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioRender.idl - * - * @brief Audio播放的接口定义文件。 - * - * @since 4.1 - * @version 1.1 - */ - -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioCallback; - -/** - * @brief AudioRender音频播放接口。 - * - * 提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据等。 - * - * @since 4.1 - * @version 1.1 - */ -interface IAudioRender { - /** - * @brief 获取音频硬件驱动的延迟时间。 - * - * @param ms 获取的延迟时间(单位:毫秒)保存到ms中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetLatency([out] unsigned int ms); - - /** - * @brief 向音频驱动中播放一帧输出数据(放音,音频下行数据)。 - * - * @param frame 待写入的输出数据的音频frame。 - * @param replyBytes 实际写入的音频数据长度(字节数),获取后保存到replyBytes中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); - - /** - * @brief 获取音频已输出的帧数。 - * - * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 - * @param time 获取的关联时间戳保存到time中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RenderFrame - * - * @since 4.1 - * @version 1.1 - */ - GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 设置一个音频的播放速度。 - * - * @param speed 待设置的播放速度(倍速),例0.5、0.75、1.0、1.25、1.5、2.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetRenderSpeed - * - * @since 4.1 - * @version 1.1 - */ - SetRenderSpeed([in] float speed); - - /** - * @brief 获取一个音频当前的播放速度。 - * - * @param speed 获取的播放速度保存到speed中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetRenderSpeed - * - * @since 4.1 - * @version 1.1 - */ - GetRenderSpeed([out] float speed); - - /** - * @brief 设置音频播放的通道模式。 - * - * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetChannelMode - * - * @since 4.1 - * @version 1.1 - */ - SetChannelMode([in] enum AudioChannelMode mode); - - /** - * @brief 获取音频播放当前的通道模式。 - * - * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetChannelMode - * - * @since 4.1 - * @version 1.1 - */ - GetChannelMode([out] enum AudioChannelMode mode); - - /** - * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 - * - * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 - * @param cookie 回调函数的入参。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RegCallback - * - * @since 4.1 - * @version 1.1 - */ - RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); - - /** - * @brief 排空缓冲区中的数据。 - * - * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RegCallback - * - * @since 4.1 - * @version 1.1 - */ - DrainBuffer([out] enum AudioDrainNotifyType type); - - /** - * @brief 判断是否支持清空缓冲区数据的功能。 - * - * @param support 是否支持的状态保存到support中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - IsSupportsDrain([out] boolean support); - /** - * @brief 是否支持某个音频场景的配置。 - * - * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SelectScene - * - * @since 4.1 - * @version 1.1 - */ - CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); - - /** - * @brief 选择音频场景。 - * - *
      - *
    • 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 - *
        - *
      • 在媒体播放场景scene为media_speaker。
      • - *
      • 在语音通话免提场景scene为voice_speaker。
      • - *
      - *
    • 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • - *
    • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • - *
    - * - * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see CheckSceneCapability - * - * @since 4.1 - * @version 1.1 - */ - SelectScene([in] struct AudioSceneDescriptor scene); - - /** - * @brief 设置音频的静音状态。 - * - * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetMute - * - * @since 4.1 - * @version 1.1 - */ - SetMute([in] boolean mute); - - /** - * @brief 获取音频的静音状态。 - * - * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetMute - * - * @since 4.1 - * @version 1.1 - */ - GetMute([out] boolean mute); - - /** - * @brief 设置一个音频流的音量。 - * - * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), - * 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15)。 - * - * @param volume 待设置的音量,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetVolume([in] float volume); - - /** - * @brief 获取一个音频流的音量。 - * - * @param volume 获取的音量保存到volume中,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetVolume - * - * @since 4.1 - * @version 1.1 - */ - GetVolume([out] float volume); - - /** - * @brief 获取音频流增益的阈值。 - * - * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: - * - *
      - *
    • 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • - *
    • 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, - * 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db)。
    • - *
    - * - * @param min 获取的音频增益的阈值下限保存到min中。 - * @param max 获取的音频增益的阈值上限保存到max中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGain - * @see SetGain - * - * @since 4.1 - * @version 1.1 - */ - GetGainThreshold([out] float min, [out] float max); - - /** - * @brief 获取音频流的增益。 - * - * @param gain 保存当前获取到的增益到gain中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see SetGain - * - * @since 4.1 - * @version 1.1 - */ - GetGain([out] float gain); - - /** - * @brief 设置音频流的增益。 - * - * @param gain 待设置的增益,最小为0.0,最大为1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see GetGain - * - * @since 4.1 - * @version 1.1 - */ - SetGain([in] float gain); - - /** - * @brief 获取音频帧的大小。 - * - * 获取一帧音频数据的长度(字节数)。 - * - * @param size 获取的音频帧大小(字节数)保存到size中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameSize([out] unsigned long size); - - /** - * @brief 获取音频buffer中的音频帧数。 - * - * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameCount([out] unsigned long count); - - /** - * @brief 设置音频采样的属性参数。 - * - * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetSampleAttributes - * - * @since 4.1 - * @version 1.1 - */ - SetSampleAttributes([in] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频采样的属性参数。 - * - * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) - * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetSampleAttributes - * - * @since 4.1 - * @version 1.1 - */ - GetSampleAttributes([out] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频的数据通道ID。 - * - * @param channelId 获取的通道ID保存到channelId中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetCurrentChannelId([out] unsigned int channelId); - - /** - * @brief 设置音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetExtraParams([in] String keyValueList); - - /** - * @brief 获取音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetExtraParams([out] String keyValueList); - - /** - * @brief 请求mmap缓冲区。 - * - * @param reqSize 请求缓冲区的大小。 - * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - ReqMmapBuffer([in] int reqSize, [in] struct AudioMmapBufferDescripter desc); - - /** - * @brief 获取当前mmap的读/写位置。 - * - * @param frames 获取的音频帧计数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 添加音频效果。 - * - * @param effectid 添加的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - AddAudioEffect([in] unsigned long effectid); - - /** - * @brief 移除音频效果。 - * - * @param effectid 移除的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - RemoveAudioEffect([in] unsigned long effectid); - - /** - * @brief 获取缓冲区大小。 - * - * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameBufferSize([out] unsigned long bufferSize); - - /** - * @brief 启动一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Stop - * - * @since 4.1 - * @version 1.1 - */ - Start(); - - /** - * @brief 停止一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Start - * - * @since 4.1 - * @version 1.1 - */ - Stop(); - - /** - * @brief 暂停一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Resume - * - * @since 4.1 - * @version 1.1 - */ - Pause(); - - /** - * @brief 恢复一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Pause - * - * @since 4.1 - * @version 1.1 - */ - Resume(); - - /** - * @brief 刷新音频缓冲区buffer中的数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - Flush(); - - /** - * @brief 设置或去设置设备的待机模式。 - * - * @return 设置设备待机模式成功返回值0,失败返回负值;设置取消设备待机模式成功返回正值,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - TurnStandbyMode(); - - /** - * @brief Dump音频设备信息。 - * - * @param range Dump信息范围,分为简要信息、全量信息。 - * @param fd 指定Dump目标文件。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - AudioDevDump([in] int range, [in] int fd); - - /** - * @brief 判断声卡是否支持音频播放的暂停和恢复功能 - * - * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 - * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); - - /** - * @brief 设置低功耗模式缓存长度。 - * - * @param size 包含音频数据的缓存长度。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetBufferSize([in] unsigned int size); -} -/** @} */ diff --git a/zh-cn/device_api/hdi/codec/image/v1_0/CodecImageType.idl b/zh-cn/device_api/hdi/codec/image/v1_0/CodecImageType.idl new file mode 100644 index 00000000..30a848fb --- /dev/null +++ b/zh-cn/device_api/hdi/codec/image/v1_0/CodecImageType.idl @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Codec + * @{ + * + * @brief 定义图像编解码器模块的接口 + * + * 编解码器模块提供用于图像编解码、设置编解码器参数以及控制和传输图像数据的接口。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file CodecImageTypes.idl + * + * @brief 定义图像编解码器模块API中使用的自定义数据类型,包括编解码器图像参数、类型和缓冲区。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 定义图像编解码器模块API的包的路径。 + * + * @since 4.0 + * @version 1.0 + */ +package ohos.hdi.codec.image.v1_0; + +/** + * @brief 定义图像区域信息。 + */ +struct CodecImageRegion { + unsigned int left; /**< 到图像左侧的距离。 */ + unsigned int right; /**< 到图像右侧的距离。 */ + unsigned int top; /**< 到图像顶部的距离。 */ + unsigned int bottom; /**< 到图像底部的距离。 */ + unsigned int flag; /**< 区域解码开关 */ + unsigned int rsv; /**< 扩展预留 */ +}; + +/** + * @brief 编解码的图像格式枚举 + */ +enum CodecImageRole { + CODEC_IMAGE_JPEG = 0, /**< Jpeg格式. */ + CODEC_IMAGE_HEIF, /**< Heif格式. */ + CODEC_IMAGE_INVALID, /**< 无效的格式 */ +}; + +/** + * @brief 定义编解码图像缓冲区信息。 + */ +struct CodecImageBuffer { + unsigned int id; /**< 缓冲区ID. */ + unsigned int size; /**< 缓冲区大小 */ + NativeBuffer buffer; /**< 用于编码或解码的缓冲区句柄。详见{@link NativeBuffer}. */ + FileDescriptor fenceFd; /**< Fence文件描述符*/ + CodecImageRole bufferRole; /**< 图像编码格式。详见{@link CodecImageRole}. */ +}; + +/** + * @brief 定义图像编解码器类型。 + */ +enum CodecImageType { + CODEC_IMAGE_TYPE_DECODER = 0, /**< 图像解码器。 */ + CODEC_IMAGE_TYPE_ENCODER, /**< 图像编码器。 */ + CODEC_IMAGE_TYPE_INVALID, /**< 无效类型 */ +}; + +/** + * @brief 定义图像编解码器功能。 + */ +struct CodecImageCapability { + String name; /**< 图像编解码器的名称。 */ + enum CodecImageRole role; /**< 图像编解码器的格式。 */ + enum CodecImageType type; /**< 图像编解码器的类型。 */ + unsigned int widthAlignment; /**< 宽度的对齐值。 */ + unsigned int heightAlignment; /**< 高度的对齐值。 */ + unsigned int maxSample; /**< 最大采样值 */ + unsigned int maxWidth; /**< 最大宽度 */ + unsigned int maxHeight; /**< 最大高度 */ + unsigned int minWidth; /**< 最小宽度 */ + unsigned int minHeight; /**< 最小高度 */ + unsigned int maxInst; /**< 最大实例数. */ + unsigned int[] supportPixFmts; /**< 支持PixFormat. 详见{@link PixFormat}. */ + boolean isSoftwareCodec; /**< 是否软件编解码 */ +}; + +/** + * @brief 定义jpeg图像量化表信息。 + */ +struct CodecJpegQuantTable { + unsigned short[] quantVal; /**< Quant表值。*/ + boolean tableFlag; /**< quant表有效时为True。*/ +}; + +/** + * @brief 定义jpeg图像Huffman表信息。 + */ +struct CodecJpegHuffTable { + unsigned char[] bits; /**< 比特值, bits[0]未使用 */ + unsigned char[] huffVal; /**< Huffman表值*/ + boolean tableFlag; /**< Huffman表有效时为true */ +}; + +/** + * @brief 定义jpeg图像的颜色分量信息。 + */ +struct CodecJpegCompInfo { + unsigned int componentId; /**< 颜色分量ID */ + unsigned int componentIndex; /**< 颜色分量索引 */ + unsigned int hSampFactor; /**< 水平采样因子 */ + unsigned int vSampFactor; /**< 垂直采样因子 */ + unsigned int quantTableNo; /**< Quant表值 */ + unsigned int dcTableNo; /**< Dc表索引 */ + unsigned int acTableNo; /**< Ac表索引 */ + boolean infoFlag; +}; + +/** + * @brief 定义jpeg图像解码信息。 + */ +struct CodecJpegDecInfo { + unsigned int imageWidth; /**< 图像宽度 */ + unsigned int imageHeight; /**< 图像高度 */ + unsigned int dataPrecision; /**< 像素位宽 */ + unsigned int numComponents; /**< jpeg图像中颜色分量的数量。*/ + unsigned int restartInterval; /**< 在一次扫描中作为独立序列处理的MCU的个数 */ + boolean arithCode; /**< Huffman编码为false,arithmetic编码为true */ + boolean progressiveMode; /**< 是否SOF指定渐进模式。 */ + struct CodecJpegCompInfo[] compInfo; /**< Jpeg压缩信息。 */ + struct CodecJpegHuffTable[] dcHuffTbl; /**< Dc huffman表信息 */ + struct CodecJpegHuffTable[] acHuffTbl; /**< Ac huffman表信息 */ + struct CodecJpegQuantTable[] quantTbl; /**< Quant表信息 */ + struct CodecImageRegion region; /**< 图像区域信息。*/ + unsigned int sampleSize; /**< 图像样本大小 */ + unsigned int compressPos; /**< Jpeg压缩数据的偏移量。*/ +}; diff --git a/zh-cn/device_api/hdi/codec/image/v1_0/ICodecImage.idl b/zh-cn/device_api/hdi/codec/image/v1_0/ICodecImage.idl new file mode 100644 index 00000000..cc1eebaa --- /dev/null +++ b/zh-cn/device_api/hdi/codec/image/v1_0/ICodecImage.idl @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * @addtogroup Codec + * @{ + * + * @brief 定义图像编解码器模块的API。 + * + * 编解码器模块提供用于图像编解码、设置编解码器参数以及控制和传输图像数据的接口。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file ICodecImage.idl + * + * @brief 定义图像编解码器的API。 + * + * 您可以使用这些API来分配输入缓冲区和解码图像 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 定义图像编解码器模块API的包的路径。 + * + * @since 4.0 + * @version 1.0 + */ +package ohos.hdi.codec.image.v1_0; + +import ohos.hdi.codec.image.v1_0.CodecImageType; + +interface ICodecImage { + + /** + * @brief 获得图像编解码器功能。 + * + * 您可以使用此API来获得图像编解码器模块提供的编解码能力集。详见{@link CodecImageCapability}。 + * + * @param capList 指向获得的图像编解码器能力集{@link CodecImageCapability}。 + * + * @return 成功返回HDF_SUCCESS + * @return 失败返回HDF_FAILURE + * + * @since 4.0 + */ + GetImageCapability([out] struct CodecImageCapability[] capList); + + /** + * @brief 图像编解码器模块初始化。 + * + * 您可以使用此API来初始化图像编解码器模块。 + * + * @param role 指示获取的图像编解码器格式{@link CodecImageRole}。 + * + * @return 成功返回HDF_SUCCESS + * @return 成功返回HDF_SUCCESS + * @return 如果vendor层返回失败,则返回其他值。其他错误代码详见HDF_STATUS的定义。 + * + * @since 4.0 + */ + Init([in] enum CodecImageRole role); + + /** + * @brief 图像编解码器模块去初始化。 + * + * 您可以使用此API对图像编解码器模块进行去初始化。 + * + * @param role 指示获取的图像编解码器格式{@link CodecImageRole}。 + * + * @return 成功返回HDF_SUCCESS + * @return 成功返回HDF_SUCCESS + * @return 如果vendor层返回失败,则返回其他值。其他错误代码详见HDF_STATUS的定义。 + * + * @since 4.0 + */ + DeInit([in] enum CodecImageRole role); + + /** + * @brief 启动jpeg图像解码。 + * + * 您可以使用此API启动jpeg图像解码。 + * + * @param inBuffer 获得的jpeg图像解码的输入缓冲区{@link CodecImageBuffer}。 + * @param outBuffer 获得的jpeg图像解码的输出缓冲区{@link CodecImageBuffer}。 + * @param decInfo 获得的jpeg图像解码的解码信息{@link JpegDecInfo}。 + * + * @return 成功返回HDF_SUCCESS + * @return 输入无效参数返回HDF_ERR_INVALID_PARAM + * @return 失败返回HDF_FAILURE + * @return 如果vendor层返回失败,则返回其他值。其他错误代码详见HDF_STATUS的定义。 + * + * @since 4.0 + */ + DoJpegDecode([in] struct CodecImageBuffer inBuffer, [in] struct CodecImageBuffer outBuffer, + [in] struct CodecJpegDecInfo decInfo); + + /** + * @brief 分配输入缓冲区。 + * + * 您可以使用此API为图像编解码器分配输入缓冲区。 + * + * @param inBuffer 获得的图像编解码器的输入缓冲区{@link CodecImageBuffer}。 + * @param size 获得的输入缓冲区的大小{@link CodecImageBuffer}。 + * @param role 获取的输入缓冲区的图像编解码器格式{@link CodecImageRole}。 + * + * @return 成功返回HDF_SUCCESS + * @return 输入无效参数返回HDF_ERR_INVALID_PARAM + * @return 失败返回HDF_FAILURE + * @return 如果vendor层返回失败,则返回其他值。其他错误代码详见HDF_STATUS的定义。 + * + * @since 4.0 + */ + AllocateInBuffer([out] struct CodecImageBuffer inBuffer, [in] unsigned int size, [in] CodecImageRole role); + + /** + * @brief 释放输入缓冲区。 + * + * 您可以使用这个API来释放输入缓冲区用于图像解码。 + * + * @param buffer 获得的图像编解码器的输入缓冲区{@link CodecImageBuffer}。 + * + * @return 成功返回HDF_SUCCESS + * @return 成功返回HDF_SUCCESS + * @return 如果vendor层返回失败,则返回其他值。其他错误代码详见HDF_STATUS的定义。 + * + * @since 4.0 + */ + FreeInBuffer([in] struct CodecImageBuffer inBuffer); + +} diff --git a/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl b/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl new file mode 100644 index 00000000..0245a6db --- /dev/null +++ b/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.codec.v2_0; + +import ohos.hdi.codec.v2_0.CodecTypes; + +/** + * @brief 视频编码格式枚举,对OMX原生枚举OMX_VIDEO_CODINGTYPE的补充。 + */ +enum CodecVideoExType { + CODEC_VIDEO_CodingVP9 = 10, /** VP9 序列号 */ + CODEC_VIDEO_CodingHEVC = 11, /** HEVC 序列号 */ +}; + +/** + * @brief HEVC的profile枚举。 + */ +enum CodecHevcProfile { + CODEC_HEVC_PROFILE_INVALID = 0x0, + CODEC_HEVC_PROFILE_MAIN = 0x1, + CODEC_HEVC_PROFILE_MAIN10 = 0x2, + CODEC_HEVC_PROFILE_MAIN_STILL = 0x3, + // 支持main_10 profile以及HDR SEI. + CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000, + CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000, + CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF +}; + +/** + * @brief HEVC的level枚举。 + */ +enum CodecHevcLevel { + CODEC_HEVC_LEVEL_INVALID = 0x0, + CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1, + CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2, + CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4, + CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8, + CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10, + CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20, + CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40, + CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80, + CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100, + CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200, + CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400, + CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800, + CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000, + CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000, + CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000, + CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000, + CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000, + CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000, + CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000, + CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000, + CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000, + CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000, + CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000, + CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000, + CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000, + CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000, + CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF +}; + +/** + * @brief 用于存储编解码视频帧的buffer类型 + */ +enum CodecBufferType { + /** 无效的buffer类型 */ + CODEC_BUFFER_TYPE_INVALID = 0, + /** Virtual address type */ + CODEC_BUFFER_TYPE_VIRTUAL_ADDR = 0x1, + /** 共享内存 */ + CODEC_BUFFER_TYPE_AVSHARE_MEM_FD = 0x2, + /** Handle. */ + CODEC_BUFFER_TYPE_HANDLE = 0x4, + /** Dynamic handle. */ + CODEC_BUFFER_TYPE_DYNAMIC_HANDLE = 0x8, + /** DMA内存 */ + CODEC_BUFFER_TYPE_DMA_MEM_FD = 0x10, +}; + +/** + * @brief 查询vendor层支持buffer类型信息 + */ +struct SupportBufferType { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + unsigned int portIndex; /** 端口序列 */ + unsigned int bufferTypes; /** 支持的buffer类型 */ +}; + +/** + * @brief 设置输入输出端口对应的buffer类型 + */ +struct UseBufferType { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + unsigned int portIndex; /** 端口序列 */ + unsigned int bufferType; /** buffer类型 */ +}; + +/** + * @brief 查询vendor层BufferHandle的默认usage配置 + */ +struct GetBufferHandleUsageParams { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + unsigned int portIndex; /** 端口序列 */ + unsigned long usage; /** Usage */ +}; + +/** + * @brief 设置输入输出端口的编解码格式 + */ +struct CodecVideoPortFormatParam { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + unsigned int portIndex; /** 端口序列 */ + unsigned int codecColorIndex; + unsigned int codecColorFormat; /** 像素格式 */ + unsigned int codecCompressFormat; /** 压缩格式 */ + unsigned int framerate; /** Q16 format */ +}; + +/** + * @brief 控制编码画面质量参数 + */ +struct ControlRateConstantQuality { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + unsigned int portIndex; /** 端口序列 */ + unsigned int qualityValue; /** 画面质量参数 */ +}; + +/** + * @brief 查询/设置vendor层编解码器工作频率 + */ +struct WorkingFrequencyParam { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + unsigned int level; /** 工作频率级别 */ +}; + +/** + * @brief 设置调用者进程名 + */ +struct ProcessNameParam { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + String processName; /** 进程名 */ +}; + +/** + * @brief 编解码器参数索引,对OMX原生枚举OMX_INDEXTYPE的扩展 + */ +enum CodecIndexExType { + /** Extended BufferType index, value = Codec_IndexExtBufferTypeStartUnused + 0x00a00000 */ + Codec_IndexExtBufferTypeStartUnused = 0x6F000000 + 0x00a00000, + /** SupportBuffer */ + Codec_IndexParamSupportBufferType, + /** UseBuffer */ + Codec_IndexParamUseBufferType, + /** GetBufferHandleUsage */ + Codec_IndexParamGetBufferHandleUsage, + /** CodecVideoPortFormatParam */ + Codec_IndexCodecVideoPortFormat, + /** ControlRateConstantQuality */ + Codec_IndexParamControlRateConstantQuality, + /** Codec_IndexParamVideoHevc */ + Codec_IndexParamVideoHevc = 0x6F000000 + 0x00a00007, + /** range/primary/transfer/matrix */ + Codec_IndexColorAspects, + /** WorkingFrequencyParam */ + Codec_IndexParamWorkingFrequency, + /** ProcessNameParam */ + Codec_IndexParamProcessName, +}; + +/** + * @brief 定义HEVC视频编码格式信息 + */ +struct CodecVideoParamHevc { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + unsigned int portIndex; /** 端口序列 */ + enum CodecHevcProfile profile; /** Hevc profile。 详见 {@link CodecHevcProfile}. */ + enum CodecHevcLevel level; /** Hevc级别。 详见 {@link CodecHevcLevel}. */ + unsigned int keyFrameInterval; /** 连续I帧(包括其中一个I帧)之间的距离。 + 0表示间隔未指定,可由编解码器自由选择, + 1表示一个仅存在I帧的流,其他值表示实际值。 */ +}; + +/** + * @brief 视频像素值范围 + */ +enum RangeType { + RANGE_UNSPECIFIED, + RANGE_FULL, + RANGE_LIMITED, + RANGE_MAX = 0xff, +}; + +/** + * @brief 设置视频色域 + */ +enum Primaries { + PRIMARIES_UNSPECIFIED, + PRIMARIES_BT709, //Rec. ITU-R BT.709-6 + PRIMARIES_BT470_6M, //Rec. ITU-R BT.470-6 System M + PRIMARIES_BT601_625, //Rec. ITU-R BT.601-7 625 or Rec. ITU-R BT.470-6 System B,G + PRIMARIES_BT601_525, //Rec. ITU-R BT.601-7 525 or SMPTE ST 170 or SMPTE ST 240 + PRIMARIES_GENERICFILM, //Generic Film + PRIMARIES_BT2020, //Rec. ITU-R BT.2020-2 or Rec. ITU-R BT.2100-2 + PRIMARIES_MAX = 0xff, +}; + +/** + * @brief 设置视频传递函数 + */ +enum Transfer { + TRANSFER_UNSPECIFIED, + TRANSFER_LINEAR, //线性传递特性 + TRANSFER_SRGB, //IEC 61966-2-1 sRGB + TRANSFER_SMPTE170, //SMPTE ST 170 or Rec. ITU-R BT.709-6 or BT.601-7 or BT.2020-2 + TRANSFER_GAMMA22, //Rec. ITU-R BT.470-6 System M + TRANSFER_GAMMA28, //Rec. ITU-R BT.470-6 System B,G + TRANSFER_PQ, //Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system + TRANSFER_HLG, //Rec. ITU-R BT.2100-2 hybrid log gamma (HLG) system + TRANSFER_SMPTE240 = 0x40, //SMPTE ST 240 + TRANSFER_XVYCC, //IEC 61966-2-4 + TRANSFER_BT1361, //Rec. ITU-R BT.1361-0 extended colour gamut system + TRANSFER_ST428, //SMPTE ST 428-1 + TRANSFER_MAX = 0xff, +}; + +/** + * @brief 设置视频矩阵系数 + */ +enum MatrixCoeffs { + MATRIX_UNSPECIFED, + MATRIX_BT709, //Rec. ITU-R BT.709-6 + MATRIX_FCC, //United States Federal Communications Commission + MATRIX_BT601, //Rec. ITU-R BT.601-7 or Rec. ITU-R BT.470-6 System B,G + MATRIX_SMPTE240, //SMPTE ST 240 + MATRIX_BT2020, //Rec. ITU-R BT.2100-2 (非恒定亮度) + MATRIX_BT2020CONSTANT, //Rec. ITU-R BT.2100-2 (恒定亮度) + MATRIX_MAX = 0xff, +}; + +/** + * @brief 色彩空间相关枚举 + */ +struct ColorAspects { + enum RangeType range; + enum Primaries primaries; + enum Transfer transfer; + enum MatrixCoeffs matrixCoeffs; +}; + +/** + * @brief 定义色彩空间参数信息 + */ +struct CodecVideoColorspace { + unsigned int size; /** 结构体大小 */ + union CodecVersionType version; /** 组件版本 */ + unsigned int portIndex; /** 端口序列 */ + unsigned int requestingDataSpace; + unsigned int dataSpaceChanged; + unsigned int pixeFormat; + unsigned int dataSpace; + struct ColorAspects aspects; +}; \ No newline at end of file diff --git a/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl b/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl new file mode 100644 index 00000000..6a92a80f --- /dev/null +++ b/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl @@ -0,0 +1,376 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Codec + * @{ + * + * @brief Codec模块接口定义。 + * + * Codec模块涉及自定义类型、音视频编解码组件初始化、参数设置、数据的轮转和控制等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file CodecTypes.idl + * + * @brief Codec模块接口定义中使用的自定义数据类型。 + * + * Codec模块接口定义中使用的自定义数据类型,包括编解码类型、音视频参数、buffer定义等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Codec模块接口定义中使用的自定义数据类型的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.codec.v2_0; +sequenceable OHOS.HDI.DISPLAY.BufferHandleParcelable; + +/** + * @brief 枚举编解码的类型。 + */ +enum CodecType { + VIDEO_DECODER, /**< 视频解码类型。 */ + VIDEO_ENCODER, /**< 视频编码类型。 */ + AUDIO_DECODER, /**< 音频解码类型。 */ + AUDIO_ENCODER, /**< 音频编码类型。 */ + INVALID_TYPE, /**< 无效类型。 */ +}; + +/** + * @brief 枚举音视频编解码组件类型。 + */ +enum AvCodecRole { + MEDIA_ROLETYPE_IMAGE_JPEG = 0, /**< 图像JPEG媒体类型。 */ + MEDIA_ROLETYPE_VIDEO_AVC, /**< 视频H.264媒体类型。 */ + MEDIA_ROLETYPE_VIDEO_HEVC, /**< 视频H.265媒体类型。 */ + MEDIA_ROLETYPE_AUDIO_FIRST = 0x10000, /**< 音频编解码器类型。 */ + MEDIA_ROLETYPE_AUDIO_AAC = 0x10000, /**< 音频AAC媒体类型。 */ + MEDIA_ROLETYPE_AUDIO_G711A, /**< 音频G711A媒体类型。 */ + MEDIA_ROLETYPE_AUDIO_G711U, /**< 音频G711U媒体类型。 */ + MEDIA_ROLETYPE_AUDIO_G726, /**< 音频G726媒体类型。 */ + MEDIA_ROLETYPE_AUDIO_PCM, /**< 音频PCM媒体类型。 */ + MEDIA_ROLETYPE_AUDIO_MP3, /**< 音频MP3媒体类型。 */ + MEDIA_ROLETYPE_INVALID, /**< 无效媒体类型。 */ +}; + +/** + * @brief 枚举Codec规格。 + */ +enum Profile { + INVALID_PROFILE = 0, /**< 无效的规格。 */ + AAC_LC_PROFILE = 0x1000, /**< AAC低复杂度规格。 */ + AAC_MAIN_PROFILE, /**< AAC主规格。 */ + AAC_HE_V1_PROFILE, /**< AAC高效率和频带重现规格,又称为HEAAC、AAC+、或者AACPlusV1。 */ + AAC_HE_V2_PROFILE, /**< AAC高效率和频带重现以及变量立体声规格,又称为AAC++或者AACPlusV2。 */ + AAC_LD_PROFILE, /**< AAC低延迟规格。 */ + AAC_ELD_PROFILE, /**< AAC增强型低延迟规格。 */ + AVC_BASELINE_PROFILE = 0x2000, /**< H.264低规格。 */ + AVC_MAIN_PROFILE, /**< H.264主规格。 */ + AVC_HIGH_PROFILE, /**< H.264高规格。 */ + HEVC_MAIN_PROFILE = 0x3000, /**< H.265主规格。 */ + HEVC_MAIN_10_PROFILE, /**< H.265 10比特主规格。 */ +}; + +/** + * @brief 枚举播放能力。 + */ +enum CodecCapsMask { + CODEC_CAP_ADAPTIVE_PLAYBACK = 0x1, /**< 自适应播放能力。 */ + CODEC_CAP_SECURE_PLAYBACK = 0x2, /**< 安全播放能力。 */ + CODEC_CAP_TUNNEL_PLAYBACK = 0x4, /**< 通道播放能力。 */ + CODEC_CAP_MULTI_PLANE = 0x10000, /**< 视频图像平面/音频通道平面能力。 */ +}; + +/** + * @brief 枚举音频采样率。 + */ +enum AudioSampleRate { + AUD_SAMPLE_RATE_8000 = 8000, /**< 8K采样率。 */ + AUD_SAMPLE_RATE_12000 = 12000, /**< 12K采样率。 */ + AUD_SAMPLE_RATE_11025 = 11025, /**< 11.025K采样率。 */ + AUD_SAMPLE_RATE_16000 = 16000, /**< 16K采样率。 */ + AUD_SAMPLE_RATE_22050 = 22050, /**< 22.050K采样率。 */ + AUD_SAMPLE_RATE_24000 = 24000, /**< 24K采样率。 */ + AUD_SAMPLE_RATE_32000 = 32000, /**< 32K采样率。 */ + AUD_SAMPLE_RATE_44100 = 44100, /**< 44.1K采样率。 */ + AUD_SAMPLE_RATE_48000 = 48000, /**< 48K采样率。 */ + AUD_SAMPLE_RATE_64000 = 64000, /**< 64K采样率。 */ + AUD_SAMPLE_RATE_96000 = 96000, /**< 96K采样率。 */ + AUD_SAMPLE_RATE_INVALID, /**< 无效采样率。 */ +}; + +/** + * @brief 枚举音频采样格式。 + * + * 对于平面格式的采样格式,每个声道的数据是独立存储在data中; + * 对于打包格式的采样格式,只使用第一个data,每个声道的数据是交错存储的。 + */ +enum AudioSampleFormat { + AUDIO_SAMPLE_FMT_U8 = 0, /**< 无符号8位整型,打包格式。 */ + AUDIO_SAMPLE_FMT_S16, /**< 带符号16位整型, 打包格式。 */ + AUDIO_SAMPLE_FMT_S32, /**< 带符号32位整型, 打包格式。 */ + AUDIO_SAMPLE_FMT_FLOAT, /**< 浮点型, 打包格式。 */ + AUDIO_SAMPLE_FMT_DOUBLE, /**< 双精度浮点型, 打包格式。 */ + AUDIO_SAMPLE_FMT_U8P, /**< 无符号8位整型, 平面格式。 */ + AUDIO_SAMPLE_FMT_S16P, /**< 带符号16位整型, 平面格式。 */ + AUDIO_SAMPLE_FMT_S32P, /**< 带符号32位整型, 平面格式。 */ + AUDIO_SAMPLE_FMT_FLOATP, /**< 浮点型, 平面格式。 */ + AUDIO_SAMPLE_FMT_DOUBLEP, /**< 双精度浮点型, 平面格式。 */ + AUDIO_SAMPLE_FMT_INVALID, /**< 无效采样格式。 */ +}; + +/** + * @brief 枚举编解码处理模式。 + */ +enum CodecProcessMode { + PROCESS_BLOCKING_INPUT_BUFFER = 0x1, /**< 同步模式输入buffer。 */ + PROCESS_BLOCKING_OUTPUT_BUFFER = 0x2, /**< 同步模式输出buffer。 */ + PROCESS_BLOCKING_CONTROL_FLOW = 0x4, /**< 同步模式控制流。 */ + PROCESS_NONBLOCKING_INPUT_BUFFER = 0x100, /**< 异步模式输入buffer。 */ + PROCESS_NONBLOCKING_OUTPUT_BUFFER = 0x200, /**< 异步模式输出buffer。 */ + PROCESS_NONBLOCKING_CONTROL_FLOW = 0x400, /**< 异步模式控制流。 */ +}; + +/** + * @brief 枚举共享内存类型。 + */ +enum ShareMemTypes { + READ_WRITE_TYPE = 0x1, /**< 可读可写的共享内存类型。 */ + READ_ONLY_TYPE = 0x2, /**< 只读的共享内存类型。 */ +}; + +/** + * @brief 枚举比特率类型。 + */ +enum BitRateMode { + BIT_RATE_MODE_INVALID, /**< 定义的一个无效值。 */ + BIT_RATE_MODE_VBR, /**< 可变比特率。 */ + BIT_RATE_MODE_CBR, /**< 恒定比特率。 */ + BIT_RATE_MODE_CQ, /**< 恒定质量。 */ + BIT_RATE_MODE_VCBR, /**< 受约束的可变位速率。 */ + BIT_RATE_MODE_ABR, /**< 平均比特率。 */ +}; + +/** +* @brief 对齐结构定义。 + */ +struct Alignment { + int widthAlignment; /**< 宽的对齐值。 */ + int heightAlignment; /**< 高的对齐值。 */ +}; + +/** + * @brief 矩形的定义。 + */ +struct Rect { + int width; /**< 矩形的宽。 */ + int height; /**< 矩形的高。 */ +}; + +/** + * @brief 取值范围的定义。 + */ +struct RangeValue { + int min; /**< 最小值。 */ + int max; /**< 最大值。 */ +}; + +/** + * @brief 定义视频编解码能力。 + */ +struct CodecVideoPortCap { + struct Rect minSize; /**< 支持的最小分辨率。 */ + struct Rect maxSize; /**< 支持的最大分辨率。 */ + struct Alignment whAlignment; /**< 宽高对齐值。 */ + struct RangeValue blockCount; /**< 支持的块数量范围。 */ + struct RangeValue blocksPerSecond; /**< 每秒可处理的块数量范围。 */ + struct Rect blockSize; /**< 支持的块大小。 */ + int[] supportPixFmts; /**< 支持的像素格式,详见{@link Display中display_type.h定义的PixeFormat}。 */ + enum BitRateMode[] bitRatemode; /**< 传输速率模式,有恒定的,有变化的等几种模式。详见{@link BitRateMode}。 */ + struct RangeValue frameRate;      /**< 帧率的范围。 */ + int[] measuredFrameRate; /**< 实测的帧率。 */ +}; + +/** + * @brief 定义音频编解码能力。 + */ +struct CodecAudioPortCap { + int[] sampleFormats; /**< 支持的音频采样格式,详见{@link AudioSampleFormat}。 */ + int[] sampleRate; /**< 支持的音频采样率,详见{@link AudioSampleRate}。 */ + int[] channelLayouts; /**< 支持的通道格式类型、单通道、平衡声道、3D立体声道等。 */ + int[] channelCount; /**< 支持的音频通道数。 */ +}; + +/** + * @brief 定义音视频编解码能力。 + */ +struct PortCap { + struct CodecVideoPortCap video; /**< 视频编解码能力。 */ + struct CodecAudioPortCap audio; /**< 音频编解码能力。 */ +}; + +/** + * @brief 定义组件的版本信息。 + */ +struct OmxVerType { + unsigned char nVersionMajor; /**< 主要版本访问元件。 */ + unsigned char nVersionMinor; /**< 次要版本访问元件。 */ + unsigned char nRevision; /**< 修正版本访问元件。 */ + unsigned char nStep; /**< 步骤版本访问元件。 */ +}; + +/** + * @brief 定义组件的版本信息。 + */ +union OMX_VERSIONTYPE { + struct OmxVerType s; /**< 组件的版本信息。 */ + unsigned int nVersion; /**< 32位值,使访问版本在单个字大小复制/比较操作中轻松完成。 */ +}; + +/** + * @brief 定义Codec编解码能力。 + */ +struct CodecCompCapability { + enum AvCodecRole role; /**< 媒体类型。 */ + enum CodecType type; /**< 编解码类型。 */ + String compName; /**< 编解码组件名称。 */ + int[] supportProfiles; /**< 支持的profiles,详见{@link Profile}。 */ + int maxInst; /**< 最大实例。 */ + boolean isSoftwareCodec; /**< 软件编解码还是硬件编解码。 */ + int processModeMask; /**< 编解码处理模式掩码,详见{@link CodecProcessMode}。 */ + unsigned int capsMask; /**< 编解码播放能力掩码,详见{@link CodecCapsMask}。 */ + struct RangeValue bitRate; /**< 支持的码率范围。 */ + struct PortCap port; /**< 支持的音视频编解码能力。 */ +}; + +/** + * @brief Codec buffer信息的定义。 + */ +struct OmxCodecBuffer { + unsigned int bufferId; /**< buffer ID。 */ + unsigned int size; /**< 结构体大小。 */ + union OMX_VERSIONTYPE version; /**< 组件版本信息。 */ + unsigned int bufferType; /**< buffer类型,详见{@link CodecBufferType}。 */ + BufferHandleParcelable bufferhandle; /**< 编码或者解码使用的bufferhandle,详见{@link BufferHandleParcelable}。 */ + FileDescriptor fd; /**< 匿名共享内存文件描述符。 */ + unsigned int allocLen; /**< 申请的buffer大小。 */ + unsigned int filledLen; /**< 填充的buffer大小。 */ + unsigned int offset; /**< 有效数据从缓冲区开始的起始偏移量。 */ + FileDescriptor fenceFd; /**< fence fd。 */ + enum ShareMemTypes type; /**< 共享内存类型。 */ + long pts; /**< 缓冲区第一个逻辑样本时间戳。 */ + unsigned int flag; /**< 缓冲区特定标志。 */ + unsigned char[] alongParam; /**< 随帧参数 */ +}; + +/** + * @brief 枚举组件状态。 + */ +enum OMX_EVENTTYPE { + OMX_EventCmdComplete, /**< 组件已成功完成命令。 */ + OMX_EventError, /**< 组件已检测到错误情况。 */ + OMX_EventMark, /**< 组件已检测到缓冲区标记。 */ + OMX_EventPortSettingsChanged, /**< 组件报告端口设置更改。 */ + OMX_EventBufferFlag, /**< 组件已检测到EOS。 */ + OMX_EventResourcesAcquired, /**< 组件已被授予资源,并正在自动启动从OMX_StateWaitForResources状态更改为OMX_StateIdle。 */ + OMX_EventComponentResumed, /**< 组件回收由于重新占用的资源。 */ + OMX_EventDynamicResourcesAvailable, /**< 组件已获取此前不可用的动态资源。 */ + OMX_EventPortFormatDetected, /**< 组件已经检测出数据格式。 */ + OMX_EventKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ + OMX_EventVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ + OMX_EventMax = 0x7FFFFFFF, /**< 枚举的最大值。 */ +}; + +/** + * @brief 枚举ICodecComponent中SendCommand接口的cmd参数。 + */ +enum OMX_COMMANDTYPE +{ + OMX_CommandStateSet, /**< 更改组件状态。 */ + OMX_CommandFlush, /**< 刷新组件的数据队列。 */ + OMX_CommandPortDisable, /**< 禁用组件上的端口。 */ + OMX_CommandPortEnable, /**< 启用组件上的端口。 */ + OMX_CommandMarkBuffer, /**< 标记组件/缓冲区以进行观察。 */ + OMX_CommandKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ + OMX_CommandVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ + OMX_CommandMax = 0x7FFFFFFF /**< 枚举的最大值。 */ +}; + +/** + * @brief 更改组件状态。 + */ +enum OMX_STATETYPE +{ + OMX_StateInvalid, /**< 组件已检测到其内部数据结构已损坏,以至于无法正确确定其状态。 */ + OMX_StateLoaded, /**< 组件已加载,但尚未完成初始化。ICodecComponent.SetParameter + 和ICodecComponent.GetParameter是允许发送到处于此状态的组件的唯一有效函数。 */ + OMX_StateIdle, /**< 组件初始化已成功完成,组件已准备好启动。*/ + OMX_StateExecuting, /**< 组件已接受启动命令并正在处理数据(如果数据可用)。 */ + OMX_StatePause, /**< 组件已收到暂停命令。 */ + OMX_StateWaitForResources, /**< 组件正在等待资源,无论是在抢占之后还是在获得请求的资源之前。*/ + OMX_StateKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ + OMX_StateVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ + OMX_StateMax = 0x7FFFFFFF /**< 枚举最大值。 */ +}; + +/** + * @brief 表示端口供应商在两个端口之间建立隧道时的首选项。 + */ +enum OMX_BUFFERSUPPLIERTYPE +{ + OMX_BufferSupplyUnspecified = 0, /**< 提供缓冲区的端口未指定,或不指定。 */ + OMX_BufferSupplyInput, /**< 为输入端口提供缓冲区。 */ + OMX_BufferSupplyOutput, /**< 为输出端口提供缓冲区。 */ + OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ + OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ + OMX_BufferSupplyMax = 0x7FFFFFFF /**< 枚举的最大值。 */ +}; + +/** + * @brief 用于将数据从输出端口传递到输入端口。 + */ +struct OMX_TUNNELSETUPTYPE { + unsigned int nTunnelFlags; /**< 隧道的位标志。 */ + enum OMX_BUFFERSUPPLIERTYPE eSupplier; /**< 供应商首选项。 */ +}; + +/** + * @brief 定义了组件信息,包含组件名,UUID, 组件版本以及spec版本。 + */ +struct CompVerInfo { + String compName; /**< 组件名称。 */ + unsigned char[] compUUID; /**< 组件的UUID标识符。 */ + union OMX_VERSIONTYPE compVersion; /**< OMX组件版本信息。 */ + union OMX_VERSIONTYPE specVersion; /**< 构建组件所依据的规范的版本信息。 */ +}; + +/** + * @brief 定义事件上报信息。 + */ +struct EventInfo { + long appData; /**< 设置回调时给入的上层实例。 */ + unsigned int data1; /**< Error类型,可能是portIndex或者其它数据。 */ + unsigned int data2; /**< 事件上报携带的数据2。 */ + byte[] eventData; /**< 事件上报携带的数据信息。 */ +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/codec/v2_0/ICodecCallback.idl b/zh-cn/device_api/hdi/codec/v2_0/ICodecCallback.idl new file mode 100644 index 00000000..afdf161f --- /dev/null +++ b/zh-cn/device_api/hdi/codec/v2_0/ICodecCallback.idl @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Codec + * @{ + * + * @brief Codec模块接口定义。 + * + * Codec模块涉及自定义类型、音视频编解码组件初始化、参数设置、数据的轮转和控制等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file ICodecCallback.idl + * + * @brief 主要包括回调函数接口定义。 + * + * 主要包括Codec模块事件上报、上报输入buffer和输出buffer处理完毕等接口定义。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Codec模块接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.codec.v2_0; + +import ohos.hdi.codec.v2_0.CodecTypes; + +/** + * @brief Codec回调接口定义。 + * + * 提供了以下3种回调函数: + * - 组件错误事件、命令完成事件、端口设置等事件回调,详见{@link EventHandler}。 + * - 输入端口处理完buffer回调,详见{@link EmptyBufferDone}。 + * - 输出端口填充完buffer回调,详见{@link FillBufferDone}。 + * 通过以下两种方式注册回调: + * - 创建组件时,通过{@link CreateComponent}方法。 + * - 当组件处于OMX_StateLoaded状态时,通过{@link SetCallbacks}方法注册回调。 + */ + +[callback] interface ICodecCallback { + + /** + * @brief 事件上报。 + * + * 组件运行过程中向上报告错误事件、命令完成事件、端口设置更改事件等。 + * - 当eEvent为OMX_EventCmdComplete,eventData为NULL,data1数据为OMX_COMMANDTYPE, + * 此时,当data1为OMX_CommandStateSet,data2表示状态,其它情况下,data2表示端口。 + * - 当event为OMX_EventError时,data1表示错误码,data2和eventData都为0。 + * - 当event为OMX_EventMark时,data1和data2都为0,eventData指向mark指针。 + * - 当event为OMX_EventPortSettingsChanged时,data1表示端口,data2和eventData为0。 + * - 当event为OMX_EventBufferFlag时,data1表示端口,data2表示flag,eventData为0。 + * - 当event为OMX_EventResourcesAcquired或OMX_EventDynamicResourcesAvailable时,data1、data2和eventData都为0。 + * + * @param event 要通知的事件类型,详见{@link OMX_EVENTTYPE}。 + * @param info 指向事件上报携带的信息指针,详见{@link EventInfo}。 + * + * @return HDF_SUCCESS 表示事件上报成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,事件上报失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + EventHandler([in] enum OMX_EVENTTYPE event, [in] struct EventInfo info); + + /** + * @brief 上报输入buffer编码或者解码处理完毕。 + * + * 组件运行过程中向上报告输入buffer已经使用完毕。 + * + * @param appData 上层数据,通常是设置回调时给入的上层实例。 + * @param buffer 已经处理完毕的输入buffer信息{@link OmxCodecBuffer}。 + * + * @return HDF_SUCCESS 表示上报成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,上报失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + EmptyBufferDone([in] long appData, [in] struct OmxCodecBuffer buffer); + + /** + * @brief 上报输出buffer填充完毕。 + * + * 组件运行过程中向上报告输出buffer已经填充完毕。 + * + * @param appData 上层数据,通常是设置回调时给入的上层实例。 + * @param buffer 已经填充完毕的buffer信息{@link OmxCodecBuffer}。 + * + * @return HDF_SUCCESS 表示上报成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,上报失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + FillBufferDone([in] long appData, [in] struct OmxCodecBuffer buffer); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/codec/v2_0/ICodecComponent.idl b/zh-cn/device_api/hdi/codec/v2_0/ICodecComponent.idl new file mode 100644 index 00000000..1ff843cf --- /dev/null +++ b/zh-cn/device_api/hdi/codec/v2_0/ICodecComponent.idl @@ -0,0 +1,396 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Codec + * @{ + * + * @brief Codec模块接口定义。 + * + * Codec模块涉及自定义类型、音视频编解码组件初始化、参数设置、数据的轮转和控制等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file ICodecComponent.idl + * + * @brief 主要包括Codec组件接口定义。 + * + * Codec模块提供了获取组件信息、给组件发送命令、组件参数设置、buffer轮转和控制等接口定义。创建组件后,可使用下列接口进行编解码处理。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Codec模块接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.codec.v2_0; + +import ohos.hdi.codec.v2_0.CodecTypes; +import ohos.hdi.codec.v2_0.ICodecCallback; + +/** + * @brief Codec组件接口定义。 + * + * 主要提供以下功能: + * - 获取组件的版本 + * - 组件参数配置的获取和设置 + * - 发送命令至组件及获取组件状态 + * - 设置回调函数 + * - 设置/释放组件使用的buffer + * - 编解码输入输出buffer处理 + * 具体方法使用详见函数说明。 + */ + +interface ICodecComponent { + /** + * @brief 获取Codec组件版本号。 + * + * 通过查询组件,返回组件版本信息。 + * + * @param verInfo 指向组件版本信息的对象,详见{@link CompVerInfo}。 + * + * @return HDF_SUCCESS 表示获取版本号成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,获取版本号失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + GetComponentVersion([out] struct CompVerInfo verInfo); + + /** + * @brief 发送命令给组件。 + * + * 发送命令给组件,当命令为设置状态时,会有事件回调通知结果给上层,其他命令则没有事件上报。 + * + * @param cmd 组件要执行的命令,详见{@link OMX_COMMANDTYPE}。 + * @param param 组件要执行的命令携带的参数。 + * - 当cmd为OMX_CommandStateSet时,param的值详见{@link OMX_STATETYPE}。 + * - 当cmd为OMX_CommandFlush、OMX_CommandPortDisable、OMX_CommandPortEnable、OMX_CommandMarkBuffer时,param为目标端口。 + * @param cmdData 当cmd为OMX_CommandMarkBuffer时,指向OMX_MARKTYPE结构体指针。 + * + * @return HDF_SUCCESS 表示发送命令成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,发送命令失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + SendCommand([in] enum OMX_COMMANDTYPE cmd, [in] unsigned int param, [in] byte[] cmdData); + + /** + * @brief 获取组件参数设置。 + * + * 当组件处于除了OMX_StateInvalid(组件状态异常)之外的其他状态,用户可通过此接口获取组件参数,组件状态详见{@link OMX_STATETYPE}。 + * + * @param index 待填充结构的索引,详见OMX IL定义的OMX_INDEXTYPE。 + * @param inParamStruct 指向由组件填充的应用程序分配的结构体指针。 + * @param outParamStruct 指向由组件填充的应用程序分配的结构体指针。 + * + * @return HDF_SUCCESS 表示获取参数成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,获取参数失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + GetParameter([in] unsigned int index, [in] byte[] inParamStruct, [out] byte[] outParamStruct); + + /** + * @brief 设置组件需要的参数。 + * + * 当出现如下情况时,用户可以通过此接口设置组件参数。 + * - 当组件处于OMX_StateLoaded(表示组件已加载)。 + * - 当组件处于OMX_StateWaitForResources(表示组件等待所需要的资源)。 + * - 当状态或者端口是去使能状态,用户可通过此接口设置组件参数。 + * 更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @param index 要设置的结构索引,详见OMX IL定义的OMX_INDEXTYPE。 + * @param paramStruct 指向组件用于初始化的应用程序分配结构的指针。 + * + * @return HDF_SUCCESS 表示设置参数成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,设置参数失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + SetParameter([in] unsigned int index, [in] byte[] paramStruct); + + /** + * @brief 获取组件的配置。 + * + * 加载组件后可以随时调用此接口获取组件的配置。 + * + * @param index 待填充结构的索引,详见{@link OMX_INDEXTYPE}。 + * @param inCfgStruct 指向由组件填充的应用程序分配的结构体指针。 + * @param outCfgStruct 指向由组件填充的应用程序分配的结构体指针。 + * + * @return HDF_SUCCESS 表示获取配置成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,获取配置失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + GetConfig([in] unsigned int index, [in] byte[] inCfgStruct, [out] byte[] outCfgStruct); + + /** + * @brief 设置组件的配置。 + * + * 加载组件后可以随时调用此接口设置组件的配置。 + * + * @param index 要设置的结构索引,详见{@link OMX_INDEXTYPE}。 + * @param cfgStruct 指向组件用于初始化的应用程序分配结构的指针。 + * + * @return HDF_SUCCESS 表示设置配置成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,设置失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + SetConfig([in] unsigned int index, [in] byte[] cfgStruct); + + /** + * @brief 根据字符串获取组件的扩展索引。 + * + * 将扩展字符串转换为Openmax IL结构索引,此索引可用于获取({@link GetParameter})或者设置({@link SetParameter})组件参数。 + * + * @param paramName 组件用来转换为配置索引的字符串。 + * @param indexType 由paramName转换的配置索引,详见{@link OMX_INDEXTYPE}。 + * + * @return HDF_SUCCESS 表示获取扩展索引成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,获取扩展索引失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + GetExtensionIndex([in] String paramName, [out] unsigned int indexType); + + /** + * @brief 获取组件的当前状态。 + * + * 用户可调用此接口获取组件的当前状态。 + * + * @param state 指向获取到的状态指针,组件状态详见{@link OMX_STATETYPE}。 + * + * @return HDF_SUCCESS 表示获取状态成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,获取状态失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + GetState([out] enum OMX_STATETYPE state); + + /** + * @brief 设置组件采用Tunnel方式通信。 + * + * 当组件处于OMX_StateLoaded状态时(表示组件已加载),用户通过调用此接口确定组件是否可以进行Tunnel传输,如果可以则设置组件的Tunnel传输。 + * 更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @param port 组件设置的端口。 + * @param tunneledComp 组件的tunnel组件句柄。 + * @param tunneledPort 组件用来Tunnel通信的端口。 + * @param inTunnelSetup 指向Tunnel设置的结构体{@link OMX_TUNNELSETUPTYPE}指针。 + * @param outTunnelSetup 指向Tunnel设置的结构体{@link OMX_TUNNELSETUPTYPE}指针。 + * + * @return HDF_SUCCESS 表示设置成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,设置失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + ComponentTunnelRequest([in] unsigned int port, [in] int tunneledComp, [in] unsigned int tunneledPort, [in] struct OMX_TUNNELSETUPTYPE inTunnelSetup, [out] struct OMX_TUNNELSETUPTYPE outTunnelSetup); + + /** + * @brief 指定组件端口的buffer。 + * + * 此接口在以下情况下使用: + * - 当组件处于OMX_StateLoaded状态(表示组件已加载),并且用户已经向组件发送OMX_StateIdle状态转换请求。 + * - 当组件处于OMX_StateWaitForResources状态,所需的资源可用,并且组件已准备好进入OMX_StateIdle状态。 + * - 在去使能端口上,组件处于OMX_StateExecuting、OMX_StatePause或OMX_StateIdle状态。 + * 更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @param portIndex 指定的组件端口。 + * @param inBuffer 指向要使用的buffer结构体的指针,结构体介绍详见{@link OmxCodecBuffer}。 + * @param outBuffer 指向要使用的buffer结构体的指针,结构体介绍详见{@link OmxCodecBuffer}。 + * + * @return HDF_SUCCESS 表示指定成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,指定失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + UseBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer, [out] struct OmxCodecBuffer outBuffer); + + /** + * @brief 向组件申请端口buffer。 + * + * 向组件申请分配新的buffer,此接口在以下情况下使用: + * - 当组件处于OMX_StateLoaded状态,并且用户已经向组件发送OMX_StateIdle状态转换请求。 + * - 当组件处于OMX_StateWaitForResources状态,所需的资源可用,并且组件已准备好进入OMX_StateIdle状态。 + * - 在去使能端口上,组件处于OMX_StateExecuting、OMX_StatePause或OMX_StateIdle状态。 + * 更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @param portIndex 指定的组件端口。 + * @param inBuffer 指向要申请的buffer结构的体指针,结构体介绍详见{@link OmxCodecBuffer}。 + * @param outBuffer 指向要申请的buffer结构的体指针,结构体介绍详见{@link OmxCodecBuffer}。 + * + * @return HDF_SUCCESS 表示申请buffer成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,申请buffer失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + AllocateBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer, [out] struct OmxCodecBuffer outBuffer); + + /** + * @brief 释放buffer。 + * + * 此接口在以下情况下使用: + * - 当组件处于OMX_StateIdle状态,并且已经向组件发送OMX_StateLoaded状态转换请求。 + * - 在去使能端口上,组件处于OMX_StateExecuting、OMX_StatePause或OMX_StateIdle时调用。 + * 更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * - 此接口调用可随时进行,但是如果未在上述情况下执行,可能会导致组件上报OMX_ErrorPortUnpopulated事件。 + * + * @param portIndex 指定的组件端口。 + * @param buffer 指向要释放的buffer结构体的结构体的指针,结构体介绍详见{@link OmxCodecBuffer}。 + * + * @return HDF_SUCCESS 表示释放buffer成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,释放buffer失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + FreeBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer buffer); + + /** + * @brief 编解码输入待处理buffer。 + * + * 此接口在组件处于OMX_StateExecuting或者OMX_StatePause状态时调用,更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @param buffer 指向要输入的buffer结构体的指针,结构体介绍详见{@link OmxCodecBuffer}。 + * + * @return HDF_SUCCESS 表示输入buffer成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,输入buffer失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + EmptyThisBuffer([in] struct OmxCodecBuffer buffer); + + /** + * @brief 编解码输出填充buffer。 + * + * 此接口在组件处于OMX_StateExecuting或者OMX_StatePause状态时调用,更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @param buffer 指向要填充的buffer结构体的指针,结构体介绍详见{@link OmxCodecBuffer}。 + * + * @return HDF_SUCCESS 表示填充buffer成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,填充buffer失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + FillThisBuffer([in] struct OmxCodecBuffer buffer); + + /** + * @brief 设置Codec组件的回调函数。 + * + * 当组件处于OMX_StateLoaded状态时,使用此回调函数向上通知事件以及上报可用的输入输出信息。更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @param callbacks 指向回调函数{@link ICodecCallback}对象的指针。 + * @param appData 指向应用程序定义的值的指针,该值将在回调期间返回。 + * + * @return HDF_SUCCESS 表示设置回调成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,设置回调失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + SetCallbacks([in] ICodecCallback callbacks, [in] long appData); + + /** + * @brief 组件去初始化。 + * + * 调用此接口使组件去初始化,当组件处于OMX_StateLoaded状态时,将直接关闭组件,更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @return HDF_SUCCESS 表示去初始化成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,去初始化失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + ComponentDeInit(); + + /** + * @brief 使用已在EGL中申请的空间。 + * + * 此接口在以下情况下使用: + * - 当组件处于OMX_StateLoaded状态,并且已经向组件发送OMX_StateIdle状态转换请求。 + * - 当组件处于OMX_StateWaitForResources状态,所需的资源可用,并且组件已准备好进入OMX_StateIdle状态。 + * - 在去使能端口上,组件处于OMX_StateExecuting、OMX_StatePause或OMX_StateIdle状态。 + * 更多组件状态的说明请详见{@link OMX_STATETYPE}。 + * + * @param portIndex 指定的组件端口。 + * @param inBuffer 指向{@link OmxCodecBuffer}结构体的指针。 + * @param outBuffer 指向{@link OmxCodecBuffer}结构体的指针。 + * @param eglImage EGL申请的图像指针。 + * + * @return HDF_SUCCESS 表示使用成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,使用失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + UseEglImage([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer, [out] struct OmxCodecBuffer outBuffer, [in] byte[] eglImage); + + /** + * @brief 获取组件角色。 + * + * 根据组件角色索引获取对应组件角色。 + * + * @param role 角色名称。 + * @param index 角色的索引,一个组件可能支持多种角色。 + * + * @return HDF_SUCCESS 表示获取角色成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,获取角色失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + ComponentRoleEnum([out] unsigned char[] role, [in] unsigned int index); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/codec/v2_0/ICodecComponentManager.idl b/zh-cn/device_api/hdi/codec/v2_0/ICodecComponentManager.idl new file mode 100644 index 00000000..3214a31d --- /dev/null +++ b/zh-cn/device_api/hdi/codec/v2_0/ICodecComponentManager.idl @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Codec + * @{ + * + * @brief Codec模块接口定义。 + * + * Codec模块涉及自定义类型、音视频编解码组件初始化、参数设置、数据的轮转和控制等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file ICodecComponentManager.idl + * + * @brief 主要包括Codec组件管理类接口。 + * + * Codec模块获取组件编解码能力集、创建组件和销毁组件等接口定义。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Codec模块接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.codec.v2_0; + +import ohos.hdi.codec.v2_0.CodecTypes; +import ohos.hdi.codec.v2_0.ICodecComponent; + +/** + * @brief Codec组件管理类接口定义。 + * + * 主要提供以下功能: + * - 获取Codec编解码组件数量以及编解码能力集表。 + * - 创建/销毁Codec组件。 + */ + +interface ICodecComponentManager { + + /** + * @brief 获取Codec编解码组件数量。 + * + * 通过此接口获取Codec编解码组件数量,用来获取全部编解码能力集。 + * + * @param count 编解码组件数量。 + * + * @return HDF_SUCCESS 表示获取编解码组件数量成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,获取编解码组件数量失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败。 + * + * @since 4.1 + */ + GetComponentNum([out] int count); + + /** + * @brief 获取编解码能力集表。 + * + * 用户可通过此接口了解Codec模块提供了哪些编解码能力,对应的能力体现在{@link CodecCompCapability}结构体。 + * + * @param capList 返回全部组件的能力集表{@link CodecCompCapability}。 + * @param count 编解码组件数量,由{@link GetComponentNum}获得。 + * + * @return HDF_SUCCESS 表示获取能力集表成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,获取能力集表失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败。 + * + * @since 4.1 + */ + GetComponentCapabilityList([out] struct CodecCompCapability[] capList, [in] int count); + + /** + * @brief 创建Codec组件实例。 + * + * 根据组件名称创建Codec组件实例。 + * + * @param component 指向Codec组件的指针。 + * @param componentId 创建组件的Id。 + * @param compName 组件名称。 + * @param appData 指向应用程序定义的值的指针,该值将在回调期间返回。 + * @param callbacks 回调接口,指向OMX_CALLBACKTYPE结构的指针,详见{@link ICodecCallback}。 + * + * @return HDF_SUCCESS 表示创建组件成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,创建组件失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + CreateComponent([out] ICodecComponent component, [out] unsigned int componentId, [in] String compName, [in] long appData, [in] ICodecCallback callbacks); + + /** + * @brief 销毁组件实例。 + * + * 销毁指定的Codec组件。 + * + * @param componentId 需要销毁的Codec组件。 + * + * @return HDF_SUCCESS 表示销毁组件成功。 + * @return HDF_ERR_INVALID_PARAM 表示参数无效,销毁组件失败。 + * @return HDF_FAILURE 表示执行失败。 + * @return 其他值表示底层返回失败,具体错误码详见OpenMAX IL定义的OMX_ERRORTYPE。 + * + * @since 4.1 + */ + DestoryComponent([in] unsigned int componentId); +} +/** @} */ \ No newline at end of file -- Gitee From cedc6356548b1b553203dd4d379efa0c475bd639 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Fri, 22 Dec 2023 17:18:30 +0800 Subject: [PATCH 0175/2135] commit msg Signed-off-by: xuxuehai --- .../device_api/hdi/audio/v2_0/AudioTypes.idl | 599 +++++++++++++++++ .../hdi/audio/v2_0/IAudioAdapter.idl | 333 ++++++++++ .../hdi/audio/v2_0/IAudioCallback.idl | 88 +++ .../hdi/audio/v2_0/IAudioCapture.idl | 479 ++++++++++++++ .../hdi/audio/v2_0/IAudioManager.idl | 114 ++++ .../hdi/audio/v2_0/IAudioRender.idl | 602 ++++++++++++++++++ 6 files changed, 2215 insertions(+) create mode 100644 zh-cn/device_api/hdi/audio/v2_0/AudioTypes.idl create mode 100644 zh-cn/device_api/hdi/audio/v2_0/IAudioAdapter.idl create mode 100644 zh-cn/device_api/hdi/audio/v2_0/IAudioCallback.idl create mode 100644 zh-cn/device_api/hdi/audio/v2_0/IAudioCapture.idl create mode 100644 zh-cn/device_api/hdi/audio/v2_0/IAudioManager.idl create mode 100644 zh-cn/device_api/hdi/audio/v2_0/IAudioRender.idl diff --git a/zh-cn/device_api/hdi/audio/v2_0/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v2_0/AudioTypes.idl new file mode 100644 index 00000000..6b8d2f6a --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v2_0/AudioTypes.idl @@ -0,0 +1,599 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file AudioTypes.idl + * + * @brief Audio模块接口定义中使用的数据类型。 + * + * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.audio.v1_1; + +/** + * @brief 音频端口的类型。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioPortDirection { + PORT_OUT = 1, /**< 音频输出端口。*/ + PORT_IN = 2, /**< 音频输入端口。 */ + PORT_OUT_IN = 3, /**< 音频输出输入端口。 */ +}; + +/** + * @brief 音频端口上的Pin脚。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioPortPin { + PIN_NONE = 0, /**< 无效端口。*/ + PIN_OUT_SPEAKER = 1 << 0, /**< 喇叭输出。 */ + PIN_OUT_HEADSET = 1 << 1, /**< 有线耳机输出。 */ + PIN_OUT_LINEOUT = 1 << 2, /**< Lineout输出。 */ + PIN_OUT_HDMI = 1 << 3, /**< HDMI输出。 */ + PIN_OUT_USB = 1 << 4, /**< USB输出。*/ + PIN_OUT_USB_EXT = 1 << 5, /**< USB外部声卡输出。*/ + PIN_OUT_EARPIECE = 1 << 5 | 1 << 4, /**< 有线耳机输出。 */ + PIN_OUT_BLUETOOTH_SCO = 1 << 6, /**< 蓝牙SCO输出 */ + PIN_OUT_DAUDIO_DEFAULT = 1 << 7, /**< 音频默认输出 */ + PIN_OUT_HEADPHONE = 1 << 8, /**< 有线耳机输出。*/ + PIN_OUT_USB_HEADSET = 1 << 9, /**< ARM USB输出 */ + PIN_OUT_BLUETOOTH_A2DP = 1 << 10, /**< 蓝牙A2DP输出 */ + PIN_IN_MIC = 1 << 27 | 1 << 0, /**< 麦克风输入 */ + PIN_IN_HS_MIC = 1 << 27 | 1 << 1, /**< 耳机麦克风输入 */ + PIN_IN_LINEIN = 1 << 27 | 1 << 2, /**< Linein输入。 */ + PIN_IN_USB_EXT = 1 << 27 | 1 << 3, /**< USB外部声卡输入。*/ + PIN_IN_BLUETOOTH_SCO_HEADSET = 1 << 27 | 1 << 4, /**< 蓝牙SCO耳机输入 */ + PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5, /**< 音频默认输入 */ + PIN_IN_USB_HEADSET = 1 << 27 | 1 << 6, /**< ARM USB输入 */ +}; + +/** + * @brief 音频类型(场景)。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioCategory { + AUDIO_IN_MEDIA = 0, /**< 媒体。 */ + AUDIO_IN_COMMUNICATION = 1, /**< 通信。 */ + AUDIO_IN_RINGTONE = 2, /**< 电话铃声。 */ + AUDIO_IN_CALL = 3, /**< 呼叫。 */ + AUDIO_MMAP_NOIRQ = 4, /**< Mmap模式 */ + AUDIO_OFFLOAD = 5, /**< 低功耗 */ + AUDIO_MULTI_CHANNEL = 6, /**< 多声道 */ +}; + +/** + * @brief 音频格式。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioFormat { + AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8bit位宽PCM(Pulse Code Modulation)格式。*/ + AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16bit位宽PCM格式。 */ + AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24bit位宽PCM格式。 */ + AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32bit位宽PCM格式。*/ + AUDIO_FORMAT_TYPE_PCM_FLOAT = 1 << 2 | 1 << 0, /**< PCM浮点格式 */ + AUDIO_FORMAT_TYPE_MP3 = 1 << 24, /**< MP3格式 */ + AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main格式 */ + AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC格式 */ + AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD格式 */ + AUDIO_FORMAT_TYPE_AAC_ELD = 1 << 24 | 1 << 2, /**< AAC ELD格式 */ + AUDIO_FORMAT_TYPE_AAC_HE_V1 = 1 << 24 | 1 << 2 | 1 << 0, /**< AAC HE_V1格式 */ + AUDIO_FORMAT_TYPE_AAC_HE_V2 = 1 << 24 | 1 << 2 | 1 << 1, /**< AAC HE_V2格式 */ + AUDIO_FORMAT_TYPE_G711A = 1 << 25 | 1 << 0, /**< PCM G711A格式 */ + AUDIO_FORMAT_TYPE_G711U = 1 << 25 | 1 << 1, /**< PCM G711u格式 */ + AUDIO_FORMAT_TYPE_G726 = 1 << 25 | 1 << 1 | 1 << 0, /**< PCM G726格式 */ +}; + +/** + *@brief 音频通道掩码。 + * + * 定义音频声道的位置掩码。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioChannelMask { + AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。 */ + AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< 声道布局前右。*/ + AUDIO_CHANNEL_MONO = 1, /**< 单声道。 */ + AUDIO_CHANNEL_STEREO = 3, /**< 立体声,由左右声道组成。 */ +}; + +/** + * @brief 音频采样频率掩码。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioSampleRatesMask { + AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< 无效的采样频率。 */ +}; + +/** + * @brief 音频端口的数据透传模式。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioPortPassthroughMode { + PORT_PASSTHROUGH_LPCM = 1 << 0, /**< 立体声PCM。*/ + PORT_PASSTHROUGH_RAW = 1 << 1, /**< HDMI透传。 */ + PORT_PASSTHROUGH_HBR2LBR = 1 << 2, /**< 蓝光次世代音频降规格输出。 */ + PORT_PASSTHROUGH_AUTO = 1 << 3, /**< 根据HDMI EDID能力自动匹配。 */ +}; + +/** + * @brief 原始音频样本格式。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioSampleFormat { + AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 32bit位宽浮点型非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F64P = 23, /**< 64bit位宽双精度浮点型非交织样本。 **/ +}; + +/** + * @brief 音频播放的通道模式。 + * + * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioChannelMode { + AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。 */ + AUDIO_CHANNEL_BOTH_LEFT = 1, /**< 两个声道全部为左声道声音。 */ + AUDIO_CHANNEL_BOTH_RIGHT = 2, /**< 两个声道全部为右声道声音。 */ + AUDIO_CHANNEL_EXCHANGE = 3, /**< 左右声道数据互换,左声道为右声道声音,右声道为左声道声音。*/ + AUDIO_CHANNEL_MIX = 4, /**< 左右两个声道输出为左右声道相加(混音)。 */ + AUDIO_CHANNEL_LEFT_MUTE = 5, /**< 左声道静音,右声道播放原右声道声音。 */ + AUDIO_CHANNEL_RIGHT_MUTE = 6, /**< 右声道静音,左声道播放原左声道声音。 */ + AUDIO_CHANNEL_BOTH_MUTE = 7, /**< 左右声道均静音。*/ +}; + +/** + * @brief 音频数据结束类型。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioDrainNotifyType { + AUDIO_DRAIN_NORMAL_MODE = 0, /**< 曲目的所有数据播放完就结束。 */ + AUDIO_DRAIN_EARLY_MODE = 1, /**< 曲目的所有数据未播放完就结束,以便给音频服务做连续性曲目切换留出时间。 */ +}; + +/** + * @brief 回调函数通知事件类型。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioCallbackType { + AUDIO_NONBLOCK_WRITE_COMPELETED = 0, /**< 非阻塞式写完成。 */ + AUDIO_DRAIN_COMPELETED = 1, /**< DrainBuffer完成,详情参考{@link DrainBuffer}。 */ + AUDIO_FLUSH_COMPLETED = 2, /**< Flush完成,详情参考{@link Flush}。 */ + AUDIO_RENDER_FULL = 3, /**< 录音缓冲区已满。 */ + AUDIO_ERROR_OCCUR = 4, /**< 发生了错误。 */ +}; + +/** + * @brief 音频端口角色。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioPortRole { + AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。 */ + AUDIO_PORT_SOURCE_ROLE = 1, /**< 指定端口为发送端角色。 */ + AUDIO_PORT_SINK_ROLE = 2, /**< 指定端口为接受端角色。 */ +}; + +/** + * @brief 音频端口类型。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioPortType { + AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。 */ + AUDIO_PORT_DEVICE_TYPE = 1, /**< 指定端口为设备类型。 */ + AUDIO_PORT_MIX_TYPE = 2, /**< 指定端口为复合类型。 */ + AUDIO_PORT_SESSION_TYPE = 3, /**< 指定端口为会话类型。 */ +}; + +/** + * @brief 端口会话类型。 + * + * @since 4.1 + * @version 2.0 + */ +enum AudioSessionType { + AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。 */ + AUDIO_OUTPUT_MIX_SESSION = 1, /**< 会话绑定到特定音轨。 */ + AUDIO_ALLOCATE_SESSION = 2, /**< 会话ID需重新申请。 */ + AUDIO_INVALID_SESSION = 3, /**< 无效会话类型。 */ +}; + +/** + * @brief 音频设备类型。 + */ +enum AudioDeviceType { + AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。 */ + AUDIO_HEADPHONE = 1 << 1, /**< 耳机。 */ + AUDIO_HEADSET = 1 << 2, /**< 头戴式耳机。 */ + AUDIO_USB_HEADSET = 1 << 3, /**< USB头戴式耳机。 */ + AUDIO_USB_HEADPHONE = 1 << 4, /**< USB耳机。 */ + AUDIO_USBA_HEADSET = 1 << 5, /**< USB模拟头戴式耳机。 */ + AUDIO_USBA_HEADPHONE = 1 << 6, /**< USB模拟耳机。 */ + AUDIO_PRIMARY_DEVICE = 1 << 7, /**< 主音频设备。 */ + AUDIO_USB_DEVICE = 1 << 8, /**< USB音频设备。 */ + AUDIO_A2DP_DEVICE = 1 << 9, /**< 蓝牙音频设备。 */ + AUDIO_HDMI_DEVICE = 1 << 10, /**< HDMI音频设备 */ + AUDIO_ADAPTER_DEVICE = 1 << 11, /**< 声卡设备 */ + AUDIO_DEVICE_UNKNOWN, /**< 未知设备。 */ +}; + +/** + * @brief 音频事件类型。 + */ +enum AudioEventType { + AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。 */ + AUDIO_DEVICE_REMOVE = 2, /**< 音频设备移除。 */ + AUDIO_LOAD_SUCCESS = 3, /**< 声卡加载成功。 */ + AUDIO_LOAD_FAILURE = 4, /**< 声卡加载失败。 */ + AUDIO_UNLOAD = 5, /**< 声卡卸载。 */ + AUDIO_SERVICE_VALID = 7, /**< 音频服务可用。 */ + AUDIO_SERVICE_INVALID = 8, /**< 音频服务不可用。 */ + AUDIO_CAPTURE_THRESHOLD = 9, /**< 录音阈值上报。 */ + AUDIO_EVENT_UNKNOWN = 10, /**< 未知事件。 */ +}; + +/** + * @brief 音频扩展参数键类型。 + */ +enum AudioExtParamKey { + AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。 */ + AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< 分布式音频-音量事件。 */ + AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< 分布式音频-焦点事件。 */ + AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< 分布式音频-媒体按钮事件。 */ + AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< 分布式音频-音频效果事件。 */ + AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< 分布式音频-设备状态事件。 */ + AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< USB设备类型( ARM 或 HIFI)*/ + AUDIO_EXT_PARAM_KEY_PERF_INFO = 201, /**< 分布式音频-dsp加载事件。 */ + AUDIO_EXT_PARAM_KEY_MMI = 301, /**< 分布式音频-主机接口测试。 */ + AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< 低电量事件。 */ +}; + +/** + * @brief 音频设备状态。 + */ +struct AudioDeviceStatus { + unsigned int pnpStatus; /**< PnP设备状态,详情参考{@link AudioDeviceType},{@link AudioEventType}。 */ +}; + +/** + * @brief 音频场景描述。 + */ +union SceneDesc { + unsigned int id; /**< 音频场景的ID,详情参考{@link AudioCategory}。*/ +}; + +/** + * @brief 音频端口。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioPort { + enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。 */ + unsigned int portId; /**< 音频端口的ID。 */ + String portName; /**< 音频端口的名称。 */ +}; + +/** + * @brief 音频适配器描述符。 + * + * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, + * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioAdapterDescriptor { + String adapterName; /**< 音频适配器的名称。 */ + struct AudioPort[] ports; /**< 一个音频适配器支持的端口列表,详情参考{@link AudioPort}。 */ +}; + +/** + * @brief 音频设备描述符。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioDeviceDescriptor { + unsigned int portId; /**< 音频端口ID。 */ + enum AudioPortPin pins; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ + String desc; /**< 以字符串命名的音频设备。 */ +}; + +/** + * @brief 音频场景描述符。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioSceneDescriptor { + union SceneDesc scene; /**< 音频场景描述,详情参考{@link SceneDesc}。 */ + struct AudioDeviceDescriptor desc; /**< 音频设备描述符,详情参考{@link AudioDeviceDescriptor}。 */ +}; + +/** + * @brief 音频输入类型. + */ +enum AudioInputType { + AUDIO_INPUT_DEFAULT_TYPE = 0, /**< 默认输入 */ + AUDIO_INPUT_MIC_TYPE = 1 << 0, /**< 麦克风输入 */ + AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, /**< 语音唤醒输入 */ + AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, /**< 通话 */ + AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< 声音识别 */ + AUDIO_INPUT_VOICE_UPLINK_TYPE = 1 << 4, /**< 上行输入 */ + AUDIO_INPUT_VOICE_DOWNLINK_TYPE = 1 << 5, /**< 下行输入 */ + AUDIO_INPUT_VOICE_CALL_TYPE = 1 << 6, /**< 电话 */ + AUDIO_INPUT_CAMCORDER_TYPE = 1 << 7, /**< 摄像机输入 */ +}; + +/** + * @brief 音频低功耗属性 + */ +struct AudioOffloadInfo +{ + unsigned int sampleRate; /**< 采样率 */ + unsigned int channelCount; /**< 声道数 */ + unsigned long channelLayout; /**< 声道布局 */ + unsigned int bitRate; /**< 比特率 */ + unsigned int bitWidth; /**< 比特位宽 */ + enum AudioFormat format; /**< 音频格式 */ + unsigned int offloadBufferSize; /**< 音频数据缓存长度 */ + unsigned long duration; /** 音频持续时间,单位纳秒*/ +}; + +/** + * @brief 音频采样属性。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioSampleAttributes { + enum AudioCategory type; /**< 音频类型,详情参考{@link AudioCategory}。 */ + boolean interleaved; /**< 音频数据交织的标记。 */ + enum AudioFormat format; /**< 音频数据格式,详情参考{@link AudioFormat}。 */ + unsigned int sampleRate; /**< 音频采样频率。 */ + unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。*/ + unsigned long channelLayout; /**< 声道布局值 */ + unsigned int period; /**< 音频采样周期,单位赫兹。 */ + unsigned int frameSize; /**< 音频数据的帧大小。 */ + boolean isBigEndian; /**< 音频数据的大端标志。 */ + boolean isSignedData; /**< 音频数据有符号或无符号标志。 */ + unsigned int startThreshold; /**< 音频播放起始阈值。 */ + unsigned int stopThreshold; /**< 音频播放停止阈值。 */ + unsigned int silenceThreshold; /**< 录音缓冲区阈值。 */ + int streamId; /**< 录音或播放的标识符。 */ + int sourceType; /**< 播放或录音的音源类型 */ + struct AudioOffloadInfo offloadInfo; /**< offload流信息 */ +}; + +/** + * @brief 音频时间戳。 + * + * 时间定义,POSIX timespec的替代品。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioTimeStamp { + long tvSec; /**< tvSec时间,单位:秒。 */ + long tvNSec; /**< tvNSec时间,单位:纳秒。 */ +}; + +/** + * @brief 音频子端口的支持能力。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioSubPortCapability { + unsigned int portId; /**< 子端口ID。 */ + String desc; /**< 以字符串命名的子端口。 */ + enum AudioPortPassthroughMode mask; /**< 数据透传模式,详情参考{@link AudioPortPassthroughMode}。 */ +}; + +/** + * @brief 音频端口的支持能力。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioPortCapability { + unsigned int deviceType; /**< 设备输出、输入类型。 */ + unsigned int deviceId; /**< 设备ID,唯一的设备识别符。 */ + boolean hardwareMode; /**< 是否支持设备绑定处理。 */ + unsigned int formatNum; /**< 支持的音频格式数目。 */ + enum AudioFormat[] formats; /**< 支持的音频格式,详情参考{@link AudioFormat}。 */ + unsigned int sampleRateMasks; /**< 支持的音频采样频率(8k、16k、32k、48k)。 */ + enum AudioChannelMask channelMasks; /**< 设备的声道布局掩码,详情参考{@link AudioChannelMask}。 */ + unsigned int channelCount; /**< 最大支持的声道总数。 */ + struct AudioSubPortCapability[] subPorts; /**< 支持的子端口列表,详情参考{@link AudioSubPortCapability}。 */ + enum AudioSampleFormat[] supportSampleFormats; /**< 支持的采样率列表,详情参考{@link AudioSampleFormat}。 */ +}; + +/** + * @brief mmap缓冲区描述符。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioMmapBufferDescripter { + byte[] memoryAddress; /**< 指向mmap缓冲区的指针。 */ + FileDescriptor memoryFd; /**< mmap缓冲区的文件描述符。 */ + int totalBufferFrames; /**< 缓冲区总大小,单位:帧。 */ + int transferFrameSize; /**< 传输大小,单位:帧。 */ + int isShareable; /**< mmap缓冲区是否可以在进程间共享。 */ + unsigned int offset; /**< 文件偏移。 */ + String filePath; /**< mmap文件路径。 */ +}; + +/** + * @brief 音频设备拓展信息。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioDevExtInfo { + int moduleId; /**< 音频流绑定的模块ID。 */ + enum AudioPortPin type; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ + String desc; /**< 地址描述。 */ +}; + +/** + * @brief 音轨拓展信息。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioMixExtInfo { + int moduleId; /**< 流所属模块标识符。 */ + int streamId; /**< 由调用者传递的Render或Capture标识符。 */ +}; + +/** + * @brief 会话拓展信息。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioSessionExtInfo { + enum AudioSessionType sessionType; /**< 音频会话类型,详情参考{@link AudioSessionType}。 */ +}; + +/** + * @brief 音频端口特定信息。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioInfo { + struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。 */ + struct AudioMixExtInfo mix; /**< 音轨特定信息,详情参考{@link AudioMixExtInfo}。 */ + struct AudioSessionExtInfo session; /**< 会话特定信息,详情参考{@link AudioSessionExtInfo}。 */ +}; + +/** + * @brief 音频路由节点。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioRouteNode { + int portId; /**< 音频端口ID。 */ + enum AudioPortRole role; /**< 指定端口角色为发送端或接收端,详情参考{@link AudioPortRole}。 */ + enum AudioPortType type; /**< 指定端口类型可以为设备类型、复合类型、绘画类型,详情参考{@link AudioPortType}。 */ + struct AudioInfo ext; /**< 音频端口特定信息,详情参考{@link AudioInfo}。 */ +}; + +/** + * @brief 音频路由信息。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioRoute { + struct AudioRouteNode[] sources; /**< 发送端列表,详情参考{@link AudioRouteNode}。 */ + struct AudioRouteNode[] sinks; /**< 接受端列表,详情参考{@link AudioRouteNode}。 */ +}; + +/** + * @brief 音频事件。 + * + * @since 4.1 + * @version 2.0 + */ +struct AudioEvent { + unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。 */ + unsigned int deviceType; /**< 设备类型,详情参考{@link enum AudioDeviceType}。 */ +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v2_0/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v2_0/IAudioAdapter.idl new file mode 100644 index 00000000..252cde4b --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v2_0/IAudioAdapter.idl @@ -0,0 +1,333 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file IAudioAdapter.idl + * + * @brief Audio适配器的接口定义文件。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.audio.v2_0; + +import ohos.hdi.audio.v2_0.AudioTypes; +import ohos.hdi.audio.v2_0.IAudioRender; +import ohos.hdi.audio.v2_0.IAudioCapture; +import ohos.hdi.audio.v2_0.IAudioCallback; + +/** + * @brief AudioAdapter音频适配器接口。 + * + * 提供音频适配器(声卡)对外支持的驱动能力,包括初始化端口、创建放音、创建录音、获取端口能力集等。 + * + * @see IAudioRender + * @see IAudioCapture + * + * @since 4.1 + * @version 2.0 + */ +interface IAudioAdapter { + /** + * @brief 初始化一个音频适配器所有的端口驱动。 + * 在音频服务中,调用其他驱动接口前需要先调用该接口检查端口是否已经初始化完成,如果端口没有初始化完成, + * 则需要等待一段时间(例如100ms)后重新进行检查,直到端口初始化完成后再继续操作。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * + * @return 初始化完成返回值0,初始化失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + InitAllPorts(); + + /** + * @brief 创建一个音频播放接口的对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@link IAudioRender}。 + * @param renderId 获取的音频播放接口序号。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetPortCapability + * @see DestroyRender + * + * @since 4.1 + * @version 2.0 + */ + CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioRender render, [out] unsigned int renderId); + + /** + * @brief 销毁一个音频播放接口的对象。 + * + * @attention 在音频播放过程中,不能销毁该接口对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param renderId 待销毁的音频播放接口的序号 + * + * @return 成功返回值0,失败返回负值。 + * @see CreateRender + * + * @since 4.1 + * @version 2.0 + */ + DestroyRender([in] unsigned int renderId); + + /** + * @brief 创建一个音频录音接口的对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@link IAudioCapture}。 + * @param captureId 获取的音频录音接口的序号 + * @return 成功返回值0,失败返回负值。 + * + * @see GetPortCapability + * @see DestroyCapture + + * @since 4.1 + * @version 2.0 + */ + CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioCapture capture, [out] unsigned int captureId); + + /** + * @brief 销毁一个音频录音接口的对象。 + * + * @attention 在音频录音过程中,不能销毁该接口对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param captureId 待销毁的音频录音接口的序号 + * + * @return 成功返回值0,失败返回负值。 + * @see CreateCapture + * + * @since 4.1 + * @version 2.0 + */ + DestroyCapture([in] unsigned int captureId); + + /** + * @brief 获取一个音频适配器的端口驱动的能力集。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param capability 获取的端口能力保存到capability中,详请参考{@link AudioPortCapability}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); + + /** + * @brief 设置音频端口驱动的数据透传模式。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待设置的端口,详请参考{@link AudioPort}。 + * @param mode 待设置的传输模式,详请参考{@link AudioPortPassthroughMode}。 + * @return 成功返回值0,失败返回负值。 + * @see GetPassthroughMode + * + * @since 4.1 + * @version 2.0 + */ + SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); + + /** + * @brief 获取音频端口驱动的数据透传模式。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param mode 获取的传输模式保存到mode中,详请参考{@link AudioPortPassthroughMode}。 + * @return 成功返回值0,失败返回负值。 + * @see SetPassthroughMode + * + * @since 4.1 + * @version 2.0 + */ + GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); + + /** + * @brief 获取一个音频适配器的设备状态。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param status 获取的设备状态保存到status中,详请参考{@link AudioDeviceStatus}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetDeviceStatus([out] struct AudioDeviceStatus status); + + /** + * @brief 更新音频路由。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param route 待更新的路由,详请参考{@link AudioRoute}。 + * @param routeHandle 更新后的音频路由句柄保存到routeHandle中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); + + /** + * @brief 释放音频路由。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param routeHandle 待释放的音频路由句柄。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + ReleaseAudioRoute([in] int routeHandle); + + /** + * @brief 设置音频静音。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param mute 表示是否将音频静音,true表示静音,false表示非静音。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMicMute + * + * @since 4.1 + * @version 2.0 + */ + SetMicMute([in] boolean mute); + + /** + * @brief 获取音频静音状态。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param mute 获取的静音状态保存到mute中,true表示静音,false表示非静音。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMicMute + * + * @since 4.1 + * @version 2.0 + */ + GetMicMute([out] boolean mute); + + /** + * @brief 设置语音呼叫的音量。 + * + * 音量范围从0.0到1.0。如果音频服务中的音量水平在0到15的范围内, + * 0.0表示音频静音,1.0指示最大音量级别(15)。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param volume 待设置的音量值,范围为(0.0-1.0),0.0表示最小音量值,1.0表示最大音量值。 + * @return 成功返回值0,失败返回负值。 + * @see GetVolume + * + * @since 4.1 + * @version 2.0 + */ + SetVoiceVolume([in] float volume); + + /** + * @brief 根据指定的条件设置音频拓展参数。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 指定的扩展参数查询条件。 + * @param value 指定的扩展参数条件值。 + * + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待设置的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待设置的音频扩展参数相关的音量类型。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); + + /** + * @brief 根据指定条件获取音频扩展参数的取值。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 指定的扩展参数查询条件。 + * @param value 待返回的指定扩展参数条件的当前值。 + * @param lenth value的长度 + * + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待查询的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待查询的音频扩展参数相关的音量类型。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); + + /** + * @brief 注册扩展参数回调函数。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param callback 待注册的回调函数,详请参考{@link AudioCallback}。 + * @param cookie 用于传递数据。 + * @return 成功返回值0,失败返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/audio/v2_0/IAudioCallback.idl b/zh-cn/device_api/hdi/audio/v2_0/IAudioCallback.idl new file mode 100644 index 00000000..47c9a89f --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v2_0/IAudioCallback.idl @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file IAudioCallback.idl + * + * @brief Audio播放的回调函数定义文件。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.audio.v2_0; + +import ohos.hdi.audio.v2_0.AudioTypes; + +/** + * @brief Audio回调接口。 + * + * @since 4.1 + * @version 2.0 + */ +[callback] interface IAudioCallback { + + /** + * @brief 放音回调函数。 + * + * @param type 回调函数通知事件类型,详请参考{@link AudioCallbackType}。 + * @param reserved 保留字段。 + * @param cookie 用于传递数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 2.0 + */ + RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); + /** + * @brief 音频扩展参数回调函数。 + * + * @param key 扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 扩展参数条件。 + * @param value 扩展参数条件的值 + * @param reserved 保留字段。 + * @param cookie 用于传递数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see ParamCallback + * + * @since 4.1 + * @version 2.0 + */ + ParamCallback([in] enum AudioExtParamKey key, [in] String condition, [in] String value, [out] byte reserved, [in] byte cookie); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v2_0/IAudioCapture.idl b/zh-cn/device_api/hdi/audio/v2_0/IAudioCapture.idl new file mode 100644 index 00000000..73102b45 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v2_0/IAudioCapture.idl @@ -0,0 +1,479 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file IAudioCapture.idl + * + * @brief Audio录音的接口定义文件。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.audio.v2_0; + +import ohos.hdi.audio.v2_0.AudioTypes; + + +/** + * @brief AudioCapture音频录音接口。 + * + * 提供音频录音支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、录制音频帧数据等。 + * + * @since 4.1 + * @version 2.0 + */ +interface IAudioCapture { + /** + * @brief 从音频驱动中录制一帧输入数据(录音,音频上行数据)。 + * + * @param capture 调用当前函数的IAudioCapture指针对象 + * @param frame 待存放输入数据的音频frame。 + * @param requestBytes 待存放输入数据的音频frame大小(字节数)。 + * @param replyBytes 指向要读取的音频数据的实际长度(以字节为单位)的指针。 + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief Obtains the last number of input audio frames. + * + * @param capture 调用当前函数的IAudioCapture指针对象 + * @param frames 获取的音频帧数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * @return 成功返回值0,失败返回负值。 + * @see CaptureFrame + * + * @since 4.1 + * @version 2.0 + */ + GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 判断某个音频场景能力是否支持。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.1 + * @version 2.0 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
      + *
    • 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
        + *
      • 在媒体播放场景中,scene为media_speaker。
      • + *
      • 在语音通话免提场景中,scene为voice_speaker。
      • + *
      + *
    • 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • + *
    • 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • + *
    + * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.1 + * @version 2.0 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.1 + * @version 2.0 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.1 + * @version 2.0 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级范围是0 ~ 15, + * 则音量的映射关系为0.0(或0)表示静音,1.0(或15)表示最大音量等级。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.1 + * @version 2.0 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
      + *
    • 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • + *
    • 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音(-50db),1.0表示最大增益(6db)。
    • + *
    + * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.1 + * @version 2.0 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.1 + * @version 2.0 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.1 + * @version 2.0 + */ + SetGain([in] float gain); + + /** + * @brief 获取一帧音频数据的长度(字节数)大小。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.1 + * @version 2.0 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.1 + * @version 2.0 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小,单位:字节。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); + + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.1 + * @version 2.0 + */ + Start(); + + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.1 + * @version 2.0 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.1 + * @version 2.0 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.1 + * @version 2.0 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,再次执行后去设置待机模式成功返回正值,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + TurnStandbyMode(); + + /** + * @brief 保存音频设备信息。 + * + * @param range 需要保存的信息范围(3 ~ 5),分为简要信息(3)、一般信息(4)、全量信息(5)。 + * @param fd 保存到指定的目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频录制的暂停和恢复功能。 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v2_0/IAudioManager.idl b/zh-cn/device_api/hdi/audio/v2_0/IAudioManager.idl new file mode 100644 index 00000000..75b98a82 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v2_0/IAudioManager.idl @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file IAudioManager.idl + * + * @brief Audio适配器管理及加载的接口定义文件。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.audio.v2_0; + +import ohos.hdi.audio.v2_0.AudioTypes; +import ohos.hdi.audio.v2_0.IAudioAdapter; + +/** + * @brief AudioManager音频适配器管理接口。 + * + * 按照音频服务下发的音频适配器(声卡)描述符加载一个具体的音频适配器驱动程序。 + * + * @see IAudioAdapter + * + * @since 4.1 + * @version 2.0 + */ +interface IAudioManager { + + /** + * @brief 获取音频驱动中支持的所有适配器的列表。 + * + * @param descs 获取到的音频适配器列表保存到descs中,详请参考{@link AudioAdapterDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see LoadAdapter + * + * @since 4.1 + * @version 2.0 + */ + GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); + + /** + * @brief 加载一个音频适配器(声卡)的驱动。 + * + * 加载一个具体的音频驱动,例如usb驱动,在具体实现中可能加载的是一个动态链接库(*.so)。 + * + * @param desc 待加载的音频适配器描述符,详请参考{@link AudioAdapterDescriptor}。 + * @param adapter 获取的音频适配器接口的对象实例保存到adapter中,详请参考{@link IAudioAdapter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetAllAdapters + * @see UnloadAdapter + * + * @since 4.1 + * @version 2.0 + */ + LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); + + /** + * @brief 卸载音频适配器(声卡)的驱动。 + * + * @param adapterName 待卸载的音频适配器接口的对象名称。 + * + * @see LoadAdapter + * + * @since 4.1 + * @version 2.0 + */ + UnloadAdapter([in] String adapterName); + + /** + * @brief 释放音频管理接口对象。 + * + * @return 功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + ReleaseAudioManagerObject(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v2_0/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v2_0/IAudioRender.idl new file mode 100644 index 00000000..61e71ae6 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/v2_0/IAudioRender.idl @@ -0,0 +1,602 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Audio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @file IAudioRender.idl + * + * @brief Audio播放的接口定义文件。 + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.audio.v2_0; + +import ohos.hdi.audio.v2_0.AudioTypes; +import ohos.hdi.audio.v2_0.IAudioCallback; + +/** + * @brief AudioRender音频播放接口。 + * + * 提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据等。 + * + * @since 4.1 + * @version 2.0 + */ +interface IAudioRender { + /** + * @brief 获取音频硬件驱动的延迟时间。 + * + * @param ms 获取的延迟时间(单位:毫秒)保存到ms中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetLatency([out] unsigned int ms); + + /** + * @brief 向音频驱动中播放一帧输出数据(放音,音频下行数据)。 + * + * @param frame 待写入的输出数据的音频frame。 + * @param replyBytes 实际写入的音频数据长度(字节数),获取后保存到replyBytes中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief 获取音频已输出的帧数。 + * + * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 + * @param time 获取的关联时间戳保存到time中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RenderFrame + * + * @since 4.1 + * @version 2.0 + */ + GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 设置一个音频的播放速度。 + * + * @param speed 待设置的播放速度(倍速),例0.5、0.75、1.0、1.25、1.5、2.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetRenderSpeed + * + * @since 4.1 + * @version 2.0 + */ + SetRenderSpeed([in] float speed); + + /** + * @brief 获取一个音频当前的播放速度。 + * + * @param speed 获取的播放速度保存到speed中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetRenderSpeed + * + * @since 4.1 + * @version 2.0 + */ + GetRenderSpeed([out] float speed); + + /** + * @brief 设置音频播放的通道模式。 + * + * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetChannelMode + * + * @since 4.1 + * @version 2.0 + */ + SetChannelMode([in] enum AudioChannelMode mode); + + /** + * @brief 获取音频播放当前的通道模式。 + * + * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetChannelMode + * + * @since 4.1 + * @version 2.0 + */ + GetChannelMode([out] enum AudioChannelMode mode); + + /** + * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 + * + * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 + * @param cookie 回调函数的入参。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 2.0 + */ + RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); + + /** + * @brief 排空缓冲区中的数据。 + * + * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 2.0 + */ + DrainBuffer([out] enum AudioDrainNotifyType type); + + /** + * @brief 判断是否支持清空缓冲区数据的功能。 + * + * @param support 是否支持的状态保存到support中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + IsSupportsDrain([out] boolean support); + /** + * @brief 是否支持某个音频场景的配置。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.1 + * @version 2.0 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
      + *
    • 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
        + *
      • 在媒体播放场景scene为media_speaker。
      • + *
      • 在语音通话免提场景scene为voice_speaker。
      • + *
      + *
    • 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • + *
    • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • + *
    + * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.1 + * @version 2.0 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.1 + * @version 2.0 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.1 + * @version 2.0 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), + * 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15)。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.1 + * @version 2.0 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
      + *
    • 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • + *
    • 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db)。
    • + *
    + * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.1 + * @version 2.0 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.1 + * @version 2.0 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.1 + * @version 2.0 + */ + SetGain([in] float gain); + + /** + * @brief 获取音频帧的大小。 + * + * 获取一帧音频数据的长度(字节数)。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.1 + * @version 2.0 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) + * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.1 + * @version 2.0 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + ReqMmapBuffer([in] int reqSize, [in] struct AudioMmapBufferDescriptor desc); + + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.1 + * @version 2.0 + */ + Start(); + + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.1 + * @version 2.0 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.1 + * @version 2.0 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.1 + * @version 2.0 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,失败返回负值;设置取消设备待机模式成功返回正值,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + TurnStandbyMode(); + + /** + * @brief Dump音频设备信息。 + * + * @param range Dump信息范围,分为简要信息、全量信息。 + * @param fd 指定Dump目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频播放的暂停和恢复功能 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); + + /** + * @brief 设置低功耗模式缓存长度。 + * + * @param size 包含音频数据的缓存长度。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 2.0 + */ + SetBufferSize([in] unsigned int size); +} +/** @} */ -- Gitee From 12e16700313dc34c77cd6cb290d90fe8d814a90e Mon Sep 17 00:00:00 2001 From: w30042960 Date: Thu, 21 Dec 2023 19:56:13 +0800 Subject: [PATCH 0176/2135] modify idl Signed-off-by: w30042960 --- .../audio/v1_0/AudioTypes.idl | 593 ++++++++++++++++++ .../audio/v1_0/IAudioAdapter.idl | 315 ++++++++++ .../audio/v1_0/IAudioCallback.idl | 87 +++ .../audio/v1_0/IAudioCapture.idl | 476 ++++++++++++++ .../audio/v1_0/IAudioManager.idl | 112 ++++ .../audio/v1_0/IAudioRender.idl | 592 +++++++++++++++++ .../audioext/v1_0/IDAudioCallback.idl | 163 +++++ .../audioext/v1_0/IDAudioManager.idl | 95 +++ .../distributed_audio/audioext/v1_0/Types.idl | 109 ++++ 9 files changed, 2542 insertions(+) create mode 100644 zh-cn/device_api/hdi/distributed_audio/audio/v1_0/AudioTypes.idl create mode 100644 zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioAdapter.idl create mode 100644 zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioCallback.idl create mode 100644 zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioCapture.idl create mode 100644 zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioManager.idl create mode 100644 zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioRender.idl create mode 100644 zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/IDAudioCallback.idl create mode 100644 zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/IDAudioManager.idl create mode 100644 zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/Types.idl diff --git a/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/AudioTypes.idl b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/AudioTypes.idl new file mode 100644 index 00000000..c2302245 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/AudioTypes.idl @@ -0,0 +1,593 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file AudioTypes.idl + * + * @brief Audio模块接口定义中使用的数据类型。 + * + * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 + * + * @since 4.1 + * @version 1.0 + */ +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audio.v1_0; + +/** + * @brief 音频端口的类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioPortDirection { + PORT_OUT = 1, /**< 音频输出端口。*/ + PORT_IN = 2, /**< 音频输入端口。*/ + PORT_OUT_IN = 3, /**< 音频输出输入端口。*/ +}; + +/** + * @brief 音频端口上的Pin脚。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioPortPin { + PIN_NONE = 0, /**< 无效端口 */ + PIN_OUT_SPEAKER = 1 << 0, /**< 喇叭输出 */ + PIN_OUT_HEADSET = 1 << 1, /**< 有线耳机输出 */ + PIN_OUT_LINEOUT = 1 << 2, /**< Lineout输出 */ + PIN_OUT_HDMI = 1 << 3, /**< HDMI输出 */ + PIN_OUT_USB = 1 << 4, /**< USB输出 */ + PIN_OUT_USB_EXT = 1 << 5, /**< USB外部声卡输出 */ + PIN_OUT_EARPIECE = 1 << 5 | 1 << 4, /**< 有线耳机输出 */ + PIN_OUT_BLUETOOTH_SCO = 1 << 6, /**< 蓝牙SCO输出 */ + PIN_OUT_DAUDIO_DEFAULT = 1 << 7, /**< 音频默认输出 */ + PIN_OUT_HEADPHONE = 1 << 8, /**< 有线耳机输出 */ + PIN_OUT_USB_HEADSET = 1 << 9, /**< ARM USB输出 */ + PIN_IN_MIC = 1 << 27 | 1 << 0, /**< 麦克风输入 */ + PIN_IN_HS_MIC = 1 << 27 | 1 << 1, /**< 耳机麦克风输入 */ + PIN_IN_LINEIN = 1 << 27 | 1 << 2, /**< Linein输入 */ + PIN_IN_USB_EXT = 1 << 27 | 1 << 3, /**< USB外部声卡输入*/ + PIN_IN_BLUETOOTH_SCO_HEADSET = 1 << 27 | 1 << 4, /**< 蓝牙SCO耳机输入 */ + PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5, /**< 音频默认输入 */ + PIN_IN_USB_HEADSET = 1 << 27 | 1 << 6, /**< ARM USB输入 */ +}; + +/** + * @brief 音频类型(场景)。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioCategory { + AUDIO_IN_MEDIA = 0, /**< 媒体 */ + AUDIO_IN_COMMUNICATION = 1, /**< 通信 */ + AUDIO_IN_RINGTONE = 2, /**< 电话铃声 */ + AUDIO_IN_CALL = 3, /**< 呼叫 */ + AUDIO_MMAP_NOIRQ = 4, /**< Mmap模式 */ +}; + +/** + * @brief 音频格式。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioFormat { + AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8bit位宽PCM(Pulse Code Modulation)格式。*/ + AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16bit位宽PCM格式。*/ + AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24bit位宽PCM格式。*/ + AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32bit位宽PCM格式。*/ + AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main格式。*/ + AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC格式。*/ + AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD格式。*/ + AUDIO_FORMAT_TYPE_AAC_ELD = 1 << 24 | 1 << 2, /**< AAC ELD格式。*/ + AUDIO_FORMAT_TYPE_AAC_HE_V1 = 1 << 24 | 1 << 2 | 1 << 0, /**< AAC HE_V1格式。*/ + AUDIO_FORMAT_TYPE_AAC_HE_V2 = 1 << 24 | 1 << 2 | 1 << 1, /**< AAC HE_V2格式。*/ + AUDIO_FORMAT_TYPE_G711A = 1 << 25 | 1 << 0, /**< PCM G711A格式。*/ + AUDIO_FORMAT_TYPE_G711U = 1 << 25 | 1 << 1, /**< PCM G711u格式。*/ + AUDIO_FORMAT_TYPE_G726 = 1 << 25 | 1 << 1 | 1 << 0, /**< PCM G726格式。*/ +}; + +/** + *@brief 音频通道掩码。 + * + * 定义音频声道的位置掩码。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioChannelMask { + AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。*/ + AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< 声道布局前右。*/ + AUDIO_CHANNEL_MONO = 1, /**< 单声道。*/ + AUDIO_CHANNEL_STEREO = 3, /**< 立体声,由左右声道组成。*/ +}; + +/** + * @brief 音频采样频率掩码。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioSampleRatesMask { + AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96K 采样频率。*/ + AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< 无效的采样频率。*/ +}; + +/** + * @brief 音频端口的数据透传模式。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioPortPassthroughMode { + PORT_PASSTHROUGH_LPCM = 1 << 0, /**< 立体声PCM。*/ + PORT_PASSTHROUGH_RAW = 1 << 1, /**< HDMI透传。*/ + PORT_PASSTHROUGH_HBR2LBR = 1 << 2, /**< 蓝光次世代音频降规格输出。*/ + PORT_PASSTHROUGH_AUTO = 1 << 3, /**< 根据HDMI EDID能力自动匹配。*/ +}; + +/** + * @brief 原始音频样本格式。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioSampleFormat { + /* 8 bits */ + AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。**/ + AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。**/ + /* 16 bits */ + AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。**/ + AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。**/ + /* 24 bits */ + AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。**/ + AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。**/ + /* 32 bits */ + AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。**/ + AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。**/ + /* 64 bits */ + AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。**/ + AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。**/ + AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。**/ + /* float double */ + AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。**/ + AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 32bit位宽浮点型非交织样本。**/ + AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。**/ + AUDIO_SAMPLE_FORMAT_F64P = 23, /**< 64bit位宽双精度浮点型非交织样本。**/ +}; + +/** + * @brief 音频播放的通道模式。 + * + * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioChannelMode { + AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。*/ + AUDIO_CHANNEL_BOTH_LEFT = 1, /**< 两个声道全部为左声道声音。*/ + AUDIO_CHANNEL_BOTH_RIGHT = 2, /**< 两个声道全部为右声道声音。*/ + AUDIO_CHANNEL_EXCHANGE = 3, /**< 左右声道数据互换,左声道为右声道声音,右声道为左声道声音。*/ + AUDIO_CHANNEL_MIX = 4, /**< 左右两个声道输出为左右声道相加(混音)。*/ + AUDIO_CHANNEL_LEFT_MUTE = 5, /**< 左声道静音,右声道播放原右声道声音。*/ + AUDIO_CHANNEL_RIGHT_MUTE = 6, /**< 右声道静音,左声道播放原左声道声音。*/ + AUDIO_CHANNEL_BOTH_MUTE = 7, /**< 左右声道均静音。*/ +}; + +/** + * @brief 音频数据结束类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioDrainNotifyType { + AUDIO_DRAIN_NORMAL_MODE = 0, /**< 曲目的所有数据播放完就结束。*/ + AUDIO_DRAIN_EARLY_MODE = 1, /**<曲目的所有数据未播放完就结束,以便给音频服务做连续性曲目切换留出时间。*/ + +}; + +/** + * @brief 回调函数通知事件类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioCallbackType { + AUDIO_NONBLOCK_WRITE_COMPLETED = 0, /**< 非阻塞式写完成。*/ + AUDIO_DRAIN_COMPLETED = 1, /**< DrainBuffer完成,详情参考{@link DrainBuffer}。*/ + AUDIO_FLUSH_COMPLETED = 2, /**< Flush完成,详情参考{@link Flush}。*/ + AUDIO_RENDER_FULL = 3, /**< 录音缓冲区已满。*/ + AUDIO_ERROR_OCCUR = 4, /**< 发生了错误。*/ +}; + +/** + * @brief 音频端口角色。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioPortRole { + AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。*/ + AUDIO_PORT_SOURCE_ROLE = 1, /**< 指定端口为发送端角色。*/ + AUDIO_PORT_SINK_ROLE = 2, /**< 指定端口为接受端角色。*/ +}; + +/** + * @brief 音频端口类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioPortType { + AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。*/ + AUDIO_PORT_DEVICE_TYPE = 1, /**< 指定端口为设备类型。*/ + AUDIO_PORT_MIX_TYPE = 2, /**< 指定端口为复合类型。*/ + AUDIO_PORT_SESSION_TYPE = 3, /**< 指定端口为会话类型。*/ +}; + +/** + * @brief 端口会话类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioSessionType { + AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。*/ + AUDIO_OUTPUT_MIX_SESSION = 1, /**< 会话绑定到特定音轨。*/ + AUDIO_ALLOCATE_SESSION = 2, /**< 会话ID需重新申请。*/ + AUDIO_INVALID_SESSION = 3, /**< 无效会话类型。*/ +}; + +/** + * @brief 音频设备类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioDeviceType { + AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。*/ + AUDIO_HEADPHONE = 1 << 1, /**< 耳机。*/ + AUDIO_HEADSET = 1 << 2, /**< 头戴式耳机。*/ + AUDIO_USB_HEADSET = 1 << 3, /**< USB头戴式耳机。*/ + AUDIO_USB_HEADPHONE = 1 << 4, /**< USB耳机。*/ + AUDIO_USBA_HEADSET = 1 << 5, /**< USB模拟头戴式耳机。*/ + AUDIO_USBA_HEADPHONE = 1 << 6, /**< USB模拟耳机。*/ + AUDIO_PRIMARY_DEVICE = 1 << 7, /**< 主音频设备。*/ + AUDIO_USB_DEVICE = 1 << 8, /**< USB音频设备。*/ + AUDIO_A2DP_DEVICE = 1 << 9, /**< 蓝牙音频设备。*/ + AUDIO_HDMI_DEVICE = 1 << 10, /**< HDMI音频设备 */ + AUDIO_ADAPTER_DEVICE = 1 << 11, /**< 声卡设备 */ + AUDIO_DEVICE_UNKNOWN, /**< 未知设备。*/ +}; + +/** + * @brief 音频事件类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioEventType { + AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。*/ + AUDIO_DEVICE_REMOVE = 2, /**< 音频设备移除。*/ + AUDIO_LOAD_SUCCESS = 3, /**< 声卡加载成功。*/ + AUDIO_LOAD_FAILURE = 4, /**< 声卡加载失败。*/ + AUDIO_UNLOAD = 5, /**< 声卡卸载。*/ + AUDIO_SERVICE_VALID = 7, /**< 音频服务可用。*/ + AUDIO_SERVICE_INVALID = 8, /**< 音频服务不可用。*/ + AUDIO_CAPTURE_THRESHOLD = 9, /**< 录音阈值上报。*/ + AUDIO_EVENT_UNKNOWN = 10, /**< 未知事件。*/ +}; + +/** + * @brief 音频扩展参数键类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioExtParamKey { + AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。*/ + AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< 分布式音频-音量事件。*/ + AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< 分布式音频-焦点事件。*/ + AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< 分布式音频-媒体按钮事件。*/ + AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< 分布式音频-音频效果事件。*/ + AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< 分布式音频-设备状态事件。*/ + AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< USB设备类型( ARM 或 HIFI)*/ + AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< 低电量事件。*/ +}; + +/** + * @brief 音频设备状态。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioDeviceStatus { + unsigned int pnpStatus; /**< 音频PnP设备状态。*/ +}; + +/** + * @brief 音频场景描述。 + * + * @since 4.1 + * @version 1.0 + */ +union SceneDesc { + unsigned int id; /**< 音频场景的ID。*/ +}; + +/** + * @brief 音频端口。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioPort { + enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。*/ + unsigned int portId; /**< 音频端口的ID。*/ + String portName; /**< 音频端口的名称。*/ +}; + +/** + * @brief 音频适配器描述符。 + * + * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, + * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioAdapterDescriptor { + String adapterName; /**< 音频适配器的名称。*/ + struct AudioPort[] ports; /**< 一个音频适配器支持的端口列表。*/ +}; + +/** + * @brief 音频设备描述符。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioDeviceDescriptor { + unsigned int portId; /**< 音频端口ID。*/ + enum AudioPortPin pins; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。*/ + String desc; /**< 以字符串命名的音频设备。*/ +}; + +/** + * @brief 音频场景描述符。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioSceneDescriptor { + union SceneDesc scene; /**< 音频场景描述。*/ + struct AudioDeviceDescriptor desc; /**< 音频设备描述符。*/ +}; + +/** + * @brief 音频输入类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum AudioInputType { + AUDIO_INPUT_DEFAULT_TYPE = 0, /**< 默认输入 */ + AUDIO_INPUT_MIC_TYPE = 1 << 0, /**< 麦克风输入 */ + AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, /**< 语音唤醒输入 */ + AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, /**< 通话 */ + AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< 声音识别 */ +}; + +/** + * @brief 音频采样属性。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioSampleAttributes { + enum AudioCategory type; /**< 音频类型,详情参考 {@link AudioCategory} */ + boolean interleaved; /**< 音频数据交织的标记。*/ + enum AudioFormat format; /**< 音频数据格式,详情参考 {@link AudioFormat}. */ + unsigned int sampleRate; /**< 音频采样频率。*/ + unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。*/ + unsigned int period; /**< 音频采样周期,单位赫兹。*/ + unsigned int frameSize; /**< 音频数据的帧大小。*/ + boolean isBigEndian; /**< 音频数据的大端标志。*/ + boolean isSignedData; /**< 音频数据有符号或无符号标志。*/ + unsigned int startThreshold; /**< 音频播放起始阈值。*/ + unsigned int stopThreshold; /**< 音频播放停止阈值。*/ + unsigned int silenceThreshold; /**< 录音缓冲区阈值。*/ + int streamId; /**< 录音或播放的标识符。*/ + int sourceType; /**< 播放或录音的音源类型。*/ +}; + +/** + * @brief 音频时间戳。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioTimeStamp { + long tvSec; /**< tvSec时间,单位:秒。 */ + long tvNSec; /**< tvNSec时间,单位:纳秒。 */ +}; + +/** + * @brief 音频子端口的支持能力。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioSubPortCapability { + unsigned int portId; /**< 子端口ID。*/ + String desc; /**< 以字符串命名的子端口。*/ + enum AudioPortPassthroughMode mask; /**< 数据透传模式,详情参考 {@link AudioPortPassthroughMode}。*/ +}; + +/** + * @brief 音频端口的支持能力。 + * +* @since 4.1 + * @version 1.0 + */ +struct AudioPortCapability { + unsigned int deviceType; /**< 设备输出、输入类型。*/ + unsigned int deviceId; /**< 设备ID,唯一的设备识别符。*/ + boolean hardwareMode; /**< 是否支持设备绑定处理。*/ + unsigned int formatNum; /**< 支持的音频格式数目。*/ + enum AudioFormat[] formats; /**< 支持的音频格式,详情参考{@link AudioFormat}。*/ + unsigned int sampleRateMasks; /**< 支持的音频采样频率(8k、16k、32k、48k)。*/ + enum AudioChannelMask channelMasks; /**< 设备的声道布局掩码,详情参考{@link AudioChannelMask}。*/ + unsigned int channelCount; /**< 最大支持的声道总数。*/ + struct AudioSubPortCapability[] subPorts; /**< 支持的子端口列表。*/ + enum AudioSampleFormat[] supportSampleFormats; /**< 支持的采样率列表,详情参考{@link AudioSampleFormat}。*/ +}; + +/** + * @brief mmap缓冲区描述符。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioMmapBufferDescriptor { + byte[] memoryAddress; /**< 指向mmap缓冲区的指针。*/ + FileDescriptor memoryFd; /**< mmap缓冲区的文件描述符。*/ + int totalBufferFrames; /**< 缓冲区总大小,单位:帧。*/ + int transferFrameSize; /**< 传输大小,单位:帧。*/ + int isShareable; /**< mmap缓冲区是否可以在进程间共享。*/ + unsigned int offset; /**< 文件偏移。*/ + String filePath; /**< mmap文件路径。*/ +}; + +/** + * @brief 音频设备拓展信息。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioDevExtInfo { + int moduleId; /**< 音频流绑定的模块ID。*/ + enum AudioPortPin type; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。*/ + String desc; /**< 地址描述。*/ +}; + +/** + * @brief 音轨拓展信息。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioMixExtInfo { + int moduleId; /**< 流所属模块标识符。*/ + int streamId; /**< 由调用者传递的Render或Capture标识符。*/ +}; + +/** + * @brief 会话拓展信息。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioSessionExtInfo { + enum AudioSessionType sessionType; /**< 音频会话类型。*/ +}; + +/** + * @brief 音频端口特定信息。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioInfo { + struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。*/ + struct AudioMixExtInfo mix; /**< 音轨特定信息,详情参考{@link AudioMixExtInfo}。*/ + struct AudioSessionExtInfo session; /**< 会话特定信息,详情参考{@link AudioSessionExtInfo}。*/ +}; + +/** + * @brief 音频路由节点。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioRouteNode { + int portId; /**< 音频端口ID。*/ + enum AudioPortRole role; /**< 指定端口角色为发送端或接收端,详情参考{@link AudioPortRole}。*/ + enum AudioPortType type; /**< 指定端口类型可以为设备类型、复合类型、绘画类型,详情参考{@link AudioPortType}。*/ + struct AudioInfo ext; /**< 音频端口特定信息,详情参考{@link AudioInfo}。*/ +}; + +/** + * @brief 音频路由信息。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioRoute { + struct AudioRouteNode[] sources; /**< 发送端列表。*/ + struct AudioRouteNode[] sinks; /**< 接受端列表。*/ +}; + +/** + * @brief 音频事件。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioEvent { + unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。*/ + unsigned int deviceType; /**< 设备类型,详情参考{@link enum AudioDeviceType}。*/ +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioAdapter.idl b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioAdapter.idl new file mode 100644 index 00000000..69ab08bb --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioAdapter.idl @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.0 + */ + + /** + * @file IAudioAdapter.idl + * + * @brief Audio适配器的接口定义文件。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audio.v1_0; + +import ohos.hdi.distributed_audio.audio.v1_0.AudioTypes; +import ohos.hdi.distributed_audio.audio.v1_0.IAudioCapture; +import ohos.hdi.distributed_audio.audio.v1_0.IAudioRender; +import ohos.hdi.distributed_audio.audio.v1_0.IAudioCallback; + +/** + * @brief 提供音频适配器(声卡)对外支持的驱动能力,包括初始化端口、创建放音、创建录音、获取端口能力集等。 + * + * @see IAudioRender + * @see IAudioCapture + * @since 4.1 + * @version 1.0 + */ +interface IAudioAdapter { + /** + * @brief 初始化一个音频适配器所有的端口驱动。 + * 在音频服务中,调用其他驱动接口前需要先调用该接口检查端口是否已经初始化完成,如果端口没有初始化完成, + * 则需要等待一段时间(例如100ms)后重新进行检查,直到端口初始化完成后再继续操作。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * + * @return 初始化完成返回值0,初始化失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + InitAllPorts(); + /** + * @brief 创建一个音频播放接口的对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@link IAudioRender}。 + * @param renderId 获取的音频播放接口序号。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetPortCapability + * @see DestroyRender + * + * @since 4.1 + * @version 1.0 + */ + CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioRender render, [out] unsigned int renderId); + /** + * @brief 销毁一个音频播放接口的对象。 + * + * @attention 在音频播放过程中,不能销毁该接口对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param renderId 待销毁的音频播放接口的序号 + * + * @return 成功返回值0,失败返回负值。 + * @see CreateRender + * + * @since 4.1 + * @version 1.0 + */ + DestroyRender([in] unsigned int renderId); + /** + * @brief 创建一个音频录音接口的对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 + * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 + * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@link IAudioCapture}。 + * @param captureId 获取的音频录音接口的序号 + * @return 成功返回值0,失败返回负值。 + * + * @see GetPortCapability + * @see DestroyCapture + + * @since 4.1 + * @version 1.0 + */ + CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioCapture capture, [out] unsigned int captureId); + /** + * @brief 销毁一个音频录音接口的对象。 + * + * @attention 在音频录音过程中,不能销毁该接口对象。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param captureId 待销毁的音频录音接口的序号 + * + * @return 成功返回值0,失败返回负值。 + * @see CreateCapture + * + * @since 4.1 + * @version 1.0 + */ + DestroyCapture([in] unsigned int captureId); + /** + * @brief 获取一个音频适配器的端口驱动的能力集。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param capability 获取的端口能力保存到capability中,详请参考{@link AudioPortCapability}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); + /** + * @brief 设置音频端口驱动的数据透传模式。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待设置的端口,详请参考{@link AudioPort}。 + * @param mode 待设置的传输模式,详请参考{@link AudioPortPassthroughMode}。 + * @return 成功返回值0,失败返回负值。 + * @see GetPassthroughMode + * + * @since 4.1 + * @version 1.0 + */ + SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); + /** + * @brief 获取音频端口驱动的数据透传模式。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param port 待获取的端口,详请参考{@link AudioPort}。 + * @param mode 获取的传输模式保存到mode中,详请参考{@link AudioPortPassthroughMode}。 + * @return 成功返回值0,失败返回负值。 + * @see SetPassthroughMode + * + * @since 4.1 + * @version 1.0 + */ + GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); + /** + * @brief 获取一个音频适配器的设备状态。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param status 获取的设备状态保存到status中,详请参考{@link AudioDeviceStatus}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetDeviceStatus([out] struct AudioDeviceStatus status); + /** + * @brief 更新音频路由。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param route 待更新的路由,详请参考{@link AudioRoute}。 + * @param routeHandle 更新后的音频路由句柄保存到routeHandle中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); + /** + * @brief 释放音频路由。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param routeHandle 待释放的音频路由句柄。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + ReleaseAudioRoute([in] int routeHandle); + /** + * @brief 设置音频静音。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param mute 表示是否将音频静音,true表示静音,false表示非静音。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMicMute + * + * @since 4.1 + * @version 1.0 + */ + SetMicMute([in] boolean mute); + /** + * @brief 获取音频静音状态。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param mute 获取的静音状态保存到mute中,true表示静音,false表示非静音。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMicMute + * + * @since 4.1 + * @version 1.0 + */ + GetMicMute([out] boolean mute); + /** + * @brief 设置语音呼叫的音量。 + * + * 音量范围从0.0到1.0。如果音频服务中的音量水平在0到15的范围内, + * 0.0表示音频静音,1.0指示最大音量级别(15)。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param volume 待设置的音量值,范围为(0.0-1.0),0.0表示最小音量值,1.0表示最大音量值。 + * @return 成功返回值0,失败返回负值。 + * @see GetVolume + * + * @since 4.1 + * @version 1.0 + */ + SetVoiceVolume([in] float volume); + /** + * @brief 根据指定的条件设置音频拓展参数。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 指定的扩展参数查询条件。 + * @param value 指定的扩展参数条件值。 + * + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待设置的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待设置的音频扩展参数相关的音量类型。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); + /** + * @brief 根据指定条件获取音频扩展参数的取值。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 指定的扩展参数查询条件。 + * @param value 待返回的指定扩展参数条件的当前值。 + * @param lenth value的长度 + * + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待查询的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待查询的音频扩展参数相关的音量类型。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); + + /** + * @brief 注册扩展参数回调函数。 + * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param callback 待注册的回调函数,详请参考{@link AudioCallback}。 + * @param cookie 用于传递数据。 + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioCallback.idl b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioCallback.idl new file mode 100644 index 00000000..3c61a855 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioCallback.idl @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.0 + */ +/** + * @file IAudioCallback.idl + * + * @brief Audio播放的回调函数定义文件。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audio.v1_0; + +import ohos.hdi.distributed_audio.audio.v1_0.AudioTypes; + +/** + * @brief Audio回调接口。 + * + * @since 4.1 + * @version 1.0 + */ +[callback] interface IAudioCallback { + /** + * @brief 放音回调函数。 + * + * @param type 回调函数通知事件类型,详请参考{@link AudioCallbackType}。 + * @param reserved 保留字段。 + * @param cookie 用于传递数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 1.0 + */ + RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); + + /** + * @brief 音频扩展参数回调函数。 + * + * @param key 扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 扩展参数条件。 + * @param value 扩展参数条件的值 + * @param reserved 保留字段。 + * @param cookie 用于传递数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see ParamCallback + * + * @since 4.1 + * @version 1.0 + */ + ParamCallback([in] enum AudioExtParamKey key, [in] String condition, [in] String value, [out] byte reserved, [in] byte cookie); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioCapture.idl b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioCapture.idl new file mode 100644 index 00000000..b0b9eff4 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioCapture.idl @@ -0,0 +1,476 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IAudioCapture.idl + * + * @brief Audio录音的接口定义文件。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audio.v1_0; + +import ohos.hdi.distributed_audio.audio.v1_0.AudioTypes; + +/** + * @brief AudioCapture音频录音接口。 + * 提供音频录音支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、录制音频帧数据等。 + * @since 4.1 + * @version 1.0 + */ +interface IAudioCapture { + /** + * @brief 从音频驱动中录制一帧输入数据(录音,音频上行数据)。 + * + * @param capture 调用当前函数的IAudioCapture指针对象 + * @param frame 待存放输入数据的音频frame。 + * @param requestBytes 待存放输入数据的音频frame大小(字节数)。 + * @param replyBytes 指向要读取的音频数据的实际长度(以字节为单位)的指针。 + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief Obtains the last number of input audio frames. + * + * @param capture 调用当前函数的IAudioCapture指针对象 + * @param frames 获取的音频帧数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * @return 成功返回值0,失败返回负值。 + * @see CaptureFrame + * + * @since 4.1 + * @version 1.0 + */ + GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 判断某个音频场景能力是否支持。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.1 + * @version 1.0 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
      + *
    • 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
        + *
      • 在媒体播放场景中,scene为media_speaker。
      • + *
      • 在语音通话免提场景中,scene为voice_speaker。
      • + *
      + *
    • 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • + *
    • 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • + *
    + * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.1 + * @version 1.0 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.1 + * @version 1.0 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.1 + * @version 1.0 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级范围是0 ~ 15, + * 则音量的映射关系为0.0(或0)表示静音,1.0(或15)表示最大音量等级。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.1 + * @version 1.0 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
      + *
    • 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • + *
    • 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音(-50db),1.0表示最大增益(6db)。
    • + *
    + * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.1 + * @version 1.0 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.1 + * @version 1.0 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.1 + * @version 1.0 + */ + SetGain([in] float gain); + + /** + * @brief 获取一帧音频数据的长度(字节数)大小。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.1 + * @version 1.0 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.1 + * @version 1.0 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小,单位:字节。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); + + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.1 + * @version 1.0 + */ + Start(); + + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.1 + * @version 1.0 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.1 + * @version 1.0 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.1 + * @version 1.0 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,再次执行后去设置待机模式成功返回正值,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + TurnStandbyMode(); + + /** + * @brief 保存音频设备信息。 + * + * @param range 需要保存的信息范围(3 ~ 5),分为简要信息(3)、一般信息(4)、全量信息(5)。 + * @param fd 保存到指定的目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频录制的暂停和恢复功能。 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioManager.idl b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioManager.idl new file mode 100644 index 00000000..d45d981b --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioManager.idl @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IAudioManager.idl + * + * @brief Audio适配器管理及加载的接口定义文件。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audio.v1_0; + +import ohos.hdi.distributed_audio.audio.v1_0.AudioTypes; +import ohos.hdi.distributed_audio.audio.v1_0.IAudioAdapter; + +/** + * @brief AudioManager音频适配器管理接口。 + * 按照音频服务下发的音频适配器(声卡)描述符加载一个具体的音频适配器驱动程序。 + * + * @see IAudioAdapter + * @since 4.1 + * @version 1.0 + */ +interface IAudioManager { + + /** + * @brief 获取音频驱动中支持的所有适配器的列表。 + * + * @param descs 获取到的音频适配器列表保存到descs中,详请参考{@link AudioAdapterDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see LoadAdapter + * + * @since 4.1 + * @version 1.0 + */ + GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); + + /** + * @brief 加载一个音频适配器(声卡)的驱动。 + * + * 加载一个具体的音频驱动,例如usb驱动,在具体实现中可能加载的是一个动态链接库(*.so)。 + * + * @param desc 待加载的音频适配器描述符,详请参考{@link AudioAdapterDescriptor}。 + * @param adapter 获取的音频适配器接口的对象实例保存到adapter中,详请参考{@link IAudioAdapter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetAllAdapters + * @see UnloadAdapter + * + * @since 4.1 + * @version 1.0 + */ + LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); + + /** + * @brief 卸载音频适配器(声卡)的驱动。 + * + * @param adapterName 待卸载的音频适配器接口的对象名称。 + * + * @see LoadAdapter + * + * @since 4.1 + * @version 1.0 + */ + UnloadAdapter([in] String adapterName); + + /** + * @brief 释放音频管理接口对象。 + * + * @return 功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + ReleaseAudioManagerObject(); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioRender.idl b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioRender.idl new file mode 100644 index 00000000..57fe13b6 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audio/v1_0/IAudioRender.idl @@ -0,0 +1,592 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Audio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IAudioRender.idl + * + * @brief Audio播放的接口定义文件。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audio.v1_0; + +import ohos.hdi.distributed_audio.audio.v1_0.AudioTypes; +import ohos.hdi.distributed_audio.audio.v1_0.IAudioCallback; + +/** + * 提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据等。 + * + * + * @since 4.1 + * @version 1.0 + */ +interface IAudioRender { + /** + * @brief 获取音频硬件驱动的延迟时间。 + * + * @param ms 获取的延迟时间(单位:毫秒)保存到ms中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetLatency([out] unsigned int ms); + + /** + * @brief 向音频驱动中播放一帧输出数据(放音,音频下行数据)。 + * + * @param frame 待写入的输出数据的音频frame。 + * @param replyBytes 实际写入的音频数据长度(字节数),获取后保存到replyBytes中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief 获取音频已输出的帧数。 + * + * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 + * @param time 获取的关联时间戳保存到time中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RenderFrame + * + * @since 4.1 + * @version 1.0 + */ + GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 设置一个音频的播放速度。 + * + * @param speed 待设置的播放速度(倍速),例0.5、0.75、1.0、1.25、1.5、2.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetRenderSpeed + * + * @since 4.1 + * @version 1.0 + */ + SetRenderSpeed([in] float speed); + + /** + * @brief 获取一个音频当前的播放速度。 + * + * @param speed 获取的播放速度保存到speed中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetRenderSpeed + * + * @since 4.1 + * @version 1.0 + */ + GetRenderSpeed([out] float speed); + + /** + * @brief 设置音频播放的通道模式。 + * + * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetChannelMode + * + * @since 4.1 + * @version 1.0 + */ + SetChannelMode([in] enum AudioChannelMode mode); + + /** + * @brief 获取音频播放当前的通道模式。 + * + * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetChannelMode + * + * @since 4.1 + * @version 1.0 + */ + GetChannelMode([out] enum AudioChannelMode mode); + + /** + * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 + * + * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 + * @param cookie 回调函数的入参。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 1.0 + */ + RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); + + /** + * @brief 排空缓冲区中的数据。 + * + * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.1 + * @version 1.0 + */ + DrainBuffer([out] enum AudioDrainNotifyType type); + + /** + * @brief 判断是否支持清空缓冲区数据的功能。 + * + * @param support 是否支持的状态保存到support中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + IsSupportsDrain([out] boolean support); + /** + * @brief 是否支持某个音频场景的配置。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.1 + * @version 1.0 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
      + *
    • 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
        + *
      • 在媒体播放场景scene为media_speaker。
      • + *
      • 在语音通话免提场景scene为voice_speaker。
      • + *
      + *
    • 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • + *
    • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • + *
    + * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.1 + * @version 1.0 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.1 + * @version 1.0 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.1 + * @version 1.0 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), + * 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15)。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.1 + * @version 1.0 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
      + *
    • 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • + *
    • 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db)。
    • + *
    + * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.1 + * @version 1.0 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.1 + * @version 1.0 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.1 + * @version 1.0 + */ + SetGain([in] float gain); + + /** + * @brief 获取音频帧的大小。 + * + * 获取一帧音频数据的长度(字节数)。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.1 + * @version 1.0 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) + * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.1 + * @version 1.0 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetExtraParams([out] String keyValueList); + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + AddAudioEffect([in] unsigned long effectid); + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.1 + * @version 1.0 + */ + Start(); + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.1 + * @version 1.0 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.1 + * @version 1.0 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.1 + * @version 1.0 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,失败返回负值;设置取消设备待机模式成功返回正值,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + TurnStandbyMode(); + /** + * @brief Dump音频设备信息。 + * + * @param range Dump信息范围,分为简要信息、全量信息。 + * @param fd 指定Dump目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频播放的暂停和恢复功能 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); + /** + * @brief 设置低功耗模式缓存长度。 + * + * @param size 包含音频数据的缓存长度。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/IDAudioCallback.idl b/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/IDAudioCallback.idl new file mode 100644 index 00000000..df765ba4 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/IDAudioCallback.idl @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Distributed Audio + * @{ + * + * @brief Distributed Audio + * + * Distributed Audio模块包括对分布式音频设备的操作、流的操作和各种回调等。 + * 通过IDAudioCallback和IDAudioManager接口,与Source SA通信交互,实现分布式功能。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IDAudioCallback.idl + * + * @brief 分布式音频HDF服务与分布式音频SA服务的传输接口调用,并为上层提供硬件驱动接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief Distributed Audio设备接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audioext.v1_0; + +import ohos.hdi.distributed_audio.audioext.v1_0.Types; + +/** + * @brief 定义Distributed Audio设备基本的操作。 + * + * 启用和关闭分布式音频设备、设置音频参数、事件通知等相关操作。 + * + * @since 4.1 + * @version 1.0 + */ +[callback] interface IDAudioCallback { + /** + * @brief 打开分布式音频设备。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + OpenDevice([in] String adpName, [in] int devId); + /** + * @brief 关闭分布式音频设备。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + CloseDevice([in] String adpName, [in] int devId); + /** + * @brief 设置分布式音频设备参数。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * @param param 音频参数(包括采样率、通道数等) + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + SetParameters([in] String adpName, [in] int devId, [in] struct AudioParameter param); + /** + * @brief 向分布式音频SA通知事件。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * @param event 通知事件类型(如焦点事件,音量事件) + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + NotifyEvent([in] String adpName, [in] int devId, [in] struct DAudioEvent event); + /** + * @brief 向分布式音频设备写入播放流。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * @param data 音频流数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + WriteStreamData([in] String adpName, [in] int devId, [in] struct AudioData data); + /** + * @brief 向分布式音频设备读取录制流。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * @param data 音频流数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + ReadStreamData([in] String adpName, [in] int devId, [out] struct AudioData data); + /** + * @brief 获取当前读写的帧数及时间戳 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * @param frames 获取的当前帧数及时间戳。 + * @param time 当前时间戳。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + ReadMmapPosition([in] String adpName, [in] int devId, [out] unsigned long frames, [out] struct CurrentTime time); + /** + * @brief 刷新共享内存信息 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * @param fd 共享内存对应文件描述符。 + * @param ashmemLength 共享内存总字节数。 + * @param lengthPerTrans 每次传输的字节数。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + RefreshAshmemInfo([in] String adpName, [in] int devId, [in] FileDescriptor fd, [in] int ashmemLength, [in] int lengthPerTrans); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/IDAudioManager.idl b/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/IDAudioManager.idl new file mode 100644 index 00000000..2c863059 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/IDAudioManager.idl @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Distributed Audio + * @{ + * + * @brief Distributed Audio + * + * Distributed Audio模块包括对分布式音频设备的操作、流的操作和各种回调等。 + * 通过IDAudioCallback和IDAudioManager接口,与Source SA通信交互,实现分布式功能。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IDAudioManager.idl + * + * @brief 分布式音频HDF层的调用接口,为分布式音频SA提供硬件驱动注册、去注册以及事件通知能力。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief Distributed Audio设备接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audioext.v1_0; + +import ohos.hdi.distributed_audio.audioext.v1_0.IDAudioCallback; +import ohos.hdi.distributed_audio.audioext.v1_0.Types; + +/** + * @brief 定义Distributed Audio设备基本的操作。 + * + * 注册与去注册分布式音频设备、提供分布式音频SA向HDF层的事件通知机制。 + */ +interface IDAudioManager { + /** + * @brief 注册分布音频设备驱动。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * @param capability 分布式音频设备能力集(包括采样率、通道数等) + * @param callbackObj 分布式音频SA回调 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + RegisterAudioDevice([in] String adpName, [in] int devId, [in] String capability, [in] IDAudioCallback callbackObj); + /** + * @brief 去注册分布音频设备驱动。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + UnRegisterAudioDevice([in] String adpName, [in] int devId); + /** + * @brief 分布音频设备SA通知事件。 + * + * @param adpName 分布式音频设备NetworkID。 + * @param devId 分布式音频设备的端口ID。 + * @param event 通知事件类型(如焦点事件,音量事件)。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.1 + * @version 1.0 + */ + NotifyEvent([in] String adpName, [in] int devId, [in] struct DAudioEvent event); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/Types.idl b/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/Types.idl new file mode 100644 index 00000000..9277f256 --- /dev/null +++ b/zh-cn/device_api/hdi/distributed_audio/audioext/v1_0/Types.idl @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Distributed Audio + * @{ + * + * @brief Distributed Audio + * + * Distributed Audio模块包括对分布式音频设备的操作、流的操作和各种回调等。 + * 通过IDAudioCallback和IDAudioManager接口,与Source SA通信交互,实现分布式功能。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file Types.idl + * + * @brief Audio模块接口定义中使用的数据类型。 + * + * Audio模块接口定义中使用的数据类型,包括音频播放模式、采样属性、事件类型、数据类型、时间戳等 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief Distributed Audio设备接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.distributed_audio.audioext.v1_0; + +/** + * @brief 音频端口播放模式。 + * + * @since 4.1 + * @version 1.0 + */ +enum PortOperationMode { + NORMAL_MODE = 0, /**< 正常模式。**/ + MMAP_MODE = 1, /**< 低时延模式。**/ +}; + +/** + * @brief 音频采样属性。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioParameter { + unsigned int format; /**< 音频采样频率。**/ + unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。**/ + unsigned int sampleRate; /**< 音频采样频率。**/ + unsigned int period; /**< 音频采样周期,单位赫兹。**/ + unsigned int frameSize; /**< 音频数据的帧大小。**/ + unsigned int streamUsage; /**< 音频流使用情况。**/ + enum PortOperationMode renderFlags; /**< 音频播放标志,用于标志播放模式。**/ + enum PortOperationMode capturerFlags; /**< 音频录音标志,用于标志播放模式。**/ + String ext; /**< 参数描述。**/ +}; + +/** + * @brief 音频数据类型。 + * + * @since 4.1 + * @version 1.0 + */ +struct AudioData { + struct AudioParameter param; /**< 音频参数。**/ + byte[] data; /**< 数据内容。**/ +}; + +/** + * @brief 音频事件类型。 + * + * @since 4.1 + * @version 1.0 + */ +struct DAudioEvent { + int type; /**< 事件类型。**/ + String content; /**< 事件内容。**/ +}; + +/** + * @brief 音频时间戳。 + * + * @since 4.1 + * @version 1.0 + */ +struct CurrentTime { + long tvSec; /**< tvSec时间,单位:秒。**/ + long tvNSec; /**< tvNSec时间,单位:纳秒。**/ +}; +/** @} */ \ No newline at end of file -- Gitee From 0c2aad2b6a222c8353a636b4ac00bec6619130cd Mon Sep 17 00:00:00 2001 From: Gloria Date: Tue, 26 Dec 2023 15:26:14 +0800 Subject: [PATCH 0177/2135] updated docs Signed-off-by: Gloria --- en/native_sdk/graphic/external_window.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/native_sdk/graphic/external_window.h b/en/native_sdk/graphic/external_window.h index 3a2c7266..bb6206cb 100644 --- a/en/native_sdk/graphic/external_window.h +++ b/en/native_sdk/graphic/external_window.h @@ -95,7 +95,7 @@ enum NativeWindowOperation { /** * Setting the geometry for the local window buffer. * Variable arguments in the function: - * [Input] int32_t height and [Input] int32_t width. + * [Input] int32_t width and [Input] int32_t height. */ SET_BUFFER_GEOMETRY, /** -- Gitee From 30dcd77c7a2e18755dfa05e4f2e6bc390a2871dc Mon Sep 17 00:00:00 2001 From: MengYao Date: Tue, 26 Dec 2023 17:06:46 +0800 Subject: [PATCH 0178/2135] =?UTF-8?q?=E6=96=87=E6=A1=A3VOD=E5=8D=95?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MengYao --- zh-cn/native_sdk/database/data/data_asset.h | 2 +- zh-cn/native_sdk/database/rdb/oh_cursor.h | 21 ++++++++++--------- zh-cn/native_sdk/database/rdb/oh_predicates.h | 1 + .../native_sdk/database/rdb/oh_value_object.h | 1 + .../database/rdb/oh_values_bucket.h | 1 + .../database/rdb/relational_store.h | 7 ++++--- .../rdb/relational_store_error_code.h | 1 + 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/zh-cn/native_sdk/database/data/data_asset.h b/zh-cn/native_sdk/database/data/data_asset.h index 1c209f00..09e8c446 100644 --- a/zh-cn/native_sdk/database/data/data_asset.h +++ b/zh-cn/native_sdk/database/data/data_asset.h @@ -34,7 +34,7 @@ * * 资产是指可以一种可以在数据管理中使用的数据结构,可以存储及查询一个文件的名称、绝对路径、相对路径、创建时间、修改时间、 状态、 * 占用空间等属性。 - * 引用文件 + * 引用文件: * @library libnative_rdb_ndk.z.so * @since 11 */ diff --git a/zh-cn/native_sdk/database/rdb/oh_cursor.h b/zh-cn/native_sdk/database/rdb/oh_cursor.h index a9ea78a5..ae6a8b5d 100644 --- a/zh-cn/native_sdk/database/rdb/oh_cursor.h +++ b/zh-cn/native_sdk/database/rdb/oh_cursor.h @@ -33,6 +33,7 @@ * @brief 提供通过查询数据库生成的数据库结果集的访问方法。 * * 结果集是指用户调用关系型数据库查询接口之后返回的结果集合,提供了多种灵活的数据访问方式,以便用户获取各项数据。 + * 引用文件: * @library libnative_rdb_ndk.z.so * @since 10 */ @@ -101,7 +102,7 @@ typedef struct OH_Cursor { * @brief 函数指针,根据指定的列索引获取列类型。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param columnType 该参数是输出参数,结果集中指定列的数据类型{@link OH_ColumnType}会写入该变量。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Cursor, OH_ColumnType. @@ -125,7 +126,7 @@ typedef struct OH_Cursor { * @brief 函数指针,根据指定的列索引获取列名。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param name 该参数是输出参数,结果集中指定列的名称会写入该变量。 * @param length 表示列名的长度。 * @return 返回操作是否成功,出错时返回对应的错误码。 @@ -159,7 +160,7 @@ typedef struct OH_Cursor { * @brief 函数指针,当结果集中列的数据类型是BLOB或者TEXT时,获取其值所需的内存。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param size 该参数是输出参数,BLOB或者TEXT数据所需内存大小会写入该变量。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Cursor. @@ -171,7 +172,7 @@ typedef struct OH_Cursor { * @brief 函数指针,以字符串形式获取当前行中指定列的值。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param value 该参数是输出参数,结果集中指定列的值会以字符串形式写入该变量。 * @param length 表示value的长度,该值可通过getSize获取。 * @return 返回操作是否成功,出错时返回对应的错误码。 @@ -184,7 +185,7 @@ typedef struct OH_Cursor { * @brief 函数指针,以int64_t形式获取当前行中指定列的值。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param value 该参数是输出参数,结果集中指定列的值会以int64_t形式写入该变量。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Cursor. @@ -196,7 +197,7 @@ typedef struct OH_Cursor { * @brief 函数指针,以double形式获取当前行中指定列的值。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param value 该参数是输出参数,结果集中指定列的值会以double形式写入该变量。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Cursor. @@ -208,7 +209,7 @@ typedef struct OH_Cursor { * @brief 函数指针,以字节数组的形式获取当前行中指定列的值。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param value 该参数是输出参数,结果集中指定列的值会以字节数组形式写入该变量。 * @param length 表示value的长度,该值可通过getSize获取。 * @return 返回操作是否成功,出错时返回对应的错误码。 @@ -221,7 +222,7 @@ typedef struct OH_Cursor { * @brief 函数指针,检查当前行中指定列的值是否为null。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param isNull 该参数是输出参数,如果当前行中指定列的值为null,该值为true,否则为false。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Cursor. @@ -243,7 +244,7 @@ typedef struct OH_Cursor { * @brief 函数指针,以资产的形式获取当前行中指定列的值。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param value 该参数是输出参数,结果集中指定列的值会以资产形式写入该变量。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Cursor. @@ -255,7 +256,7 @@ typedef struct OH_Cursor { * @brief 函数指针,以资产数组的形式获取当前行中指定列的值。 * * @param cursor 表示指向{@link OH_Cursor}实例的指针。 - * @param columnIndex 表示结果集中指定列的索引。 + * @param columnIndex 表示结果集中指定列的索引, 索引值从0开始。 * @param value 该参数是输出参数,结果集中指定列的值会以资产数组形式写入该变量。 * @param length 表示资产数组的长度。 * @return 返回操作是否成功,出错时返回对应的错误码。 diff --git a/zh-cn/native_sdk/database/rdb/oh_predicates.h b/zh-cn/native_sdk/database/rdb/oh_predicates.h index 590a3ff3..421ec3d1 100644 --- a/zh-cn/native_sdk/database/rdb/oh_predicates.h +++ b/zh-cn/native_sdk/database/rdb/oh_predicates.h @@ -31,6 +31,7 @@ * @file oh_predicates.h * * @brief 表示关系型数据库(RDB)的谓词。 + * 引用文件: * @library libnative_rdb_ndk.z.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/oh_value_object.h b/zh-cn/native_sdk/database/rdb/oh_value_object.h index 47836a8e..b6a9f3f2 100644 --- a/zh-cn/native_sdk/database/rdb/oh_value_object.h +++ b/zh-cn/native_sdk/database/rdb/oh_value_object.h @@ -31,6 +31,7 @@ * @file oh_value_object.h * * @brief 提供类型转换方法。 + * 引用文件: * @library libnative_rdb_ndk.z.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/oh_values_bucket.h b/zh-cn/native_sdk/database/rdb/oh_values_bucket.h index 084654f9..b1f531b7 100644 --- a/zh-cn/native_sdk/database/rdb/oh_values_bucket.h +++ b/zh-cn/native_sdk/database/rdb/oh_values_bucket.h @@ -31,6 +31,7 @@ * @file oh_values_bucket.h * * @brief 用于存储键值对的类型。 + * 引用文件: * @library libnative_rdb_ndk.z.so * @since 10 */ diff --git a/zh-cn/native_sdk/database/rdb/relational_store.h b/zh-cn/native_sdk/database/rdb/relational_store.h index eaf5590f..9e115847 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store.h +++ b/zh-cn/native_sdk/database/rdb/relational_store.h @@ -32,6 +32,7 @@ * @file relational_store.h * * @brief 提供管理关系数据库(RDB)方法的接口。 + * 引用文件: * @library libnative_rdb_ndk.z.so * @since 10 */ @@ -193,7 +194,7 @@ int OH_Rdb_CloseStore(OH_Rdb_Store *store); /** * @brief 使用指定的数据库文件配置删除数据库。 * - * @param path 表示数据库路径。 + * @param config 表示数据库的配置。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @since 10 */ @@ -325,7 +326,7 @@ int OH_Rdb_Restore(OH_Rdb_Store *store, const char *databasePath); * @brief 获取数据库版本。 * * @param store 表示指向{@link OH_Rdb_Store}实例的指针。 - * @param version 表示版本号。 + * @param version 该参数是输出参数, 表示版本号。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Rdb_Store. * @since 10 @@ -336,7 +337,7 @@ int OH_Rdb_GetVersion(OH_Rdb_Store *store, int *version); * @brief 设置数据库版本。 * * @param store 表示指向{@link OH_Rdb_Store}实例的指针。 - * @param version 示版本号。 + * @param version 表示版本号。 * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Rdb_Store. * @since 10 diff --git a/zh-cn/native_sdk/database/rdb/relational_store_error_code.h b/zh-cn/native_sdk/database/rdb/relational_store_error_code.h index 674bfbed..6b729728 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store_error_code.h +++ b/zh-cn/native_sdk/database/rdb/relational_store_error_code.h @@ -32,6 +32,7 @@ * @file relational_store_error_code.h * * @brief 声明关系型数据库(RDB)的错误码信息。 + * 引用文件: * @library libnative_rdb_ndk.z.so * @since 10 */ -- Gitee From 3459e5f1aa840012382ad61a60710eb48bae8bf8 Mon Sep 17 00:00:00 2001 From: w00804697 Date: Wed, 27 Dec 2023 11:08:36 +0800 Subject: [PATCH 0179/2135] Description: Fix Huks Doc Signed-off-by: wangshengming --- .../security/huks/native_huks_api.h | 23 +++- .../security/huks/native_huks_param.h | 26 ++--- .../security/huks/native_huks_type.h | 107 +++++++++++------- 3 files changed, 96 insertions(+), 60 deletions(-) diff --git a/zh-cn/native_sdk/security/huks/native_huks_api.h b/zh-cn/native_sdk/security/huks/native_huks_api.h index cc2fc893..af4e6a86 100644 --- a/zh-cn/native_sdk/security/huks/native_huks_api.h +++ b/zh-cn/native_sdk/security/huks/native_huks_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -138,7 +138,8 @@ struct OH_Huks_Result OH_Huks_GetKeyItemParamSet(const struct OH_Huks_Blob *keyA * @param keyAlias 要查找的密钥的别名。 * @param paramSet 查询密钥需要的属性TAG(默认传空)。 * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时密钥存在, - * 返回{@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST}不存在,其他时为错误。 + * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST}不存在 + * @return 返回其他错误在其他情况。 * @since 9 * @version 1.0 */ @@ -158,6 +159,20 @@ struct OH_Huks_Result OH_Huks_IsKeyItemExist(const struct OH_Huks_Blob *keyAlias struct OH_Huks_Result OH_Huks_AttestKeyItem(const struct OH_Huks_Blob *keyAlias, const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_CertChain *certChain); +/** + * @brief 获取密钥证书链。 + * + * @param keyAlias 要获取证书的密钥的别名。 + * @param paramSet 获取密钥证书需要的参数。 + * @param certChain 存放输出的密钥证书链。 + * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时获取成功,其他时为错误。 + * @since 11 + * @version 1.0 + * @note 这是一个涉及网络的耗时接口,调用方需要通过异步方式获取证书链。 + */ +struct OH_Huks_Result OH_Huks_AnonAttestKeyItem(const struct OH_Huks_Blob *keyAlias, + const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_CertChain *certChain); + /** * @brief 初始化密钥会话接口,并获取一个句柄(必选)和挑战值(可选)。 * @@ -165,7 +180,7 @@ struct OH_Huks_Result OH_Huks_AttestKeyItem(const struct OH_Huks_Blob *keyAlias, * @param paramSet 初始化操作的密钥参数集合。 * @param handle 密钥会话的句柄,后续其他操作时传入该句柄,包括{@link OH_Huks_UpdateSession}, * {@link OH_Huks_FinishSession}, {@link OH_Huks_AbortSession}。 - * @param challenge 存放安全访问控制时传回的challenge + * @param token 存放安全访问控制时传回的token * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时接口使用成功,其他时为错误。 * @since 9 * @version 1.0 @@ -174,7 +189,7 @@ struct OH_Huks_Result OH_Huks_AttestKeyItem(const struct OH_Huks_Blob *keyAlias, * @see OH_Huks_AbortSession */ struct OH_Huks_Result OH_Huks_InitSession(const struct OH_Huks_Blob *keyAlias, - const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_Blob *handle, struct OH_Huks_Blob *challenge); + const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_Blob *handle, struct OH_Huks_Blob *token); /** * @brief 分段添加密钥操作的数据并进行相应的密钥操作,输出处理数据。 diff --git a/zh-cn/native_sdk/security/huks/native_huks_param.h b/zh-cn/native_sdk/security/huks/native_huks_param.h index 0c8d5a64..8a2450e9 100644 --- a/zh-cn/native_sdk/security/huks/native_huks_param.h +++ b/zh-cn/native_sdk/security/huks/native_huks_param.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -51,7 +51,7 @@ extern "C" { * @since 9 * @version 1.0 */ -int32_t OH_Huks_InitParamSet(struct OH_Huks_ParamSet **paramSet); +struct OH_Huks_Result OH_Huks_InitParamSet(struct OH_Huks_ParamSet **paramSet); /** * @brief 添加参数到参数集里面。 @@ -63,7 +63,7 @@ int32_t OH_Huks_InitParamSet(struct OH_Huks_ParamSet **paramSet); * @since 9 * @version 1.0 */ -int32_t OH_Huks_AddParams(struct OH_Huks_ParamSet *paramSet, +struct OH_Huks_Result OH_Huks_AddParams(struct OH_Huks_ParamSet *paramSet, const struct OH_Huks_Param *params, uint32_t paramCnt); /** @@ -74,7 +74,7 @@ int32_t OH_Huks_AddParams(struct OH_Huks_ParamSet *paramSet, * @since 9 * @version 1.0 */ -int32_t OH_Huks_BuildParamSet(struct OH_Huks_ParamSet **paramSet); +struct OH_Huks_Result OH_Huks_BuildParamSet(struct OH_Huks_ParamSet **paramSet); /** * @brief 销毁参数集。 @@ -95,7 +95,7 @@ void OH_Huks_FreeParamSet(struct OH_Huks_ParamSet **paramSet); * @since 9 * @version 1.0 */ -int32_t OH_Huks_CopyParamSet(const struct OH_Huks_ParamSet *fromParamSet, +struct OH_Huks_Result OH_Huks_CopyParamSet(const struct OH_Huks_ParamSet *fromParamSet, uint32_t fromParamSetSize, struct OH_Huks_ParamSet **paramSet); /** @@ -108,29 +108,29 @@ int32_t OH_Huks_CopyParamSet(const struct OH_Huks_ParamSet *fromParamSet, * @since 9 * @version 1.0 */ -int32_t OH_Huks_GetParam(const struct OH_Huks_ParamSet *paramSet, uint32_t tag, +struct OH_Huks_Result OH_Huks_GetParam(const struct OH_Huks_ParamSet *paramSet, uint32_t tag, struct OH_Huks_Param **param); /** - * @brief 刷新(复制)参数集内Blob类型的数据到参数集内。 + * @brief 刷新参数集内Blob类型的数据。 * * @param paramSet 指向参数集的指针。 - * @param isCopy 是否要刷新参数集内存中的struct HksBlob型的参数数据。 + * @param isCopy 如果为true,刷新Blob类型数据的地址并复制到参数集。否则,只会刷新Blob类型数据的地址。 * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时表示成功,其他时为错误。 * @since 9 * @version 1.0 */ -int32_t OH_Huks_FreshParamSet(struct OH_Huks_ParamSet *paramSet, bool isCopy); +struct OH_Huks_Result OH_Huks_FreshParamSet(struct OH_Huks_ParamSet *paramSet, bool isCopy); /** * @brief 检查参数集中的参数是否有效、是否有重复。 * * @param paramSet 指向参数集的指针。 - * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时表示有效,其他时为无效或者错误。 + * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时表示有效,其他时为无效,重复或者错误的参数。 * @since 9 * @version 1.0 */ -int32_t OH_Huks_isParamSetTagValid(const struct OH_Huks_ParamSet *paramSet); +struct OH_Huks_Result OH_Huks_IsParamSetTagValid(const struct OH_Huks_ParamSet *paramSet); /** * @brief 检查参数集大小是否有效。 @@ -141,7 +141,7 @@ int32_t OH_Huks_isParamSetTagValid(const struct OH_Huks_ParamSet *paramSet); * @since 9 * @version 1.0 */ -int32_t OH_Huks_isParamSetValid(const struct OH_Huks_ParamSet *paramSet, uint32_t size); +struct OH_Huks_Result OH_Huks_IsParamSetValid(const struct OH_Huks_ParamSet *paramSet, uint32_t size); /** * @brief 比较两个参数是否相同 @@ -152,7 +152,7 @@ int32_t OH_Huks_isParamSetValid(const struct OH_Huks_ParamSet *paramSet, uint32_ * @since 9 * @version 1.0 */ -int32_t OH_Huks_CheckParamMatch(const struct OH_Huks_Param *baseParam, const struct OH_Huks_Param *param); +struct OH_Huks_Result OH_Huks_CheckParamMatch(const struct OH_Huks_Param *baseParam, const struct OH_Huks_Param *param); #ifdef __cplusplus } diff --git a/zh-cn/native_sdk/security/huks/native_huks_type.h b/zh-cn/native_sdk/security/huks/native_huks_type.h index 8857b1bf..a3cd0859 100644 --- a/zh-cn/native_sdk/security/huks/native_huks_type.h +++ b/zh-cn/native_sdk/security/huks/native_huks_type.h @@ -340,7 +340,7 @@ enum OH_Huks_ImportKeyType { }; /** - * @brief RSA在签名验签、填充模式为PSS时需要指定的盐值长度类型。 + * @brief 枚举密钥存储格式 * * @since 10 * @version 1.0 @@ -394,6 +394,16 @@ enum OH_Huks_ErrCode { OH_HUKS_ERR_CODE_INTERNAL_ERROR = 12000012, /** 认证凭据不存在。 */ OH_HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST = 12000013, + /** 内存不足。 */ + OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014, + /** 调用服务失败。 */ + OH_HUKS_ERR_CODE_CALL_SERVICE_FAILED = 12000015, + /** + * 需要锁屏密码,但没有设置。 + * + * @since 11 + */ + OH_HUKS_ERR_CODE_DEVICE_PASSWORD_UNSET = 12000016, }; /** @@ -444,6 +454,35 @@ enum OH_Huks_AuthAccessType { OH_HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD = 1 << 0, /** 安全访问控制类型为新录入生物特征后密钥无效。 */ OH_HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL = 1 << 1, + /** + * 密钥永久有效。 + * + * @since 11 + */ + OH_HUKS_AUTH_ACCESS_ALWAYS_VALID = 1 << 2, +}; + +/** + * @brief 密钥文件存储访问类别。 + * + * @since 11 + */ +enum OH_Huks_AuthStorageLevel { + /** + * 设备加密标准的密钥文件存储安全级别。 + * @since 11 + */ + OH_HUKS_AUTH_STORAGE_LEVEL_DE = 0, + /** + * 凭据加盟标准的密钥文件存储安全级别。 + * @since 11 + */ + OH_HUKS_AUTH_STORAGE_LEVEL_CE = 1, + /** + * 增强凭据加盟标准的密钥文件存储安全级别。 + * @since 11 + */ + OH_HUKS_AUTH_STORAGE_LEVEL_ECE = 2, }; /** @@ -497,9 +536,6 @@ enum OH_Huks_SecureSignType { * @version 1.0 */ enum OH_Huks_Tag { - /** 非法的Tag。 */ - OH_HUKS_TAG_INVALID = OH_HUKS_TAG_TYPE_INVALID | 0, - /** 密钥参数标签值:从1到200。 */ /** 算法类型。 */ OH_HUKS_TAG_ALGORITHM = OH_HUKS_TAG_TYPE_UINT | 1, @@ -526,19 +562,11 @@ enum OH_Huks_Tag { OH_HUKS_TAG_INFO = OH_HUKS_TAG_TYPE_BYTES | 11, /** 派生盐值。 */ OH_HUKS_TAG_SALT = OH_HUKS_TAG_TYPE_BYTES | 12, - /** 派生密码。 */ - OH_HUKS_TAG_PWD = OH_HUKS_TAG_TYPE_BYTES | 13, /** 派生迭代次数。 */ OH_HUKS_TAG_ITERATION = OH_HUKS_TAG_TYPE_UINT | 14, /** 生成密钥的类型,类型可在枚举{@link OH_Huks_KeyGenerateType}中选择。 */ OH_HUKS_TAG_KEY_GENERATE_TYPE = OH_HUKS_TAG_TYPE_UINT | 15, - /** 密钥派生时的主密钥。 */ - OH_HUKS_TAG_DERIVE_MAIN_KEY = OH_HUKS_TAG_TYPE_BYTES | 16, - /** 派生时的派生因子。 */ - OH_HUKS_TAG_DERIVE_FACTOR = OH_HUKS_TAG_TYPE_BYTES | 17, - /** 派生时的算法类型。 */ - OH_HUKS_TAG_DERIVE_ALG = OH_HUKS_TAG_TYPE_UINT | 18, /** 密钥协商时的算法类型。 */ OH_HUKS_TAG_AGREE_ALG = OH_HUKS_TAG_TYPE_UINT | 19, /** 密钥协商时的公钥别名。 */ @@ -551,11 +579,11 @@ enum OH_Huks_Tag { OH_HUKS_TAG_KEY_ALIAS = OH_HUKS_TAG_TYPE_BYTES | 23, /** 派生密钥大小。 */ OH_HUKS_TAG_DERIVE_KEY_SIZE = OH_HUKS_TAG_TYPE_UINT | 24, - /** 导入密钥类型, 类型可在枚举OH_Huks_ImportKeyType中选择。 */ + /** 导入密钥类型, 类型可在枚举{@link OH_Huks_ImportKeyType}中选择。 */ OH_HUKS_TAG_IMPORT_KEY_TYPE = OH_HUKS_TAG_TYPE_UINT | 25, /** 导入加密密钥的套件。 */ OH_HUKS_TAG_UNWRAP_ALGORITHM_SUITE = OH_HUKS_TAG_TYPE_UINT | 26, - /** 派生密钥/协商密钥的存储类型。 */ + /** 派生密钥/协商密钥的存储类型,类型可在枚举{@link OH_Huks_KeyStorageType}中选择。 */ OH_HUKS_TAG_DERIVED_AGREED_KEY_STORAGE_FLAG = OH_HUKS_TAG_TYPE_UINT | 29, /** RSA算法,填充模式为PSS时的盐值长度类型。 */ OH_HUKS_TAG_RSA_PSS_SALT_LEN_TYPE = OH_HUKS_TAG_TYPE_UINT | 30, @@ -573,44 +601,31 @@ enum OH_Huks_Tag { OH_HUKS_TAG_AUTH_TIMEOUT = OH_HUKS_TAG_TYPE_UINT | 305, /** 表示密钥访问控制中使用密钥时传入的authtoken的类型 */ OH_HUKS_TAG_AUTH_TOKEN = OH_HUKS_TAG_TYPE_BYTES | 306, - /** 表示安全访问控制类型。从OH_Huks_AuthAccessType中选择,需要和用户认证类型同时设置。 */ + /** 表示安全访问控制类型,需要和用户认证类型同时设置,类型可在枚举{@link OH_Huks_AuthAccessType}中选择。 */ OH_HUKS_TAG_KEY_AUTH_ACCESS_TYPE = OH_HUKS_TAG_TYPE_UINT | 307, /** 表示生成或导入密钥时,指定该密钥的签名类型。 */ OH_HUKS_TAG_KEY_SECURE_SIGN_TYPE = OH_HUKS_TAG_TYPE_UINT | 308, - /** 表示密钥使用时生成的challenge类型。从OH_Huks_ChallengeType中选择。 */ + /** 表示密钥使用时生成的challenge类型,类型可在枚举{@link OH_Huks_ChallengeType}中选择。 */ OH_HUKS_TAG_CHALLENGE_TYPE = OH_HUKS_TAG_TYPE_UINT | 309, - /** 表示challenge类型为用户自定义类型时,huks产生的challenge有效长度仅为8字节连续的数据的位置。从OH_Huks_ChallengePosition中选择。 */ + /** 表示challenge类型为用户自定义类型时,huks产生的challenge有效长度仅为8字节连续的数据的位置,类型可在枚举{@link OH_Huks_ChallengePosition}中选择。 */ OH_HUKS_TAG_CHALLENGE_POS = OH_HUKS_TAG_TYPE_UINT | 310, /** 表示密钥认证用途的类型。 */ OH_HUKS_TAG_KEY_AUTH_PURPOSE = OH_HUKS_TAG_TYPE_UINT | 311, + /** + * 密钥文件存储访问控制的类别,类型可在枚举{@link OH_Huks_AuthStorageLevel}中选择。 + * + * @since 11 + */ + OH_HUKS_TAG_AUTH_STORAGE_LEVEL = OH_HUKS_TAG_TYPE_UINT | 316, + /** 密钥认证相关的标签值: 501 - 600 */ /** 密钥认证时的挑战值。 */ OH_HUKS_TAG_ATTESTATION_CHALLENGE = OH_HUKS_TAG_TYPE_BYTES | 501, /** 密钥认证时拥有该密钥的application的Id。 */ OH_HUKS_TAG_ATTESTATION_APPLICATION_ID = OH_HUKS_TAG_TYPE_BYTES | 502, - /** 设备的品牌。 */ - OH_HUKS_TAG_ATTESTATION_ID_BRAND = OH_HUKS_TAG_TYPE_BYTES | 503, - /** 设备的设备ID。 */ - OH_HUKS_TAG_ATTESTATION_ID_DEVICE = OH_HUKS_TAG_TYPE_BYTES | 504, - /** 设备的产品名。 */ - OH_HUKS_TAG_ATTESTATION_ID_PRODUCT = OH_HUKS_TAG_TYPE_BYTES | 505, - /** 设备的SN号。 */ - OH_HUKS_TAG_ATTESTATION_ID_SERIAL = OH_HUKS_TAG_TYPE_BYTES | 506, - /** 设备的IMEI号。 */ - OH_HUKS_TAG_ATTESTATION_ID_IMEI = OH_HUKS_TAG_TYPE_BYTES | 507, - /** 设备的MEID号。 */ - OH_HUKS_TAG_ATTESTATION_ID_MEID = OH_HUKS_TAG_TYPE_BYTES | 508, - /** 设备的制造商。 */ - OH_HUKS_TAG_ATTESTATION_ID_MANUFACTURER = OH_HUKS_TAG_TYPE_BYTES | 509, - /** 设备的型号。 */ - OH_HUKS_TAG_ATTESTATION_ID_MODEL = OH_HUKS_TAG_TYPE_BYTES | 510, /** 密钥别名。 */ OH_HUKS_TAG_ATTESTATION_ID_ALIAS = OH_HUKS_TAG_TYPE_BYTES | 511, - /** 设备的SOCID。 */ - OH_HUKS_TAG_ATTESTATION_ID_SOCID = OH_HUKS_TAG_TYPE_BYTES | 512, - /** 设备的UDID。 */ - OH_HUKS_TAG_ATTESTATION_ID_UDID = OH_HUKS_TAG_TYPE_BYTES | 513, /** 密钥认证时的安全凭据。 */ OH_HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO = OH_HUKS_TAG_TYPE_BYTES | 514, /** 密钥认证时的版本号。 */ @@ -637,12 +652,18 @@ enum OH_Huks_Tag { OH_HUKS_TAG_KEY_FLAG = OH_HUKS_TAG_TYPE_UINT | 1007, /** 是否异步 */ OH_HUKS_TAG_IS_ASYNCHRONIZED = OH_HUKS_TAG_TYPE_UINT | 1008, - /** 安全密钥别名。 */ - OH_HUKS_TAG_SECURE_KEY_ALIAS = OH_HUKS_TAG_TYPE_BOOL | 1009, - /** 安全密钥UUID。 */ - OH_HUKS_TAG_SECURE_KEY_UUID = OH_HUKS_TAG_TYPE_BYTES | 1010, /** 密钥域。 */ OH_HUKS_TAG_KEY_DOMAIN = OH_HUKS_TAG_TYPE_UINT | 1011, + /** + * 基于设备密码设置状态的密钥访问控制。 + * True 表示只有在密码设置时才能生成和使用密钥。 + * + * @since 11 + */ + OH_HUKS_TAG_IS_DEVICE_PASSWORD_SET = OH_HUKS_TAG_TYPE_BOOL | 1012, + + /** 身份验证加密. */ + OH_HUKS_TAG_AE_TAG = OH_HUKS_TAG_TYPE_BYTES | 10009, /** * 预留值: 11000 - 12000 @@ -694,7 +715,7 @@ struct OH_Huks_Blob { struct OH_Huks_Param { /** 标签值 */ uint32_t tag; - + union { /** bool型参数。 */ bool boolParam; @@ -704,7 +725,7 @@ struct OH_Huks_Param { uint32_t uint32Param; /** uint64_t型参数。 */ uint64_t uint64Param; - /** struct OH_Huks_Blob型参数。 */ + /** OH_Huks_Blob型参数。 */ struct OH_Huks_Blob blob; }; }; -- Gitee From de4cbb5d85070856ae043a6862b852b8e45438d1 Mon Sep 17 00:00:00 2001 From: zhangkai269 Date: Mon, 25 Dec 2023 14:58:07 +0800 Subject: [PATCH 0180/2135] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91o?= =?UTF-8?q?haudio=20=E5=A4=B4=E6=96=87=E4=BB=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangkai269 --- .../media/ohaudio/native_audiocapturer.h | 5 +- .../media/ohaudio/native_audiorenderer.h | 3 +- .../media/ohaudio/native_audiostream_base.h | 81 +++++++++++++++---- .../media/ohaudio/native_audiostreambuilder.h | 15 +++- 4 files changed, 84 insertions(+), 20 deletions(-) diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h b/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h index e469ca43..ffedf405 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h @@ -224,9 +224,10 @@ OH_AudioStream_Result OH_AudioCapturer_GetTimestamp(OH_AudioCapturer *capturer, * @param frames 指向将为帧计数设置的变量的指针(作为返回值使用)。 * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 */ -OH_AudioStream_Result OH_AudioCapturer_GetFramesRead(OH_AudioCapturer *capturer, int64_t *frames) +OH_AudioStream_Result OH_AudioCapturer_GetFramesRead(OH_AudioCapturer *capturer, int64_t *frames); #ifdef __cplusplus } #endif -#endif // NATIVE_AUDIOCAPTURER_H \ No newline at end of file +#endif // NATIVE_AUDIOCAPTURER_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h b/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h index 9b9f0c21..d83ee993 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h @@ -225,4 +225,5 @@ OH_AudioStream_Result OH_AudioRenderer_GetFrameSizeInCallback(OH_AudioRenderer * #ifdef __cplusplus } #endif -#endif // NATIVE_AUDIORENDERER_H \ No newline at end of file +#endif // NATIVE_AUDIORENDERER_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h b/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h index d7e20cba..21e8ee01 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h @@ -54,22 +54,22 @@ typedef enum { /** * 操作成功 */ - AUDIOSTREAM_SUCCESS, + AUDIOSTREAM_SUCCESS = 0, /** * 入参错误。 */ - AUDIOSTREAM_ERROR_INVALID_PARAM, + AUDIOSTREAM_ERROR_INVALID_PARAM = 1, /** * 非法状态。 */ - AUDIOSTREAM_ERROR_ILLEGAL_STATE, + AUDIOSTREAM_ERROR_ILLEGAL_STATE = 2, /** * 系统通用错误。 */ - AUDIOSTREAM_ERROR_SYSTEM + AUDIOSTREAM_ERROR_SYSTEM = 3 } OH_AudioStream_Result; /** @@ -149,10 +149,46 @@ typedef enum { * 通话。 */ AUDIOSTREAM_USAGE_COMMUNICATION = 2, + /** + * 语音助手。 + */ + AUDIOSTREAM_USAGE_VOICE_ASSISTANT = 3, + /** + * 闹钟。 + */ + AUDIOSTREAM_USAGE_ALARM = 4, + /** + * 语音消息。 + */ + AUDIOSTREAM_USAGE_VOICE_MESSAGE = 5, + /** + * 铃声。 + */ + AUDIOSTREAM_USAGE_RINGTONE = 6, + /** + * 通知。 + */ + AUDIOSTREAM_USAGE_NOTIFICATION = 7, + /** + * 无障碍。 + */ + AUDIOSTREAM_USAGE_ACCESSIBILITY = 8, + /** + * 视频。 + */ + AUDIOSTREAM_USAGE_MOVIE = 10, /** * 游戏。 */ AUDIOSTREAM_USAGE_GAME = 11, + /** + * 有声读物。 + */ + AUDIOSTREAM_USAGE_AUDIOBOOK = 12, + /** + * 导航。 + */ + AUDIOSTREAM_USAGE_NAVIGATION = 13 } OH_AudioStream_Usage; /** @@ -165,7 +201,11 @@ typedef enum { /** * 该模式代表一个普通时延的音频流。 */ - AUDIOSTREAM_LATENCY_MODE_NORMAL, + AUDIOSTREAM_LATENCY_MODE_NORMAL = 0, + /** + * 该模式代表一个低时延的音频流。 + */ + AUDIOSTREAM_LATENCY_MODE_FAST = 1 } OH_AudioStream_LatencyMode; /** @@ -179,6 +219,10 @@ typedef enum { * 不合法的状态。 */ AUDIOSTREAM_STATE_INVALID = -1, + /** + * 新创建时的状态。 + */ + AUDIOSTREAM_STATE_NEW = 0, /** * 准备状态。 */ @@ -217,11 +261,15 @@ typedef enum { /** * 录音。 */ - AUDIOSTREAM_SOURCE_TYPE_MIC, + AUDIOSTREAM_SOURCE_TYPE_MIC = 0, /** * 语音识别。 */ AUDIOSTREAM_SOURCE_TYPE_VOICE_RECOGNITION = 1, + /** + * 播放录音。 + */ + AUDIOSTREAM_SOURCE_TYPE_PLAYBACK_CAPTURE = 2, /** * 通话。 */ @@ -240,7 +288,7 @@ typedef enum { /** * 音频的路由已更改。 */ - AUDIOSTREAM_EVENT_ROUTING_CHANGED + AUDIOSTREAM_EVENT_ROUTING_CHANGED = 0 } OH_AudioStream_Event; /** @@ -255,11 +303,11 @@ typedef enum { /** * 强制类型,系统更改音频状态。 */ - AUDIOSTREAM_INTERRUPT_FORCE, + AUDIOSTREAM_INTERRUPT_FORCE = 0, /** * 共享类型,应用程序更改音频状态。 */ - AUDIOSTREAM_INTERRUPT_SHAR + AUDIOSTREAM_INTERRUPT_SHAR = 1 } OH_AudioInterrupt_ForceType; /** @@ -274,27 +322,27 @@ typedef enum { /** * 不提示。 */ - AUDIOSTREAM_INTERRUPT_HINT_NONE, + AUDIOSTREAM_INTERRUPT_HINT_NONE = 0, /** * 恢复流提示。 */ - AUDIOSTREAM_INTERRUPT_HINT_RESUME, + AUDIOSTREAM_INTERRUPT_HINT_RESUME = 1, /** * 暂停流提示。 */ - AUDIOSTREAM_INTERRUPT_HINT_PAUSE, + AUDIOSTREAM_INTERRUPT_HINT_PAUSE = 2, /** * 停止流提示。 */ - AUDIOSTREAM_INTERRUPT_HINT_STOP, + AUDIOSTREAM_INTERRUPT_HINT_STOP = 3, /** * 短暂降低音量。 */ - AUDIOSTREAM_INTERRUPT_HINT_DUCK, + AUDIOSTREAM_INTERRUPT_HINT_DUCK = 4, /** * 恢复音量。 */ - AUDIOSTREAM_INTERRUPT_HINT_UNDUCK + AUDIOSTREAM_INTERRUPT_HINT_UNDUCK = 5 } OH_AudioInterrupt_Hint; /** @@ -414,4 +462,5 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { } #endif -#endif // NATIVE_AUDIOSTREAM_BASE_H \ No newline at end of file +#endif // NATIVE_AUDIOSTREAM_BASE_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h b/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h index 15136d8d..0ffea7f7 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h @@ -202,8 +202,21 @@ OH_AudioStream_Result OH_AudioStreamBuilder_GenerateRenderer(OH_AudioStreamBuild */ OH_AudioStream_Result OH_AudioStreamBuilder_GenerateCapturer(OH_AudioStreamBuilder* builder, OH_AudioCapturer** audioCapturer); + +/** + * @brief 设置每次回调的帧长,帧长至少为音频硬件一次处理的数据大小,并且小于内部缓冲容量的一半。 + * + * @since 11 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param frameSize 要设置音频数据的帧长。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetFrameSizeInCallback(OH_AudioStreamBuilder* builder, + int32_t frameSize); #ifdef __cplusplus } #endif -#endif // NATIVE_AUDIOSTREAMBUILDER_H \ No newline at end of file +#endif // NATIVE_AUDIOSTREAMBUILDER_H +/** @} */ \ No newline at end of file -- Gitee From 0feee1b0bc0737fed6547d708c48459107f061e0 Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 28 Dec 2023 03:35:19 +0000 Subject: [PATCH 0181/2135] update zh-cn/native_sdk/net/dns/net_connection_type.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net/dns/net_connection_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/net/dns/net_connection_type.h b/zh-cn/native_sdk/net/dns/net_connection_type.h index 670ade42..3bdb321f 100644 --- a/zh-cn/native_sdk/net/dns/net_connection_type.h +++ b/zh-cn/native_sdk/net/dns/net_connection_type.h @@ -20,7 +20,7 @@ * @addtogroup NetConnection * @{ * - * @brief 为网络管理的数据网络连接模块的C接口提供数据结构. + * @brief 为网络管理数据网络连接模块提供C接口. * * @since 11 * @version 1.0 @@ -28,7 +28,7 @@ /** * @file net_connection_type.h - * @brief 定义网络连接模块的C接口需要的数据结构. + * @brief 为网络管理数据网络连接模块提供C接口. * * @library libnet_connection.so * @syscap SystemCapability.Communication.NetManager.Core -- Gitee From c8cdf5b012377b872efce2186ccfe7f0c95bcadd Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 28 Dec 2023 03:38:03 +0000 Subject: [PATCH 0182/2135] rename en/native_sdk/net/dns/native_net_conn_api.h to en/native_sdk/net/dns/net_connection.h. Signed-off-by: Aurora --- en/native_sdk/net/dns/native_net_conn_api.h | 118 ----------- en/native_sdk/net/dns/net_connection.h | 211 ++++++++++++++++++++ 2 files changed, 211 insertions(+), 118 deletions(-) delete mode 100644 en/native_sdk/net/dns/native_net_conn_api.h create mode 100644 en/native_sdk/net/dns/net_connection.h diff --git a/en/native_sdk/net/dns/native_net_conn_api.h b/en/native_sdk/net/dns/native_net_conn_api.h deleted file mode 100644 index 1d332a27..00000000 --- a/en/native_sdk/net/dns/native_net_conn_api.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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 NATIVE_NET_CONN_API_H -#define NATIVE_NET_CONN_API_H - -/** - * @addtogroup NetConn - * @{ - * - * @brief Provides C APIs for the data network connection module of network management. - * - * @since 11 - * @version 1.0 - */ - -/** - * @file native_net_conn_api.h - * - * @brief Provides C APIs for the data network connection module of network management. - * - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 - */ - -#include "native_net_conn_type.h" -#include "netdb.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Obtains the DNS result based on netId. - * - * @param host Host name. - * @param serv Service name. - * @param hint Pointer to the addrinfo structure. - * @param res DNS query result, which is in the format of linked lists. - * @param netId Network ID. If netId is 0, the default network ID is used for DNS query. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.INTERNET - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 -*/ -int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); - -/** - * @brief Releases the DNS query result. - * - * @param res DNS query result, which is in the format of linked lists. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.INTERNET - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 -*/ -int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); - -/** - * @brief Registers a custom DNS resolver. - * - * @param resolve Pointer to the custom DNS resolver. - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.INTERNET - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 -*/ -int32_t OHOS_NetConn_RegisterDnsHook(customdnsresolve resolve); - -/** - * @brief Unregisters a custom DNS resolver. - * - * @return 0: success. - * @return 201: insufficient permission. - * @return 401: parameter error. - * @return 2100002: service connection failure. - * @return 2100003: internal error. - * @permission ohos.permission.INTERNET - * @syscap SystemCapability.Communication.NetManager.Core - * @since 11 - * @version 1.0 -*/ -int32_t OHOS_NetConn_UnRegisterDnsHook(void); - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif /* NATIVE_NET_CONN_API_H */ diff --git a/en/native_sdk/net/dns/net_connection.h b/en/native_sdk/net/dns/net_connection.h new file mode 100644 index 00000000..7a64821b --- /dev/null +++ b/en/native_sdk/net/dns/net_connection.h @@ -0,0 +1,211 @@ +/* + * 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 NATIVE_NET_CONN_API_H +#define NATIVE_NET_CONN_API_H + +/** + * @addtogroup NetConnection + * @{ + * + * @brief Provide C interface for the data network connection module of network management. + * + * @since 11 + * @version 1.0 + */ + +/** + * @file net_connection.h + * + * @brief Provide C interface for the data network connection module of network management. + * + * @syscap SystemCapability.Communication.NetManager.Core + * @library libnet_connection.so + * @since 11 + * @version 1.0 + */ + +#include + +#include "net_connection_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Checks whether a default activated data network is available. + * + * @param hasDefaultNet Pointer to the result that specifies whether a default activated data network is available. + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_HasDefaultNet(int32_t *hasDefaultNet); + +/** + * @brief Obtains the default activated data network. + * + * @param netHandle Pointer to the network handle that contains the network ID. + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetDefaultNet(NetConn_NetHandle *netHandle); + +/** + * @brief Checks whether metering is enabled for the default data network. + * + * @param isMetered Pointer to the result that specifies whether metering is enabled. + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_IsDefaultNetMetered(int32_t *isMetered); + +/** + * @brief Obtains the connection properties of a data network. + * + * @param netHandle Pointer to the network handle that contains the network ID. + * @param prop Pointer to the connection properties. + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetConnectionProperties(NetConn_NetHandle *netHandle, NetConn_ConnectionProperties *prop); + +/** + * @brief Obtains the capabilities of a data network. + * + * @param netHandle Pointer to the network handle that contains the network ID. + * @param netCapacities Pointer to the network capabilities. + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetNetCapabilities(NetConn_NetHandle *netHandle, NetConn_NetCapabilities *netCapacities); + +/** + * @brief Obtains the default http proxy. + * + * @param httpProxy Pointer to the HTTP proxy. + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetDefaultHttpProxy(NetConn_HttpProxy *httpProxy); + +/** + * @brief Get DNS result with netId. + * + * @param host The host name to query. + * @param serv Service name. + * @param hint Pointer to the addrinfo structure. + * @param res Store DNS query results and return them in a linked list format. + * @param netId DNS query netId, 0 is used for default netid query. + * @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 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetAddrInfo(char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId); + +/** + * @brief Free DNS result. + * + * @param res DNS query result chain header. + * @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 11 + * @version 1.0 + */ +int32_t OH_NetConn_FreeDnsResult(struct addrinfo *res); + +/** + * @brief Queries all activated data networks. + * + * @param netHandleList Network handle that stores the network ID list. + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @permission ohos.permission.GET_NETWORK_INFO + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + * @version 1.0 + */ +int32_t OH_NetConn_GetAllNets(NetConn_NetHandleList *netHandleList); + +/** + * @brief Registers a custom DNS resolver. + * + * @param resolver Pointer to the 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 11 + * @version 1.0 + */ +int32_t OHOS_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 11 + * @version 1.0 + */ +int32_t OHOS_NetConn_UnregisterDnsResolver(void); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* NATIVE_NET_CONN_API_H */ \ No newline at end of file -- Gitee From 3f4be37efdc4fcdb4475631f476507bd285512f9 Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 28 Dec 2023 03:38:37 +0000 Subject: [PATCH 0183/2135] rename en/native_sdk/net/dns/native_net_conn_type.h to en/native_sdk/net/dns/net_connection_type.h. Signed-off-by: Aurora --- ..._net_conn_type.h => net_connection_type.h} | 199 +++++++----------- 1 file changed, 80 insertions(+), 119 deletions(-) rename en/native_sdk/net/dns/{native_net_conn_type.h => net_connection_type.h} (50%) diff --git a/en/native_sdk/net/dns/native_net_conn_type.h b/en/native_sdk/net/dns/net_connection_type.h similarity index 50% rename from en/native_sdk/net/dns/native_net_conn_type.h rename to en/native_sdk/net/dns/net_connection_type.h index a29b0512..93217952 100644 --- a/en/native_sdk/net/dns/native_net_conn_type.h +++ b/en/native_sdk/net/dns/net_connection_type.h @@ -17,7 +17,7 @@ #define NATIVE_NET_CONN_TYPE_H /** - * @addtogroup NetConn + * @addtogroup NetConnection * @{ * * @brief Provides the data structures for the C APIs of the network connection module for network management. @@ -27,10 +27,10 @@ */ /** - * @file native_net_conn_type.h + * @file net_connection_type.h * @brief Defines the data structures for the C APIs of the network connection module. * - * @library libnetconn_ndk.z.so + * @library libnet_connection.so * @syscap SystemCapability.Communication.NetManager.Core * @since 11 * @version 1.0 @@ -43,13 +43,13 @@ extern "C" { #endif -#define OH_NETCONN_MAX_NET_SIZE 32 -#define OH_NETCONN_MAX_BEAR_TYPE_SIZE 32 -#define OH_NETCONN_MAX_CAP_SIZE 32 -#define OH_NETCONN_MAX_ADDR_SIZE 32 -#define OH_NETCONN_MAX_ROUTE_SIZE 64 -#define OH_NETCONN_MAX_EXCLUSION_SIZE 256 -#define OH_NETCONN_MAX_STR_LEN 256 +#define NETCONN_MAX_NET_SIZE 32 +#define NETCONN_MAX_BEARER_TYPE_SIZE 32 +#define NETCONN_MAX_CAP_SIZE 32 +#define NETCONN_MAX_ADDR_SIZE 32 +#define NETCONN_MAX_ROUTE_SIZE 64 +#define NETCONN_MAX_EXCLUSION_SIZE 256 +#define NETCONN_MAX_STR_LEN 256 /** * @brief Defines network capabilities. @@ -57,22 +57,18 @@ extern "C" { * @since 11 * @version 1.0 */ -typedef enum OH_NetConn_NetCap { +typedef enum NetConn_NetCap { /** MMS */ - OH_NETCONN_NET_CAPABILITY_MMS = 0, - /** Non-metered network */ - OH_NETCONN_NET_CAPABILITY_NOT_METERED = 11, + NETCONN_NET_CAPABILITY_MMS = 0, + /** Not Metered */ + NETCONN_NET_CAPABILITY_NOT_METERED = 11, /** Internet */ - OH_NETCONN_NET_CAPABILITY_INTERNET = 12, - /** Non-VPN */ - OH_NETCONN_NET_CAPABILITY_NOT_VPN = 15, + NETCONN_NET_CAPABILITY_INTERNET = 12, + /** Not VPN */ + NETCONN_NET_CAPABILITY_NOT_VPN = 15, /** Validated */ - OH_NETCONN_NET_CAPABILITY_VALIDATED = 16, - /** Captive portal */ - OH_NETCONN_NET_CAPABILITY_CAPTIVE_PORTAL = 17, - /** Internal default capability */ - OH_NETCONN_NET_CAPABILITY_INTERNAL_DEFAULT -} OH_NetConn_NetCap; + NETCONN_NET_CAPABILITY_VALIDATED = 16, +} NetConn_NetCap; /** * @brief Defines network bearer types. @@ -80,52 +76,14 @@ typedef enum OH_NetConn_NetCap { * @since 11 * @version 1.0 */ -typedef enum OH_NetConn_NetBearType { +typedef enum NetConn_NetBearerType { /** Cellular network */ - OH_NETCONN_BEARER_CELLULAR = 0, + NETCONN_BEARER_CELLULAR = 0, /** WIFI */ - OH_NETCONN_BEARER_WIFI = 1, - /** Bluetooth */ - OH_NETCONN_BEARER_BLUETOOTH = 2, + NETCONN_BEARER_WIFI = 1, /** Ethernet */ - OH_NETCONN_BEARER_ETHERNET = 3, - /** VPN */ - OH_NETCONN_BEARER_VPN = 4, - /** WIFI aware */ - OH_NETCONN_BEARER_WIFI_AWARE = 5, - /** Default bearer type */ - OH_NETCONN_BEARER_DEFAULT -} OH_NetConn_NetBearType; - -/** - * @brief Defines route return types. - * - * @since 11 - * @version 1.0 - */ -typedef enum OH_NetConn_RtnType { - /** Unicast */ - OH_NETCONN_RTN_UNICAST = 1, - /** Unreachable */ - OH_NETCONN_RTN_UNREACHABLE = 7, - /** Throw */ - OH_NETCONN_RTN_THROW = 9 -} OH_NetConn_RtnType; - -/** - * @brief Defines IP address types. - * - * @since 11 - * @version 1.0 - */ -typedef enum { - /** Unknown */ - OH_NETCONN_UNKNOWN = 0x00, - /** IPV4 */ - OH_NETCONN_IPV4 = 0x01, - /** IPV6 */ - OH_NETCONN_IPV6 = 0x02, -} OH_NetConn_IpType; + NETCONN_BEARER_ETHERNET = 3, +} NetConn_NetBearerType; /** * @brief Defines the network handle. @@ -133,44 +91,31 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef struct OH_NetConn_NetHandle { +typedef struct NetConn_NetHandle { /** Network ID */ int32_t netId; -} OH_NetConn_NetHandle; +} NetConn_NetHandle; /** - * @brief Defines the network handle list. - * - * @since 11 - * @version 1.0 - */ -typedef struct OH_NetConn_NetHandleList { - /** Network handle list */ - OH_NetConn_NetHandle netHandleList[OH_NETCONN_MAX_NET_SIZE]; - /** Actual size of the network handle list */ - int32_t netHandleListSize; -} OH_NetConn_NetHandleList; - -/** - * @brief Defines all network capabilities. + * @brief Defines network capabilities. * * @since 11 * @version 1.0 */ -typedef struct OH_NetConn_NetAllCapabilities { +typedef struct NetConn_NetCapabilities { /** Uplink bandwidth */ uint32_t linkUpBandwidthKbps; /** Downlink bandwidth */ uint32_t linkDownBandwidthKbps; /** Network capability list */ - OH_NetConn_NetCap netCaps[OH_NETCONN_MAX_CAP_SIZE]; + NetConn_NetCap netCaps[NETCONN_MAX_CAP_SIZE]; /** Actual size of the network capability list */ int32_t netCapsSize; /** Bearer type list */ - OH_NetConn_NetBearType bearerTypes[OH_NETCONN_MAX_BEAR_TYPE_SIZE]; + NetConn_NetBearerType bearerTypes[NETCONN_MAX_BEARER_TYPE_SIZE]; /** Actual size of the bearer type list */ int32_t bearerTypesSize; -} OH_NetConn_NetAllCapabilities; +} NetConn_NetCapabilities; /** * @brief Defines the network address. @@ -178,9 +123,7 @@ typedef struct OH_NetConn_NetAllCapabilities { * @since 11 * @version 1.0 */ -typedef struct OH_NetConn_INetAddr { - /** IP address type */ - OH_NetConn_IpType type; +typedef struct NetConn_NetAddr { /** Network address family */ uint8_t family; /** Prefix length */ @@ -188,10 +131,8 @@ typedef struct OH_NetConn_INetAddr { /** Port number */ uint8_t port; /** Address */ - char address[OH_NETCONN_MAX_STR_LEN]; - /** Host name */ - char hostName[OH_NETCONN_MAX_STR_LEN]; -} OH_NetConn_INetAddr; + char address[NETCONN_MAX_STR_LEN]; +} NetConn_NetAddr; /** * @brief Defines the route configuration information. @@ -199,24 +140,18 @@ typedef struct OH_NetConn_INetAddr { * @since 11 * @version 1.0 */ -typedef struct OH_NetConn_Route { +typedef struct NetConn_Route { /** Network interface */ - char iface[OH_NETCONN_MAX_STR_LEN]; + char iface[NETCONN_MAX_STR_LEN]; /** Destination address */ - OH_NetConn_INetAddr destination; + NetConn_NetAddr destination; /** Gateway address */ - OH_NetConn_INetAddr gateway; - /** Route type */ - OH_NetConn_RtnType rtnType; - /** MTU */ - int32_t mtu; - /** Host or not */ - int32_t isHost; + NetConn_NetAddr gateway; /** Gateway exists or not */ int32_t hasGateway; /** Default route or not */ int32_t isDefaultRoute; -} OH_NetConn_Route; +} NetConn_Route; /** * @brief Defines the proxy configuration information. @@ -224,51 +159,77 @@ typedef struct OH_NetConn_Route { * @since 11 * @version 1.0 */ -typedef struct OH_NetConn_HttpProxy { +typedef struct NetConn_HttpProxy { /** Host name */ - char host[OH_NETCONN_MAX_STR_LEN]; + char host[NETCONN_MAX_STR_LEN]; /** Exclusion list of proxy servers */ - char exclusionList[OH_NETCONN_MAX_EXCLUSION_SIZE][OH_NETCONN_MAX_STR_LEN]; + char exclusionList[NETCONN_MAX_EXCLUSION_SIZE][NETCONN_MAX_STR_LEN]; /** Actual size of the exclusion list */ int32_t exclusionListSize; /** Port number */ uint16_t port; -} OH_NetConn_HttpProxy; +} NetConn_HttpProxy; /** - * @brief Defines the network link information. + * @brief Defines the network connection properties. * * @since 11 * @version 1.0 */ -typedef struct OH_NetConn_NetLinkInfo { +typedef struct NetConn_ConnectionProperties { /** Network interface name */ - char ifaceName[OH_NETCONN_MAX_STR_LEN]; + char ifaceName[NETCONN_MAX_STR_LEN]; /** Domain name of the network connection */ - char domain[OH_NETCONN_MAX_STR_LEN]; + char domain[NETCONN_MAX_STR_LEN]; /** TCP buffer size */ - char tcpBufferSizes[OH_NETCONN_MAX_STR_LEN]; + char tcpBufferSizes[NETCONN_MAX_STR_LEN]; /** MTU */ uint16_t mtu; /** Address list */ - OH_NetConn_INetAddr netAddrList[OH_NETCONN_MAX_ADDR_SIZE]; + NetConn_NetAddr netAddrList[NETCONN_MAX_ADDR_SIZE]; /** Actual size of the address list */ int32_t netAddrListSize; /** DNS list */ - OH_NetConn_INetAddr dnsList[OH_NETCONN_MAX_ADDR_SIZE]; + NetConn_NetAddr dnsList[NETCONN_MAX_ADDR_SIZE]; /** Actual size of the DNS list */ int32_t dnsListSize; /** Route list */ - OH_NetConn_Route routeList[OH_NETCONN_MAX_ROUTE_SIZE]; + NetConn_Route routeList[NETCONN_MAX_ROUTE_SIZE]; /** Actual size of the route list */ int32_t routeListSize; /** HTTP proxy information */ - OH_NetConn_HttpProxy httpProxy; -} OH_NetConn_NetLinkInfo; + NetConn_HttpProxy httpProxy; +} NetConn_ConnectionProperties; + +/** + * @brief Defines the network handle list. + * + * @since 11 + * @version 1.0 + */ +typedef struct NetConn_NetHandleList { + /** Network handle list */ + NetConn_NetHandle netHandles[NETCONN_MAX_NET_SIZE]; + /** Actual size of the network handle list */ + int32_t netHandleListSize; +} NetConn_NetHandleList; +/** + * @brief Pointer to the custom DNS resolver. + * + * @param host The host name to query. + * @param serv Service name. + * @param hint Pointer to the addrinfo structure. + * @param res Store DNS query results and return them in a linked list format. + * + * @since 11 + * @version 1.0 + */ +typedef int (*OH_NetConn_CustomDnsResolver)(const char *host, const char *serv, + const struct addrinfo *hint, struct addrinfo **res); #ifdef __cplusplus } #endif /** @} */ -#endif /* NATIVE_NET_CONN_TYPE_H */ +#endif /* NATIVE_NET_CONN_TYPE_H */ \ No newline at end of file -- Gitee From 6cae9bad4c2863242bc30a90154127b0ff9bfecf Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 28 Dec 2023 03:54:51 +0000 Subject: [PATCH 0184/2135] update zh-cn/native_sdk/net/dns/net_connection_type.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net/dns/net_connection_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/net/dns/net_connection_type.h b/zh-cn/native_sdk/net/dns/net_connection_type.h index 3bdb321f..d4cf3cc7 100644 --- a/zh-cn/native_sdk/net/dns/net_connection_type.h +++ b/zh-cn/native_sdk/net/dns/net_connection_type.h @@ -208,7 +208,7 @@ typedef struct NetConn_ConnectionProperties { * @version 1.0 */ typedef struct NetConn_NetHandleList { - /** netHandle列表t */ + /** netHandle列表 */ NetConn_NetHandle netHandles[NETCONN_MAX_NET_SIZE]; /** netHandleList的实际大小 */ int32_t netHandleListSize; -- Gitee From 204fa4b93c214f885ccc7f963a7f323e5cf58097 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Thu, 28 Dec 2023 15:24:24 +0800 Subject: [PATCH 0185/2135] add websocket code Signed-off-by: liuxiyao223 --- .../native_sdk/net_websocket/net_websocket.h | 20 ++--- .../net_websocket/net_websocket_type.h | 80 +++++++++---------- 2 files changed, 46 insertions(+), 54 deletions(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket.h b/zh-cn/native_sdk/net_websocket/net_websocket.h index 68f4d874..9a82bb8d 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket.h @@ -36,7 +36,7 @@ * @brief 为websocket客户端模块定义C接口 * * @library libnet_websocket.so - * @syscap SystemCapability.Communication.Netstack + * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 */ @@ -60,9 +60,8 @@ extern "C" { * @since 11 * @version 1.0 */ -struct OH_NetStack_WebsocketClient *OH_NetStack_WebsocketClient_Construct( - OH_NetStack_WebsocketClient_OnOpenCallback OnOpen, OH_NetStack_WebsocketClient_OnMessageCallback onMessage, - OH_NetStack_WebsocketClient_OnErrorCallback OnError, OH_NetStack_WebsocketClient_OnCloseCallback onclose); +struct WebSocket *OH_WebSocketClient_Constructor(WebSocket_OnOpenCallback onOpen, WebSocket_OnMessageCallback onMessage, + WebSocket_OnErrorCallback onError, WebSocket_OnCloseCallback onclose); /** * @brief 将header头信息添加到client客户端request中 @@ -75,8 +74,7 @@ struct OH_NetStack_WebsocketClient *OH_NetStack_WebsocketClient_Construct( * @since 11 * @version 1.0 */ -int OH_NetStack_WebSocketClient_AddHeader(struct OH_NetStack_WebsocketClient *client, - struct OH_NetStack_WebsocketClient_Slist header); +int OH_WebSocketClient_AddHeader(struct WebSocket *client, struct WebSocket_Header header); /** * @brief 客户端连接服务端 @@ -90,8 +88,7 @@ int OH_NetStack_WebSocketClient_AddHeader(struct OH_NetStack_WebsocketClient *cl * @since 11 * @version 1.0 */ -int OH_NetStack_WebSocketClient_Connet(struct OH_NetStack_WebsocketClient *client, const char *url, - struct OH_NetStack_WebsocketClient_RequestOptions options); +int OH_WebSocketClient_Connect(struct WebSocket *client, const char *url, struct WebSocket_RequestOptions options); /** * @brief 客户端向服务端发送数据 @@ -106,7 +103,7 @@ int OH_NetStack_WebSocketClient_Connet(struct OH_NetStack_WebsocketClient *clien * @since 11 * @version 1.0 */ -int OH_NetStack_WebSocketClient_Send(struct OH_NetStack_WebsocketClient *client, char *data, size_t length); +int OH_WebSocketClient_Send(struct WebSocket *client, char *data, size_t length); /** * @brief 客户端主动关闭websocket连接 @@ -120,8 +117,7 @@ int OH_NetStack_WebSocketClient_Send(struct OH_NetStack_WebsocketClient *client, * @since 11 * @version 1.0 */ -int OH_NetStack_WebSocketClient_Close(struct OH_NetStack_WebsocketClient *client, - struct OH_NetStack_WebsocketClient_CloseOption options); +int OH_WebSocketClient_Close(struct WebSocket *client, struct WebSocket_CloseOption options); /** * @brief 释放websocket连接上下文和资源 @@ -133,7 +129,7 @@ int OH_NetStack_WebSocketClient_Close(struct OH_NetStack_WebsocketClient *client * @since 11 * @version 1.0 */ -int OH_NetStack_WebsocketClient_Destroy(struct OH_NetStack_WebsocketClient *client); +int OH_WebSocketClient_Destroy(struct WebSocket *client); #ifdef __cplusplus } diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h index 3c91da3e..9a5b6f14 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket_type.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -31,7 +31,7 @@ * @brief 定义websocket客户端模块的C接口需要的数据结构 * * @library libnet_websocket.so - * @syscap SystemCapability.Communication.Netstack + * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 */ @@ -46,7 +46,7 @@ extern "C" { * @since 11 * @version 1.0 */ -struct OH_NetStack_WebsocketClient_CloseResult { +struct WebSocket_CloseResult { /** 关闭的错误码 */ uint32_t code; /** 关闭的错误原因 */ @@ -59,7 +59,7 @@ struct OH_NetStack_WebsocketClient_CloseResult { * @since 11 * @version 1.0 */ -struct OH_NetStack_WebsocketClient_CloseOption { +struct WebSocket_CloseOption { /** 关闭的错误码 */ uint32_t code; /** 关闭的错误原因 */ @@ -72,7 +72,7 @@ struct OH_NetStack_WebsocketClient_CloseOption { * @since 11 * @version 1.0 */ -struct OH_NetStack_WebsocketClient_ErrorResult { +struct WebSocket_ErrorResult { /** 错误码 */ uint32_t errorCode; /** 错误的消息 */ @@ -85,7 +85,7 @@ struct OH_NetStack_WebsocketClient_ErrorResult { * @since 11 * @version 1.0 */ -struct OH_NetStack_WebsocketClient_OpenResult { +struct WebSocket_OpenResult { /** websocket客户端连接成功码 */ uint32_t code; /** websocket客户端连接原因 */ @@ -100,8 +100,7 @@ struct OH_NetStack_WebsocketClient_OpenResult { * @since 11 * @version 1.0 */ -typedef void (*OH_NetStack_WebsocketClient_OnOpenCallback)(struct OH_NetStack_WebsocketClient *client, - OH_NetStack_WebsocketClient_OpenResult openResult); +typedef void (*WebSocket_OnOpenCallback)(struct WebSocket *client, WebSocket_OpenResult openResult); /** * @brief websocket客户端接收数据的回调函数定义 @@ -112,8 +111,7 @@ typedef void (*OH_NetStack_WebsocketClient_OnOpenCallback)(struct OH_NetStack_We * @since 11 * @version 1.0 */ -typedef void (*OH_NetStack_WebsocketClient_OnMessageCallback)(struct OH_NetStack_WebsocketClient *client, char *data, - uint32_t length); +typedef void (*WebSocket_OnMessageCallback)(struct WebSocket *client, char *data, uint32_t length); /** * @brief websocket客户端接收error错误消息的回调函数定义 @@ -123,8 +121,7 @@ typedef void (*OH_NetStack_WebsocketClient_OnMessageCallback)(struct OH_NetStack * @since 11 * @version 1.0 */ -typedef void (*OH_NetStack_WebsocketClient_OnErrorCallback)(struct OH_NetStack_WebsocketClient *client, - OH_NetStack_WebsocketClient_ErrorResult errorResult); +typedef void (*WebSocket_OnErrorCallback)(struct WebSocket *client, WebSocket_ErrorResult errorResult); /** * @brief websocket客户端接收close消息的回调函数定义 @@ -134,8 +131,7 @@ typedef void (*OH_NetStack_WebsocketClient_OnErrorCallback)(struct OH_NetStack_W * @since 11 * @version 1.0 */ -typedef void (*OH_NetStack_WebsocketClient_OnCloseCallback)(struct OH_NetStack_WebsocketClient *client, - OH_NetStack_WebsocketClient_CloseResult closeResult); +typedef void (*WebSocket_OnCloseCallback)(struct WebSocket *client, WebSocket_CloseResult closeResult); /** * @brief websocket客户端增加header头的链表节点 @@ -143,13 +139,13 @@ typedef void (*OH_NetStack_WebsocketClient_OnCloseCallback)(struct OH_NetStack_W * @since 11 * @version 1.0 */ -struct OH_NetStack_WebsocketClient_Slist { +struct WebSocket_Header { /** header头的字段名 */ - const char *FieldName; + const char *fieldName; /**header头的字段内容 */ - const char *FieldValue; + const char *fieldValue; /** header头链表的next指针 */ - struct OH_NetStack_WebsocketClient_Slist *next; + struct WebSocket_Header *next; }; /** @@ -159,8 +155,8 @@ struct OH_NetStack_WebsocketClient_Slist { * @since 11 * @version 1.0 */ -struct OH_NetStack_WebsocketClient_RequestOptions { - struct OH_NetStack_WebsocketClient_Slist *headers; +struct WebSocket_RequestOptions { + struct WebSocket_Header *headers; }; /** @@ -169,24 +165,24 @@ struct OH_NetStack_WebsocketClient_RequestOptions { * @since 11 * @version 1.0 */ -struct OH_NetStack_WebsocketClient { +struct WebSocket { /** 客户端接收连接消息的回调指针 */ - OH_NetStack_WebsocketClient_OnOpenCallback onOpen; + WebSocket_OnOpenCallback onOpen; /**客户端接收消息的回调指针 */ - OH_NetStack_WebsocketClient_OnMessageCallback onMessage; + WebSocket_OnMessageCallback onMessage; /** 客户端接收错误消息的回调指针 */ - OH_NetStack_WebsocketClient_OnErrorCallback onError; + WebSocket_OnErrorCallback onError; /** 客户端接收关闭消息的回调指针 */ - OH_NetStack_WebsocketClient_OnCloseCallback onClose; + WebSocket_OnCloseCallback onClose; /** 客户端建立连接请求内容 */ - OH_NetStack_WebsocketClient_RequestOptions RequestOptions; + WebSocket_RequestOptions requestOptions; }; -typedef enum OH_Websocket_ErrCode { +typedef enum WebSocket_ErrCode { /** * 执行成功 */ - Websocket_OK = 0, + WEBSOCKET_OK = 0, /** * @brief 异常错误代码的基础 @@ -196,12 +192,12 @@ typedef enum OH_Websocket_ErrCode { /** * @brief websocket为空 */ - WEBSOCKET_CLIENT_IS_NULL = (E_BASE + 1), + WEBSOCKET_CLIENT_NULL = (E_BASE + 1), /** * @brief websocket未创建 */ - WEBSOCKET_CLIENT_IS_NOT_CREAT = (E_BASE + 2), + WEBSOCKET_CLIENT_NOT_CREATED = (E_BASE + 2), /** * @brief websocket客户端连接错误 @@ -211,22 +207,22 @@ typedef enum OH_Websocket_ErrCode { /** * @brief websocket客户端连接参数解析错误 */ - WEBSOCKET_CONNECTION_PARSEURL_ERROR = (E_BASE + 5), + WEBSOCKET_CONNECTION_PARSE_URL_ERROR = (E_BASE + 5), /** * @brief websocket客户端连接时创建上下文无内存 */ - WEBSOCKET_CONNECTION_NO_MEMOERY = (E_BASE + 6), + WEBSOCKET_CONNECTION_NO_MEMORY = (E_BASE + 6), /** * @brief 初始化时候关闭 */ - WEBSOCKET_PEER_INITIATED_CLOSE = (E_BASE + 7), + WEBSOCKET_CONNECTION_CLOSED_BY_PEER = (E_BASE + 7), /** * @brief websocket连接被销毁 */ - WEBSOCKET_DESTROY = (E_BASE + 8), + WEBSOCKET_DESTROYED = (E_BASE + 8), /** * @brief websocket客户端连接时候协议错误 @@ -236,7 +232,7 @@ typedef enum OH_Websocket_ErrCode { /** * @brief websocket客户端发送数据时候没有足够内存 */ - WEBSOCKET_SEND_NO_MEMOERY_ERROR = (E_BASE + 10), + WEBSOCKET_SEND_NO_MEMORY = (E_BASE + 10), /** * @brief websocket客户端发送数据为空 @@ -246,38 +242,38 @@ typedef enum OH_Websocket_ErrCode { /** * @brief websocket客户端发送数据长度超限制 */ - WEBSOCKET_DATA_LENGTH_EXCEEDS = (E_BASE + 12), + WEBSOCKET_DATA_LENGTH_EXCEEDED = (E_BASE + 12), /** * @brief websocket客户端发送数据队列长度超限制 */ - WEBSOCKET_QUEUE_LENGTH_EXCEEDS = (E_BASE + 13), + WEBSOCKET_QUEUE_LENGTH_EXCEEDED = (E_BASE + 13), /** * @brief websocket客户端上下文为空 */ - WEBSOCKET_ERROR_NO_CLIENTCONTEX = (E_BASE + 14), + WEBSOCKET_NO_CLIENT_CONTEXT = (E_BASE + 14), /** * @brief websocket客户端header头异常 */ - WEBSOCKET_ERROR_NO_HEADR_CONTEXT = (E_BASE + 15), + WEBSOCKET_NO_HEADER_CONTEXT = (E_BASE + 15), /** * @brief websocket客户端header头超过限制 */ - WEBSOCKET_ERROR_NO_HEADR_EXCEEDS = (E_BASE + 16), + WEBSOCKET_HEADER_EXCEEDED = (E_BASE + 16), /** * @brief websocket客户端没有连接 */ - WEBSOCKET_ERROR_HAVE_NO_CONNECT = (E_BASE + 17), + WEBSOCKET_NO_CONNECTION = (E_BASE + 17), /** * @brief websocket客户端没有连接上下文 */ - WEBSOCKET_ERROR_HAVE_NO_CONNECT_CONTEXT = (E_BASE + 18), -} OH_Websocket_ErrCode; + WEBSOCKET_NO_CONNECTION_CONTEXT = (E_BASE + 18), +} WebSocket_ErrCode; #ifdef __cplusplus } -- Gitee From b786696cf31e404df2527bc29c8e3cee8f155431 Mon Sep 17 00:00:00 2001 From: w00804697 Date: Thu, 28 Dec 2023 16:36:42 +0800 Subject: [PATCH 0186/2135] Description: Fix Huks Doc Signed-off-by: wangshengming --- zh-cn/native_sdk/security/huks/native_huks_api.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/security/huks/native_huks_api.h b/zh-cn/native_sdk/security/huks/native_huks_api.h index af4e6a86..9ea6b608 100644 --- a/zh-cn/native_sdk/security/huks/native_huks_api.h +++ b/zh-cn/native_sdk/security/huks/native_huks_api.h @@ -138,8 +138,7 @@ struct OH_Huks_Result OH_Huks_GetKeyItemParamSet(const struct OH_Huks_Blob *keyA * @param keyAlias 要查找的密钥的别名。 * @param paramSet 查询密钥需要的属性TAG(默认传空)。 * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时密钥存在, - * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST}不存在 - * @return 返回其他错误在其他情况。 + * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST}不存在,返回其他错误在其他情况。 * @since 9 * @version 1.0 */ -- Gitee From d7c38e8b058b958cebb2d569c8afeb3cdf6f3290 Mon Sep 17 00:00:00 2001 From: WangShengming Date: Thu, 28 Dec 2023 19:39:33 +0800 Subject: [PATCH 0187/2135] Description: Fix Huks Doc Signed-off-by: wangshengming --- zh-cn/native_sdk/security/huks/native_huks_api.h | 2 +- .../native_sdk/security/huks/native_huks_param.h | 6 +++--- .../native_sdk/security/huks/native_huks_type.h | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/zh-cn/native_sdk/security/huks/native_huks_api.h b/zh-cn/native_sdk/security/huks/native_huks_api.h index 9ea6b608..529d64b2 100644 --- a/zh-cn/native_sdk/security/huks/native_huks_api.h +++ b/zh-cn/native_sdk/security/huks/native_huks_api.h @@ -167,7 +167,7 @@ struct OH_Huks_Result OH_Huks_AttestKeyItem(const struct OH_Huks_Blob *keyAlias, * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时获取成功,其他时为错误。 * @since 11 * @version 1.0 - * @note 这是一个涉及网络的耗时接口,调用方需要通过异步方式获取证书链。 + * @note 这是一个涉及网络的耗时接口,调用方可以通过异步线程获取证书链。 */ struct OH_Huks_Result OH_Huks_AnonAttestKeyItem(const struct OH_Huks_Blob *keyAlias, const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_CertChain *certChain); diff --git a/zh-cn/native_sdk/security/huks/native_huks_param.h b/zh-cn/native_sdk/security/huks/native_huks_param.h index 8a2450e9..8e08505a 100644 --- a/zh-cn/native_sdk/security/huks/native_huks_param.h +++ b/zh-cn/native_sdk/security/huks/native_huks_param.h @@ -112,10 +112,10 @@ struct OH_Huks_Result OH_Huks_GetParam(const struct OH_Huks_ParamSet *paramSet, struct OH_Huks_Param **param); /** - * @brief 刷新参数集内Blob类型的数据。 + * @brief 刷新参数集内OH_Huks_Blob类型的数据。 * * @param paramSet 指向参数集的指针。 - * @param isCopy 如果为true,刷新Blob类型数据的地址并复制到参数集。否则,只会刷新Blob类型数据的地址。 + * @param isCopy 如果为true,刷新OH_Huks_Blob类型数据的地址并复制到参数集。否则,只会刷新OH_Huks_Blob类型数据的地址。 * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时表示成功,其他时为错误。 * @since 9 * @version 1.0 @@ -126,7 +126,7 @@ struct OH_Huks_Result OH_Huks_FreshParamSet(struct OH_Huks_ParamSet *paramSet, b * @brief 检查参数集中的参数是否有效、是否有重复。 * * @param paramSet 指向参数集的指针。 - * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时表示有效,其他时为无效,重复或者错误的参数。 + * @return 返回{@link OH_Huks_ErrCode#OH_HUKS_SUCCESS}时表示有效,其他时为无效或重复的。 * @since 9 * @version 1.0 */ diff --git a/zh-cn/native_sdk/security/huks/native_huks_type.h b/zh-cn/native_sdk/security/huks/native_huks_type.h index a3cd0859..a261de97 100644 --- a/zh-cn/native_sdk/security/huks/native_huks_type.h +++ b/zh-cn/native_sdk/security/huks/native_huks_type.h @@ -455,7 +455,7 @@ enum OH_Huks_AuthAccessType { /** 安全访问控制类型为新录入生物特征后密钥无效。 */ OH_HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL = 1 << 1, /** - * 密钥永久有效。 + * 安全访问控制类型为该密钥总是有效。 * * @since 11 */ @@ -463,23 +463,23 @@ enum OH_Huks_AuthAccessType { }; /** - * @brief 密钥文件存储访问类别。 + * @brief 表示生成或导入密钥时,指定该密钥的存储安全等级。 * * @since 11 */ enum OH_Huks_AuthStorageLevel { /** - * 设备加密标准的密钥文件存储安全级别。 + * 表示密钥仅在开机后可访问。 * @since 11 */ OH_HUKS_AUTH_STORAGE_LEVEL_DE = 0, /** - * 凭据加盟标准的密钥文件存储安全级别。 + * 表示密钥仅在首次解锁后可访问。 * @since 11 */ OH_HUKS_AUTH_STORAGE_LEVEL_CE = 1, /** - * 增强凭据加盟标准的密钥文件存储安全级别。 + * 表示密钥仅在解锁状态时可访问。 * @since 11 */ OH_HUKS_AUTH_STORAGE_LEVEL_ECE = 2, @@ -650,19 +650,19 @@ enum OH_Huks_Tag { OH_HUKS_TAG_KEY_ROLE = OH_HUKS_TAG_TYPE_UINT | 1006, /** 密钥标记, 类型可在枚举{@link OH_Huks_KeyFlag}选择。 */ OH_HUKS_TAG_KEY_FLAG = OH_HUKS_TAG_TYPE_UINT | 1007, - /** 是否异步 */ + /** 是否异步。 */ OH_HUKS_TAG_IS_ASYNCHRONIZED = OH_HUKS_TAG_TYPE_UINT | 1008, /** 密钥域。 */ OH_HUKS_TAG_KEY_DOMAIN = OH_HUKS_TAG_TYPE_UINT | 1011, /** - * 基于设备密码设置状态的密钥访问控制。 + * 表示密钥锁屏密码访问控制字段,可限制密钥只有在用户设置了锁屏密码时可用。 * True 表示只有在密码设置时才能生成和使用密钥。 * * @since 11 */ OH_HUKS_TAG_IS_DEVICE_PASSWORD_SET = OH_HUKS_TAG_TYPE_BOOL | 1012, - /** 身份验证加密. */ + /** 用于传入GCM模式中的AEAD数据的字段。 */ OH_HUKS_TAG_AE_TAG = OH_HUKS_TAG_TYPE_BYTES | 10009, /** -- Gitee From 67e0543757ebeb3225e54cbe4ab6fb6c34af026c Mon Sep 17 00:00:00 2001 From: fzj Date: Thu, 28 Dec 2023 09:33:37 +0800 Subject: [PATCH 0188/2135] add comment for nfc idl Signed-off-by: fzj --- .../device_api/hdi/nfc/v1_0/INfcCallback.idl | 60 ++++++++ .../device_api/hdi/nfc/v1_0/INfcInterface.idl | 134 ++++++++++++++++++ zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl | 76 ++++++++++ .../device_api/hdi/nfc/v1_1/INfcInterface.idl | 74 ++++++++++ zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl | 110 ++++++++++++++ 5 files changed, 454 insertions(+) create mode 100644 zh-cn/device_api/hdi/nfc/v1_0/INfcCallback.idl create mode 100644 zh-cn/device_api/hdi/nfc/v1_0/INfcInterface.idl create mode 100644 zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl create mode 100644 zh-cn/device_api/hdi/nfc/v1_1/INfcInterface.idl create mode 100644 zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl diff --git a/zh-cn/device_api/hdi/nfc/v1_0/INfcCallback.idl b/zh-cn/device_api/hdi/nfc/v1_0/INfcCallback.idl new file mode 100644 index 00000000..baa01efc --- /dev/null +++ b/zh-cn/device_api/hdi/nfc/v1_0/INfcCallback.idl @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiNfc + * @{ + * + * @brief 为nfc服务提供统一的访问nfc驱动的接口 + * + * NFC服务通过获取的nfc驱动对象提供的API接口访问nfc驱动,包括开关NFC、初始化NFC、读写数据、配置RF参数、 + * 通过IO控制发送NCI指令给nfc驱动 + * + * @since 3.2 + * @version 1.0 + */ + + +package ohos.hdi.nfc.v1_0; + +import ohos.hdi.nfc.v1_0.NfcTypes; + +/** + * @brief 用于从nfc芯片给nfc协议栈上报数据和事件的回调声明. + * + * @since 3.2 + * @version 1.0 + */ +[callback] interface INfcCallback { + /** + * @brief NFC芯片上报给协议栈NFC数据的函数定义. + * + * @param data NFC芯片上报给NFC协议栈的数据. + * + * @since 3.2 + */ + OnData([in] List data); + + /** + * @brief NFC芯片上报给协议栈事件的函数定义. + * + * @param event 上报事件的事件ID. + * @param status NFC状态,具体定义见NfcStatus. + * 事件ID具体见 {@link NfcTypes}. + * + * @since 3.2 + */ + OnEvent([in] enum NfcEvent event, [in] enum NfcStatus status); +} diff --git a/zh-cn/device_api/hdi/nfc/v1_0/INfcInterface.idl b/zh-cn/device_api/hdi/nfc/v1_0/INfcInterface.idl new file mode 100644 index 00000000..a90f96aa --- /dev/null +++ b/zh-cn/device_api/hdi/nfc/v1_0/INfcInterface.idl @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiNfc + * @{ + * + * @brief 为nfc服务提供统一的访问nfc驱动的接口 + * + * NFC服务通过获取的nfc驱动对象提供的API接口访问nfc驱动,包括开关NFC、初始化NFC、读写数据、配置RF参数、 + * 通过IO控制发送NCI指令给nfc驱动 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.nfc.v1_0; + +import ohos.hdi.nfc.v1_0.NfcTypes; +import ohos.hdi.nfc.v1_0.INfcCallback; + +/** + * @brief 声明操作nfc芯片的API,包括关闭、打开nfc,初始化nfc,读写数据、配置RF参数、发送nci指令 + * + * @since 3.2 + * @version 1.0 + */ + +interface INfcInterface { + /** + * @brief 打开NFC,对NFC初始化. + * + * @param callbackObj NFC芯片发送给NFC协议栈的数据和事件的回调对象 + * @return Returns 0 操作成功返回0, 否则返回失败. + * 具体类型详见 {@link NfcTypes}. + * + * @since 3.2 + * @version 1.0 + */ + Open([in] INfcCallback callbackObj, [out] enum NfcStatus status); + + /** + * @brief NFC初始化. + * + * @param callbackObj NFC芯片发送给NFC协议栈的数据和事件的回调对象. + * @return Returns 0 操作成功返回0, 否则返回失败. + * 具体类型详见 {@link NfcTypes}. + * + * @since 3.2 + * @version 1.0 + */ + CoreInitialized([in] List data, [out] enum NfcStatus status); + + /** + * @brief 启动RF discover之前对芯片进行预配置. + * + * @return Returns 0 配置成功返回0,否则返回失败原因. + * 具体类型详见 {@link NfcTypes}. + * + * @since 3.2 + * @version 1.0 + */ + Prediscover([out] enum NfcStatus status); + + /** + * @brief 发送数据给NFC控制器. + * + * @param 待写入NFC控制器的数据. + * @return Returns 0 配置成功返回0,否则返回失败原因. + * 具体类型详见 {@link NfcTypes}. + * + * @since 3.2 + * @version 1.0 + */ + Write([in] List data, [out] enum NfcStatus status); + + /** + * @brief 允许HDF层发送NCI指令. + * + * @return Returns 0 配置成功返回0,否则返回失败原因. + * 具体类型详见 {@link NfcTypes}. + * + * @since 3.2 + * @version 1.0 + */ + ControlGranted([out] enum NfcStatus status); + + /** + * @brief 周期性重启NFC. + * + * @return Returns 0配置成功返回0,否则返回失败原因. + * 具体类型详见 {@link NfcTypes}. + * + * @since 3.2 + * @version 1.0 + */ + PowerCycle([out] enum NfcStatus status); + + /** + * @brief 关闭NFC. + * + * @return Returns 0 配置成功返回0,否则返回失败原因. + * 具体类型详见 {@link NfcTypes}. + * + * @since 3.2 + * @version 1.0 + */ + Close([out] enum NfcStatus status); + + /** + * @brief NFC协议栈通过IO控制指令和数据发送给HDI. + * + * @param cmd NfcCommand中定义在控制指令,详见 {@link NfcTypes}. + * @param data 发送给HDI的数据. + * @return Returns 0 配置成功返回0,否则返回失败原因. + * 具体类型详见 {@link NfcTypes}. + * + * @since 3.2 + * @version 1.0 + */ + Ioctl([in] enum NfcCommand cmd, [in] List data, [out] enum NfcStatus status); +} diff --git a/zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl b/zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl new file mode 100644 index 00000000..fc77fe07 --- /dev/null +++ b/zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiNfc + * @{ + * + * @brief 为nfc服务提供统一的访问nfc驱动的接口 + * + * NFC服务通过获取的nfc驱动对象提供的API接口访问nfc驱动,包括开关NFC、初始化NFC、读写数据、配置RF参数、 + * 通过IO控制发送NCI指令给nfc驱动 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file NfcTypes.idl + * + * @brief 声明类型定义,包括开关NFC、初始化NFC、读写数据、配置RF参数等 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.nfc.v1_0; + +/** + * @brief NFC事件(包括打开NFC完成、关闭NFC完成、预配置NFC完成等上报事件)的枚举定义. + * + * @since 3.2 + */ +enum NfcEvent { + OPEN_CPLT = 0, + CLOSE_CPLT = 1, + POST_INIT_CPLT = 2, + PRE_DISCOVER_CPLT = 3, + REQUEST_CONTROL = 4, + RELEASE_CONTROL = 5, + ERROR = 6, + HCI_NETWORK_RESET = 7, +}; + +/** + * @brief NFC状态的枚举定义. + * + * @since 3.2 + */ +enum NfcStatus { + OK = 0, + FAILED = 1, + ERR_TRANSPORT = 2, + ERR_CMD_TIMEOUT = 3, + REFUSED = 4, +}; + +/** + * @brief NFC指令的枚举定义. + * + * @since 3.2 + */ +enum NfcCommand { + CMD_INVALID = 0, +}; diff --git a/zh-cn/device_api/hdi/nfc/v1_1/INfcInterface.idl b/zh-cn/device_api/hdi/nfc/v1_1/INfcInterface.idl new file mode 100644 index 00000000..e59024a5 --- /dev/null +++ b/zh-cn/device_api/hdi/nfc/v1_1/INfcInterface.idl @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiNfc + * @{ + * + * @brief 为nfc服务提供统一的访问nfc驱动的接口 + * + * NFC服务通过获取的nfc驱动对象提供的API接口访问nfc驱动,包括开关NFC、初始化NFC、读写数据、配置RF参数、 + * 通过IO控制发送NCI指令给nfc驱动 + * + * @version 1.1 + */ + +package ohos.hdi.nfc.v1_1; + +import ohos.hdi.nfc.v1_0.NfcTypes; +import ohos.hdi.nfc.v1_0.INfcInterface; +import ohos.hdi.nfc.v1_1.NfcTypes; + +/** + * @brief 声明操作nfc芯片的API,包括关闭、打开nfc,初始化nfc,读写数据、配置RF参数、发送nci指令 + * + * @since 4.1 + * @version 1.1 + */ +interface INfcInterface extends ohos.hdi.nfc.v1_0.INfcInterface { + /** + * @brief 查询厂商自定义的NFC配置. + * + * @param config 厂商自定义的NFC配置. + * @return Returns 0 操作成功返回0, 否则返回失败. + * 具体类型详见 {@link NfcTypes}. + * + * @since 4.1 + * @version 1.0 + */ + GetVendorConfig([out] struct NfcVendorConfig config, [out] enum NfcStatus status); + + /** + * @brief NFC芯片工厂级复位. + * + * @return Returns 0 操作成功返回0, 否则返回失败. + * 具体类型详见 {@link NfcTypes}. + * + * @since 4.1 + * @version 1.0 + */ + DoFactoryReset([out] enum NfcStatus status); + + /** + * @brief 关闭NFC. 如果设备支持关机刷卡功能,需要实现该接口 + * + * @return Returns 0 操作成功返回0, 否则返回失败. + * 具体类型详见 {@link NfcTypes}. + * + * @since 4.1 + * @version 1.0 + */ + Shutdown([out] enum NfcStatus status); +} diff --git a/zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl b/zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl new file mode 100644 index 00000000..e8408e45 --- /dev/null +++ b/zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiNfc + * @{ + * + * @brief 为nfc服务提供统一的访问nfc驱动的接口 + * + * NFC服务通过获取的nfc驱动对象提供的API接口访问nfc驱动,包括开关NFC、初始化NFC、读写数据、配置RF参数、 + * 通过IO控制发送NCI指令给nfc驱动 + * + * @version 1.1 + */ + +/** + * @file NfcTypes.idl + * + * @brief NFC事件(包括打开NFC完成、关闭NFC完成、预配置NFC完成等上报事件)的枚举定义. + * + * @since 4.1 + * @version 1.1 + */ + +package ohos.hdi.nfc.v1_1; + +/** + * @brief RF discover过程中厂家自定义支持的NFC协议类型. + * + * @since 4.1 + */ +enum VendorProtocalDiscoveryCfg { + NCI_PROTOCOL_18092_ACTIVE = 0, + NCI_PROTOCOL_B_PRIME = 1, + NCI_PROTOCOL_DUAL = 2, + NCI_PROTOCOL_15693 = 3, + NCI_PROTOCOL_KOVIO = 4, + NCI_PROTOCOL_MIFARE = 5, + NCI_DISCOVERY_TYPE_POLL_KOVIO = 6, + NCI_DISCOVERY_TYPE_POLL_B_PRIME = 7, + NCI_DISCOVERY_TYPE_LISTEN_B_PRIME = 8, + VENDOR_PROPEIETARY_CFG_MAX = 9, +}; + +/** + * @brief 厂家自定义的NFC配置. + * + * @since 4.1 + */ +struct NfcVendorConfig { + /** 为ISO_DEP定义的扩展APDU长度 */ + unsigned int isoDepExtApduLength; + + /** 默认路由的SE ID */ + unsigned char defaultOffHostRoute; + + /** 基于Felica的默认路由SE ID */ + unsigned char defaultOffHostRouteFelica; + + /** 基于Felica协议中定义的system code路由的默认路由位置 */ + unsigned char defaultSysCodeRoute; + + /** 基于Felica协议中定义的system code路由支持的电源状态 */ + unsigned char defaultSysCodePwrState; + + /** 基于协议和技术的默认路由. */ + unsigned char defaultUnconfiguredRoute; + + /** 配置ese使用的pipeID */ + unsigned char esePipeId; + + /** 配置SIM卡使用的pipeID */ + unsigned char simPipeId; + + /** 配置是否支持bai-out模式,为TRUE则支持,否则则是typeA/B轮询. */ + boolean pollBailOutMode; + + /** 为T4T卡选择卡在位检测算法.若未定义则默认使用I_BLOCK. */ + unsigned char checkAlgorithm; + + /** 厂家自定义的私有协议和探索配置. */ + unsigned char []vendorProtocalDiscoveryCfg; + + /** 厂家自定义的私有协议和探索配置数据大小. */ + unsigned char vendorProtocalDiscoveryCfgSize; + + /** 主机白名单 */ + List hostWhitelist; + + /** 多SE场景,选择默认路由SIM的offhost列表 */ + List offHostRouteUicc; + + /** 多SE场景,选择默认路由eSE的offhost列表 */ + List offHostRouteEse; + + /** ISO-DEP默认路由位置 */ + unsigned char defaultIsoDepRoute; +}; \ No newline at end of file -- Gitee From ac4655b4645c7d57293444f7014a9b7d46d19ca7 Mon Sep 17 00:00:00 2001 From: guoxing Date: Fri, 29 Dec 2023 02:52:33 +0000 Subject: [PATCH 0189/2135] update Signed-off-by: guoxing --- .../native_sdk/graphic/native_drawing/drawing_font_collection.h | 2 +- .../graphic/native_drawing/drawing_text_declaration.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 8093dc43..d39fad9b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -31,7 +31,7 @@ /** * @file drawing_font_collection.h * - * @brief 定义绘制模块中与fontCollection相关的函数 + * @brief 定义绘制模块中与字体集合相关的函数 * * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index 64bcbfba..dfc8f139 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -31,7 +31,7 @@ /** * @file drawing_text_declaration.h * - * @brief 提供2d drawing文本相关的数据结构声明 + * @brief 提供2d 绘制文本相关的数据结构声明 * * @since 8 * @version 1.0 -- Gitee From 7e85531107fb8d2816d99676866679a0b9fb691d Mon Sep 17 00:00:00 2001 From: sqwlly Date: Fri, 29 Dec 2023 16:58:32 +0800 Subject: [PATCH 0190/2135] new add ndk comment Signed-off-by: s30029175 Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_brush.h | 56 ++++- .../graphic/native_drawing/drawing_canvas.h | 192 +++++++++++++++++- .../native_drawing/drawing_color_filter.h | 127 ++++++++++++ .../graphic/native_drawing/drawing_filter.h | 92 +++++++++ .../graphic/native_drawing/drawing_font.h | 125 ++++++++++++ .../native_drawing/drawing_mask_filter.h | 98 +++++++++ .../graphic/native_drawing/drawing_matrix.h | 90 ++++++++ .../graphic/native_drawing/drawing_pen.h | 23 +++ .../graphic/native_drawing/drawing_point.h | 72 +++++++ .../graphic/native_drawing/drawing_rect.h | 74 +++++++ .../native_drawing/drawing_round_rect.h | 73 +++++++ .../native_drawing/drawing_shader_effect.h | 135 ++++++++++++ .../native_drawing/drawing_text_blob.h | 122 +++++++++++ .../graphic/native_drawing/drawing_typeface.h | 70 +++++++ .../graphic/native_drawing/drawing_types.h | 189 ++++++++++++++++- 15 files changed, 1524 insertions(+), 14 deletions(-) create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_font.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_point.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index df29ef54..ccfeaa25 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -86,27 +86,71 @@ bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool); /** - * @brief 函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 + * @brief 函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针 - * @return 函数返回一个描述颜色的32位(ARGB)变量 + * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @return 函数返回一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*); /** - * @brief 函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示 + * @brief 函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针 - * @param color 参数是一个描述颜色的32位(ARGB)变量 + * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param color 参数是一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ void OH_Drawing_BrushSetColor(OH_Drawing_Brush*, uint32_t color); +/** + * @brief 获取笔刷的透明度值。画笔使用透明度值填充形状。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush OH_Drawing_Brush表示指向画笔对象的指针。 + * @return 返回一个8位变量,用于表示透明度。 + * @since 11 + * @version 1.0 + */ +uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush*); + +/** + * @brief 为画笔设置透明度。画笔在填充形状时将使用透明度值。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param alpha 表示要设置的字母,是一个8位变量。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha); + +/** + * @brief 为笔刷设置着色器效果。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_ShaderEffect 表示指向着色器对象的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*); + +/** + * @brief 为笔刷设置过滤器。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_Filter OH_Drawing_Filter表示指向过滤器对象的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index af221914..a156101e 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 - * + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -136,6 +136,28 @@ void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); */ void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*); +/** + * @brief 函数用于获取栈中保存的画布状态(画布矩阵)的数量 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @return 函数会返回一个32位的值描述画布状态(画布矩阵)的数量 + * @since 11 + * @version 1.0 + */ +uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*); + +/** + * @brief 函数用于恢复到指定数量的画布状态(画布矩阵) + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param saveCount 参数为指定的画布状态(画布矩阵)数量 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount); + /** * @brief 函数用于画一条直线段 * @@ -161,6 +183,172 @@ void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, */ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); +/** + * @brief 函数用于画一个位图 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Bitmap 参数为一个指向位图对象的指针 + * @param left 参数为位图对象左上角的横坐标 + * @param top 参数为位图对象左上角的纵坐标 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); + +/** + * @brief 函数用于画一个矩形 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*); + +/** + * @brief 函数用于画一个圆形 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针,表示圆心 + * @param radius 参数为圆形的半径 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius); + +/** + * @brief 函数用于画一个椭圆 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*); + +/** + * @brief 函数用于画一个弧 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @param startAngle 参数为弧的起始角度 + * @param sweepAngle 参数为弧的扫描角度 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); + +/** + * @brief 函数用于画一个圆角矩形 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*); + +/** + * @brief 函数用于画一段文字 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针 + * @param x 参数为文本对象左下角的横坐标 + * @param y 参数为文本对象左下角的纵坐标 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob*, float x, float y); + +/** + * @brief 枚举集合定义了裁剪的方式 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** + * 将指定区域裁剪(取差集) + */ + DIFFERENCE, + /** + * 将指定区域保留(取交集) + */ + INTERSECT, +} OH_Drawing_CanvasClipOp; + +/** + * @brief 函数用于裁剪一个矩形 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @param clipOp 参数为裁剪方式 + * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*, + OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); + +/** + * @brief 函数用于裁剪一个自定义路径 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针 + * @param clipOp 参数为裁剪方式 + * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, + OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); + +/** + * @brief 函数用于旋转一定的角度,正数表示顺时针旋转 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param degrees 参数为旋转的角度 + * @param px 参数为旋转中心的横坐标 + * @param py 参数为旋转中心的纵坐标 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py); + +/** + * @brief 函数用于平移一段距离 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param dx 参数为水平方向移动的距离 + * @param dy 参数为垂直方向移动的距离 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); + +/** + * @brief 函数用于画布缩放 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param sx 参数为水平方向缩放的比例 + * @param sy 参数为垂直方向缩放的比例 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); + /** * @brief 函数用于使用指定颜色去清空画布 * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h new file mode 100644 index 00000000..f1f42e8d --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h @@ -0,0 +1,127 @@ +/* + * 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 C_INCLUDE_DRAWING_COLOR_FILTER_H +#define C_INCLUDE_DRAWING_COLOR_FILTER_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief 提供二维图形渲染、文本绘制和图像显示等功能。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_color_filter.h + * + * @brief 声明与绘图模块中的颜色滤波器对象相关的函数。 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 创建具有混合模式的颜色滤波器。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param color 表示颜色,是一个32位(ARGB)变量。 + * @param OH_Drawing_BlendMode 表示混合模式。 + * @return 返回创建的颜色滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode(uint32_t color, OH_Drawing_BlendMode); + +/** + * @brief 创建颜色滤波器应用颜色滤波器一,然后应用颜色滤波器二。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_ColorFilter 表示指向颜色滤波器对象的指针。 + * @param OH_Drawing_ColorFilter 表示指向颜色滤波器对象的指针。 + * @return 返回创建的颜色滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose(OH_Drawing_ColorFilter* colorFilter1, + OH_Drawing_ColorFilter* colorFilter2); + +/** + * @brief 创建具有5x4颜色矩阵的颜色滤波器。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param matrix 表示矩阵,以长度为20的浮点数组表示。 + * @return 返回创建的颜色滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix(const float matrix[20]); + +/** + * @brief 创建一个颜色滤波器将SRGB的伽玛曲线应用到RGB颜色通道。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 返回创建的颜色滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma(void); + +/** + * @brief 创建颜色滤波器将RGB颜色通道应用于SRGB的伽玛曲线。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 返回创建的颜色滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear(void); + +/** + * @brief 创建一个颜色滤波器将其输入的亮度值乘以透明度通道, + * 并将红色、绿色和蓝色通道设置为零。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 返回创建的颜色滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma(void); + +/** + * @brief 销毁颜色滤波器对象,并收回该对象占用的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_ColorFilter 表示指向颜色滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_ColorFilterDestroy(OH_Drawing_ColorFilter*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif \ No newline at end of file diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h new file mode 100644 index 00000000..1c50410f --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h @@ -0,0 +1,92 @@ +/* + * 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 C_INCLUDE_DRAWING_FILTER_H +#define C_INCLUDE_DRAWING_FILTER_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief 提供二维图形渲染、文本绘制和图像显示等功能。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_filter.h + * + * @brief 声明与绘图模块中的滤波器对象相关的函数。 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 创建一个滤波器对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 返回创建的滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +OH_Drawing_Filter* OH_Drawing_FilterCreate(void); + +/** + * @brief 为滤波器对象设置模板滤波器对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Filter 指示指向滤波器对象的指针。 + * @param OH_Drawing_MaskFilter 指示指向模板滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FilterSetMaskFilter(OH_Drawing_Filter*, OH_Drawing_MaskFilter*); + +/** + * @brief 为滤波器对象设置颜色滤波器对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Filter 指示指向滤波器对象的指针。 + * @param OH_Drawing_ColorFilter 指示指向颜色滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FilterSetColorFilter(OH_Drawing_Filter*, OH_Drawing_ColorFilter*); + +/** + * @brief 销毁滤波器对象,并收回该对象占用的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Filter 指示指向滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FilterDestroy(OH_Drawing_Filter*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif \ No newline at end of file diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h new file mode 100644 index 00000000..fea3571f --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -0,0 +1,125 @@ +/* + * 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 C_INCLUDE_DRAWING_FONT_H +#define C_INCLUDE_DRAWING_FONT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_font.h + * + * @brief 文件中定义了与字体相关的功能函数 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 函数用于创建一个字体对象 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 函数会返回一个指针,指针指向创建的字体对象 + * @since 11 + * @version 1.0 + */ +OH_Drawing_Font* OH_Drawing_FontCreate(void); + +/** + * @brief 函数用于给字体设置字形 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 参数为一个指向字体对象的指针 + * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); + +/** + * @brief 函数用于给字体设置文字大小 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 参数为一个指向字体对象的指针 + * @param textSize 参数为字体大小 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); + +/** + * @brief 函数用于设置线性可缩放字体 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 参数为一个指向字体对象的指针 + * @param isLinearText 参数真为使能线性可缩放字体,参数假为不使能 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetLinearText(OH_Drawing_Font*, bool isLinearText); + +/** + * @brief 函数用于给字体设置文本倾斜 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 参数为一个指向字体对象的指针 + * @param skewX 参数为X轴相对于Y轴的倾斜度 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); + +/** + * @brief 函数用于设置增加描边宽度以近似粗体字体效果 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 参数为一个指向字体对象的指针 + * @param isFakeBoldText 参数真为使能增加描边宽度,参数假为不使能 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); + +/** + * @brief 函数用于销毁字体对象并回收该对象占有的内存 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 参数为一个指向字体对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontDestroy(OH_Drawing_Font*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h new file mode 100644 index 00000000..bd5d1219 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -0,0 +1,98 @@ +/* + * 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 C_INCLUDE_DRAWING_MASK_FILTER_H +#define C_INCLUDE_DRAWING_MASK_FILTER_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief 提供二维图形渲染、文本绘制和图像显示等功能。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_mask_filter.h + * + * @brief 声明与绘图模块中的对象相关的函数。 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 枚举模糊类型。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** + * 内外模糊。 + */ + NORMAL, + /** + * 内部坚实,外部模糊。 + */ + SOLID, + /** + * 里面空白,外部模糊。 + */ + OUTER, + /** + * 内部模糊,外部空白。 + */ + INNER, +} OH_Drawing_BlurType; + +/** + * @brief 创建具有模糊效果的模板滤波器。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param blurType 表示模糊类型。 + * @param sigma 表示要应用的高斯模糊的标准偏差。必须大于0。 + * @param respectCTM 表示模糊标准差值被CTM修改,默认为正确。 + * @return 返回创建的模板滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur(OH_Drawing_BlurType blurType, float sigma, bool respectCTM); + +/** + * @brief 销毁模板滤波器对象,并收回该对象占用的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_MaskFilter 表示指向模板滤波器对象的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_MaskFilterDestroy(OH_Drawing_MaskFilter*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif \ No newline at end of file diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h new file mode 100644 index 00000000..88c95e17 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -0,0 +1,90 @@ +/* + * 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 C_INCLUDE_DRAWING_MATRIX_H +#define C_INCLUDE_DRAWING_MATRIX_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_matrix.h + * + * @brief 文件中定义了与矩阵相关的功能函数 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 函数用于创建一个矩阵对象 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 函数会返回一个指针,指针指向创建的矩阵对象 + * @since 11 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); + +/** + * @brief 函数用于给矩阵对象设置参数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 参数为一个指向矩阵对象的指针 + * @param scaleX 参数为水平缩放系数 + * @param skewX 参数为水平倾斜系数 + * @param transX 参数为水平位移系数 + * @param skewY 参数为垂直倾斜系数 + * @param scaleY 参数为垂直缩放系数 + * @param transY 参数为垂直位移系数 + * @param persp0 参数为X轴透视系数 + * @param persp1 参数为Y轴透视系数 + * @param persp2 参数为透视缩放系数 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, float transX, + float skewY, float scaleY, float transY, float persp0, float persp1, float persp2); + +/** + * @brief 函数用于销毁矩阵对象并回收该对象占有的内存 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 参数为一个指向字体对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_MatrixDestroy(OH_Drawing_Matrix*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index 8760e267..84f6bf39 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -107,6 +107,29 @@ uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen*); */ void OH_Drawing_PenSetColor(OH_Drawing_Pen*, uint32_t color); +/** + * @brief 获取钢笔的透明度值。钢笔勾勒形状时会用到。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen 表示指向钢笔对象的指针 + * @return 返回一个8比特的值表示透明度. + * @since 11 + * @version 1.0 + */ +uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen*); + +/** + + * @brief 设置钢笔的透明度值。钢笔勾勒形状时会用到。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen 表示指向钢笔对象的指针 + * @param alpha 表示要设置的透明度值,是一个八比特的变量。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_PenSetAlpha(OH_Drawing_Pen*, uint8_t alpha); + /** * @brief 函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h new file mode 100644 index 00000000..e58feb91 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h @@ -0,0 +1,72 @@ +/* + * 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 C_INCLUDE_DRAWING_POINT_H +#define C_INCLUDE_DRAWING_POINT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_point.h + * + * @brief 文件中定义了与坐标点相关的功能函数 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 函数用于创建一个坐标点对象 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param x 参数为X轴坐标 + * @param y 参数为Y轴坐标 + * @return 函数会返回一个指针,指针指向创建的坐标点对象 + * @since 11 + * @version 1.0 + */ +OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y); + +/** + * @brief 函数用于销毁坐标点对象并回收该对象占有的内存 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_PointDestroy(OH_Drawing_Point*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h new file mode 100644 index 00000000..b77547cb --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h @@ -0,0 +1,74 @@ +/* + * 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 C_INCLUDE_DRAWING_RECT_H +#define C_INCLUDE_DRAWING_RECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_rect.h + * + * @brief 文件中定义了与矩形相关的功能函数 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 函数用于创建一个矩形对象 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param left 参数为矩形左上角的横坐标 + * @param top 参数为矩形左上角的纵坐标 + * @param right 参数为矩形右下角的横坐标 + * @param bottom 参数为矩形右下角的纵坐标 + * @return 函数会返回一个指针,指针指向创建的矩形对象 + * @since 11 + * @version 1.0 + */ +OH_Drawing_Rect* OH_Drawing_RectCreate(float left, float top, float right, float bottom); + +/** + * @brief 函数用于销毁矩形对象并回收该对象占有的内存 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_RectDestroy(OH_Drawing_Rect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h new file mode 100644 index 00000000..35dfc9f8 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -0,0 +1,73 @@ +/* + * 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 C_INCLUDE_DRAWING_ROUND_RECT_H +#define C_INCLUDE_DRAWING_ROUND_RECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_round_rect.h + * + * @brief 文件中定义了与圆角矩形相关的功能函数 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 函数用于创建一个圆角矩形对象 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @param xRad 参数为X轴上的圆角半径 + * @param yRad 参数为Y轴上的圆角半径 + * @return 函数会返回一个指针,指针指向创建的圆角矩形对象 + * @since 11 + * @version 1.0 + */ +OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate(const OH_Drawing_Rect*, float xRad, float yRad); + +/** + * @brief 函数用于销毁圆角矩形对象并回收该对象占有的内存 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_RoundRectDestroy(OH_Drawing_RoundRect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h new file mode 100644 index 00000000..b6969568 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -0,0 +1,135 @@ +/* + * 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 C_INCLUDE_DRAWING_SHADER_EFFECT_H +#define C_INCLUDE_DRAWING_SHADER_EFFECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief 提供二维图形渲染、文本绘制和图像显示等功能。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_shader_effect.h + * + * @brief 声明与绘图模块中的着色器对象相关的函数。 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 枚举平铺模式。 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** + * 如果着色器效果超出其原始边界,则复制边缘颜色。 + */ + CLAMP, + /** + * 在水平和垂直方向上重复着色器效果图像。 + */ + REPEAT, + /** + * 水平和垂直重复着色器效果图像,交替使用镜像图像使相邻图像始终接缝。 + */ + MIRROR, + /** + * 只在原域内绘制,其他地方返回透明黑色。 + */ + DECAL, +} OH_Drawing_TileMode; + +/** + * @brief 创建着色器,在两个指定点之间生成线性渐变。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param startPt 表示渐变的起点 + * @param endPt 表示渐变的终点 + * @param colors 表示示两点之间分布的颜色。 + * @param pos 表示每种对应颜色在颜色数组中的相对位置。 + * @param size 表示颜色和位置的数量。 + * @param OH_Drawing_TileMode 表示平铺模式类型。 + * @return 返回创建的着色器对象的指针。 + * @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); + +/** + * @brief 创建着色器,在给定中心和半径的情况下生成径向渐变。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param centerPt 指示渐变效果的圆心。 + * @param radius 指示此渐变的圆半径。 + * @param colors 表示在两个点之间分布的颜色。 + * @param pos 表示每种对应颜色在颜色数组中的相对位置。 + * @param size 表示颜色和位置的数量。 + * @param OH_Drawing_TileMode 表示平铺模式类型。 + * @return 返回创建的着色器对象的指针。 + * @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); + +/** + * @brief 创建着色器,在给定中心的情况下生成扫掠渐变。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param centerPt 表示渐变的圆心。 + * @param colors 表示在两个点之间分布的颜色。 + * @param pos 表示每种对应颜色在颜色数组中的相对位置。 + * @param size 表示颜色和位置的数量。 + * @param OH_Drawing_TileMode 表示平铺模式类型。 + * @return 返回创建的着色器对象的指针。 + * @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); + +/** + * @brief 销毁着色器对象,并收回该对象占用的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_ShaderEffect 表示指向着色器对象的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_ShaderEffectDestroy(OH_Drawing_ShaderEffect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif \ No newline at end of file diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h new file mode 100644 index 00000000..7c410e77 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -0,0 +1,122 @@ +/* + * 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 C_INCLUDE_DRAWING_TEXT_BLOB_H +#define C_INCLUDE_DRAWING_TEXT_BLOB_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_text_blob.h + * + * @brief 文件中定义了与文字相关的功能函数 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 函数用于创建一个文本构造器对象 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 函数会返回一个指针,指针指向创建的文本构造器对象 + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void); + +/** + * @brief 结构体用于描述一块内存,描述文字和位置信息 + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** 存储文字索引 */ + uint16_t* glyphs; + /** 存储文字的位置 */ + float* pos; + /** 存储文字UTF-8编码 */ + char* utf8text; + /** 存储文字簇 (UTF-8编码) */ + uint32_t* clusters; +} OH_Drawing_RunBuffer; + +/** + * @brief 函数用于申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理,当调用OH_Drawing_TextBlobBuilderMake后禁止使用 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针 + * @param OH_Drawing_Font 参数为一个指向字体对象的指针 + * @param count 参数为文字的数量 + * @param OH_Drawing_Rect 参数为文本的边界框 + * @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*); + +/** + * @brief 函数用于从文本构造器中创建文本对象 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针 + * @return 函数会返回一个指针,指针指向创建的文本对象 + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder*); + +/** + * @brief 函数用于销毁文本对象并回收该对象占有的内存 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TextBlobDestroy(OH_Drawing_TextBlob*); + +/** + * @brief 函数用于销毁文本构造器对象并回收该对象占有的内存 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TextBlobBuilderDestroy(OH_Drawing_TextBlobBuilder*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h new file mode 100644 index 00000000..f22656c9 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -0,0 +1,70 @@ +/* + * 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 C_INCLUDE_DRAWING_TYPEFACE_H +#define C_INCLUDE_DRAWING_TYPEFACE_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_typeface.h + * + * @brief 文件中定义了与字形相关的功能函数 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 函数用于创建一个默认的字形对象 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 函数会返回一个指针,指针指向创建的字形对象 + * @since 11 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); + +/** + * @brief 函数用于销毁字形对象并回收该对象占有的内存 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TypefaceDestroy(OH_Drawing_Typeface*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index 4d8bda58..9b62e3d4 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 - * + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -45,7 +45,7 @@ extern "C" { /** * @brief OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字 - * + * * @since 8 * @version 1.0 */ @@ -53,7 +53,7 @@ typedef struct OH_Drawing_Canvas OH_Drawing_Canvas; /** * @brief OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色 - * + * * @since 8 * @version 1.0 */ @@ -61,7 +61,7 @@ typedef struct OH_Drawing_Pen OH_Drawing_Pen; /** * @brief OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色 - * + * * @since 8 * @version 1.0 */ @@ -69,7 +69,7 @@ typedef struct OH_Drawing_Brush OH_Drawing_Brush; /** * @brief OH_Drawing_Path定义为路径,路径用于自定义各种形状 - * + * * @since 8 * @version 1.0 */ @@ -77,12 +77,109 @@ typedef struct OH_Drawing_Path OH_Drawing_Path; /** * @brief OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据 - * + * * @since 8 * @version 1.0 */ typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap; +/** + * @brief 定义一个点,用于描述坐标点。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Point OH_Drawing_Point; + +/** + * @brief 用于描述矩形。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Rect OH_Drawing_Rect; + +/** + * @brief 用于描述圆角矩形。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect; + +/** + * @brief 定义一个矩阵,用于描述坐标变换。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Matrix OH_Drawing_Matrix; + +/** + * @brief 定义一个着色器,用于描述绘制内容的源颜色。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect; + +/** + * @brief 定义一个滤波器,用于存储和颜色滤波器和模板滤波器。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Filter OH_Drawing_Filter; + +/** + * @brief 定义模板滤波器,用于在绘制模板前对其进行转换。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter; + +/** + * @brief 定义颜色滤波器,调用一个颜色并返回新颜色。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter; + +/** + * @brief 用于描述字体。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Font OH_Drawing_Font; + +/** + * @brief 用于描述字形 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Typeface OH_Drawing_Typeface; + +/** + * @brief 定义一个文本对象,表示将多个文本组合到一个不可变的容器中。 + * 每个文本行由字形和位置组成。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob; + +/** + * @brief 定义文本构建器,用于构建文本。 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder; + /** * @brief OH_Drawing_ColorFormat用于描述位图像素的存储格式 * @@ -121,6 +218,86 @@ typedef enum { ALPHA_FORMAT_UNPREMUL } OH_Drawing_AlphaFormat; +/** + * @brief 混合操作会为两种颜色(源色、目标色)生成一种新的颜色。 + * 这些操作在 4 个颜色通道(红、绿、蓝、阿尔法)上是相同的。 + * 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 + * + * 为简洁起见,我们使用以下缩略语。 + * s : source + * d : destination + * sa : source alpha + * da : destination alpha + * + * 结果缩写为 + * r : 如果所有4个通道的计算方式相同 + * ra : 透明度通道结果 + * rc : "颜色"结果:红色、绿色和蓝色通道 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** r = 0. */ + BLEND_MODE_CLEAR, + /** r = s. */ + BLEND_MODE_SRC, + /** r = d. */ + BLEND_MODE_DST, + /** r = s + (1-sa)*d. */ + BLEND_MODE_SRC_OVER, + /** r = d + (1-da)*s. */ + BLEND_MODE_DST_OVER, + /** r = s * da. */ + BLEND_MODE_SRC_IN, + /** r = d * sa. */ + BLEND_MODE_DST_IN, + /** r = s * (1-da). */ + BLEND_MODE_SRC_OUT, + /** r = d * (1-sa). */ + BLEND_MODE_DST_OUT, + /** r = s*da + d*(1-sa). */ + BLEND_MODE_SRC_ATOP, + /** r = d*sa + s*(1-da). */ + BLEND_MODE_DST_ATOP, + /** r = s*(1-da) + d*(1-sa). */ + BLEND_MODE_XOR, + /** r = min(s + d, 1). */ + BLEND_MODE_PLUS, + /** r = s*d. */ + BLEND_MODE_MODULATE, + /** r = s + d - s*d. */ + BLEND_MODE_SCREEN, + /** 乘法或筛选,具体取决于目标。 */ + BLEND_MODE_OVERLAY, + /** rc = s + d - max(s*da, d*sa), ra = s + (1-sa)*d. */ + BLEND_MODE_DARKEN, + /** rc = s + d - min(s*da, d*sa), ra = s + (1-sa)*d. */ + BLEND_MODE_LIGHTEN, + /** 照亮目的地以反映源点。 */ + BLEND_MODE_COLOR_DODGE, + /** 使目的地变暗,以反映源点。 */ + BLEND_MODE_COLOR_BURN, + /** 乘法或者筛选依赖于源点。 */ + BLEND_MODE_HARD_LIGHT, + /** 变亮或变暗,具体取决于来源。 */ + BLEND_MODE_SOFT_LIGHT, + /** rc = s + d - 2*(min(s*da, d*sa)), ra = s + (1-sa)*d. */ + BLEND_MODE_DIFFERENCE, + /** rc = s + d - two(s*d), ra = s + (1-sa)*d. */ + BLEND_MODE_EXCLUSION, + /** r = s*(1-da) + d*(1-sa) + s*d. */ + BLEND_MODE_MULTIPLY, + /** 源的色调与目的地的饱和度和亮度。 */ + BLEND_MODE_HUE, + /** 源的饱和度与目的地的色调和亮度。 */ + BLEND_MODE_SATURATION, + /** 源的色调和饱和度与目的地的亮度。 */ + BLEND_MODE_COLOR, + /** 源的亮度与目标的色调和饱和度。 */ + BLEND_MODE_LUMINOSITY, +} OH_Drawing_BlendMode; + #ifdef __cplusplus } #endif -- Gitee From 40902ebe7d988e55c0a3d1d3a3bb8f45e12f1dff Mon Sep 17 00:00:00 2001 From: fzj Date: Sat, 30 Dec 2023 11:14:17 +0800 Subject: [PATCH 0191/2135] add comments for nfc Signed-off-by: fzj --- .../v1_0/IConnectedNfcTag.idl | 89 +++++++++++++++++++ .../device_api/hdi/nfc/v1_0/INfcCallback.idl | 23 +++-- .../device_api/hdi/nfc/v1_0/INfcInterface.idl | 66 ++++++++------ zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl | 21 ++++- .../device_api/hdi/nfc/v1_1/INfcInterface.idl | 31 ++++--- zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl | 20 ++++- 6 files changed, 198 insertions(+), 52 deletions(-) create mode 100644 zh-cn/device_api/hdi/connected_nfc_tag/v1_0/IConnectedNfcTag.idl diff --git a/zh-cn/device_api/hdi/connected_nfc_tag/v1_0/IConnectedNfcTag.idl b/zh-cn/device_api/hdi/connected_nfc_tag/v1_0/IConnectedNfcTag.idl new file mode 100644 index 00000000..5ca0f016 --- /dev/null +++ b/zh-cn/device_api/hdi/connected_nfc_tag/v1_0/IConnectedNfcTag.idl @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiConnectedNfcTag + * @{ + * + * @brief 为nfc服务提供统一的访问nfc驱动的接口 + * + * 通过ConnectedNfcTag服务获取到ConnectedNFCTag驱动对象或者代理提供的API访问ConnectedNFCTag设备,这些API包含可以初始化 + * 或者去初始化ConnectedNfcTag驱动,往nfc卡中读写Ndef内容 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IConnectedNfcTag.idl + * + * @brief 读写NFC Tag的接口定义文件 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.connected_nfc_tag.v1_0; + +/** + * @brief 声明ConnectedNfcTag模块提供的API,这些API包含初始化或者去初始化ConnectedNfcTag驱动,往nfc卡中读写Ndef内容 + * + * @since 3.2 + * @version 1.0 + */ + +interface IConnectedNfcTag { + /** + * @brief 初始化ConnecteNfcTag驱动。 + * + * @return 初始化成功返回0,否则返回初始化失败原因。 + * + * @since 3.2 + * @version 1.0 + */ + Init(); + + /** + * @brief 去初始化ConnecteNfcTag驱动。 + * + * @return 去初始化成功返回0,否则返回去初始化失败原因。 + * + * @since 3.2 + * @version 1.0 + */ + Uninit(); + + /** + * @brief 从连接的NFC卡中读取NDEF内容。 + * + * @return 返回NDEF内容字符串。 + * + * @since 3.2 + * @version 1.0 + */ + ReadNdefTag([out] String ndefData); + + /** + * @brief 往已连接的NFC卡中写入NDEF数据。 + * + * @param 待写入的NDEF数据字符串。 + * @return 写入成功返回0,否则返回写失败原因。 + * + * @since 3.2 + * @version 1.0 + */ + WriteNdefTag([in] String ndefData); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/nfc/v1_0/INfcCallback.idl b/zh-cn/device_api/hdi/nfc/v1_0/INfcCallback.idl index baa01efc..6cdf494c 100644 --- a/zh-cn/device_api/hdi/nfc/v1_0/INfcCallback.idl +++ b/zh-cn/device_api/hdi/nfc/v1_0/INfcCallback.idl @@ -26,35 +26,44 @@ * @version 1.0 */ +/** + * @file INfcCallback.idl + * + * @brief 定义NFC回调的接口文件 + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.nfc.v1_0; import ohos.hdi.nfc.v1_0.NfcTypes; /** - * @brief 用于从nfc芯片给nfc协议栈上报数据和事件的回调声明. + * @brief 用于从nfc芯片给nfc协议栈上报数据和事件的回调声明。 * * @since 3.2 * @version 1.0 */ [callback] interface INfcCallback { /** - * @brief NFC芯片上报给协议栈NFC数据的函数定义. + * @brief NFC芯片上报给协议栈NFC数据的函数定义。 * - * @param data NFC芯片上报给NFC协议栈的数据. + * @param data NFC芯片上报给NFC协议栈的数据。 * * @since 3.2 */ OnData([in] List data); /** - * @brief NFC芯片上报给协议栈事件的函数定义. + * @brief NFC芯片上报给协议栈事件的函数定义。 * - * @param event 上报事件的事件ID. - * @param status NFC状态,具体定义见NfcStatus. - * 事件ID具体见 {@link NfcTypes}. + * @param event 上报事件的事件ID。 + * @param status NFC状态,具体定义见NfcStatus。 + * 事件ID具体见 {@link NfcTypes}。 * * @since 3.2 */ OnEvent([in] enum NfcEvent event, [in] enum NfcStatus status); } +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/nfc/v1_0/INfcInterface.idl b/zh-cn/device_api/hdi/nfc/v1_0/INfcInterface.idl index a90f96aa..868f8101 100644 --- a/zh-cn/device_api/hdi/nfc/v1_0/INfcInterface.idl +++ b/zh-cn/device_api/hdi/nfc/v1_0/INfcInterface.idl @@ -26,6 +26,15 @@ * @version 1.0 */ +/** + * @file INfcInterface.idl + * + * @brief 定义NFC开关、初始化、传输数据的适配接口文件 + * + * @since 3.2 + * @version 1.0 + */ + package ohos.hdi.nfc.v1_0; import ohos.hdi.nfc.v1_0.NfcTypes; @@ -40,11 +49,11 @@ import ohos.hdi.nfc.v1_0.INfcCallback; interface INfcInterface { /** - * @brief 打开NFC,对NFC初始化. + * @brief 打开NFC,对NFC初始化。 * * @param callbackObj NFC芯片发送给NFC协议栈的数据和事件的回调对象 - * @return Returns 0 操作成功返回0, 否则返回失败. - * 具体类型详见 {@link NfcTypes}. + * @return Returns 0 操作成功返回0,否则返回失败。 + * 具体类型详见 {@link NfcTypes}。 * * @since 3.2 * @version 1.0 @@ -52,11 +61,11 @@ interface INfcInterface { Open([in] INfcCallback callbackObj, [out] enum NfcStatus status); /** - * @brief NFC初始化. + * @brief NFC初始化。 * - * @param callbackObj NFC芯片发送给NFC协议栈的数据和事件的回调对象. - * @return Returns 0 操作成功返回0, 否则返回失败. - * 具体类型详见 {@link NfcTypes}. + * @param callbackObj NFC芯片发送给NFC协议栈的数据和事件的回调对象。 + * @return Returns 0 操作成功返回0,否则返回失败。 + * 具体类型详见 {@link NfcTypes}。 * * @since 3.2 * @version 1.0 @@ -64,10 +73,10 @@ interface INfcInterface { CoreInitialized([in] List data, [out] enum NfcStatus status); /** - * @brief 启动RF discover之前对芯片进行预配置. + * @brief 启动RF discover之前对芯片进行预配置。 * - * @return Returns 0 配置成功返回0,否则返回失败原因. - * 具体类型详见 {@link NfcTypes}. + * @return Returns 0 配置成功返回0,否则返回失败原因。 + * 具体类型详见 {@link NfcTypes}。 * * @since 3.2 * @version 1.0 @@ -75,11 +84,11 @@ interface INfcInterface { Prediscover([out] enum NfcStatus status); /** - * @brief 发送数据给NFC控制器. + * @brief 发送数据给NFC控制器。 * - * @param 待写入NFC控制器的数据. - * @return Returns 0 配置成功返回0,否则返回失败原因. - * 具体类型详见 {@link NfcTypes}. + * @param 待写入NFC控制器的数据。 + * @return Returns 0 配置成功返回0,否则返回失败原因。 + * 具体类型详见 {@link NfcTypes}。 * * @since 3.2 * @version 1.0 @@ -87,10 +96,10 @@ interface INfcInterface { Write([in] List data, [out] enum NfcStatus status); /** - * @brief 允许HDF层发送NCI指令. + * @brief 允许HDF层发送NCI指令。 * - * @return Returns 0 配置成功返回0,否则返回失败原因. - * 具体类型详见 {@link NfcTypes}. + * @return Returns 0 配置成功返回0,否则返回失败原因。 + * 具体类型详见 {@link NfcTypes}。 * * @since 3.2 * @version 1.0 @@ -98,10 +107,10 @@ interface INfcInterface { ControlGranted([out] enum NfcStatus status); /** - * @brief 周期性重启NFC. + * @brief 周期性重启NFC。 * - * @return Returns 0配置成功返回0,否则返回失败原因. - * 具体类型详见 {@link NfcTypes}. + * @return Returns 0配置成功返回0,否则返回失败原因。 + * 具体类型详见 {@link NfcTypes}。 * * @since 3.2 * @version 1.0 @@ -109,10 +118,10 @@ interface INfcInterface { PowerCycle([out] enum NfcStatus status); /** - * @brief 关闭NFC. + * @brief 关闭NFC。 * - * @return Returns 0 配置成功返回0,否则返回失败原因. - * 具体类型详见 {@link NfcTypes}. + * @return Returns 0 配置成功返回0,否则返回失败原因。 + * 具体类型详见 {@link NfcTypes}。 * * @since 3.2 * @version 1.0 @@ -120,15 +129,16 @@ interface INfcInterface { Close([out] enum NfcStatus status); /** - * @brief NFC协议栈通过IO控制指令和数据发送给HDI. + * @brief NFC协议栈通过IO控制指令和数据发送给HDI。 * - * @param cmd NfcCommand中定义在控制指令,详见 {@link NfcTypes}. - * @param data 发送给HDI的数据. - * @return Returns 0 配置成功返回0,否则返回失败原因. - * 具体类型详见 {@link NfcTypes}. + * @param cmd NfcCommand中定义在控制指令,详见 {@link NfcTypes}。 + * @param data 发送给HDI的数据。 + * @return Returns 0 配置成功返回0,否则返回失败原因。 + * 具体类型详见 {@link NfcTypes}。 * * @since 3.2 * @version 1.0 */ Ioctl([in] enum NfcCommand cmd, [in] List data, [out] enum NfcStatus status); } +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl b/zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl index fc77fe07..e604c527 100644 --- a/zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl +++ b/zh-cn/device_api/hdi/nfc/v1_0/NfcTypes.idl @@ -38,39 +38,54 @@ package ohos.hdi.nfc.v1_0; /** - * @brief NFC事件(包括打开NFC完成、关闭NFC完成、预配置NFC完成等上报事件)的枚举定义. + * @brief NFC事件(包括打开NFC完成、关闭NFC完成、预配置NFC完成等上报事件)的枚举定义。 * * @since 3.2 */ enum NfcEvent { + /** NFC打开完成事件 */ OPEN_CPLT = 0, + /** NFC关闭完成事件 */ CLOSE_CPLT = 1, + /** NFC初始化完成事件 */ POST_INIT_CPLT = 2, + /** NFC discover预配置完成事件 */ PRE_DISCOVER_CPLT = 3, + /** 请求控制事件 */ REQUEST_CONTROL = 4, + /** 释放控制事件 */ RELEASE_CONTROL = 5, + /** 错误事件 */ ERROR = 6, + /** HCI复位事件 */ HCI_NETWORK_RESET = 7, }; /** - * @brief NFC状态的枚举定义. + * @brief NFC状态的枚举定义。 * * @since 3.2 */ enum NfcStatus { + /** NFC状态OK */ OK = 0, + /** NFC状态失败 */ FAILED = 1, + /** 传输错误 */ ERR_TRANSPORT = 2, + /** 发送命令超时 */ ERR_CMD_TIMEOUT = 3, + /** 请求被拒绝 */ REFUSED = 4, }; /** - * @brief NFC指令的枚举定义. + * @brief NFC指令的枚举定义。 * * @since 3.2 */ enum NfcCommand { + /** 无效指令 */ CMD_INVALID = 0, }; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/nfc/v1_1/INfcInterface.idl b/zh-cn/device_api/hdi/nfc/v1_1/INfcInterface.idl index e59024a5..ac89ae33 100644 --- a/zh-cn/device_api/hdi/nfc/v1_1/INfcInterface.idl +++ b/zh-cn/device_api/hdi/nfc/v1_1/INfcInterface.idl @@ -22,6 +22,16 @@ * NFC服务通过获取的nfc驱动对象提供的API接口访问nfc驱动,包括开关NFC、初始化NFC、读写数据、配置RF参数、 * 通过IO控制发送NCI指令给nfc驱动 * + * @since 4.1 + * @version 1.1 + */ + +/** + * @file INfcInterface.idl + * + * @brief 定义NFC扩展的查询配置、工厂级复位的适配接口文件 + * + * @since 4.1 * @version 1.1 */ @@ -39,11 +49,11 @@ import ohos.hdi.nfc.v1_1.NfcTypes; */ interface INfcInterface extends ohos.hdi.nfc.v1_0.INfcInterface { /** - * @brief 查询厂商自定义的NFC配置. + * @brief 查询厂商自定义的NFC配置。 * - * @param config 厂商自定义的NFC配置. - * @return Returns 0 操作成功返回0, 否则返回失败. - * 具体类型详见 {@link NfcTypes}. + * @param config 厂商自定义的NFC配置。 + * @return Returns 0 操作成功返回0,否则返回失败。 + * 具体类型详见 {@link NfcTypes}。 * * @since 4.1 * @version 1.0 @@ -51,10 +61,10 @@ interface INfcInterface extends ohos.hdi.nfc.v1_0.INfcInterface { GetVendorConfig([out] struct NfcVendorConfig config, [out] enum NfcStatus status); /** - * @brief NFC芯片工厂级复位. + * @brief NFC芯片工厂级复位。 * - * @return Returns 0 操作成功返回0, 否则返回失败. - * 具体类型详见 {@link NfcTypes}. + * @return Returns 0 操作成功返回0,否则返回失败。 + * 具体类型详见 {@link NfcTypes}。 * * @since 4.1 * @version 1.0 @@ -62,13 +72,14 @@ interface INfcInterface extends ohos.hdi.nfc.v1_0.INfcInterface { DoFactoryReset([out] enum NfcStatus status); /** - * @brief 关闭NFC. 如果设备支持关机刷卡功能,需要实现该接口 + * @brief 关闭NFC。如果设备支持关机刷卡功能,需要实现该接口 * - * @return Returns 0 操作成功返回0, 否则返回失败. - * 具体类型详见 {@link NfcTypes}. + * @return Returns 0 操作成功返回0,否则返回失败。 + * 具体类型详见 {@link NfcTypes}。 * * @since 4.1 * @version 1.0 */ Shutdown([out] enum NfcStatus status); } +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl b/zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl index e8408e45..3603b78b 100644 --- a/zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl +++ b/zh-cn/device_api/hdi/nfc/v1_1/NfcTypes.idl @@ -22,13 +22,14 @@ * NFC服务通过获取的nfc驱动对象提供的API接口访问nfc驱动,包括开关NFC、初始化NFC、读写数据、配置RF参数、 * 通过IO控制发送NCI指令给nfc驱动 * + * @since 4.1 * @version 1.1 */ /** * @file NfcTypes.idl * - * @brief NFC事件(包括打开NFC完成、关闭NFC完成、预配置NFC完成等上报事件)的枚举定义. + * @brief NFC事件(包括打开NFC完成、关闭NFC完成、预配置NFC完成等上报事件)的枚举定义。 * * @since 4.1 * @version 1.1 @@ -37,25 +38,35 @@ package ohos.hdi.nfc.v1_1; /** - * @brief RF discover过程中厂家自定义支持的NFC协议类型. + * @brief RF discover过程中厂家自定义支持的NFC协议类型。 * * @since 4.1 */ enum VendorProtocalDiscoveryCfg { + /** 遵循ISO18092协议的Felica */ NCI_PROTOCOL_18092_ACTIVE = 0, + /** 遵循typeB类型的ISO-DEP */ NCI_PROTOCOL_B_PRIME = 1, + /** 厂商自定义的私有协议 */ NCI_PROTOCOL_DUAL = 2, + /** 遵循ISO15693协议 */ NCI_PROTOCOL_15693 = 3, + /** Kovio公司的NFC条形码 */ NCI_PROTOCOL_KOVIO = 4, + /** 厂商定义的Mifare协议 */ NCI_PROTOCOL_MIFARE = 5, + /** Kovio的polling */ NCI_DISCOVERY_TYPE_POLL_KOVIO = 6, + /** typeB的polling */ NCI_DISCOVERY_TYPE_POLL_B_PRIME = 7, + /** typeB的卡模拟 */ NCI_DISCOVERY_TYPE_LISTEN_B_PRIME = 8, + /** 自定义最大配置个数 */ VENDOR_PROPEIETARY_CFG_MAX = 9, }; /** - * @brief 厂家自定义的NFC配置. + * @brief 厂家自定义的NFC配置。 * * @since 4.1 */ @@ -107,4 +118,5 @@ struct NfcVendorConfig { /** ISO-DEP默认路由位置 */ unsigned char defaultIsoDepRoute; -}; \ No newline at end of file +}; +/** @} */ \ No newline at end of file -- Gitee From 40022351aa2500b760f09f56d79639d00c4bb2af Mon Sep 17 00:00:00 2001 From: sqwlly Date: Tue, 2 Jan 2024 10:06:28 +0800 Subject: [PATCH 0192/2135] add dot Signed-off-by: s30029175 Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_brush.h | 26 +-- .../graphic/native_drawing/drawing_canvas.h | 178 ++++++++-------- .../graphic/native_drawing/drawing_color.h | 14 +- .../graphic/native_drawing/drawing_font.h | 42 ++-- .../native_drawing/drawing_font_collection.h | 12 +- .../graphic/native_drawing/drawing_matrix.h | 34 +-- .../graphic/native_drawing/drawing_path.h | 76 +++---- .../graphic/native_drawing/drawing_pen.h | 94 ++++----- .../graphic/native_drawing/drawing_point.h | 16 +- .../graphic/native_drawing/drawing_rect.h | 20 +- .../native_drawing/drawing_round_rect.h | 18 +- .../native_drawing/drawing_shader_effect.h | 4 +- .../native_drawing/drawing_text_blob.h | 30 +-- .../native_drawing/drawing_text_declaration.h | 14 +- .../native_drawing/drawing_text_typography.h | 194 +++++++++--------- .../graphic/native_drawing/drawing_typeface.h | 12 +- .../graphic/native_drawing/drawing_types.h | 18 +- 17 files changed, 401 insertions(+), 401 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index ccfeaa25..75de059b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_brush.h * - * @brief 文件中定义了与画刷相关的功能函数 + * @brief 文件中定义了与画刷相关的功能函数。 * * @since 8 * @version 1.0 @@ -44,10 +44,10 @@ extern "C" { #endif /** - * @brief 函数用于创建一个画刷对象 + * @brief 函数用于创建一个画刷对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的画刷对象 + * @return 函数会返回一个指针,指针指向创建的画刷对象。 * @since 8 * @version 1.0 */ @@ -57,29 +57,29 @@ OH_Drawing_Brush* OH_Drawing_BrushCreate(void); * @brief 函数用于销毁画刷对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针 + * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_BrushDestroy(OH_Drawing_Brush*); /** - * @brief 函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 + * @brief 函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针 - * @return 函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿 + * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @return 函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。 * @since 8 * @version 1.0 */ bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); /** - * @brief 函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理 + * @brief 函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针 - * @param bool 参数真为抗锯齿,参数假则不做抗锯齿处理 + * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param bool 参数真为抗锯齿,参数假则不做抗锯齿处理。 * @since 8 * @version 1.0 */ @@ -141,11 +141,11 @@ void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha); void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*); /** - * @brief 为笔刷设置过滤器。 + * @brief 为笔刷设置滤波器。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 - * @param OH_Drawing_Filter OH_Drawing_Filter表示指向过滤器对象的指针。 + * @param OH_Drawing_Filter OH_Drawing_Filter表示指向滤波器对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index a156101e..a5f2759f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -44,140 +44,140 @@ extern "C" { #endif /** - * @brief 函数用于创建一个画布对象 + * @brief 函数用于创建一个画布对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的画布对象 + * @return 函数会返回一个指针,指针指向创建的画布对象。 * @since 8 * @version 1.0 */ OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void); /** - * @brief 函数用于销毁画布对象并回收该对象占有的内存 + * @brief 函数用于销毁画布对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数是一个指向画布对象的指针 + * @param OH_Drawing_Canvas 参数是一个指向画布对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*); /** - * @brief 函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染) + * @brief 函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Bitmap 参数为一个指向位图对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Bitmap 参数为一个指向位图对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*); /** - * @brief 函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓 + * @brief 函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Pen 参数为一个指向画笔对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Pen 参数为一个指向画笔对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*); /** - * @brief 函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓 + * @brief 函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas*); /** - * @brief 函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状 + * @brief 函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Brush 参数为一个指向画刷对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Brush 参数为一个指向画刷对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_Brush*); /** - * @brief 函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状 + * @brief 函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*); /** - * @brief 函数用于保存当前画布的状态(画布矩阵)到一个栈顶 + * @brief 函数用于保存当前画布的状态(画布矩阵)到一个栈顶。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); /** - * @brief 函数用于恢复保存在栈顶的画布状态(画布矩阵) + * @brief 函数用于恢复保存在栈顶的画布状态(画布矩阵)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*); /** - * @brief 函数用于获取栈中保存的画布状态(画布矩阵)的数量 + * @brief 函数用于获取栈中保存的画布状态(画布矩阵)的数量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @return 函数会返回一个32位的值描述画布状态(画布矩阵)的数量 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @return 函数会返回一个32位的值描述画布状态(画布矩阵)的数量。 * @since 11 * @version 1.0 */ uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*); /** - * @brief 函数用于恢复到指定数量的画布状态(画布矩阵) + * @brief 函数用于恢复到指定数量的画布状态(画布矩阵)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param saveCount 参数为指定的画布状态(画布矩阵)数量 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param saveCount 参数为指定的画布状态(画布矩阵)数量。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount); /** - * @brief 函数用于画一条直线段 + * @brief 函数用于画一条直线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param x1 参数为线段起始点的横坐标 - * @param y1 参数为线段起始点的纵坐标 - * @param x2 参数为线段结束点的横坐标 - * @param y2 参数为线段结束点的纵坐标 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param x1 参数为线段起始点的横坐标。 + * @param y1 参数为线段起始点的纵坐标。 + * @param x2 参数为线段结束点的横坐标。 + * @param y2 参数为线段结束点的纵坐标。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, float y2); /** - * @brief 函数用于画一个自定义路径 + * @brief 函数用于画一个自定义路径。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 * @since 8 * @version 1.0 */ @@ -187,81 +187,81 @@ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); * @brief 函数用于画一个位图 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Bitmap 参数为一个指向位图对象的指针 - * @param left 参数为位图对象左上角的横坐标 - * @param top 参数为位图对象左上角的纵坐标 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Bitmap 参数为一个指向位图对象的指针。 + * @param left 参数为位图对象左上角的横坐标。 + * @param top 参数为位图对象左上角的纵坐标。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); /** - * @brief 函数用于画一个矩形 + * @brief 函数用于画一个矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*); /** - * @brief 函数用于画一个圆形 + * @brief 函数用于画一个圆形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针,表示圆心 - * @param radius 参数为圆形的半径 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针,表示圆心。 + * @param radius 参数为圆形的半径。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius); /** - * @brief 函数用于画一个椭圆 + * @brief 函数用于画一个椭圆。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*); /** - * @brief 函数用于画一个弧 + * @brief 函数用于画一个弧。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 - * @param startAngle 参数为弧的起始角度 - * @param sweepAngle 参数为弧的扫描角度 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 + * @param startAngle 参数为弧的起始角度。 + * @param sweepAngle 参数为弧的扫描角度。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); /** - * @brief 函数用于画一个圆角矩形 + * @brief 函数用于画一个圆角矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*); /** - * @brief 函数用于画一段文字 + * @brief 函数用于画一段文字。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针 - * @param x 参数为文本对象左下角的横坐标 - * @param y 参数为文本对象左下角的纵坐标 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针。 + * @param x 参数为文本对象左下角的横坐标。 + * @param y 参数为文本对象左下角的纵坐标。 * @since 11 * @version 1.0 */ @@ -285,13 +285,13 @@ typedef enum { } OH_Drawing_CanvasClipOp; /** - * @brief 函数用于裁剪一个矩形 + * @brief 函数用于裁剪一个矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 - * @param clipOp 参数为裁剪方式 - * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 + * @param clipOp 参数为裁剪方式。 + * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理。 * @since 11 * @version 1.0 */ @@ -299,13 +299,13 @@ void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** - * @brief 函数用于裁剪一个自定义路径 + * @brief 函数用于裁剪一个自定义路径。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 - * @param clipOp 参数为裁剪方式 - * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param clipOp 参数为裁剪方式。 + * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理。 * @since 11 * @version 1.0 */ @@ -313,48 +313,48 @@ void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** - * @brief 函数用于旋转一定的角度,正数表示顺时针旋转 + * @brief 函数用于旋转一定的角度,正数表示顺时针旋转。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param degrees 参数为旋转的角度 - * @param px 参数为旋转中心的横坐标 - * @param py 参数为旋转中心的纵坐标 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param degrees 参数为旋转的角度。 + * @param px 参数为旋转中心的横坐标。 + * @param py 参数为旋转中心的纵坐标。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py); /** - * @brief 函数用于平移一段距离 + * @brief 函数用于平移一段距离。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param dx 参数为水平方向移动的距离 - * @param dy 参数为垂直方向移动的距离 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param dx 参数为水平方向移动的距离。 + * @param dy 参数为垂直方向移动的距离。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); /** - * @brief 函数用于画布缩放 + * @brief 函数用于画布缩放。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param sx 参数为水平方向缩放的比例 - * @param sy 参数为垂直方向缩放的比例 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param sx 参数为水平方向缩放的比例。 + * @param sy 参数为垂直方向缩放的比例。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); /** - * @brief 函数用于使用指定颜色去清空画布 + * @brief 函数用于使用指定颜色去清空画布。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针 - * @param color 参数为一个描述颜色的32位(ARGB)变量 + * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param color 参数为一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h index f5a6c106..6b2cd1e8 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_color.h * - * @brief 文件中定义了与颜色相关的功能函数 + * @brief 文件中定义了与颜色相关的功能函数。 * * @since 8 * @version 1.0 @@ -44,13 +44,13 @@ extern "C" { #endif /** - * @brief 函数用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量 + * @brief 函数用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param alpha 参数为一个描述透明度的变量, 变量范围是0x00~0xFF - * @param red 参数为一个描述红色的变量, 变量范围是0x00~0xFF - * @param green 参数为一个描述绿色的变量, 变量范围是0x00~0xFF - * @param blue 参数为一个描述蓝色的变量, 变量范围是0x00~0xFF + * @param alpha 参数为一个描述透明度的变量, 变量范围是0x00~0xFF。 + * @param red 参数为一个描述红色的变量, 变量范围是0x00~0xFF。 + * @param green 参数为一个描述绿色的变量, 变量范围是0x00~0xFF。 + * @param blue 参数为一个描述蓝色的变量, 变量范围是0x00~0xFF。 * @return 函数返回一个描述颜色的32位(ARGB)变量 * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index fea3571f..75c610b9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_font.h * - * @brief 文件中定义了与字体相关的功能函数 + * @brief 文件中定义了与字体相关的功能函数。 * * @since 11 * @version 1.0 @@ -44,75 +44,75 @@ extern "C" { #endif /** - * @brief 函数用于创建一个字体对象 + * @brief 函数用于创建一个字体对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的字体对象 + * @return 函数会返回一个指针,指针指向创建的字体对象。 * @since 11 * @version 1.0 */ OH_Drawing_Font* OH_Drawing_FontCreate(void); /** - * @brief 函数用于给字体设置字形 + * @brief 函数用于给字体设置字形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针 - * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针 + * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针。 * @since 11 * @version 1.0 */ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); /** - * @brief 函数用于给字体设置文字大小 + * @brief 函数用于给字体设置文字大小。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针 - * @param textSize 参数为字体大小 + * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param textSize 参数为字体大小。 * @since 11 * @version 1.0 */ void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); /** - * @brief 函数用于设置线性可缩放字体 + * @brief 函数用于设置线性可缩放字体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针 - * @param isLinearText 参数真为使能线性可缩放字体,参数假为不使能 + * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param isLinearText 参数真为使能线性可缩放字体,参数假为不使能。 * @since 11 * @version 1.0 */ void OH_Drawing_FontSetLinearText(OH_Drawing_Font*, bool isLinearText); /** - * @brief 函数用于给字体设置文本倾斜 + * @brief 函数用于给字体设置文本倾斜。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针 - * @param skewX 参数为X轴相对于Y轴的倾斜度 + * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param skewX 参数为X轴相对于Y轴的倾斜度。 * @since 11 * @version 1.0 */ void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); /** - * @brief 函数用于设置增加描边宽度以近似粗体字体效果 + * @brief 函数用于设置增加描边宽度以近似粗体字体效果。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针 - * @param isFakeBoldText 参数真为使能增加描边宽度,参数假为不使能 + * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param isFakeBoldText 参数真为使能增加描边宽度,参数假为不使能。 * @since 11 * @version 1.0 */ void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); /** - * @brief 函数用于销毁字体对象并回收该对象占有的内存 + * @brief 函数用于销毁字体对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针 + * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 8093dc43..4f51b829 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供2D绘制功能 + * @brief 提供2D绘制功能。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_font_collection.h * - * @brief 定义绘制模块中与fontCollection相关的函数 + * @brief 定义绘制模块中与fontCollection相关的函数。 * * @since 8 * @version 1.0 @@ -43,20 +43,20 @@ extern "C" { #endif /** - * @brief 创建OH_Drawing_FontCollection + * @brief 创建OH_Drawing_FontCollection。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 指向创建的OH_Drawing_FontCollection对象的指针 + * @return 指向创建的OH_Drawing_FontCollection对象的指针。 * @since 8 * @version 1.0 */ OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void); /** - * @brief 释放被OH_Drawing_FontCollection对象占据的内存 + * @brief 释放被OH_Drawing_FontCollection对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection对象的指针 + * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection对象的指针。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index 88c95e17..0aded20c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_matrix.h * - * @brief 文件中定义了与矩阵相关的功能函数 + * @brief 文件中定义了与矩阵相关的功能函数。 * * @since 11 * @version 1.0 @@ -44,29 +44,29 @@ extern "C" { #endif /** - * @brief 函数用于创建一个矩阵对象 + * @brief 函数用于创建一个矩阵对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的矩阵对象 + * @return 函数会返回一个指针,指针指向创建的矩阵对象。 * @since 11 * @version 1.0 */ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); /** - * @brief 函数用于给矩阵对象设置参数 + * @brief 函数用于给矩阵对象设置参数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix 参数为一个指向矩阵对象的指针 - * @param scaleX 参数为水平缩放系数 - * @param skewX 参数为水平倾斜系数 - * @param transX 参数为水平位移系数 - * @param skewY 参数为垂直倾斜系数 - * @param scaleY 参数为垂直缩放系数 - * @param transY 参数为垂直位移系数 - * @param persp0 参数为X轴透视系数 - * @param persp1 参数为Y轴透视系数 - * @param persp2 参数为透视缩放系数 + * @param OH_Drawing_Matrix 参数为一个指向矩阵对象的指针。 + * @param scaleX 参数为水平缩放系数。 + * @param skewX 参数为水平倾斜系数。 + * @param transX 参数为水平位移系数。 + * @param skewY 参数为垂直倾斜系数。 + * @param scaleY 参数为垂直缩放系数。 + * @param transY 参数为垂直位移系数。 + * @param persp0 参数为X轴透视系数。 + * @param persp1 参数为Y轴透视系数。 + * @param persp2 参数为透视缩放系数。 * @since 11 * @version 1.0 */ @@ -74,10 +74,10 @@ void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, f float skewY, float scaleY, float transY, float persp0, float persp1, float persp2); /** - * @brief 函数用于销毁矩阵对象并回收该对象占有的内存 + * @brief 函数用于销毁矩阵对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix 参数为一个指向字体对象的指针 + * @param OH_Drawing_Matrix 参数为一个指向字体对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h index 76970bd0..6c17384a 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h @@ -44,44 +44,44 @@ extern "C" { #endif /** - * @brief 函数用于创建一个路径对象 + * @brief 函数用于创建一个路径对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的路径对象 + * @return 函数会返回一个指针,指针指向创建的路径对象。 * @since 8 * @version 1.0 */ OH_Drawing_Path* OH_Drawing_PathCreate(void); /** - * @brief 函数用于销毁路径对象并回收该对象占有的内存 + * @brief 函数用于销毁路径对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_PathDestroy(OH_Drawing_Path*); /** - * @brief 函数用于设置自定义路径的起始点位置 + * @brief 函数用于设置自定义路径的起始点位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 - * @param x 参数为起始点的横坐标 - * @param y 参数为起始点的纵坐标 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param x 参数为起始点的横坐标。 + * @param y 参数为起始点的纵坐标。 * @since 8 * @version 1.0 */ void OH_Drawing_PathMoveTo(OH_Drawing_Path*, float x, float y); /** - * @brief 函数用于添加一条从路径的最后点位置到目标点位置的线段 + * @brief 函数用于添加一条从路径的最后点位置到目标点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 - * @param x 参数为目标点的横坐标 - * @param y 参数为目标点的纵坐标 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param x 参数为目标点的横坐标。 + * @param y 参数为目标点的纵坐标。 * @since 8 * @version 1.0 */ @@ -89,46 +89,46 @@ void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y); /** * @brief 函数用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, - * 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段 + * 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 - * @param x1 参数为包围椭圆的矩形左上角点位置的横坐标 - * @param y1 参数为包围椭圆的矩形左上角点位置的纵坐标 - * @param x2 参数为包围椭圆的矩形右下角点位置的横坐标 - * @param y2 参数为包围椭圆的矩形右下角点位置的纵坐标 - * @param startDeg 参数为起始的角度 - * @param sweepDeg 参数为扫描的度数 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param x1 参数为包围椭圆的矩形左上角点位置的横坐标。 + * @param y1 参数为包围椭圆的矩形左上角点位置的纵坐标。 + * @param x2 参数为包围椭圆的矩形右下角点位置的横坐标。 + * @param y2 参数为包围椭圆的矩形右下角点位置的纵坐标。 + * @param startDeg 参数为起始的角度。 + * @param sweepDeg 参数为扫描的度数。 * @since 8 * @version 1.0 */ void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg); /** - * @brief 函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线 + * @brief 函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 - * @param ctrlX 参数为控制点位置的横坐标 - * @param ctrlY 参数为控制点位置的纵坐标 - * @param endX 参数为目标点位置的横坐标 - * @param endY 参数为目标点位置的纵坐标 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param ctrlX 参数为控制点位置的横坐标。 + * @param ctrlY 参数为控制点位置的纵坐标。 + * @param endX 参数为目标点位置的横坐标。 + * @param endY 参数为目标点位置的纵坐标。 * @since 8 * @version 1.0 */ void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY); /** - * @brief 函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线 + * @brief 函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 - * @param ctrlX1 参数为第一个控制点位置的横坐标 - * @param ctrlY1 参数为第一个控制点位置的纵坐标 - * @param ctrlX2 参数为第二个控制点位置的横坐标 - * @param ctrlY2 参数为第二个控制点位置的纵坐标 - * @param endX 参数为目标点位置的横坐标 - * @param endY 参数为目标点位置的纵坐标 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param ctrlX1 参数为第一个控制点位置的横坐标。 + * @param ctrlY1 参数为第一个控制点位置的纵坐标。 + * @param ctrlX2 参数为第二个控制点位置的横坐标。 + * @param ctrlY2 参数为第二个控制点位置的纵坐标。 + * @param endX 参数为目标点位置的横坐标。 + * @param endY 参数为目标点位置的纵坐标。 * @since 8 * @version 1.0 */ @@ -136,20 +136,20 @@ void OH_Drawing_PathCubicTo( OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); /** - * @brief 函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段 + * @brief 函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_PathClose(OH_Drawing_Path*); /** - * @brief 函数用于重置自定义路径数据 + * @brief 函数用于重置自定义路径数据。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针 + * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index 84f6bf39..f7e5a05a 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_pen.h * - * @brief 文件中定义了与画笔相关的功能函数 + * @brief 文件中定义了与画笔相关的功能函数。 * * @since 8 * @version 1.0 @@ -44,64 +44,64 @@ extern "C" { #endif /** - * @brief 函数用于创建一个画笔对象 + * @brief 函数用于创建一个画笔对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的画笔对象 + * @return 函数会返回一个指针,指针指向创建的画笔对象。 * @since 8 * @version 1.0 */ OH_Drawing_Pen* OH_Drawing_PenCreate(void); /** - * @brief 函数用于销毁画笔对象并回收该对象占有的内存 + * @brief 函数用于销毁画笔对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_PenDestroy(OH_Drawing_Pen*); /** - * @brief 函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理 + * @brief 函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @return 函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @return 函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。 * @since 8 * @version 1.0 */ bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理 + * @brief 函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @param bool 参数真为抗锯齿,参数假则不做抗锯齿处理 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param bool 参数真为抗锯齿,参数假则不做抗锯齿处理。 * @since 8 * @version 1.0 */ void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen*, bool); /** - * @brief 函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 + * @brief 函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @return 函数返回一个描述颜色的32位(ARGB)变量 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @return 函数返回一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示 + * @brief 函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @param color 参数是一个描述颜色的32位(ARGB)变量 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param color 参数是一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ @@ -111,8 +111,8 @@ void OH_Drawing_PenSetColor(OH_Drawing_Pen*, uint32_t color); * @brief 获取钢笔的透明度值。钢笔勾勒形状时会用到。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 表示指向钢笔对象的指针 - * @return 返回一个8比特的值表示透明度. + * @param OH_Drawing_Pen 表示指向钢笔对象的指针。 + * @return 返回一个8比特的值表示透明度。 * @since 11 * @version 1.0 */ @@ -123,7 +123,7 @@ uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen*); * @brief 设置钢笔的透明度值。钢笔勾勒形状时会用到。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 表示指向钢笔对象的指针 + * @param OH_Drawing_Pen 表示指向钢笔对象的指针。 * @param alpha 表示要设置的透明度值,是一个八比特的变量。 * @since 11 * @version 1.0 @@ -131,51 +131,51 @@ uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen*); void OH_Drawing_PenSetAlpha(OH_Drawing_Pen*, uint8_t alpha); /** - * @brief 函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 + * @brief 函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @return 函数返回画笔的厚度 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @return 函数返回画笔的厚度。 * @since 8 * @version 1.0 */ float OH_Drawing_PenGetWidth(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度 + * @brief 函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @param width 参数是一个描述画笔厚度的变量 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param width 参数是一个描述画笔厚度的变量。 * @since 8 * @version 1.0 */ void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width); /** - * @brief 函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 + * @brief 函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @return 函数返回尖角的限制值 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @return 函数返回尖角的限制值。 * @since 8 * @version 1.0 */ float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen*); /** - * @brief 函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角 + * @brief 函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @param miter 参数是一个描述尖角限制值的变量 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param miter 参数是一个描述尖角限制值的变量。 * @since 8 * @version 1.0 */ void OH_Drawing_PenSetMiterLimit(OH_Drawing_Pen*, float miter); /** - * @brief 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式 + * @brief 枚举集合定义了画笔笔帽的样式,即画笔在绘制线段时,在线段头尾端点的样式。 * * @since 8 * @version 1.0 @@ -190,29 +190,29 @@ typedef enum { } OH_Drawing_PenLineCapStyle; /** - * @brief 函数用于获取画笔笔帽的样式 + * @brief 函数用于获取画笔笔帽的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @return 函数返回画笔笔帽样式 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @return 函数返回画笔笔帽样式。 * @since 8 * @version 1.0 */ OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔笔帽样式 + * @brief 函数用于设置画笔笔帽样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @param OH_Drawing_PenLineCapStyle 参数是一个描述画笔笔帽样式的变量 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_PenLineCapStyle 参数是一个描述画笔笔帽样式的变量。 * @since 8 * @version 1.0 */ void OH_Drawing_PenSetCap(OH_Drawing_Pen*, OH_Drawing_PenLineCapStyle); /** - * @brief 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式 + * @brief 枚举集合定义了线条转角的样式,即画笔在绘制折线段时,在折线转角处的样式。 * * @since 8 * @version 1.0 @@ -227,22 +227,22 @@ typedef enum { } OH_Drawing_PenLineJoinStyle; /** - * @brief 函数用于获取画笔绘制折线转角的样式 + * @brief 函数用于获取画笔绘制折线转角的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @return 函数返回折线转角的样式 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @return 函数返回折线转角的样式。 * @since 8 * @version 1.0 */ OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔绘制转角的样式 + * @brief 函数用于设置画笔绘制转角的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针 - * @param OH_Drawing_PenLineJoinStyle 参数值一个描述折线转角样式的变量 + * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_PenLineJoinStyle 参数值一个描述折线转角样式的变量。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h index e58feb91..8e8c3ca3 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_point.h * - * @brief 文件中定义了与坐标点相关的功能函数 + * @brief 文件中定义了与坐标点相关的功能函数。 * * @since 11 * @version 1.0 @@ -44,22 +44,22 @@ extern "C" { #endif /** - * @brief 函数用于创建一个坐标点对象 + * @brief 函数用于创建一个坐标点对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param x 参数为X轴坐标 - * @param y 参数为Y轴坐标 - * @return 函数会返回一个指针,指针指向创建的坐标点对象 + * @param x 参数为X轴坐标。 + * @param y 参数为Y轴坐标。 + * @return 函数会返回一个指针,指针指向创建的坐标点对象。 * @since 11 * @version 1.0 */ OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y); /** - * @brief 函数用于销毁坐标点对象并回收该对象占有的内存 + * @brief 函数用于销毁坐标点对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针 + * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h index b77547cb..8ab0a76b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_rect.h * - * @brief 文件中定义了与矩形相关的功能函数 + * @brief 文件中定义了与矩形相关的功能函数。 * * @since 11 * @version 1.0 @@ -44,24 +44,24 @@ extern "C" { #endif /** - * @brief 函数用于创建一个矩形对象 + * @brief 函数用于创建一个矩形对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param left 参数为矩形左上角的横坐标 - * @param top 参数为矩形左上角的纵坐标 - * @param right 参数为矩形右下角的横坐标 - * @param bottom 参数为矩形右下角的纵坐标 - * @return 函数会返回一个指针,指针指向创建的矩形对象 + * @param left 参数为矩形左上角的横坐标。 + * @param top 参数为矩形左上角的纵坐标。 + * @param right 参数为矩形右下角的横坐标。 + * @param bottom 参数为矩形右下角的纵坐标。 + * @return 函数会返回一个指针,指针指向创建的矩形对象。 * @since 11 * @version 1.0 */ OH_Drawing_Rect* OH_Drawing_RectCreate(float left, float top, float right, float bottom); /** - * @brief 函数用于销毁矩形对象并回收该对象占有的内存 + * @brief 函数用于销毁矩形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h index 35dfc9f8..89e2bf1c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_round_rect.h * - * @brief 文件中定义了与圆角矩形相关的功能函数 + * @brief 文件中定义了与圆角矩形相关的功能函数。 * * @since 11 * @version 1.0 @@ -44,23 +44,23 @@ extern "C" { #endif /** - * @brief 函数用于创建一个圆角矩形对象 + * @brief 函数用于创建一个圆角矩形对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针 - * @param xRad 参数为X轴上的圆角半径 - * @param yRad 参数为Y轴上的圆角半径 - * @return 函数会返回一个指针,指针指向创建的圆角矩形对象 + * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 + * @param xRad 参数为X轴上的圆角半径。 + * @param yRad 参数为Y轴上的圆角半径。 + * @return 函数会返回一个指针,指针指向创建的圆角矩形对象。 * @since 11 * @version 1.0 */ OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate(const OH_Drawing_Rect*, float xRad, float yRad); /** - * @brief 函数用于销毁圆角矩形对象并回收该对象占有的内存 + * @brief 函数用于销毁圆角矩形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针 + * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h index b6969568..10f76d9d 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -72,8 +72,8 @@ typedef enum { * @brief 创建着色器,在两个指定点之间生成线性渐变。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param startPt 表示渐变的起点 - * @param endPt 表示渐变的终点 + * @param startPt 表示渐变的起点。 + * @param endPt 表示渐变的终点。 * @param colors 表示示两点之间分布的颜色。 * @param pos 表示每种对应颜色在颜色数组中的相对位置。 * @param size 表示颜色和位置的数量。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index 7c410e77..bd3ae9e0 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -44,17 +44,17 @@ extern "C" { #endif /** - * @brief 函数用于创建一个文本构造器对象 + * @brief 函数用于创建一个文本构造器对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的文本构造器对象 + * @return 函数会返回一个指针,指针指向创建的文本构造器对象。 * @since 11 * @version 1.0 */ OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void); /** - * @brief 结构体用于描述一块内存,描述文字和位置信息 + * @brief 结构体用于描述一块内存,描述文字和位置信息。 * * @since 11 * @version 1.0 @@ -71,13 +71,13 @@ typedef struct { } OH_Drawing_RunBuffer; /** - * @brief 函数用于申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理,当调用OH_Drawing_TextBlobBuilderMake后禁止使用 + * @brief 函数用于申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理,当调用OH_Drawing_TextBlobBuilderMake后禁止使用。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针 - * @param OH_Drawing_Font 参数为一个指向字体对象的指针 - * @param count 参数为文字的数量 - * @param OH_Drawing_Rect 参数为文本的边界框 + * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 + * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param count 参数为文字的数量。 + * @param OH_Drawing_Rect 参数为文本的边界框。 * @since 11 * @version 1.0 */ @@ -85,31 +85,31 @@ const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos(OH_Drawing_Tex int32_t count, const OH_Drawing_Rect*); /** - * @brief 函数用于从文本构造器中创建文本对象 + * @brief 函数用于从文本构造器中创建文本对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针 - * @return 函数会返回一个指针,指针指向创建的文本对象 + * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 + * @return 函数会返回一个指针,指针指向创建的文本对象。 * @since 11 * @version 1.0 */ OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder*); /** - * @brief 函数用于销毁文本对象并回收该对象占有的内存 + * @brief 函数用于销毁文本对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针 + * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针。 * @since 11 * @version 1.0 */ void OH_Drawing_TextBlobDestroy(OH_Drawing_TextBlob*); /** - * @brief 函数用于销毁文本构造器对象并回收该对象占有的内存 + * @brief 函数用于销毁文本构造器对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针 + * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index 64bcbfba..865538ef 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供2D绘制功能 + * @brief 提供2D绘制功能。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_text_declaration.h * - * @brief 提供2d drawing文本相关的数据结构声明 + * @brief 提供2d drawing文本相关的数据结构声明。 * * @since 8 * @version 1.0 @@ -42,7 +42,7 @@ extern "C" { #endif /** - * @brief OH_Drawing_FontCollection用于加载字体 + * @brief OH_Drawing_FontCollection用于加载字体。 * * @since 8 * @version 1.0 @@ -50,7 +50,7 @@ extern "C" { typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection; /** - * @brief OH_Drawing_Typography用于管理排版的布局和显示等 + * @brief OH_Drawing_Typography用于管理排版的布局和显示等。 * * @since 8 * @version 1.0 @@ -58,7 +58,7 @@ typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection; typedef struct OH_Drawing_Typography OH_Drawing_Typography; /** - * @brief OH_Drawing_TextStyle用于管理字体颜色、装饰等 + * @brief OH_Drawing_TextStyle用于管理字体颜色、装饰等。 * * @since 8 * @version 1.0 @@ -66,7 +66,7 @@ typedef struct OH_Drawing_Typography OH_Drawing_Typography; typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle; /** - * @brief OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等 + * @brief OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等。 * * @since 8 * @version 1.0 @@ -74,7 +74,7 @@ typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle; typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle; /** - * @brief OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography + * @brief OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography。 * * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 11bac156..c52bae8b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供2D绘制功能 + * @brief 提供2D绘制功能。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_text_typography.h * - * @brief 定义绘制模块中排版相关的函数 + * @brief 定义绘制模块中排版相关的函数。 * * @since 8 * @version 1.0 @@ -148,162 +148,162 @@ enum OH_Drawing_FontStyle { }; /** - * @brief 创建OH_Drawing_TypographyStyle + * @brief 创建OH_Drawing_TypographyStyle。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 指向创建的OH_Drawing_TypographyStyle对象的指针 + * @return 指向创建的OH_Drawing_TypographyStyle对象的指针。 * @since 8 * @version 1.0 */ OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle(void); /** - * @brief 释放被OH_Drawing_TypographyStyle对象占据的内存 + * @brief 释放被OH_Drawing_TypographyStyle对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_DestroyTypographyStyle(OH_Drawing_TypographyStyle*); /** - * @brief 设置文本方向 + * @brief 设置文本方向。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 - * @param int OH_Drawing_TextDirection枚举类型 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针。 + * @param int OH_Drawing_TextDirection枚举类型。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle*, int /* OH_Drawing_TextDirection */); /** - * @brief 设置文本对齐方式 + * @brief 设置文本对齐方式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 - * @param int OH_Drawing_TextAlign枚举类型 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针。 + * @param int OH_Drawing_TextAlign枚举类型。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Drawing_TextAlign */); /** - * @brief 设置文本最大行数 + * @brief 设置文本最大行数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 - * @param int 最大行数 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针。 + * @param int 最大行数。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle*, int /* maxLines */); /** - * @brief 创建OH_Drawing_TextStyle + * @brief 创建OH_Drawing_TextStyle。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 指向创建的OH_Drawing_TextStyle对象的指针 + * @return 指向创建的OH_Drawing_TextStyle对象的指针。 * @since 8 * @version 1.0 */ OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); /** - * @brief 释放被OH_Drawing_TextStyle对象占据的内存 + * @brief 释放被OH_Drawing_TextStyle对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_DestroyTextStyle(OH_Drawing_TextStyle*); /** - * @brief 设置文本颜色 + * @brief 设置文本颜色。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param uint32_t 颜色 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param uint32_t 颜色。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleColor(OH_Drawing_TextStyle*, uint32_t /* color */); /** - * @brief 设置字号 + * @brief 设置字号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param double 字号 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param double 字号。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleFontSize(OH_Drawing_TextStyle*, double /* fontSize */); /** - * @brief 设置字重 + * @brief 设置字重。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param int OH_Drawing_FontWeight枚举类型 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param int OH_Drawing_FontWeight枚举类型。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleFontWeight(OH_Drawing_TextStyle*, int /* OH_Drawing_FontWeight */); /** - * @brief 设置字体基线位置 + * @brief 设置字体基线位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param int OH_Drawing_TextBaseline枚举类型 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param int OH_Drawing_TextBaseline枚举类型。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleBaseLine(OH_Drawing_TextStyle*, int /* OH_Drawing_TextBaseline */); /** - * @brief 设置装饰 + * @brief 设置装饰。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param int OH_Drawing_TextDecoration枚举类型 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param int OH_Drawing_TextDecoration枚举类型。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleDecoration(OH_Drawing_TextStyle*, int /* OH_Drawing_TextDecoration */); /** - * @brief 设置装饰颜色 + * @brief 设置装饰颜色。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param uint32_t 颜色 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param uint32_t 颜色。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleDecorationColor(OH_Drawing_TextStyle*, uint32_t /* color */); /** - * @brief 设置字体高度 + * @brief 设置字体高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param double 字体高度 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param double 字体高度。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleFontHeight(OH_Drawing_TextStyle*, double /* fontHeight */); /** - * @brief 设置字体类型 + * @brief 设置字体类型。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param int 字体名称数量 - * @param char 指向字体类型的指针 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param int 字体名称数量。 + * @param char 指向字体类型的指针。 * @since 8 * @version 1.0 */ @@ -311,34 +311,34 @@ void OH_Drawing_SetTextStyleFontFamilies(OH_Drawing_TextStyle*, int /* fontFamiliesNumber */, const char* fontFamilies[]); /** - * @brief 设置字体风格 + * @brief 设置字体风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param int OH_Drawing_FontStyle枚举类型 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param int OH_Drawing_FontStyle枚举类型。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_FontStyle */); /** - * @brief 设置语言区域 + * @brief 设置语言区域。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param char 语言区域,数据类型为指向char的指针 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param char 语言区域,数据类型为指向char的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); /** - * @brief 创建指向OH_Drawing_TypographyCreate对象的指针 + * @brief 创建指向OH_Drawing_TypographyCreate对象的指针。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针 - * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection的指针 - * @return 指向新创建的OH_Drawing_TypographyCreate对象的指针 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针。 + * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection的指针。 + * @return 指向新创建的OH_Drawing_TypographyCreate对象的指针。 * @since 8 * @version 1.0 */ @@ -346,73 +346,73 @@ OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler(OH_Drawing_Typog OH_Drawing_FontCollection*); /** - * @brief 释放被OH_Drawing_TypographyCreate对象占据的内存 + * @brief 释放被OH_Drawing_TypographyCreate对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_DestroyTypographyHandler(OH_Drawing_TypographyCreate*); /** - * @brief 设置排版风格 + * @brief 设置排版风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针 - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_TypographyHandlerPushTextStyle(OH_Drawing_TypographyCreate*, OH_Drawing_TextStyle*); /** - * @brief 设置文本内容 + * @brief 设置文本内容。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针 - * @param char 指向文本内容的指针 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 + * @param char 指向文本内容的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_TypographyHandlerAddText(OH_Drawing_TypographyCreate*, const char*); /** - * @brief 排版弹出 + * @brief 排版弹出。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate*); /** - * @brief 创建OH_Drawing_Typography + * @brief 创建OH_Drawing_Typography。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针 - * @return 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 + * @return 指向OH_Drawing_Typography对象的指针。 * @since 8 * @version 1.0 */ OH_Drawing_Typography* OH_Drawing_CreateTypography(OH_Drawing_TypographyCreate*); /** - * @brief 释放OH_Drawing_Typography对象占据的内存 + * @brief 释放OH_Drawing_Typography对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_DestroyTypography(OH_Drawing_Typography*); /** - * @brief 排版布局 + * @brief 排版布局。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 * @param double 文本最大宽度 * @since 8 * @version 1.0 @@ -420,13 +420,13 @@ void OH_Drawing_DestroyTypography(OH_Drawing_Typography*); void OH_Drawing_TypographyLayout(OH_Drawing_Typography*, double /* maxWidth */); /** - * @brief 显示文本 + * @brief 显示文本。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @param OH_Drawing_Canvas 指向OH_Drawing_Canvas对象的指针 - * @param double x坐标 - * @param double y坐标 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Canvas 指向OH_Drawing_Canvas对象的指针。 + * @param double x坐标。 + * @param double y坐标。 * @since 8 * @version 1.0 */ @@ -434,77 +434,77 @@ void OH_Drawing_TypographyPaint(OH_Drawing_Typography*, OH_Drawing_Canvas*, double /* potisionX */, double /* potisionY */); /** - * @brief 获取最大宽度 + * @brief 获取最大宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @return 返回最大宽度 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @return 返回最大宽度。 * @since 9 * @version 1.1 */ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); /** - * @brief 获取高度 + * @brief 获取高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @return 返回高度 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @return 返回高度。 * @since 9 * @version 1.1 */ double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); /** - * @brief 获取最长行 + * @brief 获取最长行。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @return 返回最长行 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @return 返回最长行。 * @since 9 * @version 1.1 */ double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography*); /** - * @brief 获取最小固有宽度 + * @brief 获取最小固有宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @return 返回最小固有宽度 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @return 返回最小固有宽度。 * @since 9 * @version 1.1 */ double OH_Drawing_TypographyGetMinIntrinsicWidth(OH_Drawing_Typography*); /** - * @brief 获取最大固有宽度 + * @brief 获取最大固有宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @return 返回最大固有宽度 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @return 返回最大固有宽度。 * @since 9 * @version 1.1 */ double OH_Drawing_TypographyGetMaxIntrinsicWidth(OH_Drawing_Typography*); /** - * @brief 获取字母文字基线 + * @brief 获取字母文字基线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @return 返回字母文字基线 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @return 返回字母文字基线。 * @since 9 * @version 1.1 */ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); /** - * @brief 获取表意文字基线 + * @brief 获取表意文字基线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @return 返回表意文字基线 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @return 返回表意文字基线。 * @since 9 * @version 1.1 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h index f22656c9..b1920969 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_typeface.h * - * @brief 文件中定义了与字形相关的功能函数 + * @brief 文件中定义了与字形相关的功能函数。 * * @since 11 * @version 1.0 @@ -44,20 +44,20 @@ extern "C" { #endif /** - * @brief 函数用于创建一个默认的字形对象 + * @brief 函数用于创建一个默认的字形对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的字形对象 + * @return 函数会返回一个指针,指针指向创建的字形对象。 * @since 11 * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); /** - * @brief 函数用于销毁字形对象并回收该对象占有的内存 + * @brief 函数用于销毁字形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针 + * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index 9b62e3d4..f8b2c725 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_types.h * - * @brief 文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径 + * @brief 文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径。 * * @since 8 * @version 1.0 @@ -44,7 +44,7 @@ extern "C" { #endif /** - * @brief OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字 + * @brief OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 * * @since 8 * @version 1.0 @@ -52,7 +52,7 @@ extern "C" { typedef struct OH_Drawing_Canvas OH_Drawing_Canvas; /** - * @brief OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色 + * @brief OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 * * @since 8 * @version 1.0 @@ -60,7 +60,7 @@ typedef struct OH_Drawing_Canvas OH_Drawing_Canvas; typedef struct OH_Drawing_Pen OH_Drawing_Pen; /** - * @brief OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色 + * @brief OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色。 * * @since 8 * @version 1.0 @@ -68,7 +68,7 @@ typedef struct OH_Drawing_Pen OH_Drawing_Pen; typedef struct OH_Drawing_Brush OH_Drawing_Brush; /** - * @brief OH_Drawing_Path定义为路径,路径用于自定义各种形状 + * @brief OH_Drawing_Path定义为路径,路径用于自定义各种形状。 * * @since 8 * @version 1.0 @@ -76,7 +76,7 @@ typedef struct OH_Drawing_Brush OH_Drawing_Brush; typedef struct OH_Drawing_Path OH_Drawing_Path; /** - * @brief OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据 + * @brief OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 * * @since 8 * @version 1.0 @@ -181,7 +181,7 @@ typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob; typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder; /** - * @brief OH_Drawing_ColorFormat用于描述位图像素的存储格式 + * @brief OH_Drawing_ColorFormat用于描述位图像素的存储格式。 * * @since 8 * @version 1.0 @@ -202,7 +202,7 @@ typedef enum { } OH_Drawing_ColorFormat; /** - * @brief OH_Drawing_AlphaFormat用于描述位图像素的透明度分量 + * @brief OH_Drawing_AlphaFormat用于描述位图像素的透明度分量。 * * @since 8 * @version 1.0 -- Gitee From 68833e01b3549e5f1bb109a0d35dd73f4bcdf03c Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 2 Jan 2024 06:54:42 +0000 Subject: [PATCH 0193/2135] update zh-cn/native_sdk/net_websocket/net_websocket_type.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net_websocket/net_websocket_type.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h index 9a5b6f14..224d5c80 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket_type.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -178,6 +178,12 @@ struct WebSocket { WebSocket_RequestOptions requestOptions; }; +/** + * @brief websocket错误码 + * + * @since 11 + * @version 1.0 + */ typedef enum WebSocket_ErrCode { /** * 执行成功 -- Gitee From 70776b8377db21c0f471c54c5cfe5f892f5e1f9f Mon Sep 17 00:00:00 2001 From: sqwlly Date: Wed, 3 Jan 2024 17:15:25 +0800 Subject: [PATCH 0194/2135] add filt comment Signed-off-by: s30029175 Signed-off-by: sqwlly --- zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_color.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_font.h | 2 ++ .../native_sdk/graphic/native_drawing/drawing_font_collection.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_path.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_point.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h | 2 ++ .../graphic/native_drawing/drawing_text_declaration.h | 2 ++ .../native_sdk/graphic/native_drawing/drawing_text_typography.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h | 2 ++ zh-cn/native_sdk/graphic/native_drawing/drawing_types.h | 2 ++ 21 files changed, 42 insertions(+) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index c1344b2a..3bda1047 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与位图相关的功能函数 * + * 引用文件"native_drawing/drawing_bitmap.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index 75de059b..04be40a7 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与画刷相关的功能函数。 * + * 引用文件"native_drawing/drawing_brush.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index a5f2759f..5db67eb8 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与画布相关的功能函数 * + * 引用文件"native_drawing/drawing_canvas.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h index 6b2cd1e8..91f91048 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与颜色相关的功能函数。 * + * 引用文件"native_drawing/drawing_color.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h index f1f42e8d..cc924edf 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h @@ -33,6 +33,8 @@ * * @brief 声明与绘图模块中的颜色滤波器对象相关的函数。 * + * 引用文件"native_drawing/drawing_color_filter.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h index 1c50410f..08a5960c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h @@ -33,6 +33,8 @@ * * @brief 声明与绘图模块中的滤波器对象相关的函数。 * + * 引用文件"native_drawing/drawing_filter.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index 75c610b9..55bc15ea 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与字体相关的功能函数。 * + * 引用文件"native_drawing/drawing_font.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 4f51b829..a234365e 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -33,6 +33,8 @@ * * @brief 定义绘制模块中与fontCollection相关的函数。 * + * 引用文件"native_drawing/drawing_font_collection.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h index bd5d1219..b7ec5b34 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -33,6 +33,8 @@ * * @brief 声明与绘图模块中的对象相关的函数。 * + * 引用文件"native_drawing/drawing_mask_filter.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index 0aded20c..a3cf7e2a 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与矩阵相关的功能函数。 * + * 引用文件"native_drawing/drawing_matrix.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h index 6c17384a..ccb30031 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与自定义路径相关的功能函数 * + * 引用文件"native_drawing/drawing_path.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index f7e5a05a..5967ac8b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与画笔相关的功能函数。 * + * 引用文件"native_drawing/drawing_pen.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h index 8e8c3ca3..2d21c967 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与坐标点相关的功能函数。 * + * 引用文件"native_drawing/drawing_point.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h index 8ab0a76b..e621b935 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与矩形相关的功能函数。 * + * 引用文件"native_drawing/drawing_rect.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h index 89e2bf1c..63102d96 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与圆角矩形相关的功能函数。 * + * 引用文件"native_drawing/drawing_round_rect.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h index 10f76d9d..38391539 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -33,6 +33,8 @@ * * @brief 声明与绘图模块中的着色器对象相关的函数。 * + * 引用文件"native_drawing/drawing_shader_effect.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index bd3ae9e0..5ed402b1 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与文字相关的功能函数 * + * 引用文件"native_drawing/drawing_text_blob.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index 865538ef..b713c3d9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -33,6 +33,8 @@ * * @brief 提供2d drawing文本相关的数据结构声明。 * + * 引用文件"native_drawing/drawing_text_declaration.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index c52bae8b..150afbf4 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -33,6 +33,8 @@ * * @brief 定义绘制模块中排版相关的函数。 * + * 引用文件"native_drawing/drawing_text_typography.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h index b1920969..88eb7648 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了与字形相关的功能函数。 * + * 引用文件"native_drawing/drawing_typeface.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index f8b2c725..81ec549e 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -33,6 +33,8 @@ * * @brief 文件中定义了用于绘制2d图形的数据类型,包括画布、画笔、画刷、位图和路径。 * + * 引用文件"native_drawing/drawing_types.h" + * @library libnative_drawing.so * @since 8 * @version 1.0 */ -- Gitee From 871c24bf9dcbbf917c8cf969c00b8e4799b47fdf Mon Sep 17 00:00:00 2001 From: sqwlly Date: Wed, 3 Jan 2024 17:36:34 +0800 Subject: [PATCH 0195/2135] add dot Signed-off-by: s30029175 Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_bitmap.h | 32 +++++++++---------- .../graphic/native_drawing/drawing_canvas.h | 4 +-- .../graphic/native_drawing/drawing_color.h | 2 +- .../native_drawing/drawing_font_collection.h | 2 +- .../native_drawing/drawing_text_blob.h | 4 +-- .../native_drawing/drawing_text_typography.h | 3 +- 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index 3bda1047..e0379bd3 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -62,7 +62,7 @@ typedef struct { * @brief 函数用于创建一个位图对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的位图对象 + * @return 函数会返回一个指针,指针指向创建的位图对象。 * @since 8 * @version 1.0 */ @@ -72,20 +72,20 @@ OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void); * @brief 函数用于销毁位图对象并回收该对象占有内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针 + * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); /** - * @brief 函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式 + * @brief 函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针 - * @param width 参数是位图要初始化设置的宽度 - * @param height 参数是位图要初始化设置的高度 - * @param OH_Drawing_BitmapFormat 参数是位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型 + * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @param width 参数是位图要初始化设置的宽度。 + * @param height 参数是位图要初始化设置的高度。 + * @param OH_Drawing_BitmapFormat 参数是位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 * @since 8 * @version 1.0 */ @@ -93,33 +93,33 @@ void OH_Drawing_BitmapBuild( OH_Drawing_Bitmap*, const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat*); /** - * @brief 该函数用于获取指定位图的宽度 + * @brief 该函数用于获取指定位图的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针 - * @return 函数返回位图的宽度 + * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @return 函数返回位图的宽度。 * @since 8 * @version 1.0 */ uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_Bitmap*); /** - * @brief 函数用于获取指定位图的高度 + * @brief 函数用于获取指定位图的高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针 - * @return 函数返回位图的高度 + * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @return 函数返回位图的高度。 * @since 8 * @version 1.0 */ uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_Bitmap*); /** - * @brief 函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据 + * @brief 函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针 - * @return 函数返回位图的像素地址 + * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @return 函数返回位图的像素地址。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index 5db67eb8..32140ae4 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_canvas.h * - * @brief 文件中定义了与画布相关的功能函数 + * @brief 文件中定义了与画布相关的功能函数。 * * 引用文件"native_drawing/drawing_canvas.h" * @library libnative_drawing.so diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h index 91f91048..5a15f049 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h @@ -53,7 +53,7 @@ extern "C" { * @param red 参数为一个描述红色的变量, 变量范围是0x00~0xFF。 * @param green 参数为一个描述绿色的变量, 变量范围是0x00~0xFF。 * @param blue 参数为一个描述蓝色的变量, 变量范围是0x00~0xFF。 - * @return 函数返回一个描述颜色的32位(ARGB)变量 + * @return 函数返回一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 7b09dd52..a49014f4 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -31,7 +31,7 @@ /** * @file drawing_font_collection.h * - * @brief 定义绘制模块中与字体集合相关的函数 + * @brief 定义绘制模块中与字体集合相关的函数。 * * 引用文件"native_drawing/drawing_font_collection.h" * @library libnative_drawing.so diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index 5ed402b1..285e566b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,7 +31,7 @@ /** * @file drawing_text_blob.h * - * @brief 文件中定义了与文字相关的功能函数 + * @brief 文件中定义了与文字相关的功能函数。 * * 引用文件"native_drawing/drawing_text_blob.h" * @library libnative_drawing.so diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 150afbf4..ad46fa78 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -71,8 +71,7 @@ enum OH_Drawing_TextAlign { /** 居中对齐 */ TEXT_ALIGN_CENTER, /** - * 两端对齐,即紧靠左和右边缘,中间单词空隙由空格填充 - * 最后一行除外 + * 两端对齐,即紧靠左和右边缘,中间单词空隙由空格填充,最后一行除外。 */ TEXT_ALIGN_JUSTIFY, /** -- Gitee From 535f459ce800f0c1fe53a652fc1efd889bcaa63c Mon Sep 17 00:00:00 2001 From: guoxing Date: Thu, 28 Dec 2023 02:06:02 +0000 Subject: [PATCH 0196/2135] encode Signed-off-by: guoxing --- .../native_drawing/drawing_text_declaration.h | 24 + .../native_drawing/drawing_text_typography.h | 497 ++++++++++++++++++ 2 files changed, 521 insertions(+) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index 64bcbfba..a002ef1d 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -81,6 +81,30 @@ typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle; */ typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate; +/** + * @brief 用于接收文本框的矩形大小、方向和数量大小 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_TextBox OH_Drawing_TextBox; + +/** + * @brief 用于接收字体的位置和亲和性 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity; + +/** + * @brief 用于接收字体的起始位置和结束位置 + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Range OH_Drawing_Range; + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 11bac156..30087828 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -147,6 +147,144 @@ enum OH_Drawing_FontStyle { FONT_STYLE_ITALIC, }; +/** + * @brief 占位符垂直对齐枚举 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 偏移于基线对齐 */ + ALIGNMENT_OFFSET_AT_BASELINE, + /** 高于基线对齐 */ + ALIGNMENT_ABOVE_BASELINE, + /** 低于基线对齐 */ + ALIGNMENT_BELOW_BASELINE, + /** 行框顶部对齐 */ + ALIGNMENT_TOP_OF_ROW_BOX, + /** 行框底部对齐 */ + ALIGNMENT_BOTTOM_OF_ROW_BOX, + /** 行框中心对齐 */ + ALIGNMENT_CENTER_OF_ROW_BOX, +} OH_Drawing_PlaceholderVerticalAlignment; + +/** + * @brief 用于描述位占位符跨度的结构体 + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** 占位符宽度 */ + double width; + /** 占位符高度 */ + double height; + /** 占位符对齐方式 */ + OH_Drawing_PlaceholderVerticalAlignment alignment; + /** 占位符基线 */ + OH_Drawing_TextBaseline baseline; + /** 占位符基线偏移 */ + double baselineOffset; +} OH_Drawing_PlaceholderSpan; + +/** + * @brief 文本装饰样式枚举 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 实心样式 */ + TEXT_DECORATION_STYLE_SOLID, + /** 双重样式 */ + TEXT_DECORATION_STYLE_DOUBLE, + /** 圆点样式 */ + TEXT_DECORATION_STYLE_DOTTED, + /** 虚线样式 */ + TEXT_DECORATION_STYLE_DASHED, + /** 波浪样式 */ + TEXT_DECORATION_STYLE_WAVY, +} OH_Drawing_TextDecorationStyle; + +/** + * @brief 省略号样式枚举 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 头部模式,即省略号放在文本头部 */ + ELLIPSIS_MODAL_HEAD = 0, + /** 中部模式,即省略号放在文本中部 */ + ELLIPSIS_MODAL_MIDDLE = 1, + /** 尾部模式,即省略号放在文本尾部 */ + ELLIPSIS_MODAL_TAIL = 2, +} OH_Drawing_EllipsisModal; + +/** + * @brief 文本的中断策略枚举 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 贪心策略,换行时尽可能填满每一行 */ + BREAK_STRATEGY_GREEDY = 0, + /** 高质量策略,换行时优先考虑文本的连续性 */ + BREAK_STRATEGY_HIGH_QUALITY = 1, + /** 平衡策略,换行时在单词边界换行 */ + BREAK_STRATEGY_BALANCED = 2, +} OH_Drawing_BreakStrategy; + +/** + * @brief 单词的断词方式枚举 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 常规方式 */ + WORD_BREAK_TYPE_NORMAL = 0, + /** 全部中断方式 */ + WORD_BREAK_TYPE_BREAK_ALL = 1, + /** 单词中断方式 */ + WORD_BREAK_TYPE_BREAK_WORD = 2, +} OH_Drawing_WordBreakType; + +/** + * @brief 矩形框高度样式枚举 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 紧密样式 */ + RECT_HEIGHT_STYLE_TIGHT, + /** 最大样式 */ + RECT_HEIGHT_STYLE_MAX, + /** 包含行间距中间样式 */ + RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, + /** 包含行间距顶部样式 */ + RECT_HEIGHT_STYLE_INCLUDELINESPACETOP, + /** 包含行间距底部样式 */ + RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, + /** 结构样式 */ + RECT_HEIGHT_STYLE_STRUCT, +} OH_Drawing_RectHeightStyle; + +/** + * @brief 矩形框宽度样式枚举 + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** 紧密样式 */ + RECT_WIDTH_STYLE_TIGHT, + /** 最大样式 */ + RECT_WIDTH_STYLE_MAX, +} OH_Drawing_RectWidthStyle; + /** * @brief 创建OH_Drawing_TypographyStyle * @@ -510,6 +648,365 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); */ double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); +/** + * @brief 设置占位符 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针 + * @param OH_Drawing_PlaceholderSpan 指向OH_Drawing_PlaceholderSpan对象的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH_Drawing_PlaceholderSpan*); + +/** + * @brief 获取文本是否超过最大行 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @return 返回文本是否超过最大行,true表示超过,false表示未超过 + * @since 11 + * @version 1.0 + */ +bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); + +/** + * @brief 获取指定范围内的文本框 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param size_t 设置开始位置 + * @param size_t 设置结束位置 + * @param OH_Drawing_RectHeightStyle 设置高度样式,支持可选的高度样式具体可见{@Link OH_Drawing_RectHeightStyle}枚举 + * @param OH_Drawing_RectWidthStyle 设置宽度样式,支持可选的宽度样式具体可见{@Link OH_Drawing_RectWidthStyle}枚举 + * @return 返回指定范围内的文本框,具体可见{@Link OH_Drawing_TextBox}结构体 + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography*, + size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle); + +/** + * @brief 获取占位符的文本框 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @return 返回占位符的文本框,返回类型为{@Link OH_Drawing_TextBox}结构体 + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*); + +/** + * @brief 获取文本框左侧位置 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 + * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param int 文本框的索引 + * @return 返回文本框左侧位置 + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief 获取文本框右侧位置 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 + * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param int 文本框的索引 + * @return 返回文本框右侧位置 + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief 获取文本框顶部位置 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 + * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param int 文本框的索引 + * @return 返回文本框顶部位置 + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief 获取文本框底部位置 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 + * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param int 文本框的索引 + * @return 返回文本框底部位置 + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief 获取文本框方向 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 + * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param int 文本框的索引 + * @return 返回文本框方向 + * @since 11 + * @version 1.0 + */ +int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief 获取文本框数量大小 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 + * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @return 返回文本框数量大小 + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*); + +/** + * @brief 获取坐标处文本的索引位置和亲和性 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param double 光标的x坐标 + * @param double 光标的y坐标 + * @return 返回坐标处字体的索引位置和亲和性,返回类型为{@Link OH_Drawing_PositionAndAffinity}结构体 + * @since 11 + * @version 1.0 + */ +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*, + double, double); + +/** + * @brief 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param double 光标的x坐标 + * @param double 光标的y坐标 + * @return 返回坐标处指定类型字体的索引位置和亲和性,返回类型为{@Link OH_Drawing_PositionAndAffinity}结构体 + * @since 11 + * @version 1.0 + */ +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*, + double, double); + +/** + * @brief 获取OH_Drawing_PositionAndAffinity对象的位置属性 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PositionAndAffinity 指向OH_Drawing_PositionAndAffinity对象的指针, + * 由{@Link OH_Drawing_TypographyGetGlyphPositionAtCoordinate}或 + * {@Link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取 + * @return 返回OH_Drawing_PositionAndAffinity对象的位置属性 + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); + +/** + * @brief 获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PositionAndAffinity 指向OH_Drawing_PositionAndAffinity对象的指针, + * 由{@Link OH_Drawing_TypographyGetGlyphPositionAtCoordinate}或 + * {@Link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取 + * @return 返回OH_Drawing_PositionAndAffinity对象的亲和性 + * @since 11 + * @version 1.0 + */ +int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); + +/** + * @brief 获取单词的边界 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param size_t 单词索引 + * @return 返回单词边界,返回类型为{@Link OH_Drawing_Range}结构体 + * @since 11 + * @version 1.0 + */ +OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t); + +/** + * @brief 获取OH_Drawing_Range对象开始位置 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@Link OH_Drawing_TypographyGetWordBoundary}获取 + * @return 返回OH_Drawing_Range对象开始位置 + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*); + +/** + * @brief 获取OH_Drawing_Range对象结束位置 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@Link OH_Drawing_TypographyGetWordBoundary}获取 + * @return 返回OH_Drawing_Range对象结束位置 + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*); + +/** + * @brief 获取文本行数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @return 返回行数 + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); + +/** + * @brief 设置文本装饰样式 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param int 设置的文本装饰样式,支持可选的装饰样式具体可见{@Link OH_Drawing_TextDecorationStyle}枚举 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); + +/** + * @brief 设置文本装饰线的厚度缩放比例 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param double 缩放比例 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, double); + +/** + * @brief 设置文本的字符间距 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param double 间距大小 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); + +/** + * @brief 设置文本的单词间距 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param double 间距大小 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); + +/** + * @brief 设置文本为一半行间距 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); + +/** + * @brief 设置文本的省略号内容 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param char* 设置省略号内容,数据类型为指向char的指针 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*); + +/** + * @brief 设置文本的省略号样式 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param int 设置省略号样式,支持可选的省略号样式具体可见{@Link OH_Drawing_EllipsisModal}枚举 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); + +/** + * @brief 设置文本的中断策略 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 + * @param int 设置中断策略,支持可选的中断策略具体可见{@Link OH_Drawing_BreakStrategy}枚举 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int); + +/** + * @brief 设置单词的断词方式 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 + * @param int 设置断词方式,支持可选的断词方式样式具体可见{@Link OH_Drawing_WordBreakType}枚举 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int); + +/** + * @brief 设置文本的省略号样式 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 + * @param int 设置省略号样式,支持可选的省略号样式样式具体可见{@Link OH_Drawing_EllipsisModal}枚举 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); + +/** + * @brief 获取指定行的行高 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param int 要指定的行数 + * @return 返回指定行的行高 + * @since 11 + * @version 1.0 + */ +double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); + +/** + * @brief 获取指定行的行宽 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param int 要指定的行数 + * @return 返回指定行的行宽 + * @since 11 + * @version 1.0 + */ +double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); + #ifdef __cplusplus } #endif -- Gitee From 09b0e67f144dd48b342f71638d200c860769a590 Mon Sep 17 00:00:00 2001 From: sqwlly Date: Thu, 4 Jan 2024 16:57:55 +0800 Subject: [PATCH 0197/2135] code review Signed-off-by: s30029175 Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_brush.h | 16 ++++++++-------- .../native_drawing/drawing_font_collection.h | 2 +- .../graphic/native_drawing/drawing_pen.h | 10 +++++----- .../native_drawing/drawing_text_declaration.h | 10 +++++----- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index 04be40a7..3eaac842 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -110,29 +110,29 @@ uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*); void OH_Drawing_BrushSetColor(OH_Drawing_Brush*, uint32_t color); /** - * @brief 获取笔刷的透明度值。画笔使用透明度值填充形状。 + * @brief 获取画刷的透明度值。画刷在填充形状时透明通道会使用该值。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush OH_Drawing_Brush表示指向画笔对象的指针。 - * @return 返回一个8位变量,用于表示透明度。 + * @param OH_Drawing_Brush 表示指向画刷对象的指针。 + * @return 返回一个8位变量,用于表示透明度值。 * @since 11 * @version 1.0 */ uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush*); /** - * @brief 为画笔设置透明度。画笔在填充形状时将使用透明度值。 + * @brief 为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 - * @param alpha 表示要设置的字母,是一个8位变量。 + * @param alpha 表示要设置的透明度值,是一个8位变量。 * @since 11 * @version 1.0 */ void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha); /** - * @brief 为笔刷设置着色器效果。 + * @brief 为画刷设置着色器效果。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 @@ -143,11 +143,11 @@ void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha); void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*); /** - * @brief 为笔刷设置滤波器。 + * @brief 为画刷设置滤波器{@link OH_Drawing_Filter}。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 - * @param OH_Drawing_Filter OH_Drawing_Filter表示指向滤波器对象的指针。 + * @param OH_Drawing_Filter 表示指向滤波器对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index a49014f4..436a2d25 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -45,7 +45,7 @@ extern "C" { #endif /** - * @brief 创建OH_Drawing_FontCollection。 + * @brief 创建OH_Drawing_FontCollection{@link OH_Drawing_FontCollection}。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 指向创建的OH_Drawing_FontCollection对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index 5967ac8b..2a9a5722 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -110,10 +110,10 @@ uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen*); void OH_Drawing_PenSetColor(OH_Drawing_Pen*, uint32_t color); /** - * @brief 获取钢笔的透明度值。钢笔勾勒形状时会用到。 + * @brief 获取画笔的透明度值。画笔在勾勒图形时透明通道会使用该值。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 表示指向钢笔对象的指针。 + * @param OH_Drawing_Pen 表示指向画笔对象的指针。 * @return 返回一个8比特的值表示透明度。 * @since 11 * @version 1.0 @@ -122,11 +122,11 @@ uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen*); /** - * @brief 设置钢笔的透明度值。钢笔勾勒形状时会用到。 + * @brief 为画笔设置透明度值。画笔在勾勒图形时透明通道会使用该值。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 表示指向钢笔对象的指针。 - * @param alpha 表示要设置的透明度值,是一个八比特的变量。 + * @param OH_Drawing_Pen 表示指向画笔对象的指针。 + * @param alpha 表示要设置的透明度值,是一个8比特的变量。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index 77096732..bae51c68 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -44,7 +44,7 @@ extern "C" { #endif /** - * @brief OH_Drawing_FontCollection用于加载字体。 + * @brief 用于加载字体。 * * @since 8 * @version 1.0 @@ -52,7 +52,7 @@ extern "C" { typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection; /** - * @brief OH_Drawing_Typography用于管理排版的布局和显示等。 + * @brief 用于管理排版的布局和显示等。 * * @since 8 * @version 1.0 @@ -60,7 +60,7 @@ typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection; typedef struct OH_Drawing_Typography OH_Drawing_Typography; /** - * @brief OH_Drawing_TextStyle用于管理字体颜色、装饰等。 + * @brief 用于管理字体颜色、装饰等。 * * @since 8 * @version 1.0 @@ -68,7 +68,7 @@ typedef struct OH_Drawing_Typography OH_Drawing_Typography; typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle; /** - * @brief OH_Drawing_TypographyStyle用于管理排版风格,如文字方向等。 + * @brief 用于管理排版风格,如文字方向等。 * * @since 8 * @version 1.0 @@ -76,7 +76,7 @@ typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle; typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle; /** - * @brief OH_Drawing_TypographyCreate用于创建OH_Drawing_Typography。 + * @brief 用于创建OH_Drawing_Typography{@link OH_Drawing_Typography}。 * * @since 8 * @version 1.0 -- Gitee From 8939b04d953029b969426ef504da76d69579c4e6 Mon Sep 17 00:00:00 2001 From: sqwlly Date: Fri, 5 Jan 2024 10:06:35 +0800 Subject: [PATCH 0198/2135] blend mode Signed-off-by: s30029175 Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_filter.h | 2 +- .../graphic/native_drawing/drawing_point.h | 4 +- .../graphic/native_drawing/drawing_rect.h | 4 +- .../native_drawing/drawing_round_rect.h | 4 +- .../native_drawing/drawing_shader_effect.h | 21 +++-- .../native_drawing/drawing_text_blob.h | 10 +- .../graphic/native_drawing/drawing_typeface.h | 7 +- .../graphic/native_drawing/drawing_types.h | 94 +++++++++---------- 8 files changed, 74 insertions(+), 72 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h index 08a5960c..bd799333 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h @@ -56,7 +56,7 @@ extern "C" { OH_Drawing_Filter* OH_Drawing_FilterCreate(void); /** - * @brief 为滤波器对象设置模板滤波器对象。 + * @brief 为滤波器对象设置蒙板滤波器对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Filter 指示指向滤波器对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h index 2d21c967..7cfccda8 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个坐标点对象。 + * @brief 用于创建一个坐标点对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param x 参数为X轴坐标。 @@ -58,7 +58,7 @@ extern "C" { OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y); /** - * @brief 函数用于销毁坐标点对象并回收该对象占有的内存。 + * @brief 用于销毁坐标点对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h index e621b935..986fdd39 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个矩形对象。 + * @brief 用于创建一个矩形对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param left 参数为矩形左上角的横坐标。 @@ -60,7 +60,7 @@ extern "C" { OH_Drawing_Rect* OH_Drawing_RectCreate(float left, float top, float right, float bottom); /** - * @brief 函数用于销毁矩形对象并回收该对象占有的内存。 + * @brief 用于销毁矩形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h index 63102d96..d864bd18 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个圆角矩形对象。 + * @brief 用于创建一个圆角矩形对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 @@ -59,7 +59,7 @@ extern "C" { OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate(const OH_Drawing_Rect*, float xRad, float yRad); /** - * @brief 函数用于销毁圆角矩形对象并回收该对象占有的内存。 + * @brief 用于销毁圆角矩形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h index 38391539..a4aa2dcd 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 枚举平铺模式。 + * @brief 着色器效果平铺模式的枚举。 * * @since 11 * @version 1.0 @@ -61,11 +61,11 @@ typedef enum { */ REPEAT, /** - * 水平和垂直重复着色器效果图像,交替使用镜像图像使相邻图像始终接缝。 + * 水平和垂直重复着色器效果图像,交替镜像。 */ MIRROR, /** - * 只在原域内绘制,其他地方返回透明黑色。 + * 只在原始区域内绘制,其他地方返回透明黑色。 */ DECAL, } OH_Drawing_TileMode; @@ -76,10 +76,10 @@ typedef enum { * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param startPt 表示渐变的起点。 * @param endPt 表示渐变的终点。 - * @param colors 表示示两点之间分布的颜色。 + * @param colors 表示在两个点之间分布的颜色。 * @param pos 表示每种对应颜色在颜色数组中的相对位置。 * @param size 表示颜色和位置的数量。 - * @param OH_Drawing_TileMode 表示平铺模式类型。 + * @param OH_Drawing_TileMode 着色器效果平铺模式类型,支持可选的具体模式可见{@Link OH_Drawing_TileMoe}枚举。 * @return 返回创建的着色器对象的指针。 * @since 11 * @version 1.0 @@ -88,15 +88,16 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradient(const OH_Dr const OH_Drawing_Point* endPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode); /** - * @brief 创建着色器,在给定中心和半径的情况下生成径向渐变。 + * @brief 创建着色器,在给定圆心和半径的情况下生成径向渐变。 + * 从起点到终点颜色从内到外进行圆形渐变(从中间向外拉)被称为径向渐变。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param centerPt 指示渐变效果的圆心。 + * @param centerPt 指示渐变的圆心。 * @param radius 指示此渐变的圆半径。 * @param colors 表示在两个点之间分布的颜色。 * @param pos 表示每种对应颜色在颜色数组中的相对位置。 * @param size 表示颜色和位置的数量。 - * @param OH_Drawing_TileMode 表示平铺模式类型。 + * @param OH_Drawing_TileMode 着色器效果平铺模式类型,支持可选的具体模式可见{@Link OH_Drawing_TileMoe}枚举。 * @return 返回创建的着色器对象的指针。 * @since 11 * @version 1.0 @@ -105,14 +106,14 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradient(const OH_Dr const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode); /** - * @brief 创建着色器,在给定中心的情况下生成扫掠渐变。 + * @brief 创建着色器,在给定中心的情况下生成扇形渐变。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param centerPt 表示渐变的圆心。 * @param colors 表示在两个点之间分布的颜色。 * @param pos 表示每种对应颜色在颜色数组中的相对位置。 * @param size 表示颜色和位置的数量。 - * @param OH_Drawing_TileMode 表示平铺模式类型。 + * @param OH_Drawing_TileMode 着色器效果平铺模式类型,支持可选的具体模式可见{@Link OH_Drawing_TileMoe}枚举。 * @return 返回创建的着色器对象的指针。 * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index 285e566b..5ae321f4 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -73,7 +73,7 @@ typedef struct { } OH_Drawing_RunBuffer; /** - * @brief 函数用于申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理,当调用OH_Drawing_TextBlobBuilderMake后禁止使用。 + * @brief 用于申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理,当调用OH_Drawing_TextBlobBuilderMake后禁止使用。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 @@ -87,18 +87,18 @@ const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos(OH_Drawing_Tex int32_t count, const OH_Drawing_Rect*); /** - * @brief 函数用于从文本构造器中创建文本对象。 + * @brief 用于从文本构造器中创建文本对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 - * @return 函数会返回一个指针,指针指向创建的文本对象。 + * @return 返回一个指针,指针指向创建的文本对象。 * @since 11 * @version 1.0 */ OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder*); /** - * @brief 函数用于销毁文本对象并回收该对象占有的内存。 + * @brief 用于销毁文本对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针。 @@ -108,7 +108,7 @@ OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder*) void OH_Drawing_TextBlobDestroy(OH_Drawing_TextBlob*); /** - * @brief 函数用于销毁文本构造器对象并回收该对象占有的内存。 + * @brief 用于销毁文本构造器对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h index 88eb7648..20c7a368 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -32,6 +32,7 @@ * @file drawing_typeface.h * * @brief 文件中定义了与字形相关的功能函数。 + * 不同的平台有自己的默认字形,也可以从ttf文件解析出三方指定字形,如宋体、黑体字形等。 * * 引用文件"native_drawing/drawing_typeface.h" * @library libnative_drawing.so @@ -46,17 +47,17 @@ extern "C" { #endif /** - * @brief 函数用于创建一个默认的字形对象。 + * @brief 用于创建一个默认的字形对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 函数会返回一个指针,指针指向创建的字形对象。 + * @return 返回一个指针,指针指向创建的字形对象。 * @since 11 * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); /** - * @brief 函数用于销毁字形对象并回收该对象占有的内存。 + * @brief 用于销毁字形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index 81ec549e..cbe63a5f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief OH_Drawing_Canvas定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 + * @brief 定义为一块矩形的画布,可以结合画笔和画刷在上面绘制各种形状、图片和文字。 * * @since 8 * @version 1.0 @@ -54,7 +54,7 @@ extern "C" { typedef struct OH_Drawing_Canvas OH_Drawing_Canvas; /** - * @brief OH_Drawing_Pen定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 + * @brief 定义为画笔,画笔用于描述绘制图形轮廓的样式和颜色。 * * @since 8 * @version 1.0 @@ -62,7 +62,7 @@ typedef struct OH_Drawing_Canvas OH_Drawing_Canvas; typedef struct OH_Drawing_Pen OH_Drawing_Pen; /** - * @brief OH_Drawing_Brush定义为画刷,画刷用于描述填充图形的样式和颜色。 + * @brief 定义为画刷,画刷用于描述填充图形的样式和颜色。 * * @since 8 * @version 1.0 @@ -70,7 +70,7 @@ typedef struct OH_Drawing_Pen OH_Drawing_Pen; typedef struct OH_Drawing_Brush OH_Drawing_Brush; /** - * @brief OH_Drawing_Path定义为路径,路径用于自定义各种形状。 + * @brief 定义为路径,路径用于自定义各种形状。 * * @since 8 * @version 1.0 @@ -78,7 +78,7 @@ typedef struct OH_Drawing_Brush OH_Drawing_Brush; typedef struct OH_Drawing_Path OH_Drawing_Path; /** - * @brief OH_Drawing_Bitmap定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 + * @brief 定义为位图,位图是一块内存,内存中包含了描述一张图片的像素数据。 * * @since 8 * @version 1.0 @@ -126,7 +126,7 @@ typedef struct OH_Drawing_Matrix OH_Drawing_Matrix; typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect; /** - * @brief 定义一个滤波器,用于存储和颜色滤波器和模板滤波器。 + * @brief 定义一个滤波器,用于存储颜色滤波器和模板滤波器。 * * @since 11 * @version 1.0 @@ -142,7 +142,7 @@ typedef struct OH_Drawing_Filter OH_Drawing_Filter; typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter; /** - * @brief 定义颜色滤波器,调用一个颜色并返回新颜色。 + * @brief 定义颜色滤波器,传入一个颜色并返回一个新的颜色。 * * @since 11 * @version 1.0 @@ -158,7 +158,7 @@ typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter; typedef struct OH_Drawing_Font OH_Drawing_Font; /** - * @brief 用于描述字形 + * @brief 用于描述字形。 * * @since 11 * @version 1.0 @@ -183,7 +183,7 @@ typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob; typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder; /** - * @brief OH_Drawing_ColorFormat用于描述位图像素的存储格式。 + * @brief 用于描述位图像素的存储格式。 * * @since 8 * @version 1.0 @@ -204,7 +204,7 @@ typedef enum { } OH_Drawing_ColorFormat; /** - * @brief OH_Drawing_AlphaFormat用于描述位图像素的透明度分量。 + * @brief 用于描述位图像素的透明度分量。 * * @since 8 * @version 1.0 @@ -221,82 +221,82 @@ typedef enum { } OH_Drawing_AlphaFormat; /** - * @brief 混合操作会为两种颜色(源色、目标色)生成一种新的颜色。 - * 这些操作在 4 个颜色通道(红、绿、蓝、阿尔法)上是相同的。 + * @brief 混合模式枚举。混合模式的操作会为两种颜色(源色、目标色)生成一种新的颜色。 + * 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 * 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 * - * 为简洁起见,我们使用以下缩略语。 - * s : source - * d : destination - * sa : source alpha - * da : destination alpha + * 为简洁起见,我们使用以下缩写。 + * s : source 源的缩写 + * d : destination 目标的缩写 + * sa : source alpha 源透明度的缩写 + * da : destination alpha 目标透明度的缩写 * - * 结果缩写为 - * r : 如果所有4个通道的计算方式相同 - * ra : 透明度通道结果 - * rc : "颜色"结果:红色、绿色和蓝色通道 + * 计算结果用如下缩写表示 + * r : 如果4个通道的计算方式相同,用r表示。 + * ra : 如果只操作透明度通道,用ra表示。 + * rc : 如果操作3个颜色通道,用rc表示。 * * @since 11 * @version 1.0 */ typedef enum { - /** r = 0. */ + /** 清除模式,r = 0. */ BLEND_MODE_CLEAR, - /** r = s. */ + /** r = s(源的4个通道都是相同的计算方式) */ BLEND_MODE_SRC, - /** r = d. */ + /** r = d(目标的4个通道都是相同的计算方式) */ BLEND_MODE_DST, - /** r = s + (1-sa)*d. */ + /** r = s + (1 - sa) * d. */ BLEND_MODE_SRC_OVER, - /** r = d + (1-da)*s. */ + /** r = d + (1 - da) * s. */ BLEND_MODE_DST_OVER, /** r = s * da. */ BLEND_MODE_SRC_IN, /** r = d * sa. */ BLEND_MODE_DST_IN, - /** r = s * (1-da). */ + /** r = s * (1 - da). */ BLEND_MODE_SRC_OUT, - /** r = d * (1-sa). */ + /** r = d * (1 - sa). */ BLEND_MODE_DST_OUT, - /** r = s*da + d*(1-sa). */ + /** r = s * da + d * (1 - sa). */ BLEND_MODE_SRC_ATOP, - /** r = d*sa + s*(1-da). */ + /** r = d * sa + s * (1 - da). */ BLEND_MODE_DST_ATOP, - /** r = s*(1-da) + d*(1-sa). */ + /** r = s * (1 - da) + d * (1 - sa). */ BLEND_MODE_XOR, /** r = min(s + d, 1). */ BLEND_MODE_PLUS, - /** r = s*d. */ + /** r = s * d. */ BLEND_MODE_MODULATE, - /** r = s + d - s*d. */ + /** 滤色模式,r = s + d - s * d. */ BLEND_MODE_SCREEN, - /** 乘法或筛选,具体取决于目标。 */ + /** 叠加模式 */ BLEND_MODE_OVERLAY, - /** rc = s + d - max(s*da, d*sa), ra = s + (1-sa)*d. */ + /** 变暗模式,rc = s + d - max(s * da, d * sa), ra = s + (1 - sa) * d. */ BLEND_MODE_DARKEN, - /** rc = s + d - min(s*da, d*sa), ra = s + (1-sa)*d. */ + /** 变亮模式,rc = s + d - min(s * da, d * sa), ra = s + (1 - sa) * d. */ BLEND_MODE_LIGHTEN, - /** 照亮目的地以反映源点。 */ + /** 颜色减淡模式 */ BLEND_MODE_COLOR_DODGE, - /** 使目的地变暗,以反映源点。 */ + /** 颜色加深模式 */ BLEND_MODE_COLOR_BURN, - /** 乘法或者筛选依赖于源点。 */ + /** 强光模式 */ BLEND_MODE_HARD_LIGHT, - /** 变亮或变暗,具体取决于来源。 */ + /** 柔光模式 */ BLEND_MODE_SOFT_LIGHT, - /** rc = s + d - 2*(min(s*da, d*sa)), ra = s + (1-sa)*d. */ + /** 差值模式,rc = s + d - 2 * (min(s * da, d * sa)), ra = s + (1 - sa) * d. */ BLEND_MODE_DIFFERENCE, - /** rc = s + d - two(s*d), ra = s + (1-sa)*d. */ + /** 排除模式,rc = s + d - two(s * d), ra = s + (1 - sa) * d. */ BLEND_MODE_EXCLUSION, - /** r = s*(1-da) + d*(1-sa) + s*d. */ + /** 正片叠底,r = s * (1 - da) + d * (1 - sa) + s * d. */ BLEND_MODE_MULTIPLY, - /** 源的色调与目的地的饱和度和亮度。 */ + /** 色相模式 */ BLEND_MODE_HUE, - /** 源的饱和度与目的地的色调和亮度。 */ + /** 饱和度模式 */ BLEND_MODE_SATURATION, - /** 源的色调和饱和度与目的地的亮度。 */ + /** 颜色模式 */ BLEND_MODE_COLOR, - /** 源的亮度与目标的色调和饱和度。 */ + /** 亮度模式 */ BLEND_MODE_LUMINOSITY, } OH_Drawing_BlendMode; -- Gitee From 11f40afafe0ee07da8f6947e6c8e08c1cca8c8ed Mon Sep 17 00:00:00 2001 From: sqwlly Date: Fri, 5 Jan 2024 15:01:15 +0800 Subject: [PATCH 0199/2135] blend mode Signed-off-by: s30029175 Signed-off-by: sqwlly --- zh-cn/native_sdk/graphic/native_drawing/drawing_types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index cbe63a5f..534cbc1b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -242,9 +242,9 @@ typedef enum { typedef enum { /** 清除模式,r = 0. */ BLEND_MODE_CLEAR, - /** r = s(源的4个通道都是相同的计算方式) */ + /** r = s(result的4个通道,都等于source的4个通道,即结果等于源) */ BLEND_MODE_SRC, - /** r = d(目标的4个通道都是相同的计算方式) */ + /** r = d(result的4个通道,都等于destination的4个通道,即结果等于目标) */ BLEND_MODE_DST, /** r = s + (1 - sa) * d. */ BLEND_MODE_SRC_OVER, -- Gitee From c2814ed04ff3989ae49f8ffd63da4966c836844f Mon Sep 17 00:00:00 2001 From: sqwlly Date: Fri, 5 Jan 2024 16:17:45 +0800 Subject: [PATCH 0200/2135] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=20Signed-off-by:=20s30029175=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_bitmap.h | 12 ++--- .../graphic/native_drawing/drawing_brush.h | 12 ++--- .../graphic/native_drawing/drawing_canvas.h | 52 +++++++++---------- .../graphic/native_drawing/drawing_color.h | 2 +- .../graphic/native_drawing/drawing_font.h | 14 ++--- .../graphic/native_drawing/drawing_matrix.h | 6 +-- .../graphic/native_drawing/drawing_path.h | 18 +++---- .../graphic/native_drawing/drawing_pen.h | 28 +++++----- .../native_drawing/drawing_text_blob.h | 2 +- 9 files changed, 73 insertions(+), 73 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index e0379bd3..e77024e0 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -59,7 +59,7 @@ typedef struct { } OH_Drawing_BitmapFormat; /** - * @brief 函数用于创建一个位图对象。 + * @brief 用于创建一个位图对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 函数会返回一个指针,指针指向创建的位图对象。 @@ -69,7 +69,7 @@ typedef struct { OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void); /** - * @brief 函数用于销毁位图对象并回收该对象占有内存。 + * @brief 用于销毁位图对象并回收该对象占有内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 @@ -79,7 +79,7 @@ OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void); void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); /** - * @brief 函数用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 + * @brief 用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 @@ -93,7 +93,7 @@ void OH_Drawing_BitmapBuild( OH_Drawing_Bitmap*, const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat*); /** - * @brief 该函数用于获取指定位图的宽度。 + * @brief 用于获取指定位图的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 @@ -104,7 +104,7 @@ void OH_Drawing_BitmapBuild( uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_Bitmap*); /** - * @brief 函数用于获取指定位图的高度。 + * @brief 用于获取指定位图的高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 @@ -115,7 +115,7 @@ uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_Bitmap*); uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_Bitmap*); /** - * @brief 函数用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 + * @brief 用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index 3eaac842..8a18c487 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个画刷对象。 + * @brief 用于创建一个画刷对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 函数会返回一个指针,指针指向创建的画刷对象。 @@ -56,7 +56,7 @@ extern "C" { OH_Drawing_Brush* OH_Drawing_BrushCreate(void); /** - * @brief 函数用于销毁画刷对象并回收该对象占有的内存。 + * @brief 用于销毁画刷对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 @@ -66,7 +66,7 @@ OH_Drawing_Brush* OH_Drawing_BrushCreate(void); void OH_Drawing_BrushDestroy(OH_Drawing_Brush*); /** - * @brief 函数用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 + * @brief 用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 @@ -77,7 +77,7 @@ void OH_Drawing_BrushDestroy(OH_Drawing_Brush*); bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); /** - * @brief 函数用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 + * @brief 用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 @@ -88,7 +88,7 @@ bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool); /** - * @brief 函数用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 + * @brief 用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 @@ -99,7 +99,7 @@ void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool); uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*); /** - * @brief 函数用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 + * @brief 用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index 32140ae4..3e15b56f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个画布对象。 + * @brief 用于创建一个画布对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 函数会返回一个指针,指针指向创建的画布对象。 @@ -56,7 +56,7 @@ extern "C" { OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void); /** - * @brief 函数用于销毁画布对象并回收该对象占有的内存。 + * @brief 用于销毁画布对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数是一个指向画布对象的指针。 @@ -66,7 +66,7 @@ OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void); void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*); /** - * @brief 函数用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 + * @brief 用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -77,7 +77,7 @@ void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*); void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*); /** - * @brief 函数用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 + * @brief 用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -88,7 +88,7 @@ void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*); void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*); /** - * @brief 函数用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 + * @brief 用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -98,7 +98,7 @@ void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*); void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas*); /** - * @brief 函数用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 + * @brief 用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -109,7 +109,7 @@ void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas*); void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_Brush*); /** - * @brief 函数用于去除掉画布中的画刷,使用后画布将不去填充图形形状。 + * @brief 用于去除掉画布中的画刷,使用后画布将不去填充图形形状。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -119,7 +119,7 @@ void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_Brush*); void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*); /** - * @brief 函数用于保存当前画布的状态(画布矩阵)到一个栈顶。 + * @brief 用于保存当前画布的状态(画布矩阵)到一个栈顶。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -129,7 +129,7 @@ void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*); void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); /** - * @brief 函数用于恢复保存在栈顶的画布状态(画布矩阵)。 + * @brief 用于恢复保存在栈顶的画布状态(画布矩阵)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -139,7 +139,7 @@ void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*); /** - * @brief 函数用于获取栈中保存的画布状态(画布矩阵)的数量。 + * @brief 用于获取栈中保存的画布状态(画布矩阵)的数量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -150,7 +150,7 @@ void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*); uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*); /** - * @brief 函数用于恢复到指定数量的画布状态(画布矩阵)。 + * @brief 用于恢复到指定数量的画布状态(画布矩阵)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -161,7 +161,7 @@ uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*); void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount); /** - * @brief 函数用于画一条直线段。 + * @brief 用于画一条直线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -175,7 +175,7 @@ void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount); void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, float y2); /** - * @brief 函数用于画一个自定义路径。 + * @brief 用于画一个自定义路径。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -186,7 +186,7 @@ void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); /** - * @brief 函数用于画一个位图 + * @brief 用于画一个位图 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -199,7 +199,7 @@ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); /** - * @brief 函数用于画一个矩形。 + * @brief 用于画一个矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -210,7 +210,7 @@ void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, f void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*); /** - * @brief 函数用于画一个圆形。 + * @brief 用于画一个圆形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -222,7 +222,7 @@ void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*); void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius); /** - * @brief 函数用于画一个椭圆。 + * @brief 用于画一个椭圆。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -233,7 +233,7 @@ void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, fl void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*); /** - * @brief 函数用于画一个弧。 + * @brief 用于画一个弧。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -246,7 +246,7 @@ void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*); void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); /** - * @brief 函数用于画一个圆角矩形。 + * @brief 用于画一个圆角矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -257,7 +257,7 @@ void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*); /** - * @brief 函数用于画一段文字。 + * @brief 用于画一段文字。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -287,7 +287,7 @@ typedef enum { } OH_Drawing_CanvasClipOp; /** - * @brief 函数用于裁剪一个矩形。 + * @brief 用于裁剪一个矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -301,7 +301,7 @@ void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** - * @brief 函数用于裁剪一个自定义路径。 + * @brief 用于裁剪一个自定义路径。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -315,7 +315,7 @@ void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** - * @brief 函数用于旋转一定的角度,正数表示顺时针旋转。 + * @brief 用于旋转一定的角度,正数表示顺时针旋转。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -328,7 +328,7 @@ void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py); /** - * @brief 函数用于平移一段距离。 + * @brief 用于平移一段距离。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -340,7 +340,7 @@ void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); /** - * @brief 函数用于画布缩放。 + * @brief 用于画布缩放。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 @@ -352,7 +352,7 @@ void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); /** - * @brief 函数用于使用指定颜色去清空画布。 + * @brief 用于使用指定颜色去清空画布。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h index 5a15f049..b9ef2f89 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 + * @brief 用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param alpha 参数为一个描述透明度的变量, 变量范围是0x00~0xFF。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index 55bc15ea..c7a91bea 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个字体对象。 + * @brief 用于创建一个字体对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 函数会返回一个指针,指针指向创建的字体对象。 @@ -56,7 +56,7 @@ extern "C" { OH_Drawing_Font* OH_Drawing_FontCreate(void); /** - * @brief 函数用于给字体设置字形。 + * @brief 用于给字体设置字形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 @@ -67,7 +67,7 @@ OH_Drawing_Font* OH_Drawing_FontCreate(void); void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); /** - * @brief 函数用于给字体设置文字大小。 + * @brief 用于给字体设置文字大小。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 @@ -78,7 +78,7 @@ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); /** - * @brief 函数用于设置线性可缩放字体。 + * @brief 用于设置线性可缩放字体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 @@ -89,7 +89,7 @@ void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); void OH_Drawing_FontSetLinearText(OH_Drawing_Font*, bool isLinearText); /** - * @brief 函数用于给字体设置文本倾斜。 + * @brief 用于给字体设置文本倾斜。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 @@ -100,7 +100,7 @@ void OH_Drawing_FontSetLinearText(OH_Drawing_Font*, bool isLinearText); void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); /** - * @brief 函数用于设置增加描边宽度以近似粗体字体效果。 + * @brief 用于设置增加描边宽度以近似粗体字体效果。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 @@ -111,7 +111,7 @@ void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); /** - * @brief 函数用于销毁字体对象并回收该对象占有的内存。 + * @brief 用于销毁字体对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index a3cf7e2a..707621d4 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个矩阵对象。 + * @brief 用于创建一个矩阵对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 函数会返回一个指针,指针指向创建的矩阵对象。 @@ -56,7 +56,7 @@ extern "C" { OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); /** - * @brief 函数用于给矩阵对象设置参数。 + * @brief 用于给矩阵对象设置参数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Matrix 参数为一个指向矩阵对象的指针。 @@ -76,7 +76,7 @@ void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, f float skewY, float scaleY, float transY, float persp0, float persp1, float persp2); /** - * @brief 函数用于销毁矩阵对象并回收该对象占有的内存。 + * @brief 用于销毁矩阵对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Matrix 参数为一个指向字体对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h index ccb30031..5205e0f2 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个路径对象。 + * @brief 用于创建一个路径对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 函数会返回一个指针,指针指向创建的路径对象。 @@ -56,7 +56,7 @@ extern "C" { OH_Drawing_Path* OH_Drawing_PathCreate(void); /** - * @brief 函数用于销毁路径对象并回收该对象占有的内存。 + * @brief 用于销毁路径对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 @@ -66,7 +66,7 @@ OH_Drawing_Path* OH_Drawing_PathCreate(void); void OH_Drawing_PathDestroy(OH_Drawing_Path*); /** - * @brief 函数用于设置自定义路径的起始点位置。 + * @brief 用于设置自定义路径的起始点位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 @@ -78,7 +78,7 @@ void OH_Drawing_PathDestroy(OH_Drawing_Path*); void OH_Drawing_PathMoveTo(OH_Drawing_Path*, float x, float y); /** - * @brief 函数用于添加一条从路径的最后点位置到目标点位置的线段。 + * @brief 用于添加一条从路径的最后点位置到目标点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 @@ -90,7 +90,7 @@ void OH_Drawing_PathMoveTo(OH_Drawing_Path*, float x, float y); void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y); /** - * @brief 函数用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, + * @brief 用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,矩形边框会包裹椭圆, * 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing @@ -107,7 +107,7 @@ void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y); void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg); /** - * @brief 函数用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线。 + * @brief 用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 @@ -121,7 +121,7 @@ void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY); /** - * @brief 函数用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线。 + * @brief 用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 @@ -138,7 +138,7 @@ void OH_Drawing_PathCubicTo( OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); /** - * @brief 函数用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 + * @brief 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 @@ -148,7 +148,7 @@ void OH_Drawing_PathCubicTo( void OH_Drawing_PathClose(OH_Drawing_Path*); /** - * @brief 函数用于重置自定义路径数据。 + * @brief 用于重置自定义路径数据。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index 2a9a5722..06132c1f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个画笔对象。 + * @brief 用于创建一个画笔对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 函数会返回一个指针,指针指向创建的画笔对象。 @@ -56,7 +56,7 @@ extern "C" { OH_Drawing_Pen* OH_Drawing_PenCreate(void); /** - * @brief 函数用于销毁画笔对象并回收该对象占有的内存。 + * @brief 用于销毁画笔对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -66,7 +66,7 @@ OH_Drawing_Pen* OH_Drawing_PenCreate(void); void OH_Drawing_PenDestroy(OH_Drawing_Pen*); /** - * @brief 函数用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 + * @brief 用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -77,7 +77,7 @@ void OH_Drawing_PenDestroy(OH_Drawing_Pen*); bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 + * @brief 用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -88,7 +88,7 @@ bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen*); void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen*, bool); /** - * @brief 函数用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 + * @brief 用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -99,7 +99,7 @@ void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen*, bool); uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 + * @brief 用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -133,7 +133,7 @@ uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen*); void OH_Drawing_PenSetAlpha(OH_Drawing_Pen*, uint8_t alpha); /** - * @brief 函数用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 + * @brief 用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -144,7 +144,7 @@ void OH_Drawing_PenSetAlpha(OH_Drawing_Pen*, uint8_t alpha); float OH_Drawing_PenGetWidth(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 + * @brief 用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -155,7 +155,7 @@ float OH_Drawing_PenGetWidth(const OH_Drawing_Pen*); void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width); /** - * @brief 函数用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 + * @brief 用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -166,7 +166,7 @@ void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width); float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen*); /** - * @brief 函数用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 + * @brief 用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -192,7 +192,7 @@ typedef enum { } OH_Drawing_PenLineCapStyle; /** - * @brief 函数用于获取画笔笔帽的样式。 + * @brief 用于获取画笔笔帽的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -203,7 +203,7 @@ typedef enum { OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔笔帽样式。 + * @brief 用于设置画笔笔帽样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -229,7 +229,7 @@ typedef enum { } OH_Drawing_PenLineJoinStyle; /** - * @brief 函数用于获取画笔绘制折线转角的样式。 + * @brief 用于获取画笔绘制折线转角的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 @@ -240,7 +240,7 @@ typedef enum { OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen*); /** - * @brief 函数用于设置画笔绘制转角的样式。 + * @brief 用于设置画笔绘制转角的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index 5ae321f4..4e025d97 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 函数用于创建一个文本构造器对象。 + * @brief 用于创建一个文本构造器对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 函数会返回一个指针,指针指向创建的文本构造器对象。 -- Gitee From e7cbc2d2ae3307fb7c5280510a74e968b6da2e36 Mon Sep 17 00:00:00 2001 From: sqwlly Date: Fri, 5 Jan 2024 16:27:40 +0800 Subject: [PATCH 0201/2135] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=EF=BC=8Ccode=20review=20Signed-off-by:=20s30?= =?UTF-8?q?029175=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_canvas.h | 132 +++++++++--------- .../graphic/native_drawing/drawing_color.h | 8 +- .../graphic/native_drawing/drawing_font.h | 18 +-- .../graphic/native_drawing/drawing_matrix.h | 22 +-- .../graphic/native_drawing/drawing_path.h | 56 ++++---- .../graphic/native_drawing/drawing_point.h | 6 +- .../graphic/native_drawing/drawing_rect.h | 10 +- .../native_drawing/drawing_round_rect.h | 8 +- .../native_drawing/drawing_text_blob.h | 14 +- .../native_drawing/drawing_text_declaration.h | 2 +- .../graphic/native_drawing/drawing_typeface.h | 2 +- .../graphic/native_drawing/drawing_types.h | 16 +-- 12 files changed, 147 insertions(+), 147 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index 3e15b56f..3548cf0f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -69,8 +69,8 @@ void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*); * @brief 用于将一个位图对象绑定到画布中,使得画布绘制的内容输出到位图中(即CPU渲染)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Bitmap 参数为一个指向位图对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Bitmap 指向位图对象的指针。 * @since 8 * @version 1.0 */ @@ -80,8 +80,8 @@ void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*); * @brief 用于设置画笔给画布,画布将会使用设置画笔的样式和颜色去绘制图形形状的轮廓。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Pen 参数为一个指向画笔对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @since 8 * @version 1.0 */ @@ -91,7 +91,7 @@ void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*); * @brief 用于去除掉画布中的画笔,使用后画布将不去绘制图形形状的轮廓。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 * @since 8 * @version 1.0 */ @@ -101,8 +101,8 @@ void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas*); * @brief 用于设置画刷给画布,画布将会使用设置的画刷样式和颜色去填充绘制的图形形状。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Brush 参数为一个指向画刷对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 * @since 8 * @version 1.0 */ @@ -112,7 +112,7 @@ void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_Brush*); * @brief 用于去除掉画布中的画刷,使用后画布将不去填充图形形状。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 * @since 8 * @version 1.0 */ @@ -122,7 +122,7 @@ void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*); * @brief 用于保存当前画布的状态(画布矩阵)到一个栈顶。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 * @since 8 * @version 1.0 */ @@ -132,7 +132,7 @@ void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); * @brief 用于恢复保存在栈顶的画布状态(画布矩阵)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 * @since 8 * @version 1.0 */ @@ -142,7 +142,7 @@ void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*); * @brief 用于获取栈中保存的画布状态(画布矩阵)的数量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 * @return 函数会返回一个32位的值描述画布状态(画布矩阵)的数量。 * @since 11 * @version 1.0 @@ -153,8 +153,8 @@ uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*); * @brief 用于恢复到指定数量的画布状态(画布矩阵)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param saveCount 参数为指定的画布状态(画布矩阵)数量。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param saveCount 指定的画布状态(画布矩阵)数量。 * @since 11 * @version 1.0 */ @@ -164,11 +164,11 @@ void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount); * @brief 用于画一条直线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param x1 参数为线段起始点的横坐标。 - * @param y1 参数为线段起始点的纵坐标。 - * @param x2 参数为线段结束点的横坐标。 - * @param y2 参数为线段结束点的纵坐标。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param x1 线段起始点的横坐标。 + * @param y1 线段起始点的纵坐标。 + * @param x2 线段结束点的横坐标。 + * @param y2 线段结束点的纵坐标。 * @since 8 * @version 1.0 */ @@ -178,21 +178,21 @@ void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, * @brief 用于画一个自定义路径。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Path 指向路径对象的指针。 * @since 8 * @version 1.0 */ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); /** - * @brief 用于画一个位图 + * @brief 用于画一个位图,位图又称为点阵图像、像素图或栅格图像,是由像素(图片元素)的单个点组成。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Bitmap 参数为一个指向位图对象的指针。 - * @param left 参数为位图对象左上角的横坐标。 - * @param top 参数为位图对象左上角的纵坐标。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Bitmap 指向位图对象的指针。 + * @param left 位图对象左上角的横坐标。 + * @param top 位图对象左上角的纵坐标。 * @since 11 * @version 1.0 */ @@ -202,8 +202,8 @@ void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, f * @brief 用于画一个矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Rect 指向矩形对象的指针。 * @since 11 * @version 1.0 */ @@ -213,9 +213,9 @@ void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*); * @brief 用于画一个圆形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针,表示圆心。 - * @param radius 参数为圆形的半径。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Point 指向坐标点对象的指针,表示圆心。 + * @param radius 圆形的半径。 * @since 11 * @version 1.0 */ @@ -225,8 +225,8 @@ void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, fl * @brief 用于画一个椭圆。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Rect 指向矩形对象的指针。 * @since 11 * @version 1.0 */ @@ -236,10 +236,10 @@ void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*); * @brief 用于画一个弧。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 - * @param startAngle 参数为弧的起始角度。 - * @param sweepAngle 参数为弧的扫描角度。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Rect 指向矩形对象的指针。 + * @param startAngle 弧的起始角度。 + * @param sweepAngle 弧的扫描角度。 * @since 11 * @version 1.0 */ @@ -249,8 +249,8 @@ void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float * @brief 用于画一个圆角矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_RoundRect 指向圆角矩形对象的指针。 * @since 11 * @version 1.0 */ @@ -260,28 +260,28 @@ void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRe * @brief 用于画一段文字。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针。 - * @param x 参数为文本对象左下角的横坐标。 - * @param y 参数为文本对象左下角的纵坐标。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_TextBlob 指向文本对象的指针。 + * @param x 文本对象左下角的横坐标。 + * @param y 文本对象左下角的纵坐标。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob*, float x, float y); /** - * @brief 枚举集合定义了裁剪的方式 + * @brief 画布裁剪方式的枚举集合。 * * @since 11 * @version 1.0 */ typedef enum { /** - * 将指定区域裁剪(取差集) + * 将指定区域裁剪(取差集)。 */ DIFFERENCE, /** - * 将指定区域保留(取交集) + * 将指定区域保留(取交集)。 */ INTERSECT, } OH_Drawing_CanvasClipOp; @@ -290,10 +290,10 @@ typedef enum { * @brief 用于裁剪一个矩形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 - * @param clipOp 参数为裁剪方式。 - * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Rect 指向矩形对象的指针。 + * @param clipOp 裁剪方式。支持可选的具体裁剪方式可见@{link OH_Drawing_CanvasClipOp}枚举。 + * @param doAntiAlias 值为true则做抗锯齿处理,反之不做。 * @since 11 * @version 1.0 */ @@ -304,9 +304,9 @@ void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*, * @brief 用于裁剪一个自定义路径。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 - * @param clipOp 参数为裁剪方式。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param OH_Drawing_Path 指向路径对象的指针。 + * @param clipOp 裁剪方式。支持可选的具体裁剪方式可见@{link OH_Drawing_CanvasClipOp}枚举。 * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理。 * @since 11 * @version 1.0 @@ -315,25 +315,25 @@ void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** - * @brief 用于旋转一定的角度,正数表示顺时针旋转。 + * @brief 用于画布旋转一定的角度,正数表示顺时针旋转,负数反之。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param degrees 参数为旋转的角度。 - * @param px 参数为旋转中心的横坐标。 - * @param py 参数为旋转中心的纵坐标。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param degrees 旋转角度。 + * @param px 旋转中心的横坐标。 + * @param py 旋转中心的纵坐标。 * @since 11 * @version 1.0 */ void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py); /** - * @brief 用于平移一段距离。 + * @brief 用于平移画布一段距离。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param dx 参数为水平方向移动的距离。 - * @param dy 参数为垂直方向移动的距离。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param dx 水平方向移动的距离。 + * @param dy 垂直方向移动的距离。 * @since 11 * @version 1.0 */ @@ -343,9 +343,9 @@ void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); * @brief 用于画布缩放。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param sx 参数为水平方向缩放的比例。 - * @param sy 参数为垂直方向缩放的比例。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param sx 水平方向缩放的比例。 + * @param sy 垂直方向缩放的比例。 * @since 11 * @version 1.0 */ @@ -355,8 +355,8 @@ void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); * @brief 用于使用指定颜色去清空画布。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数为一个指向画布对象的指针。 - * @param color 参数为一个描述颜色的32位(ARGB)变量。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 + * @param color 描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h index b9ef2f89..87abdab5 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h @@ -49,10 +49,10 @@ extern "C" { * @brief 用于将4个变量(分别描述透明度、红色、绿色和蓝色)转化为一个描述颜色的32位(ARGB)变量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param alpha 参数为一个描述透明度的变量, 变量范围是0x00~0xFF。 - * @param red 参数为一个描述红色的变量, 变量范围是0x00~0xFF。 - * @param green 参数为一个描述绿色的变量, 变量范围是0x00~0xFF。 - * @param blue 参数为一个描述蓝色的变量, 变量范围是0x00~0xFF。 + * @param alpha 描述透明度的变量, 变量范围是0x00~0xFF。 + * @param red 描述红色的变量, 变量范围是0x00~0xFF。 + * @param green 描述绿色的变量, 变量范围是0x00~0xFF。 + * @param blue 描述蓝色的变量, 变量范围是0x00~0xFF。 * @return 函数返回一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index c7a91bea..27ff409f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -59,8 +59,8 @@ OH_Drawing_Font* OH_Drawing_FontCreate(void); * @brief 用于给字体设置字形。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 - * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针。 + * @param OH_Drawing_Font 指向字体对象的指针。 + * @param OH_Drawing_Typeface 指向字形对象的指针。 * @since 11 * @version 1.0 */ @@ -70,8 +70,8 @@ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); * @brief 用于给字体设置文字大小。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 - * @param textSize 参数为字体大小。 + * @param OH_Drawing_Font 指向字体对象的指针。 + * @param textSize 字体大小。 * @since 11 * @version 1.0 */ @@ -81,7 +81,7 @@ void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); * @brief 用于设置线性可缩放字体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param OH_Drawing_Font 指向字体对象的指针。 * @param isLinearText 参数真为使能线性可缩放字体,参数假为不使能。 * @since 11 * @version 1.0 @@ -92,8 +92,8 @@ void OH_Drawing_FontSetLinearText(OH_Drawing_Font*, bool isLinearText); * @brief 用于给字体设置文本倾斜。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 - * @param skewX 参数为X轴相对于Y轴的倾斜度。 + * @param OH_Drawing_Font 指向字体对象的指针。 + * @param skewX X轴相对于Y轴的倾斜度。 * @since 11 * @version 1.0 */ @@ -103,7 +103,7 @@ void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); * @brief 用于设置增加描边宽度以近似粗体字体效果。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param OH_Drawing_Font 指向字体对象的指针。 * @param isFakeBoldText 参数真为使能增加描边宽度,参数假为不使能。 * @since 11 * @version 1.0 @@ -114,7 +114,7 @@ void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); * @brief 用于销毁字体对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 + * @param OH_Drawing_Font 指向字体对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index 707621d4..1d1fdb12 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -59,16 +59,16 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); * @brief 用于给矩阵对象设置参数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix 参数为一个指向矩阵对象的指针。 - * @param scaleX 参数为水平缩放系数。 - * @param skewX 参数为水平倾斜系数。 - * @param transX 参数为水平位移系数。 - * @param skewY 参数为垂直倾斜系数。 - * @param scaleY 参数为垂直缩放系数。 - * @param transY 参数为垂直位移系数。 - * @param persp0 参数为X轴透视系数。 - * @param persp1 参数为Y轴透视系数。 - * @param persp2 参数为透视缩放系数。 + * @param OH_Drawing_Matrix 指向矩阵对象的指针。 + * @param scaleX 水平缩放系数。 + * @param skewX 水平倾斜系数。 + * @param transX 水平位移系数。 + * @param skewY 垂直倾斜系数。 + * @param scaleY 垂直缩放系数。 + * @param transY 垂直位移系数。 + * @param persp0 X轴透视系数。 + * @param persp1 Y轴透视系数。 + * @param persp2 透视缩放系数。 * @since 11 * @version 1.0 */ @@ -79,7 +79,7 @@ void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, f * @brief 用于销毁矩阵对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix 参数为一个指向字体对象的指针。 + * @param OH_Drawing_Matrix 指向字体对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h index 5205e0f2..1fbdde21 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h @@ -59,7 +59,7 @@ OH_Drawing_Path* OH_Drawing_PathCreate(void); * @brief 用于销毁路径对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param OH_Drawing_Path 指向路径对象的指针。 * @since 8 * @version 1.0 */ @@ -69,9 +69,9 @@ void OH_Drawing_PathDestroy(OH_Drawing_Path*); * @brief 用于设置自定义路径的起始点位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 - * @param x 参数为起始点的横坐标。 - * @param y 参数为起始点的纵坐标。 + * @param OH_Drawing_Path 指向路径对象的指针。 + * @param x 起始点的横坐标。 + * @param y 起始点的纵坐标。 * @since 8 * @version 1.0 */ @@ -81,9 +81,9 @@ void OH_Drawing_PathMoveTo(OH_Drawing_Path*, float x, float y); * @brief 用于添加一条从路径的最后点位置到目标点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 - * @param x 参数为目标点的横坐标。 - * @param y 参数为目标点的纵坐标。 + * @param OH_Drawing_Path 指向路径对象的指针。 + * @param x 目标点的横坐标。 + * @param y 目标点的纵坐标。 * @since 8 * @version 1.0 */ @@ -94,13 +94,13 @@ void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y); * 然后会指定一个起始角度和扫描度数,从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。另外会默认添加一条从路径的最后点位置到弧线起始点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 - * @param x1 参数为包围椭圆的矩形左上角点位置的横坐标。 - * @param y1 参数为包围椭圆的矩形左上角点位置的纵坐标。 - * @param x2 参数为包围椭圆的矩形右下角点位置的横坐标。 - * @param y2 参数为包围椭圆的矩形右下角点位置的纵坐标。 - * @param startDeg 参数为起始的角度。 - * @param sweepDeg 参数为扫描的度数。 + * @param OH_Drawing_Path 指向路径对象的指针。 + * @param x1 包围椭圆的矩形左上角点位置的横坐标。 + * @param y1 包围椭圆的矩形左上角点位置的纵坐标。 + * @param x2 包围椭圆的矩形右下角点位置的横坐标。 + * @param y2 包围椭圆的矩形右下角点位置的纵坐标。 + * @param startDeg 起始的角度。 + * @param sweepDeg 扫描的度数。 * @since 8 * @version 1.0 */ @@ -110,11 +110,11 @@ void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float * @brief 用于添加一条从路径最后点位置到目标点位置的二阶贝塞尔圆滑曲线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 - * @param ctrlX 参数为控制点位置的横坐标。 - * @param ctrlY 参数为控制点位置的纵坐标。 - * @param endX 参数为目标点位置的横坐标。 - * @param endY 参数为目标点位置的纵坐标。 + * @param OH_Drawing_Path 指向路径对象的指针。 + * @param ctrlX 控制点位置的横坐标。 + * @param ctrlY 控制点位置的纵坐标。 + * @param endX 目标点位置的横坐标。 + * @param endY 目标点位置的纵坐标。 * @since 8 * @version 1.0 */ @@ -124,13 +124,13 @@ void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float end * @brief 用于添加一条从路径最后点位置到目标点位置的三阶贝塞尔圆滑曲线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 - * @param ctrlX1 参数为第一个控制点位置的横坐标。 - * @param ctrlY1 参数为第一个控制点位置的纵坐标。 - * @param ctrlX2 参数为第二个控制点位置的横坐标。 - * @param ctrlY2 参数为第二个控制点位置的纵坐标。 - * @param endX 参数为目标点位置的横坐标。 - * @param endY 参数为目标点位置的纵坐标。 + * @param OH_Drawing_Path 指向路径对象的指针。 + * @param ctrlX1 第一个控制点位置的横坐标。 + * @param ctrlY1 第一个控制点位置的纵坐标。 + * @param ctrlX2 第二个控制点位置的横坐标。 + * @param ctrlY2 第二个控制点位置的纵坐标。 + * @param endX 目标点位置的横坐标。 + * @param endY 目标点位置的纵坐标。 * @since 8 * @version 1.0 */ @@ -141,7 +141,7 @@ void OH_Drawing_PathCubicTo( * @brief 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param OH_Drawing_Path 指向路径对象的指针。 * @since 8 * @version 1.0 */ @@ -151,7 +151,7 @@ void OH_Drawing_PathClose(OH_Drawing_Path*); * @brief 用于重置自定义路径数据。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path 参数为一个指向路径对象的指针。 + * @param OH_Drawing_Path 指向路径对象的指针。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h index 7cfccda8..e51db265 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h @@ -49,8 +49,8 @@ extern "C" { * @brief 用于创建一个坐标点对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param x 参数为X轴坐标。 - * @param y 参数为Y轴坐标。 + * @param x X轴坐标。 + * @param y Y轴坐标。 * @return 函数会返回一个指针,指针指向创建的坐标点对象。 * @since 11 * @version 1.0 @@ -61,7 +61,7 @@ OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y); * @brief 用于销毁坐标点对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Point 参数为一个指向坐标点对象的指针。 + * @param OH_Drawing_Point 指向坐标点对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h index 986fdd39..539e3831 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h @@ -49,10 +49,10 @@ extern "C" { * @brief 用于创建一个矩形对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param left 参数为矩形左上角的横坐标。 - * @param top 参数为矩形左上角的纵坐标。 - * @param right 参数为矩形右下角的横坐标。 - * @param bottom 参数为矩形右下角的纵坐标。 + * @param left 矩形左上角的横坐标。 + * @param top 矩形左上角的纵坐标。 + * @param right 矩形右下角的横坐标。 + * @param bottom 矩形右下角的纵坐标。 * @return 函数会返回一个指针,指针指向创建的矩形对象。 * @since 11 * @version 1.0 @@ -63,7 +63,7 @@ OH_Drawing_Rect* OH_Drawing_RectCreate(float left, float top, float right, float * @brief 用于销毁矩形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 + * @param OH_Drawing_Rect 指向矩形对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h index d864bd18..c9faf0c3 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -49,9 +49,9 @@ extern "C" { * @brief 用于创建一个圆角矩形对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect 参数为一个指向矩形对象的指针。 - * @param xRad 参数为X轴上的圆角半径。 - * @param yRad 参数为Y轴上的圆角半径。 + * @param OH_Drawing_Rect 指向矩形对象的指针。 + * @param xRad X轴上的圆角半径。 + * @param yRad Y轴上的圆角半径。 * @return 函数会返回一个指针,指针指向创建的圆角矩形对象。 * @since 11 * @version 1.0 @@ -62,7 +62,7 @@ OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate(const OH_Drawing_Rect*, float x * @brief 用于销毁圆角矩形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_RoundRect 参数为一个指向圆角矩形对象的指针。 + * @param OH_Drawing_RoundRect 指向圆角矩形对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index 4e025d97..cb2ffd1f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -76,10 +76,10 @@ typedef struct { * @brief 用于申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理,当调用OH_Drawing_TextBlobBuilderMake后禁止使用。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 - * @param OH_Drawing_Font 参数为一个指向字体对象的指针。 - * @param count 参数为文字的数量。 - * @param OH_Drawing_Rect 参数为文本的边界框。 + * @param OH_Drawing_TextBlobBuilder 指向文本构造器对象的指针。 + * @param OH_Drawing_Font 指向字体对象的指针。 + * @param count 文字的数量。 + * @param OH_Drawing_Rect 文本的边界框。 * @since 11 * @version 1.0 */ @@ -90,7 +90,7 @@ const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos(OH_Drawing_Tex * @brief 用于从文本构造器中创建文本对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 + * @param OH_Drawing_TextBlobBuilder 指向文本构造器对象的指针。 * @return 返回一个指针,指针指向创建的文本对象。 * @since 11 * @version 1.0 @@ -101,7 +101,7 @@ OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder*) * @brief 用于销毁文本对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlob 参数为一个指向文本对象的指针。 + * @param OH_Drawing_TextBlob 指向文本对象的指针。 * @since 11 * @version 1.0 */ @@ -111,7 +111,7 @@ void OH_Drawing_TextBlobDestroy(OH_Drawing_TextBlob*); * @brief 用于销毁文本构造器对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder 参数为一个指向文本构造器对象的指针。 + * @param OH_Drawing_TextBlobBuilder 指向文本构造器对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index d826d171..a3fb0b95 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -76,7 +76,7 @@ typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle; typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle; /** - * @brief 用于创建OH_Drawing_Typography{@link OH_Drawing_Typography}。 + * @brief 用于创建{@link OH_Drawing_Typography}。 * * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h index 20c7a368..efaaf537 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -60,7 +60,7 @@ OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); * @brief 用于销毁字形对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typeface 参数为一个指向字形对象的指针。 + * @param OH_Drawing_Typeface 指向字形对象的指针。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index 534cbc1b..13ce7f92 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -225,13 +225,13 @@ typedef enum { * 这些操作在4个颜色通道(红、绿、蓝、透明度)上是相同的。 * 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 * - * 为简洁起见,我们使用以下缩写。 - * s : source 源的缩写 - * d : destination 目标的缩写 - * sa : source alpha 源透明度的缩写 - * da : destination alpha 目标透明度的缩写 + * 为简洁起见,我们使用以下缩写: + * s : source 源的缩写。 + * d : destination 目标的缩写。 + * sa : source alpha 源透明度的缩写。 + * da : destination alpha 目标透明度的缩写。 * - * 计算结果用如下缩写表示 + * 计算结果用如下缩写表示: * r : 如果4个通道的计算方式相同,用r表示。 * ra : 如果只操作透明度通道,用ra表示。 * rc : 如果操作3个颜色通道,用rc表示。 @@ -242,9 +242,9 @@ typedef enum { typedef enum { /** 清除模式,r = 0. */ BLEND_MODE_CLEAR, - /** r = s(result的4个通道,都等于source的4个通道,即结果等于源) */ + /** r = s(result的4个通道,都等于source的4个通道,即结果等于源。) */ BLEND_MODE_SRC, - /** r = d(result的4个通道,都等于destination的4个通道,即结果等于目标) */ + /** r = d(result的4个通道,都等于destination的4个通道,即结果等于目标。) */ BLEND_MODE_DST, /** r = s + (1 - sa) * d. */ BLEND_MODE_SRC_OVER, -- Gitee From 56290226919197c0fbcac77d572accf3dcb2e046 Mon Sep 17 00:00:00 2001 From: sqwlly Date: Fri, 5 Jan 2024 17:15:05 +0800 Subject: [PATCH 0202/2135] code review Signed-off-by: s30029175 Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_color_filter.h | 8 ++++---- .../graphic/native_drawing/drawing_font_collection.h | 8 ++++---- .../graphic/native_drawing/drawing_mask_filter.h | 6 +++--- .../native_sdk/graphic/native_drawing/drawing_text_blob.h | 5 +++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h index cc924edf..6763f455 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h @@ -50,7 +50,7 @@ extern "C" { * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param color 表示颜色,是一个32位(ARGB)变量。 - * @param OH_Drawing_BlendMode 表示混合模式。 + * @param OH_Drawing_BlendMode 表示混合模式。支持可选的混合模式具体可见{@link OH_Drawing_BlendMode}枚举。 * @return 返回创建的颜色滤波器对象的指针。 * @since 11 * @version 1.0 @@ -58,11 +58,11 @@ extern "C" { OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode(uint32_t color, OH_Drawing_BlendMode); /** - * @brief 创建颜色滤波器应用颜色滤波器一,然后应用颜色滤波器二。 + * @brief 将两个颜色滤波器合成一个新的颜色滤波器。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_ColorFilter 表示指向颜色滤波器对象的指针。 - * @param OH_Drawing_ColorFilter 表示指向颜色滤波器对象的指针。 + * @param OH_Drawing_ColorFilter 指向颜色滤波器对象一的指针。 + * @param OH_Drawing_ColorFilter 指向颜色滤波器对象二的指针。 * @return 返回创建的颜色滤波器对象的指针。 * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 436a2d25..20b23458 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -45,20 +45,20 @@ extern "C" { #endif /** - * @brief 创建OH_Drawing_FontCollection{@link OH_Drawing_FontCollection}。 + * @brief 创建字体集对象{@link OH_Drawing_FontCollection}。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 指向创建的OH_Drawing_FontCollection对象的指针。 + * @return 指向创建的字体集对象的指针。 * @since 8 * @version 1.0 */ OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void); /** - * @brief 释放被OH_Drawing_FontCollection对象占据的内存。 + * @brief 释放被字体集对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection对象的指针。 + * @param OH_Drawing_FontCollection 指向字体集对象的指针。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h index b7ec5b34..8c47b30a 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -57,11 +57,11 @@ typedef enum { */ NORMAL, /** - * 内部坚实,外部模糊。 + * 内部实体,外部模糊。 */ SOLID, /** - * 里面空白,外部模糊。 + * 内部空白,外部模糊。 */ OUTER, /** @@ -76,7 +76,7 @@ typedef enum { * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param blurType 表示模糊类型。 * @param sigma 表示要应用的高斯模糊的标准偏差。必须大于0。 - * @param respectCTM 表示模糊标准差值被CTM修改,默认为正确。 + * @param respectCTM 表示模糊标准差值被CTM修改,默认为真。 * @return 返回创建的模板滤波器对象的指针。 * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index cb2ffd1f..4aa875e2 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -68,12 +68,13 @@ typedef struct { float* pos; /** 存储文字UTF-8编码 */ char* utf8text; - /** 存储文字簇 (UTF-8编码) */ + /** 存储文字簇UTF-8编码(簇指的是集合) */ uint32_t* clusters; } OH_Drawing_RunBuffer; /** - * @brief 用于申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理,当调用OH_Drawing_TextBlobBuilderMake后禁止使用。 + * @brief 申请一块内存,用于存储文字和位置信息。返回的指针无需调用者管理, + * 当调用{@link OH_Drawing_TextBlobBuilderMake}后禁止使用。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBlobBuilder 指向文本构造器对象的指针。 -- Gitee From 1e4b963a8612fa2d98ae271a4f20be516a38bef8 Mon Sep 17 00:00:00 2001 From: sqwlly Date: Sat, 6 Jan 2024 15:27:58 +0800 Subject: [PATCH 0203/2135] code review Signed-off-by: s30029175 Signed-off-by: sqwlly --- .../graphic/native_drawing/drawing_bitmap.h | 10 +++--- .../graphic/native_drawing/drawing_brush.h | 18 +++++----- .../graphic/native_drawing/drawing_canvas.h | 2 +- .../native_drawing/drawing_color_filter.h | 2 +- .../graphic/native_drawing/drawing_filter.h | 2 +- .../native_drawing/drawing_font_collection.h | 2 +- .../native_drawing/drawing_mask_filter.h | 2 +- .../graphic/native_drawing/drawing_pen.h | 34 +++++++++---------- .../native_drawing/drawing_shader_effect.h | 2 +- .../native_drawing/drawing_text_declaration.h | 2 +- .../native_drawing/drawing_text_typography.h | 2 +- .../graphic/native_drawing/drawing_types.h | 15 +++++--- 12 files changed, 50 insertions(+), 43 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index e77024e0..d300e029 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -72,7 +72,7 @@ OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void); * @brief 用于销毁位图对象并回收该对象占有内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @param OH_Drawing_Bitmap 指向位图对象的指针。 * @since 8 * @version 1.0 */ @@ -82,7 +82,7 @@ void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); * @brief 用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @param OH_Drawing_Bitmap 指向位图对象的指针。 * @param width 参数是位图要初始化设置的宽度。 * @param height 参数是位图要初始化设置的高度。 * @param OH_Drawing_BitmapFormat 参数是位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 @@ -96,7 +96,7 @@ void OH_Drawing_BitmapBuild( * @brief 用于获取指定位图的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @param OH_Drawing_Bitmap 指向位图对象的指针。 * @return 函数返回位图的宽度。 * @since 8 * @version 1.0 @@ -107,7 +107,7 @@ uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_Bitmap*); * @brief 用于获取指定位图的高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @param OH_Drawing_Bitmap 指向位图对象的指针。 * @return 函数返回位图的高度。 * @since 8 * @version 1.0 @@ -118,7 +118,7 @@ uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_Bitmap*); * @brief 用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap 参数是一个指向位图对象的指针。 + * @param OH_Drawing_Bitmap 指向位图对象的指针。 * @return 函数返回位图的像素地址。 * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index 8a18c487..048694d9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -59,7 +59,7 @@ OH_Drawing_Brush* OH_Drawing_BrushCreate(void); * @brief 用于销毁画刷对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 * @since 8 * @version 1.0 */ @@ -69,7 +69,7 @@ void OH_Drawing_BrushDestroy(OH_Drawing_Brush*); * @brief 用于获取画刷是否设置抗锯齿属性,如果为真则说明画刷会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 * @return 函数返回画刷对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。 * @since 8 * @version 1.0 @@ -80,7 +80,7 @@ bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); * @brief 用于设置画刷的抗锯齿属性,设置为真则画刷在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 * @param bool 参数真为抗锯齿,参数假则不做抗锯齿处理。 * @since 8 * @version 1.0 @@ -91,7 +91,7 @@ void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool); * @brief 用于获取画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 * @return 函数返回一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 @@ -102,8 +102,8 @@ uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*); * @brief 用于设置画刷的颜色属性,颜色属性描述了画刷填充图形时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 - * @param color 参数是一个描述颜色的32位(ARGB)变量。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 + * @param color 描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ @@ -124,7 +124,7 @@ uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush*); * @brief 为画刷设置透明度值。画刷在填充形状时透明通道会使用该值。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 * @param alpha 表示要设置的透明度值,是一个8位变量。 * @since 11 * @version 1.0 @@ -135,7 +135,7 @@ void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha); * @brief 为画刷设置着色器效果。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 * @param OH_Drawing_ShaderEffect 表示指向着色器对象的指针。 * @since 11 * @version 1.0 @@ -146,7 +146,7 @@ void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect* * @brief 为画刷设置滤波器{@link OH_Drawing_Filter}。滤波器是一个容器,可以承载蒙版滤波器和颜色滤波器。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush 参数是一个指向画刷对象的指针。 + * @param OH_Drawing_Brush 指向画刷对象的指针。 * @param OH_Drawing_Filter 表示指向滤波器对象的指针。 * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index 3548cf0f..afac4ddc 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -59,7 +59,7 @@ OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void); * @brief 用于销毁画布对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas 参数是一个指向画布对象的指针。 + * @param OH_Drawing_Canvas 指向画布对象的指针。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h index 6763f455..46381c69 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供二维图形渲染、文本绘制和图像显示等功能。 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h index bd799333..bf91c840 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供二维图形渲染、文本绘制和图像显示等功能。 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 20b23458..0a2a02e9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供2D绘制功能。 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h index 8c47b30a..1b748c9d 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供二维图形渲染、文本绘制和图像显示等功能。 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index 06132c1f..dd0439fa 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -59,7 +59,7 @@ OH_Drawing_Pen* OH_Drawing_PenCreate(void); * @brief 用于销毁画笔对象并回收该对象占有的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @since 8 * @version 1.0 */ @@ -69,7 +69,7 @@ void OH_Drawing_PenDestroy(OH_Drawing_Pen*); * @brief 用于获取画笔是否设置抗锯齿属性,如果为真则说明画笔会启用抗锯齿功能,在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @return 函数返回画笔对象是否设置抗锯齿属性,返回真则设置了抗锯齿,返回假则没有设置抗锯齿。 * @since 8 * @version 1.0 @@ -80,7 +80,7 @@ bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen*); * @brief 用于设置画笔的抗锯齿属性,设置为真则画笔在绘制图形时会对图形的边缘像素进行半透明的模糊处理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @param bool 参数真为抗锯齿,参数假则不做抗锯齿处理。 * @since 8 * @version 1.0 @@ -91,7 +91,7 @@ void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen*, bool); * @brief 用于获取画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @return 函数返回一个描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 @@ -102,8 +102,8 @@ uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen*); * @brief 用于设置画笔的颜色属性,颜色属性描述了画笔绘制图形轮廓时使用的颜色,用一个32位(ARGB)的变量表示。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 - * @param color 参数是一个描述颜色的32位(ARGB)变量。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 + * @param color 描述颜色的32位(ARGB)变量。 * @since 8 * @version 1.0 */ @@ -136,7 +136,7 @@ void OH_Drawing_PenSetAlpha(OH_Drawing_Pen*, uint8_t alpha); * @brief 用于获取画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @return 函数返回画笔的厚度。 * @since 8 * @version 1.0 @@ -147,8 +147,8 @@ float OH_Drawing_PenGetWidth(const OH_Drawing_Pen*); * @brief 用于设置画笔的厚度属性,厚度属性描述了画笔绘制图形轮廓的宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 - * @param width 参数是一个描述画笔厚度的变量。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 + * @param width 描述画笔厚度的变量。 * @since 8 * @version 1.0 */ @@ -158,7 +158,7 @@ void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width); * @brief 用于获取折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @return 函数返回尖角的限制值。 * @since 8 * @version 1.0 @@ -169,8 +169,8 @@ float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen*); * @brief 用于设置折线尖角的限制值,当画笔绘制一条折线,转角类型设置为尖角时,那么此时该属性用于限制出现尖角的长度范围,如果超出则平角显示,不超出依然为尖角。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 - * @param miter 参数是一个描述尖角限制值的变量。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 + * @param miter 描述尖角限制值的变量。 * @since 8 * @version 1.0 */ @@ -195,7 +195,7 @@ typedef enum { * @brief 用于获取画笔笔帽的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @return 函数返回画笔笔帽样式。 * @since 8 * @version 1.0 @@ -206,8 +206,8 @@ OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap(const OH_Drawing_Pen*); * @brief 用于设置画笔笔帽样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 - * @param OH_Drawing_PenLineCapStyle 参数是一个描述画笔笔帽样式的变量。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 + * @param OH_Drawing_PenLineCapStyle 描述画笔笔帽样式的变量。 * @since 8 * @version 1.0 */ @@ -232,7 +232,7 @@ typedef enum { * @brief 用于获取画笔绘制折线转角的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @return 函数返回折线转角的样式。 * @since 8 * @version 1.0 @@ -243,7 +243,7 @@ OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen*); * @brief 用于设置画笔绘制转角的样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen 参数是一个指向画笔对象的指针。 + * @param OH_Drawing_Pen 指向画笔对象的指针。 * @param OH_Drawing_PenLineJoinStyle 参数值一个描述折线转角样式的变量。 * @since 8 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h index a4aa2dcd..4807bdc9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供二维图形渲染、文本绘制和图像显示等功能。 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index a3fb0b95..d4830ab1 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供2D绘制功能。 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index d63a3171..adec1ca3 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief 提供2D绘制功能。 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index 13ce7f92..4fc0f7a1 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -226,14 +226,21 @@ typedef enum { * 对于这些,我们使用透明度通道作为示例,而不是单独命名每个通道。 * * 为简洁起见,我们使用以下缩写: - * s : source 源的缩写。 - * d : destination 目标的缩写。 - * sa : source alpha 源透明度的缩写。 - * da : destination alpha 目标透明度的缩写。 + * + * s : source,源的缩写。 + * + * d : destination,目标的缩写。 + * + * sa : source alpha,源透明度的缩写。 + * + * da : destination alpha,目标透明度的缩写。 * * 计算结果用如下缩写表示: + * * r : 如果4个通道的计算方式相同,用r表示。 + * * ra : 如果只操作透明度通道,用ra表示。 + * * rc : 如果操作3个颜色通道,用rc表示。 * * @since 11 -- Gitee From d8121275d00e915fa6ba5de08c044bc49ef12610 Mon Sep 17 00:00:00 2001 From: sqwlly Date: Sat, 6 Jan 2024 16:08:20 +0800 Subject: [PATCH 0204/2135] code review Signed-off-by: s30029175 Signed-off-by: sqwlly --- zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h | 6 +++--- zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_font.h | 4 ++-- .../native_sdk/graphic/native_drawing/drawing_mask_filter.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index d300e029..4b783cd9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -83,9 +83,9 @@ void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Bitmap 指向位图对象的指针。 - * @param width 参数是位图要初始化设置的宽度。 - * @param height 参数是位图要初始化设置的高度。 - * @param OH_Drawing_BitmapFormat 参数是位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 + * @param width 位图要初始化设置的宽度。 + * @param height 位图要初始化设置的高度。 + * @param OH_Drawing_BitmapFormat 位图要初始化设置的像素格式,包括像素的颜色类型和透明度类型。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index 048694d9..f8d58cdb 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -81,7 +81,7 @@ bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush 指向画刷对象的指针。 - * @param bool 参数真为抗锯齿,参数假则不做抗锯齿处理。 + * @param bool 真为抗锯齿,假则不做抗锯齿处理。 * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index afac4ddc..728a9f9d 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -307,7 +307,7 @@ void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*, * @param OH_Drawing_Canvas 指向画布对象的指针。 * @param OH_Drawing_Path 指向路径对象的指针。 * @param clipOp 裁剪方式。支持可选的具体裁剪方式可见@{link OH_Drawing_CanvasClipOp}枚举。 - * @param doAntiAlias 参数真为抗锯齿,参数假则不做抗锯齿处理。 + * @param doAntiAlias 真为抗锯齿,假则不做抗锯齿处理。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index 27ff409f..bbc3de54 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -82,7 +82,7 @@ void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font 指向字体对象的指针。 - * @param isLinearText 参数真为使能线性可缩放字体,参数假为不使能。 + * @param isLinearText 真为使能线性可缩放字体,假为不使能。 * @since 11 * @version 1.0 */ @@ -104,7 +104,7 @@ void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font 指向字体对象的指针。 - * @param isFakeBoldText 参数真为使能增加描边宽度,参数假为不使能。 + * @param isFakeBoldText 真为使能增加描边宽度,假为不使能。 * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h index 1b748c9d..5e3ebd79 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -46,7 +46,7 @@ extern "C" { #endif /** - * @brief 枚举模糊类型。 + * @brief 蒙版滤波器模糊操作类型的枚举。 * * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index dd0439fa..6daef580 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -81,7 +81,7 @@ bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 指向画笔对象的指针。 - * @param bool 参数真为抗锯齿,参数假则不做抗锯齿处理。 + * @param bool 真为抗锯齿,假则不做抗锯齿处理。 * @since 8 * @version 1.0 */ @@ -244,7 +244,7 @@ OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Pen 指向画笔对象的指针。 - * @param OH_Drawing_PenLineJoinStyle 参数值一个描述折线转角样式的变量。 + * @param OH_Drawing_PenLineJoinStyle 折线转角样式。 * @since 8 * @version 1.0 */ -- Gitee From 54d3067855798c2a909bfe10bb1e2192e9c9a94f Mon Sep 17 00:00:00 2001 From: lyj_love_code Date: Sat, 6 Jan 2024 17:00:11 +0800 Subject: [PATCH 0205/2135] feat: add hiappevent ndk doc Signed-off-by: lyj_love_code --- zh-cn/native_sdk/dfx/hiappevent.h | 365 ++++++++++++++++++++++++ zh-cn/native_sdk/dfx/hiappevent_cfg.h | 73 +++++ zh-cn/native_sdk/dfx/hiappevent_event.h | 84 ++++++ zh-cn/native_sdk/dfx/hiappevent_param.h | 83 ++++++ 4 files changed, 605 insertions(+) create mode 100644 zh-cn/native_sdk/dfx/hiappevent.h create mode 100644 zh-cn/native_sdk/dfx/hiappevent_cfg.h create mode 100644 zh-cn/native_sdk/dfx/hiappevent_event.h create mode 100644 zh-cn/native_sdk/dfx/hiappevent_param.h diff --git a/zh-cn/native_sdk/dfx/hiappevent.h b/zh-cn/native_sdk/dfx/hiappevent.h new file mode 100644 index 00000000..986aa37e --- /dev/null +++ b/zh-cn/native_sdk/dfx/hiappevent.h @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_H +#define HIVIEWDFX_HIAPPEVENT_H +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief HiAppEvent模块提供应用事件打点功能。 + * + * 为应用程序提供事件打点功能,记录运行过程中上报的故障事件、统计事件、安全事件和用户行为事件。基于事件信息,您可以分析应用的运行状态。 + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent.h + * + * @brief HiAppEvent模块的应用事件打点函数定义。 + * + * 在执行应用事件打点之前,您必须先构造一个参数列表对象来存储输入的事件参数,并指定事件领域、事件名称和事件类型。 + * + *

    事件领域:用于标识事件打点的领域的字符串。 + *

    事件名称:用于标识事件打点的名称的字符串。 + *

    事件类型:故障、统计、安全、行为。 + *

    参数列表:用于存储事件参数的链表,每个参数由参数名和参数值组成。 + * + * 示例代码: + * 00 引入头文件: + *

    + *     #include "hiappevent/hiappevent.h"
    + * 
    + * 01 创建一个参数列表指针: + *
    + *     ParamList list = OH_HiAppEvent_CreateParamList();
    + * 
    + * 02 添加参数到参数列表中: + *
    + *     bool boolean = true;
    + *     OH_HiAppEvent_AddBoolParam(list, "bool_key", boolean);
    + *     int32_t nums[] = {1, 2, 3};
    + *     OH_HiAppEvent_AddInt32ArrayParam(list, "int32_arr_key", nums, sizeof(nums) / sizeof(nums[0]));
    + * 
    + * 03 执行事件打点: + *
    + *     int res = OH_HiAppEvent_Write("test_domain", "test_event", BEHAVIOR, list);
    + * 
    + * 04 销毁参数列表指针,释放其分配内存: + *
    + *     OH_HiAppEvent_DestroyParamList(list);
    + * 
    + * + * @since 8 + * @version 1.0 + */ + +#include +#include + +#include "hiappevent_cfg.h" +#include "hiappevent_event.h" +#include "hiappevent_param.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 事件类型。 + * + * 建议您根据不同的使用场景选择不同的事件类型。 + * + * @since 8 + * @version 1.0 + */ +enum EventType { + /* 故障事件类型 */ + FAULT = 1, + + /* 统计事件类型 */ + STATISTIC = 2, + + /* 安全事件类型 */ + SECURITY = 3, + + /* 行为事件类型 */ + BEHAVIOR = 4 +}; + +/** + * @brief 事件参数列表节点。 + * + * @since 8 + * @version 1.0 + */ +typedef struct ParamListNode* ParamList; + +/** + * @brief 创建一个指向参数列表对象的指针。 + * + * @return 指向参数列表对象的指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_CreateParamList(void); + +/** + * @brief 销毁一个指向参数列表对象的指针,释放其分配内存。 + * + * @param list 参数列表对象指针。 + * @since 8 + * @version 1.0 + */ +void OH_HiAppEvent_DestroyParamList(ParamList list); + +/** + * @brief 添加一个布尔参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param boolean 需要添加的布尔参数值。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddBoolParam(ParamList list, const char* name, bool boolean); + +/** + * @brief 添加一个布尔数组参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param booleans 需要添加的布尔数组参数值。 + * @param arrSize 需要添加的参数数组大小。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddBoolArrayParam(ParamList list, const char* name, const bool* booleans, int arrSize); + +/** + * @brief 添加一个int8_t参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param num 需要添加的int8_t参数值。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt8Param(ParamList list, const char* name, int8_t num); + +/** + * @brief 添加一个int8_t数组参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param nums 需要添加的int8_t数组参数值。 + * @param arrSize 需要添加的参数数组大小。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt8ArrayParam(ParamList list, const char* name, const int8_t* nums, int arrSize); + +/** + * @brief 添加一个int16_t参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param num 需要添加的int16_t参数值。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt16Param(ParamList list, const char* name, int16_t num); + +/** + * @brief 添加一个int16_t数组参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param nums 需要添加的int16_t数组参数值。 + * @param arrSize 需要添加的参数数组大小。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt16ArrayParam(ParamList list, const char* name, const int16_t* nums, int arrSize); + +/** + * @brief 添加一个int32_t参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param num 需要添加的int32_t参数值。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt32Param(ParamList list, const char* name, int32_t num); + +/** + * @brief 添加一个int32_t数组参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param nums 需要添加的int32_t数组参数值。 + * @param arrSize 需要添加的参数数组大小。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt32ArrayParam(ParamList list, const char* name, const int32_t* nums, int arrSize); + +/** + * @brief 添加一个int64_t参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param num 需要添加的int64_t参数值。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt64Param(ParamList list, const char* name, int64_t num); + +/** + * @brief 添加一个int64_t数组参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param nums 需要添加的int64_t数组参数值。 + * @param arrSize 需要添加的参数数组大小。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt64ArrayParam(ParamList list, const char* name, const int64_t* nums, int arrSize); + +/** + * @brief 添加一个float参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param num 需要添加的float参数值。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddFloatParam(ParamList list, const char* name, float num); + +/** + * @brief 添加一个float数组参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param nums 需要添加的float数组参数值。 + * @param arrSize 需要添加的参数数组大小。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddFloatArrayParam(ParamList list, const char* name, const float* nums, int arrSize); + +/** + * @brief 添加一个double参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param num 需要添加的double参数值。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddDoubleParam(ParamList list, const char* name, double num); + +/** + * @brief 添加一个double数组参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param nums 需要添加的double数组参数值。 + * @param arrSize 需要添加的参数数组大小。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddDoubleArrayParam(ParamList list, const char* name, const double* nums, int arrSize); + +/** + * @brief 添加一个字符串参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param str 需要添加的字符串参数值。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddStringParam(ParamList list, const char* name, const char* str); + +/** + * @brief 添加一个字符串数组参数到参数列表中。 + * + * @param list 需要添加参数的参数列表指针。 + * @param name 需要添加的参数名称。 + * @param strs 需要添加的字符串数组参数值。 + * @param arrSize 需要添加的参数数组大小。 + * @return 添加参数后的参数列表指针。 + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddStringArrayParam(ParamList list, const char* name, const char * const *strs, int arrSize); + +/** + * @brief 实现对参数为列表类型的应用事件打点。 + * + * 在应用事件打点前,该接口会先对该事件的参数进行校验。如果校验成功,则接口会将事件写入事件文件。 + * + * @param domain 事件领域。您可以根据需要自定义事件领域。 + * @param name 事件名称。您可以根据需要自定义事件名称。 + * @param type 事件类型,在{@link EventType}中定义。 + * @param list 事件参数列表,每个参数由参数名和参数值组成。 + * @return 如果事件参数校验成功,则返回{@code 0},将事件写入事件文件;如果事件中存在无效参数,则返回正值,丢弃 + * 无效参数后将事件写入事件文件;如果事件参数校验失败,则返回负值,并且事件将不会写入事件文件。 + * @since 8 + * @version 1.0 + */ +int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType type, const ParamList list); + +/** + * @brief 实现应用事件打点的配置功能。 + * + * 应用事件打点配置接口,用于配置事件打点开关、事件文件目录存储配额大小等功能。 + * + * @param name 配置项名称。 + * @param value 配置项值。 + * @return 配置结果。 + * @since 8 + * @version 1.0 + */ +bool OH_HiAppEvent_Configure(const char* name, const char* value); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_H \ No newline at end of file diff --git a/zh-cn/native_sdk/dfx/hiappevent_cfg.h b/zh-cn/native_sdk/dfx/hiappevent_cfg.h new file mode 100644 index 00000000..c116db30 --- /dev/null +++ b/zh-cn/native_sdk/dfx/hiappevent_cfg.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_CONFIG_H +#define HIVIEWDFX_HIAPPEVENT_CONFIG_H + +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief HiAppEvent模块提供应用事件打点功能。 + * + * 为应用程序提供事件打点功能,记录运行过程中上报的故障事件、统计事件、安全事件和用户行为事件。基于事件信息,您可以分析应用的运行状态。 + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent_cfg.h + * + * @brief 定义事件打点配置函数的所有配置项名称。 + * + * 如果您想要对应用事件打点功能进行配置,您可以直接使用配置项常量。 + * + * 示例代码: + *
    + *     bool res = OH_HiAppEvent_Configure(MAX_STORAGE, "100M");
    + * 
    + * + * @since 8 + * @version 1.0 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 事件打点开关。 + * + * @since 8 + * @version 1.0 + */ +#define DISABLE "disable" + +/** + * @brief 事件文件目录存储配额大小。 + * + * @since 8 + * @version 1.0 + */ +#define MAX_STORAGE "max_storage" + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_CONFIG_H \ No newline at end of file diff --git a/zh-cn/native_sdk/dfx/hiappevent_event.h b/zh-cn/native_sdk/dfx/hiappevent_event.h new file mode 100644 index 00000000..3794ec70 --- /dev/null +++ b/zh-cn/native_sdk/dfx/hiappevent_event.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_EVENT_H +#define HIVIEWDFX_HIAPPEVENT_EVENT_H + +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief HiAppEvent模块提供应用事件打点功能。 + * + * 为应用程序提供事件打点功能,记录运行过程中上报的故障事件、统计事件、安全事件和用户行为事件。基于事件信息,您可以分析应用的运行状态。 + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent_event.h + * + * @brief 定义所有预定义事件的事件名称。 + * + * 除了与特定应用关联的自定义事件之外,您还可以使用预定义事件进行打点。 + * + * 示例代码: + *
    + *     ParamList list = OH_HiAppEvent_CreateParamList();
    + *     OH_HiAppEvent_AddInt32Param(list, PARAM_USER_ID, 123);
    + *     int res = OH_HiAppEvent_Write("user_domain", EVENT_USER_LOGIN, BEHAVIOR, list);
    + *     OH_HiAppEvent_DestroyParamList(list);
    + * 
    + * + * @since 8 + * @version 1.0 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 用户登录事件。 + * + * @since 8 + * @version 1.0 + */ +#define EVENT_USER_LOGIN "hiappevent.user_login" + +/** + * @brief 用户登出事件。 + * + * @since 8 + * @version 1.0 + */ +#define EVENT_USER_LOGOUT "hiappevent.user_logout" + +/** + * @brief 分布式服务事件。 + * + * @since 8 + * @version 1.0 + */ +#define EVENT_DISTRIBUTED_SERVICE_START "hiappevent.distributed_service_start" + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_EVENT_H \ No newline at end of file diff --git a/zh-cn/native_sdk/dfx/hiappevent_param.h b/zh-cn/native_sdk/dfx/hiappevent_param.h new file mode 100644 index 00000000..4c578c93 --- /dev/null +++ b/zh-cn/native_sdk/dfx/hiappevent_param.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_PARAM_H +#define HIVIEWDFX_HIAPPEVENT_PARAM_H + +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief HiAppEvent模块提供应用事件打点功能。 + * + * 为应用程序提供事件打点功能,记录运行过程中上报的故障事件、统计事件、安全事件和用户行为事件。基于事件信息,您可以分析应用的运行状态。 + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent_param.h + * + * @brief 定义所有预定义事件的参数名称。 + * + * 除了与特定应用关联的自定义事件之外,您还可以使用预定义事件进行打点。 + * + * 示例代码: + *
    + *     ParamList list = OH_HiAppEvent_CreateParamList();
    + *     OH_HiAppEvent_AddInt32Param(list, PARAM_USER_ID, 123);
    + *     int res = OH_HiAppEvent_Write("user_domain", EVENT_USER_LOGIN, BEHAVIOR, list);
    + *     OH_HiAppEvent_DestroyParamList(list);
    + * 
    + * + * @since 8 + * @version 1.0 + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 用户ID。 + * + * @since 8 + * @version 1.0 + */ +#define PARAM_USER_ID "user_id" + +/** + * @brief 分布式服务名称。 + * + * @since 8 + * @version 1.0 + */ +#define PARAM_DISTRIBUTED_SERVICE_NAME "ds_name" + +/** + * @brief 分布式服务实例ID。 + * + * @since 8 + * @version 1.0 + */ +#define PARAM_DISTRIBUTED_SERVICE_INSTANCE_ID "ds_instance_id" + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_PARAM_H \ No newline at end of file -- Gitee From 8054bbe6cb2af8d1ae8ab575bea90970d73555e2 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Sat, 6 Jan 2024 18:50:09 +0800 Subject: [PATCH 0206/2135] commit msg Signed-off-by: xuxuehai --- .../device_api/hdi/codec/v1_0/CodecTypes.idl | 126 ++++++++--------- .../hdi/codec/v2_0/CodecExtTypes.idl | 108 +++++++-------- .../device_api/hdi/codec/v2_0/CodecTypes.idl | 128 +++++++++--------- 3 files changed, 181 insertions(+), 181 deletions(-) diff --git a/zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl b/zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl index 12b3be71..a610cdd4 100644 --- a/zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl +++ b/zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl @@ -170,7 +170,70 @@ enum BitRateMode { BIT_RATE_MODE_VCBR, /**< 受约束的可变位速率。 */ BIT_RATE_MODE_ABR, /**< 平均比特率。 */ }; +//xuxuehai +/** + * @brief 枚举组件状态 + */ +enum CodecEventType { + CODEC_EVENT_CMD_COMPLETE, /**< 组件已成功完成命令 */ + CODEC_EVENT_ERROR, /**< 组件已检测到错误情况 */ + CODEC_EVENT_MARK, /**< 组件已检测到缓冲区标记 */ + CODEC_EVENT_PORT_SETTINGS_CHANGED, /**< 组件报告端口设置更改 */ + CODEC_EVENT_BUFFER_FLAG, /**< 组件已检测到EOS */ + CODEC_EVENT_RESOURCES_ACQUIRED, /**< 组件已被授予资源,并正在自动启动从OMX_StateWaitForResources状态更改为OMX_StateIdle */ + CODEC_EVENT_COMPONENT_RESUMED, /**< 组件回收由于重新占用的资源 */ + CODEC_EVENT_DYNAMIC_RESOURCES_AVAILABLE, /**< 组件已获取此前不可用的动态资源 */ + CODEC_EVENT_PORT_FORMAT_DETECTED, /**< 组件已经检测出数据格式 */ + CODEC_EVENT_KHRONOS_EXTENSIONS = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域 */ + CODEC_EVENT_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ + CODEC_EVENT_MAX = 0x7FFFFFFF, /**< 枚举的最大值 */ +}; + +/** + * @brief 枚举ICodecComponent中SendCommand接口的cmd参数 + */ +enum CodecCommandType +{ + CODEC_COMMAND_STATE_SET, /**< 更改组件状态 */ + CODEC_COMMAND_FLUSH, /**< 刷新组件的数据队列 */ + CODEC_COMMAND_PORT_DISABLE, /**< 禁用组件上的端口 */ + CODEC_COMMAND_PORT_ENABLE, /**< 启用组件上的端口 */ + CODEC_COMMAND_MARK_BUFFER, /**< 标记组件/缓冲区以进行观察 */ + CODEC_COMMAND_KHRONOS_EXTENSIONS = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域 */ + CODEC_COMMAND_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ + CODEC_COMMAND_MAX = 0x7FFFFFFF, /**< 枚举的最大值 */ +}; + +/** + * @brief 更改组件状态 + */ +enum CodecStateType +{ + CODEC_STATE_INVALID, /**< 组件已检测到其内部数据结构已损坏,以至于无法正确确定其状态 */ + CODEC_STATE_LOADED, /**< 组件已加载,但尚未完成初始化。ICodecComponent.SetParameter + 和ICodecComponent.GetParameter是允许发送到处于此状态的组件的唯一有效函数 */ + CODEC_STATE_IDLE, /**< 组件初始化已成功完成,组件已准备好启动 */ + CODEC_STATE_EXECUTING, /**< 组件已接受启动命令并正在处理数据(如果数据可用) */ + CODEC_STATE_PAUSE, /**< 组件已收到暂停命令 */ + CODEC_STATE_WAIT_FOR_RESOURCES, /**< 组件正在等待资源,无论是在抢占之后还是在获得请求的资源之前 */ + CODEC_STATE_KHRONOS_EXTENSIONS = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域 */ + CODEC_STATE_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ + CODEC_STATE_MAX = 0x7FFFFFFF, /**< 枚举最大值 */ +}; +/** + * @brief 表示端口供应商在两个端口之间建立隧道时的首选项 + */ +enum CodecBufferSupplierType +{ + CODEC_BUFFER_SUPPLY_UNSPECIFIED = 0, /**< 提供缓冲区的端口未指定,或不指定 */ + CODEC_BUFFER_SUPPLY_INPUT, /**< 为输入端口提供缓冲区 */ + CODEC_BUFFER_SUPPLY_OUTPUT, /**< 为输出端口提供缓冲区 */ + CODEC_BUFFER_SUPPLY_KHRONOS_EXTENSIONS = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域 */ + CODEC_BUFFER_SUPPLY_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ + CODEC_BUFFER_SUPPLY_MAX = 0x7FFFFFFF, /**< 枚举的最大值 */ +}; +//xuxuehai /** * @brief 对齐结构定义。 */ @@ -282,69 +345,6 @@ struct OmxCodecBuffer { unsigned int flag; /**< 缓冲区特定标志。 */ }; -/** - * @brief 枚举组件状态。 - */ -enum OMX_EVENTTYPE { - OMX_EventCmdComplete, /**< 组件已成功完成命令。 */ - OMX_EventError, /**< 组件已检测到错误情况。 */ - OMX_EventMark, /**< 组件已检测到缓冲区标记。 */ - OMX_EventPortSettingsChanged, /**< 组件报告端口设置更改。 */ - OMX_EventBufferFlag, /**< 组件已检测到EOS。 */ - OMX_EventResourcesAcquired, /**< 组件已被授予资源,并正在自动启动从OMX_StateWaitForResources状态更改为OMX_StateIdle。 */ - OMX_EventComponentResumed, /**< 组件回收由于重新占用的资源。 */ - OMX_EventDynamicResourcesAvailable, /**< 组件已获取此前不可用的动态资源。 */ - OMX_EventPortFormatDetected, /**< 组件已经检测出数据格式。 */ - OMX_EventKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ - OMX_EventVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ - OMX_EventMax = 0x7FFFFFFF, /**< 枚举的最大值。 */ -}; - -/** - * @brief 枚举ICodecComponent中SendCommand接口的cmd参数。 - */ -enum OMX_COMMANDTYPE -{ - OMX_CommandStateSet, /**< 更改组件状态。 */ - OMX_CommandFlush, /**< 刷新组件的数据队列。 */ - OMX_CommandPortDisable, /**< 禁用组件上的端口。 */ - OMX_CommandPortEnable, /**< 启用组件上的端口。 */ - OMX_CommandMarkBuffer, /**< 标记组件/缓冲区以进行观察。 */ - OMX_CommandKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ - OMX_CommandVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ - OMX_CommandMax = 0x7FFFFFFF /**< 枚举的最大值。 */ -}; - -/** - * @brief 更改组件状态。 - */ -enum OMX_STATETYPE -{ - OMX_StateInvalid, /**< 组件已检测到其内部数据结构已损坏,以至于无法正确确定其状态。 */ - OMX_StateLoaded, /**< 组件已加载,但尚未完成初始化。ICodecComponent.SetParameter - 和ICodecComponent.GetParameter是允许发送到处于此状态的组件的唯一有效函数。 */ - OMX_StateIdle, /**< 组件初始化已成功完成,组件已准备好启动。*/ - OMX_StateExecuting, /**< 组件已接受启动命令并正在处理数据(如果数据可用)。 */ - OMX_StatePause, /**< 组件已收到暂停命令。 */ - OMX_StateWaitForResources, /**< 组件正在等待资源,无论是在抢占之后还是在获得请求的资源之前。*/ - OMX_StateKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ - OMX_StateVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ - OMX_StateMax = 0x7FFFFFFF /**< 枚举最大值。 */ -}; - -/** - * @brief 表示端口供应商在两个端口之间建立隧道时的首选项。 - */ -enum OMX_BUFFERSUPPLIERTYPE -{ - OMX_BufferSupplyUnspecified = 0, /**< 提供缓冲区的端口未指定,或不指定。 */ - OMX_BufferSupplyInput, /**< 为输入端口提供缓冲区。 */ - OMX_BufferSupplyOutput, /**< 为输出端口提供缓冲区。 */ - OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ - OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ - OMX_BufferSupplyMax = 0x7FFFFFFF /**< 枚举的最大值。 */ -}; - /** * @brief 用于将数据从输出端口传递到输入端口。 */ diff --git a/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl b/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl index 0245a6db..e6d5407b 100644 --- a/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl +++ b/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl @@ -21,56 +21,56 @@ import ohos.hdi.codec.v2_0.CodecTypes; * @brief 视频编码格式枚举,对OMX原生枚举OMX_VIDEO_CODINGTYPE的补充。 */ enum CodecVideoExType { - CODEC_VIDEO_CodingVP9 = 10, /** VP9 序列号 */ - CODEC_VIDEO_CodingHEVC = 11, /** HEVC 序列号 */ + CODEC_VIDEO_CodingVP9 = 10, /** VP9格式 */ + CODEC_VIDEO_CodingHEVC = 11, /** HEVC格式 */ }; /** * @brief HEVC的profile枚举。 */ enum CodecHevcProfile { - CODEC_HEVC_PROFILE_INVALID = 0x0, - CODEC_HEVC_PROFILE_MAIN = 0x1, - CODEC_HEVC_PROFILE_MAIN10 = 0x2, - CODEC_HEVC_PROFILE_MAIN_STILL = 0x3, + CODEC_HEVC_PROFILE_INVALID = 0x0, /** 无效的profile */ + CODEC_HEVC_PROFILE_MAIN = 0x1, /** main profile */ + CODEC_HEVC_PROFILE_MAIN10 = 0x2, /** main10 profile */ + CODEC_HEVC_PROFILE_MAIN_STILL = 0x3, /** main still profile */ // 支持main_10 profile以及HDR SEI. - CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000, - CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000, - CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF + CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000, /** main10 hdr10 profile */ + CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000, /** main10 hdr10 plus profile */ + CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF /** 最大值 */ }; /** * @brief HEVC的level枚举。 */ enum CodecHevcLevel { - CODEC_HEVC_LEVEL_INVALID = 0x0, - CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1, - CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2, - CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4, - CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8, - CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10, - CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20, - CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40, - CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80, - CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100, - CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200, - CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400, - CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800, - CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000, - CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000, - CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000, - CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000, - CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000, - CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000, - CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000, - CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000, - CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000, - CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000, - CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000, - CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000, - CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000, - CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000, - CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF + CODEC_HEVC_LEVEL_INVALID = 0x0, /** 无效的level */ + CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1, /** main tier level1 */ + CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2, /** high tier level1 */ + CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4, /** main tier level2 */ + CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8, /** high tier level2 */ + CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10, /** main tier level2.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20, /** high tier level2.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40, /** main tier level3 */ + CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80, /** high tier level3 */ + CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100, /** main tier level3.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200, /** high tier level3.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400, /** main tier level4 */ + CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800, /** high tier level4 */ + CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000, /** main tier level4.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000, /** high tier level4.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000, /** main tier level5 */ + CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000, /** high tier level5 */ + CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000, /** main tier level5.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000, /** high tier level5.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000, /** main tier level5.2 */ + CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000, /** high tier level5.2 */ + CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000, /** main tier level6 */ + CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000, /** high tier level6 */ + CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000, /** main tier level6.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000, /** high tier level6.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000, /** main tier level6.2 */ + CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000, /** high tier level6.2 */ + CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF /** 最大值 */ }; /** @@ -128,7 +128,7 @@ struct CodecVideoPortFormatParam { unsigned int size; /** 结构体大小 */ union CodecVersionType version; /** 组件版本 */ unsigned int portIndex; /** 端口序列 */ - unsigned int codecColorIndex; + unsigned int codecColorIndex; /** 已废弃 */ unsigned int codecColorFormat; /** 像素格式 */ unsigned int codecCompressFormat; /** 压缩格式 */ unsigned int framerate; /** Q16 format */ @@ -206,10 +206,10 @@ struct CodecVideoParamHevc { * @brief 视频像素值范围 */ enum RangeType { - RANGE_UNSPECIFIED, - RANGE_FULL, - RANGE_LIMITED, - RANGE_MAX = 0xff, + RANGE_UNSPECIFIED, /** 未指定的range类型 */ + RANGE_FULL, /** full range */ + RANGE_LIMITED, /** limited range */ + RANGE_MAX = 0xff, /** 最大值 */ }; /** @@ -223,7 +223,7 @@ enum Primaries { PRIMARIES_BT601_525, //Rec. ITU-R BT.601-7 525 or SMPTE ST 170 or SMPTE ST 240 PRIMARIES_GENERICFILM, //Generic Film PRIMARIES_BT2020, //Rec. ITU-R BT.2020-2 or Rec. ITU-R BT.2100-2 - PRIMARIES_MAX = 0xff, + PRIMARIES_MAX = 0xff, //最大值 }; /** @@ -242,7 +242,7 @@ enum Transfer { TRANSFER_XVYCC, //IEC 61966-2-4 TRANSFER_BT1361, //Rec. ITU-R BT.1361-0 extended colour gamut system TRANSFER_ST428, //SMPTE ST 428-1 - TRANSFER_MAX = 0xff, + TRANSFER_MAX = 0xff, //最大值 }; /** @@ -256,17 +256,17 @@ enum MatrixCoeffs { MATRIX_SMPTE240, //SMPTE ST 240 MATRIX_BT2020, //Rec. ITU-R BT.2100-2 (非恒定亮度) MATRIX_BT2020CONSTANT, //Rec. ITU-R BT.2100-2 (恒定亮度) - MATRIX_MAX = 0xff, + MATRIX_MAX = 0xff, //最大值 }; /** * @brief 色彩空间相关枚举 */ struct ColorAspects { - enum RangeType range; - enum Primaries primaries; - enum Transfer transfer; - enum MatrixCoeffs matrixCoeffs; + enum RangeType range; /** 视频像素值范围 */ + enum Primaries primaries; /** 视频色域 */ + enum Transfer transfer; /** 视频传递函数 */ + enum MatrixCoeffs matrixCoeffs; /** 视频矩阵系数 */ }; /** @@ -276,9 +276,9 @@ struct CodecVideoColorspace { unsigned int size; /** 结构体大小 */ union CodecVersionType version; /** 组件版本 */ unsigned int portIndex; /** 端口序列 */ - unsigned int requestingDataSpace; - unsigned int dataSpaceChanged; - unsigned int pixeFormat; - unsigned int dataSpace; - struct ColorAspects aspects; + unsigned int requestingDataSpace; /** 请求颜色空间信息 */ + unsigned int dataSpaceChanged; /** 颜色空间信息发生变化 */ + unsigned int pixeFormat; /** 像素格式 */ + unsigned int dataSpace; /** 颜色空间 */ + struct ColorAspects aspects; /** 色彩空间 */ }; \ No newline at end of file diff --git a/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl b/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl index 6a92a80f..fa09cdd7 100644 --- a/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl +++ b/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl @@ -170,7 +170,70 @@ enum BitRateMode { BIT_RATE_MODE_VCBR, /**< 受约束的可变位速率。 */ BIT_RATE_MODE_ABR, /**< 平均比特率。 */ }; +//xuxuehai +/** + * @brief 枚举组件状态 + */ +enum CodecEventType { + CODEC_EVENT_CMD_COMPLETE, /**< 组件已成功完成命令 */ + CODEC_EVENT_ERROR, /**< 组件已检测到错误情况 */ + CODEC_EVENT_MARK, /**< 组件已检测到缓冲区标记 */ + CODEC_EVENT_PORT_SETTINGS_CHANGED, /**< 组件报告端口设置更改 */ + CODEC_EVENT_BUFFER_FLAG, /**< 组件已检测到EOS */ + CODEC_EVENT_RESOURCES_ACQUIRED, /**< 组件已被授予资源,并正在自动启动从OMX_StateWaitForResources状态更改为OMX_StateIdle */ + CODEC_EVENT_COMPONENT_RESUMED, /**< 组件回收由于重新占用的资源 */ + CODEC_EVENT_DYNAMIC_RESOURCES_AVAILABLE, /**< 组件已获取此前不可用的动态资源 */ + CODEC_EVENT_PORT_FORMAT_DETECTED, /**< 组件已经检测出数据格式 */ + CODEC_EVENT_KHRONOS_EXTENSIONS = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域 */ + CODEC_EVENT_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ + CODEC_EVENT_MAX = 0x7FFFFFFF, /**< 枚举的最大值 */ +}; + +/** + * @brief 枚举ICodecComponent中SendCommand接口的cmd参数 + */ +enum CodecCommandType +{ + CODEC_COMMAND_STATE_SET, /**< 更改组件状态 */ + CODEC_COMMAND_FLUSH, /**< 刷新组件的数据队列 */ + CODEC_COMMAND_PORT_DISABLE, /**< 禁用组件上的端口 */ + CODEC_COMMAND_PORT_ENABLE, /**< 启用组件上的端口 */ + CODEC_COMMAND_MARK_BUFFER, /**< 标记组件/缓冲区以进行观察 */ + CODEC_COMMAND_KHRONOS_EXTENSIONS = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域 */ + CODEC_COMMAND_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ + CODEC_COMMAND_MAX = 0x7FFFFFFF, /**< 枚举的最大值 */ +}; + +/** + * @brief 更改组件状态 + */ +enum CodecStateType +{ + CODEC_STATE_INVALID, /**< 组件已检测到其内部数据结构已损坏,以至于无法正确确定其状态 */ + CODEC_STATE_LOADED, /**< 组件已加载,但尚未完成初始化。ICodecComponent.SetParameter + 和ICodecComponent.GetParameter是允许发送到处于此状态的组件的唯一有效函数 */ + CODEC_STATE_IDLE, /**< 组件初始化已成功完成,组件已准备好启动 */ + CODEC_STATE_EXECUTING, /**< 组件已接受启动命令并正在处理数据(如果数据可用) */ + CODEC_STATE_PAUSE, /**< 组件已收到暂停命令 */ + CODEC_STATE_WAIT_FOR_RESOURCES, /**< 组件正在等待资源,无论是在抢占之后还是在获得请求的资源之前 */ + CODEC_STATE_KHRONOS_EXTENSIONS = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域 */ + CODEC_STATE_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ + CODEC_STATE_MAX = 0x7FFFFFFF, /**< 枚举最大值 */ +}; +/** + * @brief 表示端口供应商在两个端口之间建立隧道时的首选项 + */ +enum CodecBufferSupplierType +{ + CODEC_BUFFER_SUPPLY_UNSPECIFIED = 0, /**< 提供缓冲区的端口未指定,或不指定 */ + CODEC_BUFFER_SUPPLY_INPUT, /**< 为输入端口提供缓冲区 */ + CODEC_BUFFER_SUPPLY_OUTPUT, /**< 为输出端口提供缓冲区 */ + CODEC_BUFFER_SUPPLY_KHRONOS_EXTENSIONS = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域 */ + CODEC_BUFFER_SUPPLY_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ + CODEC_BUFFER_SUPPLY_MAX = 0x7FFFFFFF, /**< 枚举的最大值 */ +}; +//xuxuehai /** * @brief 对齐结构定义。 */ @@ -280,70 +343,7 @@ struct OmxCodecBuffer { enum ShareMemTypes type; /**< 共享内存类型。 */ long pts; /**< 缓冲区第一个逻辑样本时间戳。 */ unsigned int flag; /**< 缓冲区特定标志。 */ - unsigned char[] alongParam; /**< 随帧参数 */ -}; - -/** - * @brief 枚举组件状态。 - */ -enum OMX_EVENTTYPE { - OMX_EventCmdComplete, /**< 组件已成功完成命令。 */ - OMX_EventError, /**< 组件已检测到错误情况。 */ - OMX_EventMark, /**< 组件已检测到缓冲区标记。 */ - OMX_EventPortSettingsChanged, /**< 组件报告端口设置更改。 */ - OMX_EventBufferFlag, /**< 组件已检测到EOS。 */ - OMX_EventResourcesAcquired, /**< 组件已被授予资源,并正在自动启动从OMX_StateWaitForResources状态更改为OMX_StateIdle。 */ - OMX_EventComponentResumed, /**< 组件回收由于重新占用的资源。 */ - OMX_EventDynamicResourcesAvailable, /**< 组件已获取此前不可用的动态资源。 */ - OMX_EventPortFormatDetected, /**< 组件已经检测出数据格式。 */ - OMX_EventKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ - OMX_EventVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ - OMX_EventMax = 0x7FFFFFFF, /**< 枚举的最大值。 */ -}; - -/** - * @brief 枚举ICodecComponent中SendCommand接口的cmd参数。 - */ -enum OMX_COMMANDTYPE -{ - OMX_CommandStateSet, /**< 更改组件状态。 */ - OMX_CommandFlush, /**< 刷新组件的数据队列。 */ - OMX_CommandPortDisable, /**< 禁用组件上的端口。 */ - OMX_CommandPortEnable, /**< 启用组件上的端口。 */ - OMX_CommandMarkBuffer, /**< 标记组件/缓冲区以进行观察。 */ - OMX_CommandKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ - OMX_CommandVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ - OMX_CommandMax = 0x7FFFFFFF /**< 枚举的最大值。 */ -}; - -/** - * @brief 更改组件状态。 - */ -enum OMX_STATETYPE -{ - OMX_StateInvalid, /**< 组件已检测到其内部数据结构已损坏,以至于无法正确确定其状态。 */ - OMX_StateLoaded, /**< 组件已加载,但尚未完成初始化。ICodecComponent.SetParameter - 和ICodecComponent.GetParameter是允许发送到处于此状态的组件的唯一有效函数。 */ - OMX_StateIdle, /**< 组件初始化已成功完成,组件已准备好启动。*/ - OMX_StateExecuting, /**< 组件已接受启动命令并正在处理数据(如果数据可用)。 */ - OMX_StatePause, /**< 组件已收到暂停命令。 */ - OMX_StateWaitForResources, /**< 组件正在等待资源,无论是在抢占之后还是在获得请求的资源之前。*/ - OMX_StateKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ - OMX_StateVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ - OMX_StateMax = 0x7FFFFFFF /**< 枚举最大值。 */ -}; - -/** - * @brief 表示端口供应商在两个端口之间建立隧道时的首选项。 - */ -enum OMX_BUFFERSUPPLIERTYPE -{ - OMX_BufferSupplyUnspecified = 0, /**< 提供缓冲区的端口未指定,或不指定。 */ - OMX_BufferSupplyInput, /**< 为输入端口提供缓冲区。 */ - OMX_BufferSupplyOutput, /**< 为输出端口提供缓冲区。 */ - OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< 用于引入Khronos标准扩展的保留区域。 */ - OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< 用于引入供应商扩展的预留区域。 */ - OMX_BufferSupplyMax = 0x7FFFFFFF /**< 枚举的最大值。 */ + unsigned char[] alongParam; /**< 随帧参数 */ }; /** -- Gitee From 88faf96bce890f56a6b602e3ef8c18849fcab55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Sat, 6 Jan 2024 10:54:41 +0000 Subject: [PATCH 0207/2135] update zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- .../hdi/codec/v2_0/CodecExtTypes.idl | 98 +++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl b/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl index e6d5407b..47c08edc 100644 --- a/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl +++ b/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl @@ -29,48 +29,48 @@ enum CodecVideoExType { * @brief HEVC的profile枚举。 */ enum CodecHevcProfile { - CODEC_HEVC_PROFILE_INVALID = 0x0, /** 无效的profile */ - CODEC_HEVC_PROFILE_MAIN = 0x1, /** main profile */ - CODEC_HEVC_PROFILE_MAIN10 = 0x2, /** main10 profile */ - CODEC_HEVC_PROFILE_MAIN_STILL = 0x3, /** main still profile */ + CODEC_HEVC_PROFILE_INVALID = 0x0, /** 无效的profile */ + CODEC_HEVC_PROFILE_MAIN = 0x1, /** main profile */ + CODEC_HEVC_PROFILE_MAIN10 = 0x2, /** main10 profile */ + CODEC_HEVC_PROFILE_MAIN_STILL = 0x3, /** main still profile */ // 支持main_10 profile以及HDR SEI. - CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000, /** main10 hdr10 profile */ - CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000, /** main10 hdr10 plus profile */ - CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF /** 最大值 */ + CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000, /** main10 hdr10 profile */ + CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000, /** main10 hdr10 plus profile */ + CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF /** 最大值 */ }; /** * @brief HEVC的level枚举。 */ enum CodecHevcLevel { - CODEC_HEVC_LEVEL_INVALID = 0x0, /** 无效的level */ - CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1, /** main tier level1 */ - CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2, /** high tier level1 */ - CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4, /** main tier level2 */ - CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8, /** high tier level2 */ - CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10, /** main tier level2.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20, /** high tier level2.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40, /** main tier level3 */ - CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80, /** high tier level3 */ - CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100, /** main tier level3.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200, /** high tier level3.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400, /** main tier level4 */ - CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800, /** high tier level4 */ - CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000, /** main tier level4.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000, /** high tier level4.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000, /** main tier level5 */ - CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000, /** high tier level5 */ - CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000, /** main tier level5.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000, /** high tier level5.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000, /** main tier level5.2 */ - CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000, /** high tier level5.2 */ - CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000, /** main tier level6 */ - CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000, /** high tier level6 */ - CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000, /** main tier level6.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000, /** high tier level6.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000, /** main tier level6.2 */ - CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000, /** high tier level6.2 */ - CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF /** 最大值 */ + CODEC_HEVC_LEVEL_INVALID = 0x0, /** 无效的level */ + CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1, /** main tier level1 */ + CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2, /** high tier level1 */ + CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4, /** main tier level2 */ + CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8, /** high tier level2 */ + CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10, /** main tier level2.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20, /** high tier level2.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40, /** main tier level3 */ + CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80, /** high tier level3 */ + CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100, /** main tier level3.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200, /** high tier level3.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400, /** main tier level4 */ + CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800, /** high tier level4 */ + CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000, /** main tier level4.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000, /** high tier level4.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000, /** main tier level5 */ + CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000, /** high tier level5 */ + CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000, /** main tier level5.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000, /** high tier level5.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000, /** main tier level5.2 */ + CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000, /** high tier level5.2 */ + CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000, /** main tier level6 */ + CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000, /** high tier level6 */ + CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000, /** main tier level6.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000, /** high tier level6.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000, /** main tier level6.2 */ + CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000, /** high tier level6.2 */ + CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF /** 最大值 */ }; /** @@ -206,10 +206,10 @@ struct CodecVideoParamHevc { * @brief 视频像素值范围 */ enum RangeType { - RANGE_UNSPECIFIED, /** 未指定的range类型 */ - RANGE_FULL, /** full range */ - RANGE_LIMITED, /** limited range */ - RANGE_MAX = 0xff, /** 最大值 */ + RANGE_UNSPECIFIED, /** 未指定的range类型 */ + RANGE_FULL, /** full range */ + RANGE_LIMITED, /** limited range */ + RANGE_MAX = 0xff, /** 最大值 */ }; /** @@ -242,7 +242,7 @@ enum Transfer { TRANSFER_XVYCC, //IEC 61966-2-4 TRANSFER_BT1361, //Rec. ITU-R BT.1361-0 extended colour gamut system TRANSFER_ST428, //SMPTE ST 428-1 - TRANSFER_MAX = 0xff, //最大值 + TRANSFER_MAX = 0xff, //最大值 }; /** @@ -256,17 +256,17 @@ enum MatrixCoeffs { MATRIX_SMPTE240, //SMPTE ST 240 MATRIX_BT2020, //Rec. ITU-R BT.2100-2 (非恒定亮度) MATRIX_BT2020CONSTANT, //Rec. ITU-R BT.2100-2 (恒定亮度) - MATRIX_MAX = 0xff, //最大值 + MATRIX_MAX = 0xff, //最大值 }; /** * @brief 色彩空间相关枚举 */ struct ColorAspects { - enum RangeType range; /** 视频像素值范围 */ - enum Primaries primaries; /** 视频色域 */ - enum Transfer transfer; /** 视频传递函数 */ - enum MatrixCoeffs matrixCoeffs; /** 视频矩阵系数 */ + enum RangeType range; /** 视频像素值范围 */ + enum Primaries primaries; /** 视频色域 */ + enum Transfer transfer; /** 视频传递函数 */ + enum MatrixCoeffs matrixCoeffs; /** 视频矩阵系数 */ }; /** @@ -277,8 +277,8 @@ struct CodecVideoColorspace { union CodecVersionType version; /** 组件版本 */ unsigned int portIndex; /** 端口序列 */ unsigned int requestingDataSpace; /** 请求颜色空间信息 */ - unsigned int dataSpaceChanged; /** 颜色空间信息发生变化 */ - unsigned int pixeFormat; /** 像素格式 */ - unsigned int dataSpace; /** 颜色空间 */ - struct ColorAspects aspects; /** 色彩空间 */ + unsigned int dataSpaceChanged; /** 颜色空间信息发生变化 */ + unsigned int pixeFormat; /** 像素格式 */ + unsigned int dataSpace; /** 颜色空间 */ + struct ColorAspects aspects; /** 色彩空间 */ }; \ No newline at end of file -- Gitee From 1578aa3f88cd412d4eaf58d214ba10899bd178f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Sat, 6 Jan 2024 10:55:50 +0000 Subject: [PATCH 0208/2135] update zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl b/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl index fa09cdd7..c8505e64 100644 --- a/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl +++ b/zh-cn/device_api/hdi/codec/v2_0/CodecTypes.idl @@ -170,7 +170,7 @@ enum BitRateMode { BIT_RATE_MODE_VCBR, /**< 受约束的可变位速率。 */ BIT_RATE_MODE_ABR, /**< 平均比特率。 */ }; -//xuxuehai + /** * @brief 枚举组件状态 */ @@ -233,7 +233,7 @@ enum CodecBufferSupplierType CODEC_BUFFER_SUPPLY_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ CODEC_BUFFER_SUPPLY_MAX = 0x7FFFFFFF, /**< 枚举的最大值 */ }; -//xuxuehai + /** * @brief 对齐结构定义。 */ -- Gitee From 0906c7dd2d127d0fbe9a50d91417a397d4b70377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Sat, 6 Jan 2024 10:56:41 +0000 Subject: [PATCH 0209/2135] update zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl b/zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl index a610cdd4..78ecb53c 100644 --- a/zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl +++ b/zh-cn/device_api/hdi/codec/v1_0/CodecTypes.idl @@ -170,7 +170,7 @@ enum BitRateMode { BIT_RATE_MODE_VCBR, /**< 受约束的可变位速率。 */ BIT_RATE_MODE_ABR, /**< 平均比特率。 */ }; -//xuxuehai + /** * @brief 枚举组件状态 */ @@ -233,7 +233,7 @@ enum CodecBufferSupplierType CODEC_BUFFER_SUPPLY_VENDOR_START_UNUSED = 0x7F000000, /**< 用于引入供应商扩展的预留区域 */ CODEC_BUFFER_SUPPLY_MAX = 0x7FFFFFFF, /**< 枚举的最大值 */ }; -//xuxuehai + /** * @brief 对齐结构定义。 */ -- Gitee From 350d85d56d0bf31e5ad913c235542fa591d01c81 Mon Sep 17 00:00:00 2001 From: bao92 Date: Sun, 7 Jan 2024 10:10:28 +0800 Subject: [PATCH 0210/2135] add drm native interface Signed-off-by: bao92 --- .../native_sdk/media/drm/native_drm_common.h | 451 ++++++++++++++++++ zh-cn/native_sdk/media/drm/native_drm_err.h | 110 +++++ .../media/drm/native_mediakeysession.h | 214 +++++++++ .../media/drm/native_mediakeysystem.h | 285 +++++++++++ 4 files changed, 1060 insertions(+) create mode 100644 zh-cn/native_sdk/media/drm/native_drm_common.h create mode 100644 zh-cn/native_sdk/media/drm/native_drm_err.h create mode 100644 zh-cn/native_sdk/media/drm/native_mediakeysession.h create mode 100644 zh-cn/native_sdk/media/drm/native_mediakeysystem.h diff --git a/zh-cn/native_sdk/media/drm/native_drm_common.h b/zh-cn/native_sdk/media/drm/native_drm_common.h new file mode 100644 index 00000000..3ef3251c --- /dev/null +++ b/zh-cn/native_sdk/media/drm/native_drm_common.h @@ -0,0 +1,451 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drm + * @{ + * + * @brief 提供数字版权保护能力的API。 + * @kit Drm. + * @since 11 + * @version 1.0 + */ + +/** + * @file native_drm_common.h + * + * @brief 定义DRM数据类型 + * @library libnative_drm.z.so + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_DRM_COMMON_H +#define NATIVE_DRM_COMMON_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 监听类型. + * @syscap SystemCapability.Multimedia.Drm.Core. + * @since 11 + * @version 1.0 +*/ +typedef enum DRM_ListenerType { + /** + * DRM基础事件. + */ + LISTENER_DRM_EVENT = 200, + /** + * 设备证书请求事件. + */ + LISTENER_PROVISION_REQUIRED = 201, + /** + * 密钥请求事件. + */ + LISTENER_KEY_REQUIRED = 202, + /** + * 密钥过期事件. + */ + LISTENER_KEY_EXPIRED = 203, + /** + * 第三方定义事件. + */ + LISTENER_VENDOR_DEFINED = 204, + /** + * 密钥过期更新事件. + */ + LISTENER_EXPIRATION_UPDATE = 206, + } DRM_ListenerType; + +/** + * @brief 内容保护级别类型. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_ContentProtectionLevel { + /** + * 未知级别. + */ + CONTENT_PROTECTION_LEVEL_UNKNOWN = 0, + /** + * 软件安全级别. + */ + CONTENT_PROTECTION_LEVEL_SW_CRYPTO, + /** + * 硬件安全级别. + */ + CONTENT_PROTECTION_LEVEL_HW_CRYPTO, + /** + * 硬件增强级别. + */ + CONTENT_PROTECTION_LEVEL_ENHANCED_HW_CRYPTO, + /** + * 最大安全级别. + */ + CONTENT_PROTECTION_LEVEL_MAX, +} DRM_ContentProtectionLevel; + +/** + * @brief 许可证类型. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_MediaKeyType { + /** + * Media key type offline. + */ + MEDIA_KEY_TYPE_OFFLINE = 0, + /** + * Media key type online + */ + MEDIA_KEY_TYPE_ONLINE, +} DRM_MediaKeyType; + +/** + * @brief 许可证请求类型e. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_MediaKeyRequestType { + /** + * 未知请求类型. + */ + MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, + /** + * 初始化请求. + */ + MEDIA_KEY_REQUEST_TYPE_INITIAL, + /** + * 续订请求. + */ + MEDIA_KEY_REQUEST_TYPE_RENEWAL, + /** + * 释放请求. + */ + MEDIA_KEY_REQUEST_TYPE_RELEASE, + /** + * 无请求. + */ + MEDIA_KEY_REQUEST_TYPE_NONE, + /** + * 更新请求. + */ + MEDIA_KEY_REQUEST_TYPE_UPDATE, +} DRM_MediaKeyRequestType; + +/** + * @brief 离线许可证状态. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_OfflineMediaKeyStatus { + /** + * 未知状态. + */ + OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, + /** + * 可用状态e. + */ + OFFLINE_MEDIA_KEY_STATUS_USABLE, + /** + * 失活状态. + */ + OFFLINE_MEDIA_KEY_STATUS_INACTIVE, +} DRM_OfflineMediaKeyStatus; + +/** + * @brief 设备证书状态类型. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_CertificateStatus { + /** + * 设备已安装设备证书. + */ + CERT_STATUS_PROVISIONED = 0, + /** + * 设备未安装设备证书. + */ + CERT_STATUS_NOT_PROVISIONED, + /** + * 设备证书过期. + */ + CERT_STATUS_EXPIRED, + /** + * 无效设备证书. + */ + CERT_STATUS_INVALID, + /** + * 设备证书不可用. + */ + CERT_STATUS_UNAVAILABLE, +} DRM_CertificateStatus; + +/** + * @brief 在线许可证状态. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_MediaKeyStatus { + /** + * 可用状态. + */ + MEDIA_KEY_STATUS_OK = 0, + /** + * 许可证不存在. + */ + MEDIA_KEY_STATUS_UNAVAILABLE = 1, +} DRM_MediaKeyStatus; + +/** + * @brief DRM uint_8 数组类型. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_Uint8Buffer { + /** + * 数组首地址. + */ + unsigned char *buffer; + /** + * 数组长度. + */ + uint32_t bufferLen; +} DRM_Uint8Buffer; + +/** + * @brief DRM 字符数组类型. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_CharBuffer { + /** + * 数组首地址. + */ + char *buffer; + /** + * 数组长度. + */ + uint32_t bufferLen; +} DRM_CharBuffer; + +/** + * @brief 名值对. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_CharBufferPair { + /* 名字. */ + DRM_CharBuffer name; + /* 值. */ + DRM_CharBuffer value; +} DRM_CharBufferPair; + +/** + * @brief 名值对. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_Uint8CharBufferPair { + /* 名字. */ + DRM_Uint8Buffer key; + /* 值. */ + DRM_CharBuffer value; +} DRM_Uint8CharBufferPair; + +/** + * @brief 许可证请求参数类型. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeyRequestInfo { + /** + * 许可证类型. + */ + DRM_MediaKeyType type; + /** + * base64编码后的pssh数据. + */ + DRM_Uint8Buffer data; + /** + * 媒体类型. + */ + DRM_CharBuffer mimeType; + /** + * 操作数数组长度. + */ + uint32_t optionsCount; + /** + * 操作数数组. + */ + DRM_CharBufferPair optionsData[0]; +} DRM_MediaKeyRequestInfo; + +/** + * @brief 许可证请求类型. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeyRequest { + /** + * 许可证请求类型. + */ + DRM_MediaKeyRequestType type; + /** + * 许可证请求数据. + */ + DRM_Uint8Buffer data; + /** + * 许可证服务器URL. + */ + DRM_CharBuffer defaultUrl; +} DRM_MediaKeyRequest; + +/** + * @brief DRM度量统计信息. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_Statistics { + /* 度量信息数组长度. */ + uint32_t statisticsCount; + /* 度量信息数组. */ + DRM_CharBufferPair info[0]; +} DRM_Statistics; + +/** + * @brief 离线许可证Id数组. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediakeyIdArray { + /* 许可证Id数组长度. */ + uint32_t mediaKeyIdCount; + /* 许可证Id数组. */ + DRM_Uint8Buffer mediaKeyIds[0]; +} DRM_MediakeyIdArray; + +/** + * @brief 密钥信息. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_KeysInfo { + /* 密钥信息数组长度. */ + uint32_t keysCount; + /* 密钥信息数组. */ + DRM_Uint8CharBufferPair keysInfo[0]; +} DRM_KeysInfo; + +/** + * @brief 在线许可证描述信息 + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeyDescription { + /* 许可证信息数组长度. */ + uint32_t mediaKeyCount; + /* 许可证信息数组. */ + DRM_CharBufferPair description[0]; +} DRM_MediaKeyDescription; + +/** + * @brief DRM插件类型名. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +#define DRM_UUID_LEN 16 + +/** + * @brief DRM Pssh信息. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_PsshInfo { + /** + * DRM插件类型名. + */ + char uuid[DRM_UUID_LEN]; + /** + * PSSH数据长度. + */ + uint32_t dataLen; + /** + * PSSH数据. + */ + unsigned char *data; +} DRM_PsshInfo; + +/** + * @brief 从媒体源获取的drm信息. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeySystemInfo { + /* PSSH信息数组长度. */ + uint32_t psshCount; + /* PSSH信息数组. */ + DRM_PsshInfo psshInfo[0]; +} DRM_MediaKeySystemInfo; + +typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeySystemInfo); + +/** + * @brief MediaKeySystem结构体. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct MediaKeySystem MediaKeySystem; + +/** + * @brief MediaKeySession结构体. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef struct MediaKeySession MediaKeySession; + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_DRM_COMMON_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/drm/native_drm_err.h b/zh-cn/native_sdk/media/drm/native_drm_err.h new file mode 100644 index 00000000..8e1e9efd --- /dev/null +++ b/zh-cn/native_sdk/media/drm/native_drm_err.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drm + * @{ + * + * @brief 提供数字版权保护能力的API。 + * @kit Drm. + * @since 11 + * @version 1.0 + */ + +/** + * @file native_drm_err.h + * @brief 定义DRM错误码 + * @library libnative_drm.z.so + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_DRM_ERR_H +#define NATIVE_DRM_ERR_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief DRM 错误码 + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum Drm_ErrCode { + /** + * 操作成功完成。 + */ + DRM_ERR_OK = 0, + /** + * 内存不足。 + */ + DRM_ERR_NO_MEMORY, + /** + * 不支持的操作。 + */ + DRM_ERR_OPERATION_NOT_PERMITTED, + /** + * 无效参数。 + */ + DRM_ERR_INVALID_VAL, + /** + * IO 错误。 + */ + DRM_ERR_IO, + /** + * 网络超时。 + */ + DRM_ERR_TIMEOUT, + /** + * 未知错误。 + */ + DRM_ERR_UNKNOWN, + /** + * drm服务挂死。 + */ + DRM_ERR_SERVICE_DIED, + /** + * 无效的操作状态。 + */ + DRM_ERR_INVALID_STATE, + /** + * 不支持的操作。 + */ + DRM_ERR_UNSUPPORTED, + /** + * MediaKeySystem最大实例数。 + */ + DRM_ERR_MAX_SYSTEM_NUM_REACHED, + /** + * MediaKeySession最大实例数。 + */ + DRM_ERR_MAX_SESSION_NUM_REACHED, + /** + * 扩展错误。 + */ + DRM_ERR_EXTEND_START = 100, +} Drm_ErrCode; + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_DRM_ERR_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysession.h b/zh-cn/native_sdk/media/drm/native_mediakeysession.h new file mode 100644 index 00000000..846d568f --- /dev/null +++ b/zh-cn/native_sdk/media/drm/native_mediakeysession.h @@ -0,0 +1,214 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drm + * @{ + * + * @brief 提供数字版权保护能力的API。 + * @kit Drm. + * @since 11 + * @version 1.0 + */ + +/** + * @file native_mediakeysession.h + * @brief 定义Drm MediaKeySession API。提供以下功能: + * 生成媒体密钥请求、处理媒体密钥响应、事件侦听、获取内容保护级别、 + * 检查媒体密钥状态、删除媒体密钥等。 + * @library libnative_drm.z.so + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ + +#ifndef OHOS_DRM_NATIVE_MEDIA_KEY_SESSION_H +#define OHOS_DRM_NATIVE_MEDIA_KEY_SESSION_H + +#include +#include +#include "native_drm_err.h" +#include "native_drm_common.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief 事件触发时将调用的回调。 + * @param eventType 事件类型。 + * @param eventInfo 从MediaKeySystem中获取的事件信息。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +typedef Drm_ErrCode (*MediaKeySession_EventCallback)(DRM_ListenerType eventType, DRM_Uint8CharBufferPair *eventInfo); + +/** + * @brief 注册监听,监听密钥变化。 + * @param keysInfo 密钥信息。 + * @param newKeysAvailable 新密钥释放可用。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +typedef Drm_ErrCode (*MediaKeySession_KeyChangeCallback)(DRM_KeysInfo *keysInfo, bool newKeysAvailable); + +/** + * @brief MediaKeySession回调结构体, 用来监听密钥过期、密钥变化等事件。 + * @since 11 + * @version 1.0 + */ +typedef struct MediaKeySession_Callback { + /** + * KeySession回调事件,如许可证过期。 + */ + MediaKeySession_EventCallback eventCallback; + /** + * 密钥变化事件触发的keyChange事件。 + */ + MediaKeySession_KeyChangeCallback keyChangeCallback; +} MediaKeySession_Callback; + +/** + * @brief 生成许可证请求。 + * @param mediaKeySession mediaKeySession实例。 + * @param info 许可证请求信息。 + * @param mediaKeyRequest 许可证请求 + * @return Drm_ErrCode. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_GenerateMediaKeyRequest(MediaKeySession *mediaKeySession, + DRM_MediaKeyRequestInfo *info, DRM_MediaKeyRequest **mediaKeyRequest); + +/** + * @brief 处理许可证响应。 + * @param mediaKeySession mediaKeySession实例。 + * @param response 许可证响应。 + * @param mediaKeyId 许可证Id。 + * @param mediaKeyIdLen 许可证Id长度。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse(MediaKeySession *keySession, + DRM_Uint8Buffer *response, unsigned char **mediaKeyId, int32_t *mediaKeyIdLen); + +/** + * @brief 检查许可证状态. + * @param mediaKeySession mediaKeySession实例。 + * @param mediaKeyDescription 许可证状态描述。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus(MediaKeySession *mediaKeySessoin, + DRM_MediaKeyDescription **mediaKeyDescription); + +/** + * @brief 清除当前会话的许可证 . + * @param mediaKeySession mediaKeySession实例。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin); + +/** + * @brief 生成离线许可证释放请求。 + * @param mediaKeySession mediaKeySession实例。 + * @param mediaKeyId 许可证Id。 + * @param releaseRequest 离线许可证请求。 + * @param releaseRequestLen 离线许可证请求长度。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *mediaKeySessoin, + DRM_Uint8Buffer *mediaKeyId, unsigned char **releaseRequest, int32_t *releaseRequestLen); + +/** + * @brief 处理离线许可证释放响应。 + * @param mediaKeySession mediaKeySession实例。 + * @param mediaKeyId 许可证Id。 + * @param releaseReponse 许可证响应。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse(MediaKeySession *mediaKeySessoin, + DRM_Uint8Buffer *mediaKeyId, DRM_Uint8Buffer *releaseReponse); + +/** + * @brief 根据许可证ID恢复对应许可证状态。 + * @param mediaKeySession mediaKeySession实例。 + * @param mediaKeyId 许可证Id。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys(MediaKeySession *mediaKeySessoin, + DRM_Uint8Buffer *mediaKeyId); + +/** + * @brief 获取当前会话的内容保护级别。 + * @param mediaKeySession mediaKeySession实例。 + * @param contentProtectionLevel 内容保护级别。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_GetContentProtectionLevel(MediaKeySession *mediaKeySessoin, + DRM_ContentProtectionLevel *contentProtectionLevel); + +/** + * @brief 查询是否需要安全解码. + * @param mediaKeySession mediaKeySession实例。 + * @param mimeType 媒体类型。 + * @param status 是否安全解码。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_RequireSecureDecoderModule(MediaKeySession *mediaKeySessoin, + const char *mimeType, bool *status); + +/** + * @brief 设置MediaKeySession事件回调。 + * @param mediaKeySession mediaKeySession实例。 + * @param callback 设置到MediaKeySession中的回调. + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *mediaKeySessoin, + MediaKeySession_Callback *callback); + +/** + * @brief MediaKeySession资源销毁. + * @param mediaKeySession mediaKeySession实例。 + * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_Destroy(MediaKeySession *mediaKeySessoin); + +#ifdef __cplusplus +} +#endif + +#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h new file mode 100644 index 00000000..5ce82d5f --- /dev/null +++ b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h @@ -0,0 +1,285 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drm + * @{ + * + * @brief 提供数字版权保护能力的API。 + * @kit Drm. + * @since 11 + * @version 1.0 + */ + +/** + * @file native_mediakeysystem.h + * @brief 定义Drm MediaKeySystem API。提供以下功能: + * 查询是否支持特定的drm,创建媒体密钥会话,获取和设置配置, + * 获取统计信息,获取内容保护级别,生成提供请求,处理提供响应, + * 事件监听,获取内容防护级别,管理离线媒体密钥等。 + * @library libnative_drm.z.so + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ + +#ifndef OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H +#define OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H + +#include +#include +#include +#include "native_drm_err.h" +#include "native_drm_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 事件触发时将调用的回调。 + * @param eventType 事件类型。 + * @param eventInfo MediaKeySystem获取到的事件信息。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +typedef Drm_ErrCode (*MediaKeySystem_Callback)(DRM_ListenerType eventType, DRM_Uint8CharBufferPair *eventInfo); +/** + * @brief 通过MediaKeySystem方案唯一编号获取MediaKeySystem方案名。 + * @param uuid MediaKeySystem方案唯一编号。 + * @param name MediaKeySystem方案名。 + * @param nameLen MediaKeySystem方案名长度。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetMediaKeySystemName(const char *uuid, unsigned char **name, int32_t *nameLen); + +/** + * @brief 查询设备是否支持指定MediaKeySystem方案。 + * @param name MediaKeySystem方案名。 + * @return 支持与否。 + * @since 11 + * @version 1.0 + */ +bool OH_MediaKeySystem_IsSupported(const char *name); +/** + * @brief 查询设备是否支持指定MediaKeySystem方案、指定媒体类型。 + * @param name MediaKeySystem方案名。 + * @param mimeType 媒体类型。 + * @return 支持与否。 + * @since 11 + * @version 1.0 + */ +bool OH_MediaKeySystem_IsSupported2(const char *name, const char *mimeType); +/** + * @brief 查询设备是否支持指定MediaKeySystem方案、指定媒体类型、指定内容保护级别。 + * @param name MediaKeySystem方案名。 + * @param mimeType 媒体类型。 + * @param contentProtectionLevel 内容保护级别。 + * @return 支持与否。 + * @since 11 + * @version 1.0 + */ +bool OH_MediaKeySystem_IsSupported3(const char *name, const char *mimeType, + DRM_ContentProtectionLevel contentProtectionLevel); + +/** + * @brief 根据方案名创建一个MediaKeySystem实例。 + * @param name MediaKeySystem方案名 + * @param mediaKeySystem MediaKeySystem实例。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * 达到MediaKeySession实例最大数量返回{@link DRM_ERR_MAX_SYSTEM_NUM_REACHED}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_Create(const char *name, MediaKeySystem **mediaKeySystem); +/** + * @brief 通过配置名设置MediaKeySystem的配置值。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param configName 字符串类型配置名。 + * @param value 字符串形式配置值。 + * @param valueLen 字符串形式配置值长度。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_SetConfigurationString(MediaKeySystem *mediaKeySystem, + const char *configName, const char *value); +/** + * @brief 通过配置名获取MediaKeySystem的配置值。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param configName 字符串类型配置名。 + * @param value 字符串形式配置值。 + * @param valueLen 字符串形式配置值长度。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetConfigurationString(MediaKeySystem *mediaKeySystem, + const char *configName, char **value, int32_t *valueLen); +/** + * @brief 通过配置名设置MediaKeySystem的配置值。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param configName 字符串类型配置名。 + * @param value 字节数组形式配置值。 + * @param valueLen 字节数组形式配置值长度。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_SetConfigurationByteArray(MediaKeySystem *mediaKeySystem, + const char *configName, DRM_Uint8Buffer *value); +/** + * @brief 通过配置名获取MediaKeySystem的配置值。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param configName 字符串类型配置名。 + * @param value 字节数组形式配置值。 + * @param valueLen 字节数组形式配置值长度。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray(MediaKeySystem *mediaKeySystem, + const char *configName, unsigned char **value, int32_t *valueLen); +/** + * @brief 获取MediaKeySystem的度量统计信息。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param statistics 度量统计信息。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetStatistics(MediaKeySystem *mediaKeySystem, DRM_Statistics **statistics); +/** + * @brief 获取MediaKeySystem支持的最大内容保护级别。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param contentProtectionLevel 内容保护级别。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetMaxContentProtectionLevel(MediaKeySystem *mediaKeySystem, + DRM_ContentProtectionLevel *contentProtectionLevel); +/** + * @brief 设置MediaKeySystem回调监听。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param callback 设置到MediaKeySystem中的回调函数。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_SetMediaKeySystemCallback(MediaKeySystem *mediaKeySystem, + MediaKeySystem_Callback callback); + +/** + * @brief 创建一个MediaKeySession实例。 + * @param mediaKeySystem 用来创建MediaKeySession实例的MediaKeySystem实例。 + * @param level 内容保护级别。 + * @param mediaKeySession MediaKeySession实例。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * 达到MediaKeySession实例最大数量返回{@link DRM_ERR_MAX_SESSION_NUM_REACHED}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_CreateMediaKeySession(MediaKeySystem *mediaKeySystem, + DRM_ContentProtectionLevel *level, MediaKeySession **mediaKeySession); + +/** + * @brief 生成设备证书请求。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param request Provision请求数据。 + * @param requestLen Provision请求长度。 + * @param defaultUrl Provision服务器URL。 + * @param defaultUrlLen Provision服务器URL长度。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest(MediaKeySystem *mediaKeySystem, unsigned char **request, + int32_t *requestLen, char **defaultUrl, int32_t *defaultUrlLen); + +/** + * @brief 处理设备证书响应。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param response 设备证书响应。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_ProcessKeySystemResponse(MediaKeySystem *mediaKeySystem, + DRM_Uint8Buffer *response); + +/** + * @brief 获取离线许可证状态。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param mediaKeyIds 离线许可证Id。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyIds(MediaKeySystem *mediaKeySystem, + DRM_MediakeyIdArray **mediaKeyIds); + +/** + * @brief 获取离线许可证状态。 + * @param mediaKeySystem MediaKeySystem实例。 + * @param mediaKeyId 许可证Id。 + * @param status 获取到的许可证状态。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyStatus(MediaKeySystem *mediaKeySystem, + DRM_Uint8Buffer *mediaKeyId, DRM_OfflineMediaKeyStatus *status); + +/** + * @brief 根据许可证Id清理许可证. + * @param mediaKeySystem MediaKeySystem实例。 + * @param mediaKeyId 许可证Id. + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_ClearOfflineMediaKeys(MediaKeySystem *mediaKeySystem, + DRM_Uint8Buffer *mediaKeyId); + +/** + * @brief 获取设备证书状态. + * @param mediaKeySystem MediaKeySystem实例。 + * @param certStatus 获取的设备证书状态。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetCertificateStatus(MediaKeySystem *mediaKeySystem, + DRM_CertificateStatus *certStatus); + +/** + * @brief 销毁MediaKeySystem实例。 + * @param mediaKeySystem 被销毁的MediaKeySystem实例。 + * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_Destroy(MediaKeySystem *mediaKeySystem); + + +#ifdef __cplusplus +} +#endif + +#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H \ No newline at end of file -- Gitee From 91271e40b838d02082f608e06f59c59e207181dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Mon, 8 Jan 2024 01:41:58 +0000 Subject: [PATCH 0211/2135] update zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- .../hdi/codec/v2_0/CodecExtTypes.idl | 180 +++++++++--------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl b/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl index 47c08edc..10007287 100644 --- a/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl +++ b/zh-cn/device_api/hdi/codec/v2_0/CodecExtTypes.idl @@ -21,56 +21,56 @@ import ohos.hdi.codec.v2_0.CodecTypes; * @brief 视频编码格式枚举,对OMX原生枚举OMX_VIDEO_CODINGTYPE的补充。 */ enum CodecVideoExType { - CODEC_VIDEO_CodingVP9 = 10, /** VP9格式 */ - CODEC_VIDEO_CodingHEVC = 11, /** HEVC格式 */ + CODEC_VIDEO_CodingVP9 = 10, /**< VP9格式 */ + CODEC_VIDEO_CodingHEVC = 11, /**< HEVC格式 */ }; /** * @brief HEVC的profile枚举。 */ enum CodecHevcProfile { - CODEC_HEVC_PROFILE_INVALID = 0x0, /** 无效的profile */ - CODEC_HEVC_PROFILE_MAIN = 0x1, /** main profile */ - CODEC_HEVC_PROFILE_MAIN10 = 0x2, /** main10 profile */ - CODEC_HEVC_PROFILE_MAIN_STILL = 0x3, /** main still profile */ + CODEC_HEVC_PROFILE_INVALID = 0x0, /**< 无效的profile */ + CODEC_HEVC_PROFILE_MAIN = 0x1, /**< main profile */ + CODEC_HEVC_PROFILE_MAIN10 = 0x2, /**< main10 profile */ + CODEC_HEVC_PROFILE_MAIN_STILL = 0x3, /**< main still profile */ // 支持main_10 profile以及HDR SEI. - CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000, /** main10 hdr10 profile */ - CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000, /** main10 hdr10 plus profile */ - CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF /** 最大值 */ + CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000, /**< main10 hdr10 profile */ + CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000, /**< main10 hdr10 plus profile */ + CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF /**< 最大值 */ }; /** * @brief HEVC的level枚举。 */ enum CodecHevcLevel { - CODEC_HEVC_LEVEL_INVALID = 0x0, /** 无效的level */ - CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1, /** main tier level1 */ - CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2, /** high tier level1 */ - CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4, /** main tier level2 */ - CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8, /** high tier level2 */ - CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10, /** main tier level2.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20, /** high tier level2.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40, /** main tier level3 */ - CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80, /** high tier level3 */ - CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100, /** main tier level3.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200, /** high tier level3.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400, /** main tier level4 */ - CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800, /** high tier level4 */ - CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000, /** main tier level4.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000, /** high tier level4.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000, /** main tier level5 */ - CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000, /** high tier level5 */ - CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000, /** main tier level5.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000, /** high tier level5.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000, /** main tier level5.2 */ - CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000, /** high tier level5.2 */ - CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000, /** main tier level6 */ - CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000, /** high tier level6 */ - CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000, /** main tier level6.1 */ - CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000, /** high tier level6.1 */ - CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000, /** main tier level6.2 */ - CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000, /** high tier level6.2 */ - CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF /** 最大值 */ + CODEC_HEVC_LEVEL_INVALID = 0x0, /**< 无效的level */ + CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1, /**< main tier level1 */ + CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2, /**< high tier level1 */ + CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4, /**< main tier level2 */ + CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8, /**< high tier level2 */ + CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10, /**< main tier level2.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20, /**< high tier level2.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40, /**< main tier level3 */ + CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80, /**< high tier level3 */ + CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100, /**< main tier level3.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200, /**< high tier level3.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400, /**< main tier level4 */ + CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800, /**< high tier level4 */ + CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000, /**< main tier level4.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000, /**< high tier level4.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000, /**< main tier level5 */ + CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000, /**< high tier level5 */ + CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000, /**< main tier level5.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000, /**< high tier level5.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000, /**< main tier level5.2 */ + CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000, /**< high tier level5.2 */ + CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000, /**< main tier level6 */ + CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000, /**< high tier level6 */ + CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000, /**< main tier level6.1 */ + CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000, /**< high tier level6.1 */ + CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000, /**< main tier level6.2 */ + CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000, /**< high tier level6.2 */ + CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF /**< 最大值 */ }; /** @@ -95,71 +95,71 @@ enum CodecBufferType { * @brief 查询vendor层支持buffer类型信息 */ struct SupportBufferType { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - unsigned int portIndex; /** 端口序列 */ - unsigned int bufferTypes; /** 支持的buffer类型 */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + unsigned int portIndex; /**< 端口序列 */ + unsigned int bufferTypes; /**< 支持的buffer类型 */ }; /** * @brief 设置输入输出端口对应的buffer类型 */ struct UseBufferType { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - unsigned int portIndex; /** 端口序列 */ - unsigned int bufferType; /** buffer类型 */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + unsigned int portIndex; /**< 端口序列 */ + unsigned int bufferType; /**< buffer类型 */ }; /** * @brief 查询vendor层BufferHandle的默认usage配置 */ struct GetBufferHandleUsageParams { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - unsigned int portIndex; /** 端口序列 */ - unsigned long usage; /** Usage */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + unsigned int portIndex; /**< 端口序列 */ + unsigned long usage; /**< Usage */ }; /** * @brief 设置输入输出端口的编解码格式 */ struct CodecVideoPortFormatParam { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - unsigned int portIndex; /** 端口序列 */ - unsigned int codecColorIndex; /** 已废弃 */ - unsigned int codecColorFormat; /** 像素格式 */ - unsigned int codecCompressFormat; /** 压缩格式 */ - unsigned int framerate; /** Q16 format */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + unsigned int portIndex; /**< 端口序列 */ + unsigned int codecColorIndex; /**< 已废弃 */ + unsigned int codecColorFormat; /**< 像素格式 */ + unsigned int codecCompressFormat; /**< 压缩格式 */ + unsigned int framerate; /**< Q16 format */ }; /** * @brief 控制编码画面质量参数 */ struct ControlRateConstantQuality { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - unsigned int portIndex; /** 端口序列 */ - unsigned int qualityValue; /** 画面质量参数 */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + unsigned int portIndex; /**< 端口序列 */ + unsigned int qualityValue; /**< 画面质量参数 */ }; /** * @brief 查询/设置vendor层编解码器工作频率 */ struct WorkingFrequencyParam { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - unsigned int level; /** 工作频率级别 */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + unsigned int level; /**< 工作频率级别 */ }; /** * @brief 设置调用者进程名 */ struct ProcessNameParam { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - String processName; /** 进程名 */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + String processName; /**< 进程名 */ }; /** @@ -192,24 +192,24 @@ enum CodecIndexExType { * @brief 定义HEVC视频编码格式信息 */ struct CodecVideoParamHevc { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - unsigned int portIndex; /** 端口序列 */ - enum CodecHevcProfile profile; /** Hevc profile。 详见 {@link CodecHevcProfile}. */ - enum CodecHevcLevel level; /** Hevc级别。 详见 {@link CodecHevcLevel}. */ - unsigned int keyFrameInterval; /** 连续I帧(包括其中一个I帧)之间的距离。 - 0表示间隔未指定,可由编解码器自由选择, - 1表示一个仅存在I帧的流,其他值表示实际值。 */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + unsigned int portIndex; /**< 端口序列 */ + enum CodecHevcProfile profile; /**< Hevc profile。 详见 {@link CodecHevcProfile}. */ + enum CodecHevcLevel level; /**< Hevc级别。 详见 {@link CodecHevcLevel}. */ + unsigned int keyFrameInterval; /**< 连续I帧(包括其中一个I帧)之间的距离。 + 0表示间隔未指定,可由编解码器自由选择, + 1表示一个仅存在I帧的流,其他值表示实际值。 */ }; /** * @brief 视频像素值范围 */ enum RangeType { - RANGE_UNSPECIFIED, /** 未指定的range类型 */ - RANGE_FULL, /** full range */ - RANGE_LIMITED, /** limited range */ - RANGE_MAX = 0xff, /** 最大值 */ + RANGE_UNSPECIFIED, /**< 未指定的range类型 */ + RANGE_FULL, /**< full range */ + RANGE_LIMITED, /**< limited range */ + RANGE_MAX = 0xff, /**< 最大值 */ }; /** @@ -263,22 +263,22 @@ enum MatrixCoeffs { * @brief 色彩空间相关枚举 */ struct ColorAspects { - enum RangeType range; /** 视频像素值范围 */ - enum Primaries primaries; /** 视频色域 */ - enum Transfer transfer; /** 视频传递函数 */ - enum MatrixCoeffs matrixCoeffs; /** 视频矩阵系数 */ + enum RangeType range; /**< 视频像素值范围 */ + enum Primaries primaries; /**< 视频色域 */ + enum Transfer transfer; /**< 视频传递函数 */ + enum MatrixCoeffs matrixCoeffs; /**< 视频矩阵系数 */ }; /** * @brief 定义色彩空间参数信息 */ struct CodecVideoColorspace { - unsigned int size; /** 结构体大小 */ - union CodecVersionType version; /** 组件版本 */ - unsigned int portIndex; /** 端口序列 */ - unsigned int requestingDataSpace; /** 请求颜色空间信息 */ - unsigned int dataSpaceChanged; /** 颜色空间信息发生变化 */ - unsigned int pixeFormat; /** 像素格式 */ - unsigned int dataSpace; /** 颜色空间 */ - struct ColorAspects aspects; /** 色彩空间 */ + unsigned int size; /**< 结构体大小 */ + union CodecVersionType version; /**< 组件版本 */ + unsigned int portIndex; /**< 端口序列 */ + unsigned int requestingDataSpace; /**< 请求颜色空间信息 */ + unsigned int dataSpaceChanged; /**< 颜色空间信息发生变化 */ + unsigned int pixeFormat; /**< 像素格式 */ + unsigned int dataSpace; /**< 颜色空间 */ + struct ColorAspects aspects; /**< 色彩空间 */ }; \ No newline at end of file -- Gitee From de6bfc44fdc43af835cb604ea44bda1ae31d6462 Mon Sep 17 00:00:00 2001 From: guoxing Date: Mon, 8 Jan 2024 07:08:29 +0000 Subject: [PATCH 0212/2135] =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoxing --- .../native_drawing/drawing_text_typography.h | 193 +++++++++--------- 1 file changed, 97 insertions(+), 96 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index adec1ca3..60fb96c7 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -287,7 +287,7 @@ typedef enum { } OH_Drawing_RectWidthStyle; /** - * @brief 创建OH_Drawing_TypographyStyle + * @brief 创建指向OH_Drawing_TypographyStyle对象的指针。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 指向创建的OH_Drawing_TypographyStyle对象的指针。 @@ -300,7 +300,7 @@ OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle(void); * @brief 释放被OH_Drawing_TypographyStyle对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针。 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @since 8 * @version 1.0 */ @@ -310,8 +310,8 @@ void OH_Drawing_DestroyTypographyStyle(OH_Drawing_TypographyStyle*); * @brief 设置文本方向。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针。 - * @param int OH_Drawing_TextDirection枚举类型。 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置文本方向,设置1为从左到右,设置0或其它为从右到左,具体可见{@link OH_Drawing_TextDirection}枚举。 * @since 8 * @version 1.0 */ @@ -321,8 +321,8 @@ void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle*, int /* O * @brief 设置文本对齐方式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针。 - * @param int OH_Drawing_TextAlign枚举类型。 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置文本对齐方式,设置1为右对齐,设置2为居中对齐,设置3为两端对齐,设置4为与文字方向相同,设置5为文字方向相反,设置0或其它为左对齐,具体可见{@link OH_Drawing_TextAlign}枚举。 * @since 8 * @version 1.0 */ @@ -332,7 +332,7 @@ void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Dr * @brief 设置文本最大行数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针。 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param int 最大行数。 * @since 8 * @version 1.0 @@ -340,7 +340,7 @@ void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Dr void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle*, int /* maxLines */); /** - * @brief 创建OH_Drawing_TextStyle。 + * @brief 创建指向OH_Drawing_TextStyle对象的指针。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 指向创建的OH_Drawing_TextStyle对象的指针。 @@ -353,7 +353,7 @@ OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); * @brief 释放被OH_Drawing_TextStyle对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @since 8 * @version 1.0 */ @@ -363,7 +363,7 @@ void OH_Drawing_DestroyTextStyle(OH_Drawing_TextStyle*); * @brief 设置文本颜色。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param uint32_t 颜色。 * @since 8 * @version 1.0 @@ -374,7 +374,7 @@ void OH_Drawing_SetTextStyleColor(OH_Drawing_TextStyle*, uint32_t /* color */); * @brief 设置字号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param double 字号。 * @since 8 * @version 1.0 @@ -385,8 +385,9 @@ void OH_Drawing_SetTextStyleFontSize(OH_Drawing_TextStyle*, double /* fontSize * * @brief 设置字重。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 - * @param int OH_Drawing_FontWeight枚举类型。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param int 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, + * 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见{@link OH_Drawing_FontWeight}枚举。 * @since 8 * @version 1.0 */ @@ -396,8 +397,8 @@ void OH_Drawing_SetTextStyleFontWeight(OH_Drawing_TextStyle*, int /* OH_Drawing_ * @brief 设置字体基线位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 - * @param int OH_Drawing_TextBaseline枚举类型。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param int 设置字体基线位置,设置1基线位于底部,设置0或其它基线在中间偏下的位置,具体可见{@link OH_Drawing_TextBaseline}枚举。 * @since 8 * @version 1.0 */ @@ -407,8 +408,8 @@ void OH_Drawing_SetTextStyleBaseLine(OH_Drawing_TextStyle*, int /* OH_Drawing_Te * @brief 设置装饰。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 - * @param int OH_Drawing_TextDecoration枚举类型。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param int 设置装饰,设置1为下划线,设置2为上划线,设置3为删除线,设置0或其它为无装饰,具体可见{@link OH_Drawing_TextDecoration}枚举。 * @since 8 * @version 1.0 */ @@ -418,7 +419,7 @@ void OH_Drawing_SetTextStyleDecoration(OH_Drawing_TextStyle*, int /* OH_Drawing_ * @brief 设置装饰颜色。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param uint32_t 颜色。 * @since 8 * @version 1.0 @@ -429,7 +430,7 @@ void OH_Drawing_SetTextStyleDecorationColor(OH_Drawing_TextStyle*, uint32_t /* c * @brief 设置字体高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param double 字体高度。 * @since 8 * @version 1.0 @@ -440,7 +441,7 @@ void OH_Drawing_SetTextStyleFontHeight(OH_Drawing_TextStyle*, double /* fontHeig * @brief 设置字体类型。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param int 字体名称数量。 * @param char 指向字体类型的指针。 * @since 8 @@ -453,8 +454,8 @@ void OH_Drawing_SetTextStyleFontFamilies(OH_Drawing_TextStyle*, * @brief 设置字体风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 - * @param int OH_Drawing_FontStyle枚举类型。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param int 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见{@link OH_Drawing_FontStyle}枚举。 * @since 8 * @version 1.0 */ @@ -464,7 +465,7 @@ void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_F * @brief 设置语言区域。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param char 语言区域,数据类型为指向char的指针。 * @since 8 * @version 1.0 @@ -475,8 +476,8 @@ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); * @brief 创建指向OH_Drawing_TypographyCreate对象的指针。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针。 - * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection的指针。 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection的指针,由{@link OH_Drawing_CreateFontCollection}获取。 * @return 指向新创建的OH_Drawing_TypographyCreate对象的指针。 * @since 8 * @version 1.0 @@ -488,7 +489,7 @@ OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler(OH_Drawing_Typog * @brief 释放被OH_Drawing_TypographyCreate对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针,由{@link OH_Drawing_CreateTypographyHandler}获取。 * @since 8 * @version 1.0 */ @@ -498,8 +499,8 @@ void OH_Drawing_DestroyTypographyHandler(OH_Drawing_TypographyCreate*); * @brief 设置排版风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针。 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针,由{@link OH_Drawing_CreateTypographyHandler}获取。 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @since 8 * @version 1.0 */ @@ -509,7 +510,7 @@ void OH_Drawing_TypographyHandlerPushTextStyle(OH_Drawing_TypographyCreate*, OH_ * @brief 设置文本内容。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针,由{@link OH_Drawing_CreateTypographyHandler}获取。 * @param char 指向文本内容的指针。 * @since 8 * @version 1.0 @@ -520,17 +521,17 @@ void OH_Drawing_TypographyHandlerAddText(OH_Drawing_TypographyCreate*, const cha * @brief 排版弹出。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针,由{@link OH_Drawing_CreateTypographyHandler}获取。 * @since 8 * @version 1.0 */ void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate*); /** - * @brief 创建OH_Drawing_Typography。 + * @brief 创建指向OH_Drawing_Typography对象的指针。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针。 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针,由{@link OH_Drawing_CreateTypographyHandler}获取。 * @return 指向OH_Drawing_Typography对象的指针。 * @since 8 * @version 1.0 @@ -541,7 +542,7 @@ OH_Drawing_Typography* OH_Drawing_CreateTypography(OH_Drawing_TypographyCreate*) * @brief 释放OH_Drawing_Typography对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @since 8 * @version 1.0 */ @@ -551,7 +552,7 @@ void OH_Drawing_DestroyTypography(OH_Drawing_Typography*); * @brief 排版布局。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param double 文本最大宽度 * @since 8 * @version 1.0 @@ -562,8 +563,8 @@ void OH_Drawing_TypographyLayout(OH_Drawing_Typography*, double /* maxWidth */); * @brief 显示文本。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 - * @param OH_Drawing_Canvas 指向OH_Drawing_Canvas对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param OH_Drawing_Canvas 指向OH_Drawing_Canvas对象的指针,由OH_Drawing_CanvasCreate()获取。 * @param double x坐标。 * @param double y坐标。 * @since 8 @@ -576,7 +577,7 @@ void OH_Drawing_TypographyPaint(OH_Drawing_Typography*, OH_Drawing_Canvas*, * @brief 获取最大宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回最大宽度。 * @since 9 * @version 1.1 @@ -587,7 +588,7 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); * @brief 获取高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回高度。 * @since 9 * @version 1.1 @@ -598,7 +599,7 @@ double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); * @brief 获取最长行。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回最长行。 * @since 9 * @version 1.1 @@ -609,7 +610,7 @@ double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography*); * @brief 获取最小固有宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回最小固有宽度。 * @since 9 * @version 1.1 @@ -620,7 +621,7 @@ double OH_Drawing_TypographyGetMinIntrinsicWidth(OH_Drawing_Typography*); * @brief 获取最大固有宽度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回最大固有宽度。 * @since 9 * @version 1.1 @@ -631,7 +632,7 @@ double OH_Drawing_TypographyGetMaxIntrinsicWidth(OH_Drawing_Typography*); * @brief 获取字母文字基线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回字母文字基线。 * @since 9 * @version 1.1 @@ -642,7 +643,7 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); * @brief 获取表意文字基线。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回表意文字基线。 * @since 9 * @version 1.1 @@ -650,10 +651,10 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); /** - * @brief 设置占位符 + * @brief 设置占位符。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针 + * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针,由{@link OH_Drawing_CreateTypographyHandler}获取。 * @param OH_Drawing_PlaceholderSpan 指向OH_Drawing_PlaceholderSpan对象的指针 * @since 11 * @version 1.0 @@ -661,10 +662,10 @@ double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH_Drawing_PlaceholderSpan*); /** - * @brief 获取文本是否超过最大行 + * @brief 获取文本是否超过最大行。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回文本是否超过最大行,true表示超过,false表示未超过 * @since 11 * @version 1.0 @@ -672,15 +673,15 @@ void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); /** - * @brief 获取指定范围内的文本框 + * @brief 获取指定范围内的文本框。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param size_t 设置开始位置 * @param size_t 设置结束位置 - * @param OH_Drawing_RectHeightStyle 设置高度样式,支持可选的高度样式具体可见{@Link OH_Drawing_RectHeightStyle}枚举 - * @param OH_Drawing_RectWidthStyle 设置宽度样式,支持可选的宽度样式具体可见{@Link OH_Drawing_RectWidthStyle}枚举 - * @return 返回指定范围内的文本框,具体可见{@Link OH_Drawing_TextBox}结构体 + * @param OH_Drawing_RectHeightStyle 设置高度样式,支持可选的高度样式具体可见{@link OH_Drawing_RectHeightStyle}枚举 + * @param OH_Drawing_RectWidthStyle 设置宽度样式,支持可选的宽度样式具体可见{@link OH_Drawing_RectWidthStyle}枚举 + * @return 返回指定范围内的文本框,具体可见{@link OH_Drawing_TextBox}结构体 * @since 11 * @version 1.0 */ @@ -691,8 +692,8 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* * @brief 获取占位符的文本框 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 - * @return 返回占位符的文本框,返回类型为{@Link OH_Drawing_TextBox}结构体 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @return 返回占位符的文本框,返回类型为{@link OH_Drawing_TextBox}结构体 * @since 11 * @version 1.0 */ @@ -702,8 +703,8 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typo * @brief 获取文本框左侧位置 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 - * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 * @param int 文本框的索引 * @return 返回文本框左侧位置 * @since 11 @@ -715,8 +716,8 @@ float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int); * @brief 获取文本框右侧位置 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 - * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 * @param int 文本框的索引 * @return 返回文本框右侧位置 * @since 11 @@ -728,8 +729,8 @@ float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int); * @brief 获取文本框顶部位置 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 - * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 * @param int 文本框的索引 * @return 返回文本框顶部位置 * @since 11 @@ -741,8 +742,8 @@ float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int); * @brief 获取文本框底部位置 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 - * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 * @param int 文本框的索引 * @return 返回文本框底部位置 * @since 11 @@ -754,8 +755,8 @@ float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int); * @brief 获取文本框方向 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 - * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 * @param int 文本框的索引 * @return 返回文本框方向 * @since 11 @@ -767,8 +768,8 @@ int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int); * @brief 获取文本框数量大小 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@Link OH_Drawing_TypographyGetRectsForRange}或 - * {@Link OH_Drawing_TypographyGetRectsForPlaceholders}获取 + * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 * @return 返回文本框数量大小 * @since 11 * @version 1.0 @@ -779,10 +780,10 @@ size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*); * @brief 获取坐标处文本的索引位置和亲和性 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param double 光标的x坐标 * @param double 光标的y坐标 - * @return 返回坐标处字体的索引位置和亲和性,返回类型为{@Link OH_Drawing_PositionAndAffinity}结构体 + * @return 返回坐标处字体的索引位置和亲和性,返回类型为{@link OH_Drawing_PositionAndAffinity}结构体 * @since 11 * @version 1.0 */ @@ -793,10 +794,10 @@ OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinat * @brief 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param double 光标的x坐标 * @param double 光标的y坐标 - * @return 返回坐标处指定类型字体的索引位置和亲和性,返回类型为{@Link OH_Drawing_PositionAndAffinity}结构体 + * @return 返回坐标处指定类型字体的索引位置和亲和性,返回类型为{@link OH_Drawing_PositionAndAffinity}结构体 * @since 11 * @version 1.0 */ @@ -808,8 +809,8 @@ OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinat * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_PositionAndAffinity 指向OH_Drawing_PositionAndAffinity对象的指针, - * 由{@Link OH_Drawing_TypographyGetGlyphPositionAtCoordinate}或 - * {@Link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取 + * 由{@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate}或 + * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取 * @return 返回OH_Drawing_PositionAndAffinity对象的位置属性 * @since 11 * @version 1.0 @@ -821,8 +822,8 @@ size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffin * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_PositionAndAffinity 指向OH_Drawing_PositionAndAffinity对象的指针, - * 由{@Link OH_Drawing_TypographyGetGlyphPositionAtCoordinate}或 - * {@Link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取 + * 由{@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate}或 + * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取 * @return 返回OH_Drawing_PositionAndAffinity对象的亲和性 * @since 11 * @version 1.0 @@ -833,9 +834,9 @@ int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity * @brief 获取单词的边界 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param size_t 单词索引 - * @return 返回单词边界,返回类型为{@Link OH_Drawing_Range}结构体 + * @return 返回单词边界,返回类型为{@link OH_Drawing_Range}结构体 * @since 11 * @version 1.0 */ @@ -845,7 +846,7 @@ OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, s * @brief 获取OH_Drawing_Range对象开始位置 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@Link OH_Drawing_TypographyGetWordBoundary}获取 + * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@link OH_Drawing_TypographyGetWordBoundary}获取 * @return 返回OH_Drawing_Range对象开始位置 * @since 11 * @version 1.0 @@ -856,7 +857,7 @@ size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*); * @brief 获取OH_Drawing_Range对象结束位置 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@Link OH_Drawing_TypographyGetWordBoundary}获取 + * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@link OH_Drawing_TypographyGetWordBoundary}获取 * @return 返回OH_Drawing_Range对象结束位置 * @since 11 * @version 1.0 @@ -867,7 +868,7 @@ size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*); * @brief 获取文本行数 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回行数 * @since 11 * @version 1.0 @@ -878,8 +879,8 @@ size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); * @brief 设置文本装饰样式 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param int 设置的文本装饰样式,支持可选的装饰样式具体可见{@Link OH_Drawing_TextDecorationStyle}枚举 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param int 设置的文本装饰样式,支持可选的装饰样式具体可见{@link OH_Drawing_TextDecorationStyle}枚举 * @since 11 * @version 1.0 */ @@ -889,7 +890,7 @@ void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); * @brief 设置文本装饰线的厚度缩放比例 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param double 缩放比例 * @since 11 * @version 1.0 @@ -900,7 +901,7 @@ void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, doub * @brief 设置文本的字符间距 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param double 间距大小 * @since 11 * @version 1.0 @@ -911,7 +912,7 @@ void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); * @brief 设置文本的单词间距 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param double 间距大小 * @since 11 * @version 1.0 @@ -922,7 +923,7 @@ void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); * @brief 设置文本为一半行间距 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效 * @since 11 * @version 1.0 @@ -933,7 +934,7 @@ void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); * @brief 设置文本的省略号内容 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param char* 设置省略号内容,数据类型为指向char的指针 * @since 11 * @version 1.0 @@ -944,8 +945,8 @@ void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*); * @brief 设置文本的省略号样式 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针 - * @param int 设置省略号样式,支持可选的省略号样式具体可见{@Link OH_Drawing_EllipsisModal}枚举 + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param int 设置省略号样式,支持可选的省略号样式具体可见{@link OH_Drawing_EllipsisModal}枚举 * @since 11 * @version 1.0 */ @@ -955,8 +956,8 @@ void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); * @brief 设置文本的中断策略 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 - * @param int 设置中断策略,支持可选的中断策略具体可见{@Link OH_Drawing_BreakStrategy}枚举 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置中断策略,支持可选的中断策略具体可见{@link OH_Drawing_BreakStrategy}枚举 * @since 11 * @version 1.0 */ @@ -966,8 +967,8 @@ void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int) * @brief 设置单词的断词方式 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 - * @param int 设置断词方式,支持可选的断词方式样式具体可见{@Link OH_Drawing_WordBreakType}枚举 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置断词方式,支持可选的断词方式样式具体可见{@link OH_Drawing_WordBreakType}枚举 * @since 11 * @version 1.0 */ @@ -977,8 +978,8 @@ void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int) * @brief 设置文本的省略号样式 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针 - * @param int 设置省略号样式,支持可选的省略号样式样式具体可见{@Link OH_Drawing_EllipsisModal}枚举 + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置省略号样式,支持可选的省略号样式样式具体可见{@link OH_Drawing_EllipsisModal}枚举 * @since 11 * @version 1.0 */ @@ -988,7 +989,7 @@ void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int) * @brief 获取指定行的行高 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 要指定的行数 * @return 返回指定行的行高 * @since 11 @@ -1000,7 +1001,7 @@ double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); * @brief 获取指定行的行宽 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针 + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 要指定的行数 * @return 返回指定行的行宽 * @since 11 -- Gitee From 6d45e8f61f7c143f3c0e412d61c207acbbdb6ff3 Mon Sep 17 00:00:00 2001 From: m00472246 Date: Tue, 9 Jan 2024 10:07:44 +0800 Subject: [PATCH 0213/2135] =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20Signed-off-by:=20m00472246=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: m00472246 --- zh-cn/native_sdk/graphic/external_window.h | 220 +++++++++++---------- zh-cn/native_sdk/graphic/native_buffer.h | 4 +- zh-cn/native_sdk/graphic/native_image.h | 90 ++++----- zh-cn/native_sdk/graphic/native_vsync.h | 36 ++-- 4 files changed, 176 insertions(+), 174 deletions(-) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index a137a4bc..051a71d5 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -20,7 +20,7 @@ * @addtogroup NativeWindow * @{ * - * @brief 提供NativeWindow功能,作为数据生产者,可用来和egl对接 + * @brief 提供NativeWindow功能,作为数据生产者,可用来和egl对接。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @since 8 @@ -30,7 +30,7 @@ /** * @file external_window.h * - * @brief 定义获取和使用NativeWindow的相关函数 + * @brief 定义获取和使用NativeWindow的相关函数。 * * 引用文件 * @library libnative_window.so @@ -47,48 +47,48 @@ extern "C" { /** - * @brief NativeWindow结构体 + * @brief NativeWindow结构体。 * @since 8 */ struct NativeWindow; /** - * @brief NativeWindowBuffer结构体 + * @brief NativeWindowBuffer结构体。 * @since 8 */ struct NativeWindowBuffer; /** - * @brief 提供对OHNativeWindow的访问功能 + * @brief 提供对OHNativeWindow的访问功能。 * @since 8 */ typedef struct NativeWindow OHNativeWindow; /** - * @brief 提供对OHNativeWindowBuffer的访问功能 + * @brief 提供对OHNativeWindowBuffer的访问功能。 * @since 8 */ typedef struct NativeWindowBuffer OHNativeWindowBuffer; /** - * @brief 表示本地窗口OHNativeWindow需要更新内容的矩形区域(脏区) + * @brief 表示本地窗口OHNativeWindow需要更新内容的矩形区域(脏区)。 * @since 8 */ typedef struct Region { - /** 如果rects是空指针nullptr, 默认Buffer大小为脏区*/ + /** 如果rects是空指针nullptr, 默认Buffer大小为脏区 */ struct Rect { int32_t x; /**< 矩形框起始x坐标 */ int32_t y; /**< 矩形框起始y坐标 */ uint32_t w; /**< 矩形框宽度 */ uint32_t h; /**< 矩形框高度 */ } *rects; - /** 如果rectNumber为0,默认Buffer大小为脏区*/ + /** 如果rectNumber为0,默认Buffer大小为脏区 */ int32_t rectNumber; }Region; /** - * @brief OH_NativeWindow_NativeWindowHandleOpt函数中的操作码 + * @brief OH_NativeWindow_NativeWindowHandleOpt函数中的操作码。 * @since 8 */ enum NativeWindowOperation { @@ -197,55 +197,55 @@ enum NativeWindowOperation { }; /** - * @brief 缩放模式 Scaling Mode + * @brief 缩放模式 Scaling Mode。 * @since 9 - * @deprecated 从API version 10开始废弃,不再提供替代接口 + * @deprecated 从API version 10开始废弃,不再提供替代接口。 */ typedef enum { /** - * 在接收到窗口大小的缓冲区之前,不可以更新窗口内容 + * 在接收到窗口大小的缓冲区之前,不可以更新窗口内容。 */ OH_SCALING_MODE_FREEZE = 0, /** - * 缓冲区在二维中缩放以匹配窗口大小 + * 缓冲区在二维中缩放以匹配窗口大小。 */ OH_SCALING_MODE_SCALE_TO_WINDOW, /** - * 缓冲区被统一缩放,使得缓冲区的较小尺寸与窗口大小匹配 + * 缓冲区被统一缩放,使得缓冲区的较小尺寸与窗口大小匹配。 */ OH_SCALING_MODE_SCALE_CROP, /** - * 窗口被裁剪为缓冲区裁剪矩形的大小,裁剪矩形之外的像素被视为完全透明 + * 窗口被裁剪为缓冲区裁剪矩形的大小,裁剪矩形之外的像素被视为完全透明。 */ OH_SCALING_MODE_NO_SCALE_CROP, } OHScalingMode; /** - * @brief 枚举HDR元数据关键字 + * @brief 枚举HDR元数据关键字。 * @since 9 - * @deprecated 从API version 10开始废弃,不再提供替代接口 + * @deprecated 从API version 10开始废弃,不再提供替代接口。 */ typedef enum { - OH_METAKEY_RED_PRIMARY_X = 0, /**< 红基色X坐标 */ - OH_METAKEY_RED_PRIMARY_Y = 1, /**< 红基色Y坐标 */ - OH_METAKEY_GREEN_PRIMARY_X = 2, /**< 绿基色X坐标 */ - OH_METAKEY_GREEN_PRIMARY_Y = 3, /**< 绿基色Y坐标 */ - OH_METAKEY_BLUE_PRIMARY_X = 4, /**< 蓝基色X坐标 */ - OH_METAKEY_BLUE_PRIMARY_Y = 5, /**< 蓝基色Y坐标 */ - OH_METAKEY_WHITE_PRIMARY_X = 6, /**< 白点X坐标 */ - OH_METAKEY_WHITE_PRIMARY_Y = 7, /**< 白点Y坐标 */ - OH_METAKEY_MAX_LUMINANCE = 8, /**< 最大的光亮度 */ - OH_METAKEY_MIN_LUMINANCE = 9, /**< 最小的光亮度 */ - OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, /**< 最大的内容亮度水平 */ - OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, /**< 最大的帧平均亮度水平 */ - OH_METAKEY_HDR10_PLUS = 12, /**< HDR10 Plus */ - OH_METAKEY_HDR_VIVID = 13, /**< Vivid */ + OH_METAKEY_RED_PRIMARY_X = 0, /**< 红基色X坐标。 */ + OH_METAKEY_RED_PRIMARY_Y = 1, /**< 红基色Y坐标。*/ + OH_METAKEY_GREEN_PRIMARY_X = 2, /**< 绿基色X坐标。 */ + OH_METAKEY_GREEN_PRIMARY_Y = 3, /**< 绿基色Y坐标。 */ + OH_METAKEY_BLUE_PRIMARY_X = 4, /**< 蓝基色X坐标。 */ + OH_METAKEY_BLUE_PRIMARY_Y = 5, /**< 蓝基色Y坐标。 */ + OH_METAKEY_WHITE_PRIMARY_X = 6, /**< 白点X坐标。 */ + OH_METAKEY_WHITE_PRIMARY_Y = 7, /**< 白点Y坐标。 */ + OH_METAKEY_MAX_LUMINANCE = 8, /**< 最大的光亮度。 */ + OH_METAKEY_MIN_LUMINANCE = 9, /**< 最小的光亮度。 */ + OH_METAKEY_MAX_CONTENT_LIGHT_LEVEL = 10, /**< 最大的内容亮度水平。 */ + OH_METAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, /**< 最大的帧平均亮度水平。 */ + OH_METAKEY_HDR10_PLUS = 12, /**< HDR10 Plus。 */ + OH_METAKEY_HDR_VIVID = 13, /**< Vivid。 */ } OHHDRMetadataKey; /** - * @brief HDR元数据结构体定义 + * @brief HDR元数据结构体定义。 * @since 9 - * @deprecated 从API version 10开始废弃,不再提供替代接口 + * @deprecated 从API version 10开始废弃,不再提供替代接口。 */ typedef struct { OHHDRMetadataKey key; /**< HDR元数据关键字 */ @@ -253,9 +253,9 @@ typedef struct { } OHHDRMetaData; /** - * @brief 扩展数据句柄结构体定义 + * @brief 扩展数据句柄结构体定义。 * @since 9 - * @deprecated 从API version 10开始废弃,不再提供替代接口 + * @deprecated 从API version 10开始废弃,不再提供替代接口。 */ typedef struct { int32_t fd; /**< 句柄 Fd, -1代表不支持 */ @@ -265,66 +265,68 @@ typedef struct { /** - * @brief 创建OHNativeWindow实例,每次调用都会产生一个新的OHNativeWindow实例 + * @brief 创建OHNativeWindow实例,每次调用都会产生一个新的OHNativeWindow实例。 + * 说明:此接口不可用,可通过OH_NativeImage_AcquireNativeWindow创建,或通过XComponent创建。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param pSurface 一个指向生产者ProduceSurface的指针,类型为sptr - * @return 返回一个指针,指向OHNativeWindow的结构体实例 + * @param pSurface 一个指向生产者ProduceSurface的指针,类型为sptr。 + * @return 返回一个指针,指向OHNativeWindow的结构体实例。 * @since 8 * @version 1.0 */ OHNativeWindow* OH_NativeWindow_CreateNativeWindow(void* pSurface); /** - * @brief 将OHNativeWindow对象的引用计数减1,当引用计数为0的时候,该OHNativeWindow对象会被析构掉 + * @brief 将OHNativeWindow对象的引用计数减1,当引用计数为0的时候,该OHNativeWindow对象会被析构掉。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 + * @param window 一个OHNativeWindow的结构体实例的指针。 * @since 8 * @version 1.0 */ void OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window); /** - * @brief 创建OHNativeWindowBuffer实例,每次调用都会产生一个新的OHNativeWindowBuffer实例 + * @brief 创建OHNativeWindowBuffer实例,每次调用都会产生一个新的OHNativeWindowBuffer实例。 + * 说明:此接口不可用,使用OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer替代。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param pSurfaceBuffer 一个指向生产者buffer的指针,类型为sptr - * @return 返回一个指针,指向OHNativeWindowBuffer的结构体实例 + * @param pSurfaceBuffer 一个指向生产者buffer的指针,类型为sptr。 + * @return 返回一个指针,指向OHNativeWindowBuffer的结构体实例。 * @since 8 * @version 1.0 */ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer(void* pSurfaceBuffer); /** - * @brief 创建OHNativeWindowBuffer实例,每次调用都会产生一个新的OHNativeWindowBuffer实例 + * @brief 创建OHNativeWindowBuffer实例,每次调用都会产生一个新的OHNativeWindowBuffer实例。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param nativeBuffer 一个指向OH_NativeBuffer的指针 - * @return 返回一个指针,指向OHNativeWindowBuffer的结构体实例 + * @param nativeBuffer 一个指向OH_NativeBuffer的指针。 + * @return 返回一个指针,指向OHNativeWindowBuffer的结构体实例。 * @since 11 * @version 1.0 */ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer(OH_NativeBuffer* nativeBuffer); /** - * @brief 将OHNativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该OHNativeWindowBuffer对象会被析构掉 + * @brief 将OHNativeWindowBuffer对象的引用计数减1,当引用计数为0的时候,该OHNativeWindowBuffer对象会被析构掉。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针 + * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针。 * @since 8 * @version 1.0 */ void OH_NativeWindow_DestroyNativeWindowBuffer(OHNativeWindowBuffer* buffer); /** - * @brief 通过OHNativeWindow对象申请一块OHNativeWindowBuffer,用以内容生产 + * @brief 通过OHNativeWindow对象申请一块OHNativeWindowBuffer,用以内容生产。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 - * @param buffer 一个OHNativeWindowBuffer的结构体实例的二级指针 - * @param fenceFd 一个文件描述符句柄 - * @return 返回值为0表示执行成功 + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param buffer 一个OHNativeWindowBuffer的结构体实例的二级指针。 + * @param fenceFd 一个文件描述符句柄。 + * @return 返回值为0表示执行成功。 * @since 8 * @version 1.0 */ @@ -332,14 +334,14 @@ int32_t OH_NativeWindow_NativeWindowRequestBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer, int *fenceFd); /** - * @brief 通过OHNativeWindow将生产好内容的OHNativeWindowBuffer放回到Buffer队列中,用以内容消费 + * @brief 通过OHNativeWindow将生产好内容的OHNativeWindowBuffer放回到Buffer队列中,用以内容消费。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 - * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针 - * @param fenceFd 一个文件描述符句柄,用以同步时序 - * @param region 表示一块脏区域,该区域有内容更新 - * @return 返回值为0表示执行成功 + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针。 + * @param fenceFd 一个文件描述符句柄,用以同步时序。 + * @param region 表示一块脏区域,该区域有内容更新。 + * @return 返回值为0表示执行成功。 * @since 8 * @version 1.0 */ @@ -347,14 +349,14 @@ int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNative int fenceFd, Region region); /** - * @brief 从OHNativeWindow获取上次送回到buffer队列中的OHNativeWindowBuffer + * @brief 从OHNativeWindow获取上次送回到buffer队列中的OHNativeWindowBuffer。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 - * @param buffer 一个OHNativeWindowBuffer结构体指针的指针 - * @param fenceFd 一个文件描述符的指针 - * @param matrix 表示检索到的4*4变换矩阵 - * @return 返回值为0表示执行成功 + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param buffer 一个OHNativeWindowBuffer结构体指针的指针。 + * @param fenceFd 一个文件描述符的指针。 + * @param matrix 表示检索到的4*4变换矩阵。 + * @return 返回值为0表示执行成功。 * @since 11 * @version 1.0 */ @@ -362,101 +364,101 @@ int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWin int *fenceFd, float matrix[16]); /** - * @brief 通过OHNativeWindow将之前申请出来的OHNativeWindowBuffer返还到Buffer队列中,供下次再申请 + * @brief 通过OHNativeWindow将之前申请出来的OHNativeWindowBuffer返还到Buffer队列中,供下次再申请。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 - * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针 - * @return 返回值为0表示执行成功 + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针。 + * @return 返回值为0表示执行成功。 * @since 8 * @version 1.0 */ int32_t OH_NativeWindow_NativeWindowAbortBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); /** - * @brief 设置/获取OHNativeWindow的属性,包括设置/获取宽高、内容格式等 + * @brief 设置/获取OHNativeWindow的属性,包括设置/获取宽高、内容格式等。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 - * @param code 表示操作码,详见{@link NativeWindowOperation} - * @param ... 可变参数,必须与操作码一一对应 - * @return 返回值为0表示执行成功 + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param code 表示操作码,详见{@link NativeWindowOperation}。 + * @param ... 可变参数,必须与操作码一一对应。 + * @return 返回值为0表示执行成功。 * @since 8 * @version 1.0 */ int32_t OH_NativeWindow_NativeWindowHandleOpt(OHNativeWindow *window, int code, ...); /** - * @brief 通过OHNativeWindowBuffer获取该buffer的BufferHandle指针 + * @brief 通过OHNativeWindowBuffer获取该buffer的BufferHandle指针。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针 - * @return BufferHandle 返回一个指针,指向BufferHandle的结构体实例 + * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针。 + * @return BufferHandle 返回一个指针,指向BufferHandle的结构体实例。 * @since 8 * @version 1.0 */ BufferHandle *OH_NativeWindow_GetBufferHandleFromNative(OHNativeWindowBuffer *buffer); /** - * @brief 增加一个NativeObject的引用计数 + * @brief 增加一个NativeObject的引用计数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param obj 一个OHNativeWindow或者OHNativeWindowBuffer的结构体实例的指针 - * @return 返回值为0表示执行成功 + * @param obj 一个OHNativeWindow或者OHNativeWindowBuffer的结构体实例的指针。 + * @return 返回值为0表示执行成功。 * @since 8 * @version 1.0 */ int32_t OH_NativeWindow_NativeObjectReference(void *obj); /** - * @brief 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉 + * @brief 减少一个NativeObject的引用计数,当引用计数减少为0时,该NativeObject将被析构掉。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param obj 一个OHNativeWindow或者OHNativeWindowBuffer的结构体实例的指针 - * @return 返回值为0表示执行成功 + * @param obj 一个OHNativeWindow或者OHNativeWindowBuffer的结构体实例的指针。 + * @return 返回值为0表示执行成功。 * @since 8 * @version 1.0 */ int32_t OH_NativeWindow_NativeObjectUnreference(void *obj); /** - * @brief 获取NativeObject的MagicId + * @brief 获取NativeObject的MagicId。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param obj 一个OHNativeWindow或者OHNativeWindowBuffer的结构体实例的指针 - * @return MagicId 返回值为魔鬼数字,每个NativeObject唯一 + * @param obj 一个OHNativeWindow或者OHNativeWindowBuffer的结构体实例的指针。 + * @return MagicId 返回值为魔鬼数字,每个NativeObject唯一。 * @since 8 * @version 1.0 */ int32_t OH_NativeWindow_GetNativeObjectMagic(void *obj); /** - * @brief 设置OHNativeWindow的ScalingMode + * @brief 设置OHNativeWindow的ScalingMode。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 - * @param sequence 生产缓冲区的序列 - * @param scalingMode 枚举值OHScalingMode - * @return 返回值为0表示执行成功 + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param sequence 生产缓冲区的序列。 + * @param scalingMode 枚举值OHScalingMode。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 - * @deprecated 从API version 10开始废弃,不再提供替代接口 + * @deprecated 从API version 10开始废弃,不再提供替代接口。 */ int32_t OH_NativeWindow_NativeWindowSetScalingMode(OHNativeWindow *window, uint32_t sequence, OHScalingMode scalingMode); /** - * @brief 设置OHNativeWindow的元数据 + * @brief 设置OHNativeWindow的元数据。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 - * @param sequence 生产缓冲区的序列 - * @param size OHHDRMetaData数组的大小 - * @param metaDate 指向OHHDRMetaData数组的指针 - * @return 返回值为0表示执行成功 + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param sequence 生产缓冲区的序列。 + * @param size OHHDRMetaData数组的大小。 + * @param metaDate 指向OHHDRMetaData数组的指针。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 - * @deprecated 从API version 10开始废弃,不再提供替代接口 + * @deprecated 从API version 10开始废弃,不再提供替代接口。 */ int32_t OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow *window, uint32_t sequence, int32_t size, const OHHDRMetaData *metaData); @@ -467,13 +469,13 @@ int32_t OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow *window, uint32_t * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param window 一个OHNativeWindow的结构体实例的指针。 * @param sequence 生产缓冲区的序列。 - * @param key 枚举值OHHDRMetadataKey - * @param size uint8_t向量的大小 - * @param metaDate 指向uint8_t向量的指针 - * @return 返回值为0表示执行成功 + * @param key 枚举值OHHDRMetadataKey。 + * @param size uint8_t向量的大小。 + * @param metaDate 指向uint8_t向量的指针。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 - * @deprecated 从API version 10开始废弃,不再提供替代接口 + * @deprecated 从API version 10开始废弃,不再提供替代接口。 */ int32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t *metaData); @@ -482,12 +484,12 @@ int32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint3 * @brief 设置OHNativeWindow的TunnelHandle。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow - * @param window 一个OHNativeWindow的结构体实例的指针 - * @param handle 指向OHExtDataHandle的指针 - * @return 返回值为0表示执行成功 + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param handle 指向OHExtDataHandle的指针。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 - * @deprecated 从API version 10开始废弃,不再提供替代接口 + * @deprecated 从API version 10开始废弃,不再提供替代接口。 */ int32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, const OHExtDataHandle *handle); diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index d952641b..a9c10cdd 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -20,7 +20,7 @@ * @addtogroup OH_NativeBuffer * @{ * - * @brief 提供NativeBuffer功能,通过提供的接口,可以实现共享内存的申请、使用、属性查询、释放等操作 + * @brief 提供NativeBuffer功能,通过提供的接口,可以实现共享内存的申请、使用、属性查询、释放等操作。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 9 @@ -30,7 +30,7 @@ /** * @file native_buffer.h * - * @brief 定义获取和使用NativeBuffer的相关函数 + * @brief 定义获取和使用NativeBuffer的相关函数。 * * 引用文件 * @library libnative_buffer.so diff --git a/zh-cn/native_sdk/graphic/native_image.h b/zh-cn/native_sdk/graphic/native_image.h index 48869bbb..3a6e2202 100644 --- a/zh-cn/native_sdk/graphic/native_image.h +++ b/zh-cn/native_sdk/graphic/native_image.h @@ -20,7 +20,7 @@ * @addtogroup OH_NativeImage * @{ * - * @brief 提供NativeImage功能,作为数据消费者,主要用来将数据和OpenGL纹理对接,需在OpenGL环境下使用 + * @brief 提供NativeImage功能,作为数据消费者,主要用来将数据和OpenGL纹理对接,需在OpenGL环境下使用。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage * @since 9 @@ -30,7 +30,7 @@ /** * @file native_image.h * - * @brief 定义获取和使用NativeImage的相关函数 + * @brief 定义获取和使用NativeImage的相关函数。 * * 引用文件 * @library libnative_image.so @@ -45,28 +45,28 @@ extern "C" { #endif /** - * @brief 提供OH_NativeImage结构体声明 + * @brief 提供OH_NativeImage结构体声明。 * @since 9 */ struct OH_NativeImage; /** - * @brief 提供OH_NativeImage结构体声明 + * @brief 提供OH_NativeImage结构体声明。 * @since 9 */ typedef struct OH_NativeImage OH_NativeImage; /** - * @brief 提供对NativeWindow的访问功能 + * @brief 提供对NativeWindow的访问功能。 * @since 9 */ typedef struct NativeWindow OHNativeWindow; /** - * @brief 有buffer可获取时触发的回调函数 + * @brief 有buffer可获取时触发的回调函数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param context 用户自定义的上下文信息,会在回调触发时返回给用户 + * @param context 用户自定义的上下文信息,会在回调触发时返回给用户。 * @since 11 * @version 1.0 */ @@ -74,7 +74,7 @@ typedef void (*OH_OnFrameAvailable)(void *context); /** * @brief 一个OH_NativeImage的监听者,通过{@Link OH_NativeImage_SetOnFrameAvailableListener}接口注册 - * 该监听结构体,当有buffer可获取时,将触发回调给用户 + * 该监听结构体,当有buffer可获取时,将触发回调给用户。 * * @since 11 * @version 1.0 @@ -87,12 +87,12 @@ typedef struct OH_OnFrameAvailableListener { } OH_OnFrameAvailableListener; /** - * @brief 创建一个OH_NativeImage实例,该实例与OpenGL ES的纹理ID和纹理目标相关联 + * @brief 创建一个OH_NativeImage实例,该实例与OpenGL ES的纹理ID和纹理目标相关联。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param textureId OpenGL ES的纹理ID,OH_NativeImage实例会与之相关联 - * @param textureTarget OpenGL ES的纹理目标 - * @return 返回一个指向OH_NativeImage实例的指针 + * @param textureId OpenGL ES的纹理ID,OH_NativeImage实例会与之相关联。 + * @param textureTarget OpenGL ES的纹理目标。 + * @return 返回一个指向OH_NativeImage实例的指针。 * returns NULL otherwise * @since 9 * @version 1.0 @@ -101,11 +101,11 @@ OH_NativeImage* OH_NativeImage_Create(uint32_t textureId, uint32_t textureTarget /** * @brief 获取与OH_NativeImage相关联的OHNativeWindow指针. 该OHNativeWindow后续不再需要时需要调用\n - * OH_NativeWindow_DestroyNativeWindow释放 + * OH_NativeWindow_DestroyNativeWindow释放。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @return 成功则返回一个指向OHNativeWindow实例的指针,否则返回NULL + * @param image 是指向OH_NativeImage实例的指针。 + * @return 成功则返回一个指向OHNativeWindow实例的指针,否则返回NULL。 * @since 9 * @version 1.0 */ @@ -113,23 +113,23 @@ OHNativeWindow* OH_NativeImage_AcquireNativeWindow(OH_NativeImage* image); /** * @brief 将OH_NativeImage实例附加到当前OpenGL ES上下文, 且该OpenGL ES纹理会绑定到 \n - * GL_TEXTURE_EXTERNAL_OES, 并通过OH_NativeImage进行更新 + * GL_TEXTURE_EXTERNAL_OES, 并通过OH_NativeImage进行更新。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @param textureId 是OH_NativeImage要附加到的OpenGL ES纹理的id - * @return 返回值为0表示执行成功 + * @param image 是指向OH_NativeImage实例的指针。 + * @param textureId 是OH_NativeImage要附加到的OpenGL ES纹理的id。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 */ int32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId); /** - * @brief 将OH_NativeImage实例从当前OpenGL ES上下文分离 + * @brief 将OH_NativeImage实例从当前OpenGL ES上下文分离。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @return 返回值为0表示执行成功 + * @param image 是指向OH_NativeImage实例的指针。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 */ @@ -137,69 +137,69 @@ int32_t OH_NativeImage_AttachContext(OH_NativeImage* image, uint32_t textureId); int32_t OH_NativeImage_DetachContext(OH_NativeImage* image); /** - * @brief 通过OH_NativeImage获取最新帧更新相关联的OpenGL ES纹理 + * @brief 通过OH_NativeImage获取最新帧更新相关联的OpenGL ES纹理。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @return 返回值为0表示执行成功 + * @param image 是指向OH_NativeImage实例的指针。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 */ int32_t OH_NativeImage_UpdateSurfaceImage(OH_NativeImage* image); /** - * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳 + * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的相关时间戳。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @return 返回纹理图像的相关时间戳 + * @param image 是指向OH_NativeImage实例的指针。 + * @return 返回纹理图像的相关时间戳。 * @since 9 * @version 1.0 */ int64_t OH_NativeImage_GetTimestamp(OH_NativeImage* image); /** - * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵 + * @brief 获取最近调用OH_NativeImage_UpdateSurfaceImage的纹理图像的变化矩阵。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @param matrix 用来存储要获取的4*4的变化矩阵 - * @return 返回值为0表示执行成功 + * @param image 是指向OH_NativeImage实例的指针。 + * @param matrix 用来存储要获取的4*4的变化矩阵。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 */ int32_t OH_NativeImage_GetTransformMatrix(OH_NativeImage* image, float matrix[16]); /** - * @brief 获取OH_NativeImage的surface编号 + * @brief 获取OH_NativeImage的surface编号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @param surfaceId 是指向surface编号的指针 - * @return 返回值为0表示执行成功 + * @param image 是指向OH_NativeImage实例的指针。 + * @param surfaceId 是指向surface编号的指针。 + * @return 返回值为0表示执行成功。 * @since 11 * @version 1.0 */ int32_t OH_NativeImage_GetSurfaceId(OH_NativeImage* image, uint64_t* surfaceId); /** - * @brief 设置帧可用回调 + * @brief 设置帧可用回调。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @param listener 表示回调监听者 - * @return 返回值为0表示执行成功 + * @param image 是指向OH_NativeImage实例的指针。 + * @param listener 表示回调监听者。 + * @return 返回值为0表示执行成功。 * @since 11 * @version 1.0 */ int32_t OH_NativeImage_SetOnFrameAvailableListener(OH_NativeImage* image, OH_OnFrameAvailableListener listener); /** - * @brief 取消设置帧可用回调 + * @brief 取消设置帧可用回调。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 - * @return 返回值为0表示执行成功 + * @param image 是指向OH_NativeImage实例的指针。 + * @return 返回值为0表示执行成功。 * @since 11 * @version 1.0 */ @@ -207,10 +207,10 @@ int32_t OH_NativeImage_UnsetOnFrameAvailableListener(OH_NativeImage* image); /** * @brief 销毁通过OH_NativeImage_Create创建的OH_NativeImage实例, 销毁后该\n - * OH_NativeImage指针会被赋值为空 + * OH_NativeImage指针会被赋值为空。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage - * @param image 是指向OH_NativeImage实例的指针 + * @param image 是指向OH_NativeImage实例的指针。 * @since 9 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_vsync.h b/zh-cn/native_sdk/graphic/native_vsync.h index c862a1e3..b90f97de 100644 --- a/zh-cn/native_sdk/graphic/native_vsync.h +++ b/zh-cn/native_sdk/graphic/native_vsync.h @@ -20,7 +20,7 @@ * @addtogroup NativeVsync * @{ * - * @brief 提供NativeVsync功能 + * @brief 提供NativeVsync功能。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync * @since 9 @@ -30,7 +30,7 @@ /** * @file native_vsync.h * - * @brief 定义获取和使用NativeVsync的相关函数 + * @brief 定义获取和使用NativeVsync的相关函数。 * * @library libnative_vsync.so * @since 9 @@ -42,58 +42,58 @@ extern "C" { #endif /** - * @brief 提供OH_NativeVSync结构体声明 + * @brief 提供OH_NativeVSync结构体声明。 * @since 9 */ struct OH_NativeVSync; /** - * @brief 提供OH_NativeVSync结构体声明 + * @brief 提供OH_NativeVSync结构体声明。 * @since 9 */ typedef struct OH_NativeVSync OH_NativeVSync; /** - * @brief VSync回调函数类型 + * @brief VSync回调函数类型。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @param timestamp VSync时间戳 - * @param data 用户自定义数据 + * @param timestamp VSync时间戳。 + * @param data 用户自定义数据。 * @since 9 * @version 1.0 */ typedef void (*OH_NativeVSync_FrameCallback)(long long timestamp, void *data); /** - * @brief 创建一个OH_NativeVSync实例,每次调用都会产生一个新的实例 + * @brief 创建一个OH_NativeVSync实例,每次调用都会产生一个新的实例。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @param name 表示一个名字,与创建的OH_NativeVSync实例关联 - * @param length name的长度 - * @return 返回一个指向OH_NativeVSync实例的指针 + * @param name 表示一个名字,与创建的OH_NativeVSync实例关联。 + * @param length name的长度。 + * @return 返回一个指向OH_NativeVSync实例的指针。 * @since 9 * @version 1.0 */ OH_NativeVSync* OH_NativeVSync_Create(const char* name, unsigned int length); /** - * @brief 销毁OH_NativeVSync实例 + * @brief 销毁OH_NativeVSync实例。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @param nativeVsync 一个指向OH_NativeVSync实例的指针 + * @param nativeVsync 一个指向OH_NativeVSync实例的指针。 * @since 9 * @version 1.0 */ void OH_NativeVSync_Destroy(OH_NativeVSync* nativeVsync); /** - * @brief 请求下一次vsync信号,当信号到来时,调用回调函数callback + * @brief 请求下一次vsync信号,当信号到来时,调用回调函数callback。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @param nativeVsync 一个指向OH_NativeVSync实例的指针 - * @param callback 一个OH_NativeVSync_FrameCallback类型的函数指针,当下一次vsync信号到来时会被调用 - * @param data 一个指向用户自定义数据结构的指针,类型是void* - * @return 返回值为0表示执行成功 + * @param nativeVsync 一个指向OH_NativeVSync实例的指针。 + * @param callback 一个OH_NativeVSync_FrameCallback类型的函数指针,当下一次vsync信号到来时会被调用。 + * @param data 一个指向用户自定义数据结构的指针,类型是void*。 + * @return 返回值为0表示执行成功。 * @since 9 * @version 1.0 */ -- Gitee From 525c45996a58c5511803b2a010d6285f411c4b6c Mon Sep 17 00:00:00 2001 From: Gloria Date: Tue, 9 Jan 2024 17:42:43 +0800 Subject: [PATCH 0214/2135] updated en docs Signed-off-by: Gloria --- en/native_sdk/graphic/external_window.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/en/native_sdk/graphic/external_window.h b/en/native_sdk/graphic/external_window.h index bb6206cb..dddd18ca 100644 --- a/en/native_sdk/graphic/external_window.h +++ b/en/native_sdk/graphic/external_window.h @@ -268,6 +268,8 @@ typedef struct { /** * @brief Creates an OHNativeWindow instance. * A new OHNativeWindow instance is created each time this function is called. + * If this API is unavailable, you can create an OHNativeWindow instance by calling + * OH_NativeImage_AcquireNativeWindow or through the . * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param pSurface Pointer to a ProduceSurface. The type is sptr. @@ -291,6 +293,8 @@ void OH_NativeWindow_DestroyNativeWindow(OHNativeWindow* window); /** * @brief Creates an OHNativeWindowBuffer instance. * A new OHNativeWindowBuffer instance is created each time this function is called. + * If this API is unavailable, you can create an OHNativeWindowBuffer instance + * by calling OH_NativeWindow_CreateNativeWindowBufferFromNativeBuffer. * * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param pSurfaceBuffer Pointer to a produce buffer. The type is sptr. @@ -360,11 +364,14 @@ int32_t OH_NativeWindow_NativeWindowFlushBuffer(OHNativeWindow *window, OHNative * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow * @param window Pointer to an OHNativeWindow instance. * @param buffer Double pointer to an OHNativeWindowBuffer instance. + * @param fenceFd Pointer to a file descriptor handle. + * @param matrix Retrieved 4*4 transformation matrix. * @return Returns 0 if the operation is successful. * @since 11 * @version 1.0 */ -int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer); +int32_t OH_NativeWindow_GetLastFlushedBuffer(OHNativeWindow *window, OHNativeWindowBuffer **buffer, + int *fenceFd, float matrix[16]); /** * @brief Returns the OHNativeWindowBuffer to the buffer queue through an OHNativeWindow instance, -- Gitee From 1cea6e2619e0bd7d0b73d19e3c28bc2247f44e9f Mon Sep 17 00:00:00 2001 From: zhangkai269 Date: Wed, 10 Jan 2024 10:15:51 +0800 Subject: [PATCH 0215/2135] =?UTF-8?q?ohaudio=20=E5=A4=B4=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=A0=BC=E5=BC=8F=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangkai269 --- .../media/ohaudio/native_audiocapturer.h | 42 +++++++++---------- .../media/ohaudio/native_audiorenderer.h | 41 +++++++++--------- .../media/ohaudio/native_audiostream_base.h | 36 ++++++++-------- .../media/ohaudio/native_audiostreambuilder.h | 2 +- 4 files changed, 61 insertions(+), 60 deletions(-) diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h b/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h index ffedf405..71dda08c 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiocapturer.h @@ -43,7 +43,7 @@ #ifdef __cplusplus extern "C" { #endif -/* +/** * @brief 释放音频流。 * * @since 10 @@ -54,7 +54,7 @@ extern "C" { */ OH_AudioStream_Result OH_AudioCapturer_Release(OH_AudioCapturer* capturer); -/* +/** * @brief 开始获取音频数据。 * * @since 10 @@ -65,7 +65,7 @@ OH_AudioStream_Result OH_AudioCapturer_Release(OH_AudioCapturer* capturer); */ OH_AudioStream_Result OH_AudioCapturer_Start(OH_AudioCapturer* capturer); -/* +/** * @brief 暂停音频流。 * * @since 10 @@ -76,7 +76,7 @@ OH_AudioStream_Result OH_AudioCapturer_Start(OH_AudioCapturer* capturer); */ OH_AudioStream_Result OH_AudioCapturer_Pause(OH_AudioCapturer* capturer); -/* +/** * @brief 停止音频流 * * @since 10 @@ -87,7 +87,7 @@ OH_AudioStream_Result OH_AudioCapturer_Pause(OH_AudioCapturer* capturer); */ OH_AudioStream_Result OH_AudioCapturer_Stop(OH_AudioCapturer* capturer); -/* +/** * @brief 丢弃获取的音频数据。 * * @since 10 @@ -97,7 +97,7 @@ OH_AudioStream_Result OH_AudioCapturer_Stop(OH_AudioCapturer* capturer); */ OH_AudioStream_Result OH_AudioCapturer_Flush(OH_AudioCapturer* capturer); -/* +/** * @brief 查询当前音频流状态。 * * @since 10 @@ -108,7 +108,7 @@ OH_AudioStream_Result OH_AudioCapturer_Flush(OH_AudioCapturer* capturer); */ OH_AudioStream_Result OH_AudioCapturer_GetCurrentState(OH_AudioCapturer* capturer, OH_AudioStream_State* state); -/* +/** * @brief 查询当前音频流时延模式。 * * @since 10 @@ -120,7 +120,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetCurrentState(OH_AudioCapturer* capture OH_AudioStream_Result OH_AudioCapturer_GetLatencyMode(OH_AudioCapturer* capturer, OH_AudioStream_LatencyMode* latencyMode); -/* +/** * @brief 查询当前音频流ID。 * * @since 10 @@ -131,7 +131,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetLatencyMode(OH_AudioCapturer* capturer */ OH_AudioStream_Result OH_AudioCapturer_GetStreamId(OH_AudioCapturer* capturer, uint32_t* streamId); -/* +/** * @brief 查询当前音频流采样率。 * * @since 10 @@ -142,7 +142,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetStreamId(OH_AudioCapturer* capturer, u */ OH_AudioStream_Result OH_AudioCapturer_GetSamplingRate(OH_AudioCapturer* capturer, int32_t* rate); -/* +/** * @brief 查询当前音频流通道数。 * * @since 10 @@ -153,7 +153,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetSamplingRate(OH_AudioCapturer* capture */ OH_AudioStream_Result OH_AudioCapturer_GetChannelCount(OH_AudioCapturer* capturer, int32_t* channelCount); -/* +/** * @brief 查询当前音频流采样格式。 * * @since 10 @@ -165,7 +165,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetChannelCount(OH_AudioCapturer* capture OH_AudioStream_Result OH_AudioCapturer_GetSampleFormat(OH_AudioCapturer* capturer, OH_AudioStream_SampleFormat* sampleFormat); -/* +/** * @brief 查询当前音频流编码类型。 * * @since 10 @@ -177,7 +177,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetSampleFormat(OH_AudioCapturer* capture OH_AudioStream_Result OH_AudioCapturer_GetEncodingType(OH_AudioCapturer* capturer, OH_AudioStream_EncodingType* encodingType); -/* +/** * @brief 查询当前音频流工作场景类型。 * * @since 10 @@ -189,7 +189,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetEncodingType(OH_AudioCapturer* capture OH_AudioStream_Result OH_AudioCapturer_GetCapturerInfo(OH_AudioCapturer* capturer, OH_AudioStream_SourceType* sourceType); -/* +/** * @brief 在回调中查询帧大小,它是每次回调返回的缓冲区的固定长度。 * * @since 10 @@ -198,10 +198,10 @@ OH_AudioStream_Result OH_AudioCapturer_GetCapturerInfo(OH_AudioCapturer* capture * @param frameSize 指向将为帧大小设置的变量的指针(作为返回值使用)。 * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 */ -OH_AudioStream_Result OH_AudioCapturer_GetFrameSizeInCallback(OH_AudioCapturer *capturer, - int32_t *frameSize); +OH_AudioStream_Result OH_AudioCapturer_GetFrameSizeInCallback(OH_AudioCapturer* capturer, + int32_t* frameSize); -/* +/** * @brief 获取输入音频流时间戳和位置信息。 * * @since 10 @@ -212,10 +212,10 @@ OH_AudioStream_Result OH_AudioCapturer_GetFrameSizeInCallback(OH_AudioCapturer * * @param timestamp 指向接收时间戳的变量的指针(作为返回值使用)。 * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 */ -OH_AudioStream_Result OH_AudioCapturer_GetTimestamp(OH_AudioCapturer *capturer, clockid_t clockId, - int64_t *framePosition, int64_t *timestamp); +OH_AudioStream_Result OH_AudioCapturer_GetTimestamp(OH_AudioCapturer* capturer, clockid_t clockId, + int64_t* framePosition, int64_t* timestamp); -/* +/** * @brief 查询自创建流以来已读取的帧数。 * * @since 10 @@ -224,7 +224,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetTimestamp(OH_AudioCapturer *capturer, * @param frames 指向将为帧计数设置的变量的指针(作为返回值使用)。 * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 */ -OH_AudioStream_Result OH_AudioCapturer_GetFramesRead(OH_AudioCapturer *capturer, int64_t *frames); +OH_AudioStream_Result OH_AudioCapturer_GetFramesRead(OH_AudioCapturer* capturer, int64_t* frames); #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h b/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h index d83ee993..53b4727b 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h @@ -43,7 +43,7 @@ #ifdef __cplusplus extern "C" { #endif -/* +/** * @brief 释放音频流。 * * @since 10 @@ -53,7 +53,7 @@ extern "C" { */ OH_AudioStream_Result OH_AudioRenderer_Release(OH_AudioRenderer* renderer); -/* +/** * @brief 开始输出音频数据。 * * @since 10 @@ -63,7 +63,7 @@ OH_AudioStream_Result OH_AudioRenderer_Release(OH_AudioRenderer* renderer); */ OH_AudioStream_Result OH_AudioRenderer_Start(OH_AudioRenderer* renderer); -/* +/** * @brief 暂停音频流。 * * @since 10 @@ -73,7 +73,7 @@ OH_AudioStream_Result OH_AudioRenderer_Start(OH_AudioRenderer* renderer); */ OH_AudioStream_Result OH_AudioRenderer_Pause(OH_AudioRenderer* renderer); -/* +/** * @brief 停止音频流 * * @since 10 @@ -83,7 +83,7 @@ OH_AudioStream_Result OH_AudioRenderer_Pause(OH_AudioRenderer* renderer); */ OH_AudioStream_Result OH_AudioRenderer_Stop(OH_AudioRenderer* renderer); -/* +/** * @brief 丢弃已经写入的音频数据。 * * @since 10 @@ -93,7 +93,7 @@ OH_AudioStream_Result OH_AudioRenderer_Stop(OH_AudioRenderer* renderer); */ OH_AudioStream_Result OH_AudioRenderer_Flush(OH_AudioRenderer* renderer); -/* +/** * @brief 查询当前音频流状态。 * * @since 10 @@ -105,7 +105,7 @@ OH_AudioStream_Result OH_AudioRenderer_Flush(OH_AudioRenderer* renderer); OH_AudioStream_Result OH_AudioRenderer_GetCurrentState(OH_AudioRenderer* renderer, OH_AudioStream_State* state); -/* +/** * @brief 查询当前音频流采样率。 * * @since 10 @@ -116,7 +116,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetCurrentState(OH_AudioRenderer* rendere */ OH_AudioStream_Result OH_AudioRenderer_GetSamplingRate(OH_AudioRenderer* renderer, int32_t* rate); -/* +/** * @brief 查询当前音频流ID。 * * @since 10 @@ -127,7 +127,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetSamplingRate(OH_AudioRenderer* rendere */ OH_AudioStream_Result OH_AudioRenderer_GetStreamId(OH_AudioRenderer* renderer, uint32_t* streamId); -/* +/** * @brief 查询当前音频流通道数。 * * @since 10 @@ -138,7 +138,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetStreamId(OH_AudioRenderer* renderer, u */ OH_AudioStream_Result OH_AudioRenderer_GetChannelCount(OH_AudioRenderer* renderer, int32_t* channelCount); -/* +/** * @brief 查询当前音频流采样格式。 * * @since 10 @@ -150,7 +150,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetChannelCount(OH_AudioRenderer* rendere OH_AudioStream_Result OH_AudioRenderer_GetSampleFormat(OH_AudioRenderer* renderer, OH_AudioStream_SampleFormat* sampleFormat); -/* +/** * @brief 查询当前音频流时延模式。 * * @since 10 @@ -161,7 +161,8 @@ OH_AudioStream_Result OH_AudioRenderer_GetSampleFormat(OH_AudioRenderer* rendere */ OH_AudioStream_Result OH_AudioRenderer_GetLatencyMode(OH_AudioRenderer* renderer, OH_AudioStream_LatencyMode* latencyMode); -/* + +/** * @brief 查询当前音频流工作场景类型。 * * The rendere info includes {@link OH_AudioStream_Usage} value and {@link OH_AudioStream_Content} value. @@ -175,7 +176,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetLatencyMode(OH_AudioRenderer* renderer OH_AudioStream_Result OH_AudioRenderer_GetRendererInfo(OH_AudioRenderer* renderer, OH_AudioStream_Usage* usage); -/* +/** * @brief 查询当前音频流编码类型。 * * @since 10 @@ -187,7 +188,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetRendererInfo(OH_AudioRenderer* rendere OH_AudioStream_Result OH_AudioRenderer_GetEncodingType(OH_AudioRenderer* renderer, OH_AudioStream_EncodingType* encodingType); -/* +/** * @brief 查询自创建流以来已写入的帧数。 * * @since 10 @@ -196,9 +197,9 @@ OH_AudioStream_Result OH_AudioRenderer_GetEncodingType(OH_AudioRenderer* rendere * @param frames 指向将为帧计数设置的变量的指针(作为返回值使用)。 * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 */ -OH_AudioStream_Result OH_AudioRenderer_GetFramesWritten(OH_AudioRenderer *renderer, int64_t *frames); +OH_AudioStream_Result OH_AudioRenderer_GetFramesWritten(OH_AudioRenderer* renderer, int64_t* frames); -/* +/** * @brief 获取输出音频流时间戳和位置信息。 * * @since 10 @@ -209,10 +210,10 @@ OH_AudioStream_Result OH_AudioRenderer_GetFramesWritten(OH_AudioRenderer *render * @param timestamp 指向接收时间戳的变量的指针(作为返回值使用)。 * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 */ -OH_AudioStream_Result OH_AudioRenderer_GetTimestamp(OH_AudioRenderer *renderer, clockid_t clockId, - int64_t *framePosition, int64_t *timestamp); +OH_AudioStream_Result OH_AudioRenderer_GetTimestamp(OH_AudioRenderer* renderer, clockid_t clockId, + int64_t* framePosition, int64_t* timestamp); -/* +/** * @brief 在回调中查询帧大小,它是一个固定的长度,每次回调都要填充流。 * * @since 10 @@ -221,7 +222,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetTimestamp(OH_AudioRenderer *renderer, * @param frameSize 指向将为帧大小设置的变量的指针(作为返回值使用)。 * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 */ -OH_AudioStream_Result OH_AudioRenderer_GetFrameSizeInCallback(OH_AudioRenderer *renderer, int32_t *frameSize); +OH_AudioStream_Result OH_AudioRenderer_GetFrameSizeInCallback(OH_AudioRenderer* renderer, int32_t* frameSize); #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h b/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h index 21e8ee01..5395ab02 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h @@ -394,26 +394,26 @@ typedef struct OH_AudioRenderer_Callbacks_Struct { /** * 这个函数指针将指向用于处理音频播放流事件的回调函数。 */ - int32_t (*OH_AudioRenderer_Callbacks_Struct::OH_AudioRenderer_OnStreamEvent)( - OH_AudioRenderer *renderer, - void *userData, + int32_t (*OH_AudioRenderer_OnStreamEvent)( + OH_AudioRenderer* renderer, + void* userData, OH_AudioStream_Event event); /** * 这个函数指针将指向用于处理音频播放中断事件的回调函数。 */ - int32_t (*OH_AudioRenderer_Callbacks_Struct::OH_AudioRenderer_OnInterruptEvent)( - OH_AudioRenderer *renderer, - void *userData, + int32_t (*OH_AudioRenderer_OnInterruptEvent)( + OH_AudioRenderer* renderer, + void* userData, OH_AudioInterrupt_ForceType type, OH_AudioInterrupt_Hint hint); /** * 这个函数指针将指向用于处理音频播放错误结果的回调函数。 */ - int32_t (*OH_AudioRenderer_Callbacks_Struct::OH_AudioRenderer_OnError)( - OH_AudioRenderer *renderer, - void *userData, + int32_t (*OH_AudioRenderer_OnError)( + OH_AudioRenderer* renderer, + void* userData, OH_AudioStream_Result error); } OH_AudioRenderer_Callbacks; @@ -436,26 +436,26 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { /** * 这个函数指针将指向用于处理音频录制流事件的回调函数。 */ - int32_t (*OH_AudioCapturer_Callbacks_Struct::OH_AudioCapturer_OnStreamEvent)( - OH_AudioCapturer *capturer, - void *userData, + int32_t (*OH_AudioCapturer_OnStreamEvent)( + OH_AudioCapturer* capturer, + void* userData, OH_AudioStream_Event event); /** * 这个函数指针将指向用于处理音频录制中断事件的回调函数。 */ - int32_t (*OH_AudioCapturer_Callbacks_Struct::OH_AudioCapturer_OnInterruptEvent)( - OH_AudioCapturer *capturer, - void *userData, + int32_t (*OH_AudioCapturer_OnInterruptEvent)( + OH_AudioCapturer* capturer, + void* userData, OH_AudioInterrupt_ForceType type, OH_AudioInterrupt_Hint hint); /** * 这个函数指针将指向用于处理音频录制错误结果的回调函数。 */ - int32_t (*OH_AudioCapturer_Callbacks_Struct::OH_AudioCapturer_OnError)( - OH_AudioCapturer *capturer, - void *userData, + int32_t (*OH_AudioCapturer_OnError)( + OH_AudioCapturer* capturer, + void* userData, OH_AudioStream_Result error); } OH_AudioCapturer_Callbacks; #ifdef __cplusplus diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h b/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h index 0ffea7f7..d3d7356d 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h @@ -1,4 +1,4 @@ -/** +/* * 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. -- Gitee From a3e62d8040b95071473a55348a9f2173a29d9920 Mon Sep 17 00:00:00 2001 From: fangyunzhong Date: Sat, 6 Jan 2024 18:34:46 +0800 Subject: [PATCH 0216/2135] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=AE=A1=E7=90=86natvie=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangyunzhong --- zh-cn/native_sdk/resmgr/raw_file.h | 184 ++++++++++++++++++--- zh-cn/native_sdk/resmgr/raw_file_manager.h | 40 ++--- 2 files changed, 181 insertions(+), 43 deletions(-) diff --git a/zh-cn/native_sdk/resmgr/raw_file.h b/zh-cn/native_sdk/resmgr/raw_file.h index f817c2e5..51361625 100644 --- a/zh-cn/native_sdk/resmgr/raw_file.h +++ b/zh-cn/native_sdk/resmgr/raw_file.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -17,9 +17,7 @@ * @addtogroup rawfile * @{ * - * @brief 提供操作rawfile目录和rawfile文件功能 - * - * 功能包括遍历、打开、搜索、读取和关闭rawfile + * @brief 提供操作rawfile目录和rawfile文件的功能,包括遍历、打开、搜索、读取和关闭 * * @since 8 * @version 1.0 @@ -28,9 +26,7 @@ /** * @file raw_file.h * - * @brief 提供rawfile文件相关功能 - * - * 功能包括搜索、读取和关闭rawfile文件 + * @brief 提供rawfile文件相关功能,功能包括搜索、读取和关闭 * * @since 8 * @version 1.0 @@ -46,6 +42,14 @@ extern "C" { struct RawFile; +/** + * @brief 提供对较大rawfile的访问功能 + * + * @since 11 + * @version 1.0 + */ +struct RawFile64; + /** * @brief 提供对rawfile的访问功能 * @@ -56,6 +60,14 @@ struct RawFile; */ typedef struct RawFile RawFile; +/** + * @brief 提供对较大rawfile的访问功能 + * + * @since 11 + * @version 1.0 + */ +typedef struct RawFile64 RawFile64; + /** * @brief 提供rawfile文件描述符信息 * @@ -66,20 +78,38 @@ typedef struct RawFile RawFile; * @version 1.0 */ typedef struct { - /** rawfile文件描述符 */ + /** rawfile文件描述符,单位为int */ int fd; - /** rawfile在HAP包中的起始位置 */ + /** rawfile在HAP包中的起始位置,单位为long */ long start; - /** rawfile在HAP包中的长度 */ + /** rawfile在HAP包中的长度,单位为long */ long length; } RawFileDescriptor; /** - * @brief 读取rawfile + * @brief 提供较大rawfile文件描述符信息 + * + * RawFileDescriptor64是{@link OH_ResourceManager_GetRawFileDescriptor64}的输出参数, + * 涵盖了rawfile文件的文件描述符以及在HAP包中的起始位置和长度。 * - * 从当前位置读取指定长度的数据 + * @since 11 + * @version 1.0 + */ +typedef struct { + /** rawfile文件描述符,单位为int*/ + int fd; + + /** rawfile在HAP包中的起始位置,单位为int64_t */ + int64_t start; + + /** rawfile在HAP包中的长度,单位为int64_t */ + int64_t length; +} RawFileDescriptor64; + +/** + * @brief 读取rawfile内容,从当前位置读取指定长度的数据 * * @param rawFile 表示指向{@link RawFile}的指针 * @param buf 用于接收读取数据的缓冲区指针 @@ -91,32 +121,42 @@ typedef struct { int OH_ResourceManager_ReadRawFile(const RawFile *rawFile, void *buf, size_t length); /** - * @brief 基于指定的offset,在rawfile文件内搜索读写数据的位置 + * @brief 基于指定的偏移量,在rawfile文件内搜索读写数据的位置 * * @param rawFile 表示指向{@link RawFile}的指针 - * @param offset 表示指定的offset + * @param offset 表示指定的偏移量 * @param whence 读写位置,有以下场景: \n - * 0: 读写位置为offset \n + * 0: 读写位置为文件起始位置加上offset \n * 1: 读写位置为当前位置加上offset \n - * 2: 读写位置为文件末尾(EOF)加上offset - * @return 如果搜索成功返回新的读写位置,如果发生错误返回 (long) -1 + * 2: 读写位置为文件末尾加上offset + * @return 如果搜索成功返回(int) 0,如果发生错误返回 (int) -1 * @since 8 * @version 1.0 */ int OH_ResourceManager_SeekRawFile(const RawFile *rawFile, long offset, int whence); /** - * @brief 获取rawfile长度,单位为int32_t + * @brief 获取rawfile长度,单位为long * * @param rawFile 表示指向{@link RawFile}的指针 - * @return Returns rawfile整体长度 + * @return 返回rawfile的整体长度 * @since 8 * @version 1.0 */ long OH_ResourceManager_GetRawFileSize(RawFile *rawFile); /** - * @brief 关闭已打开的{@link RawFile} 以及释放所有相关联资源 + * @brief 获取rawfile的剩余长度,单位为long + * + * @param rawFile 表示指向{@link RawFile}的指针 + * @return 返回rawfile的剩余长度 + * @since 11 + * @version 1.0 + */ +long OH_ResourceManager_GetRawFileRemainingLength(const RawFile *rawFile); + +/** + * @brief 关闭已打开的{@link RawFile} 以及释放所有相关联的资源 * * * @@ -128,19 +168,19 @@ long OH_ResourceManager_GetRawFileSize(RawFile *rawFile); void OH_ResourceManager_CloseRawFile(RawFile *rawFile); /** - * @brief 获取rawfile当前的offset,单位为int32_t + * @brief 获取rawfile当前的偏移量,单位为long * - * rawfile当前的offset + * rawfile当前的偏移量 * * @param rawFile 表示指向{@link RawFile}的指针 - * @return 返回rawfile当前的offset + * @return 返回rawfile当前的偏移量 * @since 8 * @version 1.0 */ long OH_ResourceManager_GetRawFileOffset(const RawFile *rawFile); /** - * @brief 基于offset(单位为int32_t)和文件长度打开rawfile,并获取rawfile文件描述符 + * @brief 基于偏移量(单位为long)和文件长度(单位为long)打开rawfile,并获取rawfile文件描述符 * * 打开的文件描述符被用于读取rawfile * @@ -164,6 +204,102 @@ bool OH_ResourceManager_GetRawFileDescriptor(const RawFile *rawFile, RawFileDesc */ bool OH_ResourceManager_ReleaseRawFileDescriptor(const RawFileDescriptor &descriptor); +/** + * @brief 读取较大的rawfile文件内容,从当前位置读取指定长度的数据 + * + * @param rawFile 表示指向{@link RawFile64}的指针 + * @param buf 用于接收读取数据的缓冲区指针 + * @param length 读取数据的字节长度 + * @return 返回读取的字节数,如果读取长度超过文件末尾长度,则返回0 + * @since 11 + * @version 1.0 + */ +int64_t OH_ResourceManager_ReadRawFile64(const RawFile64 *rawFile, void *buf, int64_t length); + +/** + * @brief 基于指定的偏移量,在较大的rawfile文件内搜索读写数据的位置 + * + * @param rawFile 表示指向{@link RawFile64}的指针 + * @param offset 表示指定的偏移量 + * @param whence 读写位置,有以下场景: \n + * 0: 读写位置为文件起始位置加上offset \n + * 1: 读写位置为当前位置加上offset \n + * 2: 读写位置为文件末尾加上offset + * @return 如果搜索成功返回 (int) 0,如果发生错误返回 (int) -1 + * occurs. + * @since 11 + * @version 1.0 + */ +int OH_ResourceManager_SeekRawFile64(const RawFile64 *rawFile, int64_t offset, int whence); + +/** + * @brief 获取较大rawfile文件的长度,单位为int64_t + * + * @param rawFile 表示指向{@link RawFile64}的指针 + * @return 返回rawfile的整体长度 + * @since 11 + * @version 1.0 + */ +int64_t OH_ResourceManager_GetRawFileSize64(RawFile64 *rawFile); + +/** + * @brief 获取较大rawfile的剩余长度,单位为int64_t. + * + * @param rawFile 表示指向{@link RawFile64}的指针 + * @return 返回rawfile的剩余长度 + * @since 11 + * @version 1.0 + */ +int64_t OH_ResourceManager_GetRawFileRemainingLength64(const RawFile64 *rawFile); + +/** + * @brief 关闭已打开的{@link RawFile64} 以及释放所有相关联的资源 + * + * + * + * @param rawFile 表示指向{@link RawFile64}的指针 + * @see OH_ResourceManager_OpenRawFile64 + * @since 11 + * @version 1.0 + */ +void OH_ResourceManager_CloseRawFile64(RawFile64 *rawFile); + +/** + * @brief 获取较大rawfile文件的偏移量,单位为int64_t + * + * + * @param rawFile 表示指向{@link RawFile64}的指针 + * @return 返回rawfile当前的偏移量 + * @since 11 + * @version 1.0 + */ +int64_t OH_ResourceManager_GetRawFileOffset64(const RawFile64 *rawFile); + +/** + * @brief 基于偏移量(单位为int64_t)和文件长度(单位为int64_t)打开较大的rawfile,并获取e文件描述符 + * + * 打开的文件描述符被用于读取rawfile + * + * @param rawFile 表示指向{@link RawFile64}的指针 + * @param 显示rawfile文件描述符,以及在HAP包中的起始位置和长度 + * @return 返回true表示打开rawfile文件描述符成功,返回false表示rawfile不允许被访问 + * @since 11 + * @version 1.0 + */ +bool OH_ResourceManager_GetRawFileDescriptor64(const RawFile64 *rawFile, RawFileDescriptor64 *descriptor); + +/** + * @brief 关闭rawfile文件描述符 + * + * 已打开的文件描述符在使用完以后必须释放,防止文件描述符泄露 + * + * @param descriptor 包含rawfile文件描述符,以及在HAP包中的起始位置和长度 + * @return 返回true表示关闭文件描述符成功,返回false表示关闭文件描述符失败 + * @since 11 + * @version 1.0 + */ +bool OH_ResourceManager_ReleaseRawFileDescriptor64(const RawFileDescriptor64 *descriptor); + #ifdef __cplusplus }; #endif diff --git a/zh-cn/native_sdk/resmgr/raw_file_manager.h b/zh-cn/native_sdk/resmgr/raw_file_manager.h index ed7aec90..4d72f679 100644 --- a/zh-cn/native_sdk/resmgr/raw_file_manager.h +++ b/zh-cn/native_sdk/resmgr/raw_file_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-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 @@ -28,9 +28,7 @@ /** * @file raw_file_manager.h * - * @brief 提供资源管理rawfile相关功能 - * - * 可以使用resource manager打开rawfile来进行后续相关操作,像搜索和读取等 + * @brief 提供资源管理rawfile相关功能,可以使用ResourceManager打开rawfile进行后续相关操作,像搜索和读取等 * * @since 8 * @version 1.0 @@ -49,7 +47,7 @@ extern "C" { struct NativeResourceManager; /** - * @brief 代表resource manager + * @brief 代表native侧的ResourceManager * * 此类封装了JavaScript resource manager的native实现 * ResourceManager指针可以通过调用{@link OH_ResourceManager_InitNativeResourceManager}方法获取 @@ -60,9 +58,7 @@ struct NativeResourceManager; typedef struct NativeResourceManager NativeResourceManager; /** - * @brief 基于JavaScipt resource manager获取native resource manager - * - * 通过获取resource manager来完成rawfile相关功能 + * @brief 基于JavaScipt侧的ResourceManager获取native侧的ResourceManager,用来完成rawfile相关功能 * * @param env 表示JavaScipt Native Interface (napi)环境指针 * @param jsResMgr 表示JavaScipt resource manager @@ -73,9 +69,7 @@ typedef struct NativeResourceManager NativeResourceManager; NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr); /** - * @brief 释放native resource manager - * - * + * @brief 释放native侧ResourceManager * * @param resMgr 表示{@link NativeResourceManager}指针 * @since 8 @@ -84,9 +78,7 @@ NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr); /** - * @brief 打开rawfile目录 - * - * 打开rawfile目录后,可以遍历对应目录下的rawfile文件 + * @brief 打开rawfile目录,打开后可以遍历对应目录下的rawfile文件 * * @param mgr 表示指向{@link NativeResourceManager}的指针,此指针是通过调用 * {@link OH_ResourceManager_InitNativeResourceManager}方法获取的 @@ -100,12 +92,9 @@ void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resM RawDir *OH_ResourceManager_OpenRawDir(const NativeResourceManager *mgr, const char *dirName); /** - * @brief 打开rawfile文件 - * - * 当打开rawfile以后,可以读取它的数据 + * @brief 打开rawfile文件,打开后可以读取它的数据 * - * @param mgr 表示指向{@link NativeResourceManager}的指针,此指针是通过调用 - * {@link OH_ResourceManager_InitNativeResourceManager}方法获取的 + * @param mgr 表示指向{@link NativeResourceManager}的指针,此指针通过调用{@link OH_ResourceManager_InitNativeResourceManager}方法获取 * @param fileName 表示基于rawfile根目录的相对路径下的文件名称 * @return 返回{@link RawFile}指针。当使用完此指针,调用{@link OH_ResourceManager_CloseRawFile}释放。 * @see OH_ResourceManager_InitNativeResourceManager @@ -115,6 +104,19 @@ RawDir *OH_ResourceManager_OpenRawDir(const NativeResourceManager *mgr, const ch */ RawFile *OH_ResourceManager_OpenRawFile(const NativeResourceManager *mgr, const char *fileName); +/** + * @brief 打开较大的rawfile文件,打开后可以读取它的数据 + * + * @param mgr 表示指向{@link NativeResourceManager}的指针,此指针通过调用{@link OH_ResourceManager_InitNativeResourceManager}方法获取 + * @param fileName 表示基于rawfile根目录的相对路径下的文件名称 + * @return 返回{@link RawFile64}指针。当使用完此指针,调用{@link OH_ResourceManager_CloseRawFile64}释放。 + * @see OH_ResourceManager_InitNativeResourceManager + * @see OH_ResourceManager_CloseRawFile64 + * @since 11 + * @version 1.0 + */ +RawFile64 *OH_ResourceManager_OpenRawFile64(const NativeResourceManager *mgr, const char *fileName); + #ifdef __cplusplus }; #endif -- Gitee From cd49da2c5789ef0d675a70c9d8d18459e1e26432 Mon Sep 17 00:00:00 2001 From: wuXin Date: Fri, 12 Jan 2024 03:48:58 +0000 Subject: [PATCH 0217/2135] =?UTF-8?q?update=20zh-cn/native=5Fsdk/security/?= =?UTF-8?q?huks/native=5Fhuks=5Fapi.h.=20=E6=96=B0=E5=A2=9Eohos.permission?= =?UTF-8?q?.ATTEST=5FKEY=E6=9D=83=E9=99=90=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuXin --- zh-cn/native_sdk/security/huks/native_huks_api.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zh-cn/native_sdk/security/huks/native_huks_api.h b/zh-cn/native_sdk/security/huks/native_huks_api.h index 529d64b2..307c026f 100644 --- a/zh-cn/native_sdk/security/huks/native_huks_api.h +++ b/zh-cn/native_sdk/security/huks/native_huks_api.h @@ -148,6 +148,7 @@ struct OH_Huks_Result OH_Huks_IsKeyItemExist(const struct OH_Huks_Blob *keyAlias /** * @brief 获取密钥证书链。 * + * @permission ohos.permission.ATTEST_KEY * @param keyAlias 要获取证书的密钥的别名。 * @param paramSet 获取密钥证书需要的参数。 * @param certChain 存放输出的密钥证书链。 -- Gitee From c492b1a9bd1784d7bda14342edadf48c7ec47a48 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Fri, 12 Jan 2024 11:51:23 +0800 Subject: [PATCH 0218/2135] modify Signed-off-by: liuxiyao223 --- en/native_sdk/net_ssl/net_ssl_c.h | 4 ++-- en/native_sdk/net_ssl/net_ssl_c_type.h | 2 +- zh-cn/native_sdk/net_ssl/net_ssl_c.h | 4 ++-- zh-cn/native_sdk/net_ssl/net_ssl_c_type.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/en/native_sdk/net_ssl/net_ssl_c.h b/en/native_sdk/net_ssl/net_ssl_c.h index dd2b531f..0ee00875 100644 --- a/en/native_sdk/net_ssl/net_ssl_c.h +++ b/en/native_sdk/net_ssl/net_ssl_c.h @@ -32,7 +32,7 @@ * @brief Defines C APIs for the SSL/TLS certificate chain verification module. * * @library libnet_ssl.so - * @syscap SystemCapability.Communication.Netstack + * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 */ @@ -64,7 +64,7 @@ extern "C" { * 2305023 - Certificate has been revoked. * 2305024 - Invalid certificate authority (CA). * 2305027 - Certificate is untrusted. - * @syscap SystemCapability.Communication.Netstack + * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 */ diff --git a/en/native_sdk/net_ssl/net_ssl_c_type.h b/en/native_sdk/net_ssl/net_ssl_c_type.h index 661770f4..eda742dc 100644 --- a/en/native_sdk/net_ssl/net_ssl_c_type.h +++ b/en/native_sdk/net_ssl/net_ssl_c_type.h @@ -31,7 +31,7 @@ * @brief Defines the data structures for the C APIs of the SSL/TLS certificate chain verification module. * * @library libnet_ssl.so - * @syscap SystemCapability.Communication.Netstack + * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/net_ssl/net_ssl_c.h b/zh-cn/native_sdk/net_ssl/net_ssl_c.h index 7ba549cc..32d5d6ec 100644 --- a/zh-cn/native_sdk/net_ssl/net_ssl_c.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c.h @@ -32,7 +32,7 @@ * @brief 为SSL/TLS证书链校验模块定义C接口 * * @library libnet_ssl.so - * @syscap SystemCapability.Communication.Netstack + * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 */ @@ -64,7 +64,7 @@ extern "C" { * 2305023 - 证书已被吊销. * 2305024 - 证书颁发机构(CA)无效. * 2305027 - 证书不受信任. - * @syscap SystemCapability.Communication.Netstack + * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h index 8f75d9f1..a364b06a 100644 --- a/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h +++ b/zh-cn/native_sdk/net_ssl/net_ssl_c_type.h @@ -31,7 +31,7 @@ * @brief 定义SSL/TLS证书链校验模块的C接口需要的数据结构 * * @library libnet_ssl.so - * @syscap SystemCapability.Communication.Netstack + * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 */ -- Gitee From 4c071f3945bb4bd657c9a23c04c58de0a01a9923 Mon Sep 17 00:00:00 2001 From: zengyawen Date: Fri, 12 Jan 2024 17:35:46 +0800 Subject: [PATCH 0219/2135] update docs Signed-off-by: zengyawen --- .../native_sdk/media/drm/native_drm_common.h | 160 +++++++++--------- zh-cn/native_sdk/media/drm/native_drm_err.h | 2 +- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_drm_common.h b/zh-cn/native_sdk/media/drm/native_drm_common.h index 3ef3251c..6776f7e5 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_common.h +++ b/zh-cn/native_sdk/media/drm/native_drm_common.h @@ -44,348 +44,348 @@ extern "C" { #endif /** - * @brief 监听类型. + * @brief 监听类型。 * @syscap SystemCapability.Multimedia.Drm.Core. * @since 11 * @version 1.0 */ typedef enum DRM_ListenerType { /** - * DRM基础事件. + * DRM基础事件 */ LISTENER_DRM_EVENT = 200, /** - * 设备证书请求事件. + * 设备证书请求事件 */ LISTENER_PROVISION_REQUIRED = 201, /** - * 密钥请求事件. + * 密钥请求事件 */ LISTENER_KEY_REQUIRED = 202, /** - * 密钥过期事件. + * 密钥过期事件 */ LISTENER_KEY_EXPIRED = 203, /** - * 第三方定义事件. + * 第三方定义事件 */ LISTENER_VENDOR_DEFINED = 204, /** - * 密钥过期更新事件. + * 密钥过期更新事件 */ LISTENER_EXPIRATION_UPDATE = 206, } DRM_ListenerType; /** - * @brief 内容保护级别类型. + * @brief 内容保护级别类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_ContentProtectionLevel { /** - * 未知级别. + * 未知级别 */ CONTENT_PROTECTION_LEVEL_UNKNOWN = 0, /** - * 软件安全级别. + * 软件安全级别 */ CONTENT_PROTECTION_LEVEL_SW_CRYPTO, /** - * 硬件安全级别. + * 硬件安全级别 */ CONTENT_PROTECTION_LEVEL_HW_CRYPTO, /** - * 硬件增强级别. + * 硬件增强级别 */ CONTENT_PROTECTION_LEVEL_ENHANCED_HW_CRYPTO, /** - * 最大安全级别. + * 最大安全级别 */ CONTENT_PROTECTION_LEVEL_MAX, } DRM_ContentProtectionLevel; /** - * @brief 许可证类型. + * @brief 许可证类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_MediaKeyType { /** - * Media key type offline. + * 离线 */ MEDIA_KEY_TYPE_OFFLINE = 0, /** - * Media key type online + * 在线 */ MEDIA_KEY_TYPE_ONLINE, } DRM_MediaKeyType; /** - * @brief 许可证请求类型e. + * @brief 许可证请求类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_MediaKeyRequestType { /** - * 未知请求类型. + * 未知请求类型 */ MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, /** - * 初始化请求. + * 初始化请求 */ MEDIA_KEY_REQUEST_TYPE_INITIAL, /** - * 续订请求. + * 续订请求 */ MEDIA_KEY_REQUEST_TYPE_RENEWAL, /** - * 释放请求. + * 释放请求 */ MEDIA_KEY_REQUEST_TYPE_RELEASE, /** - * 无请求. + * 无请求 */ MEDIA_KEY_REQUEST_TYPE_NONE, /** - * 更新请求. + * 更新请求 */ MEDIA_KEY_REQUEST_TYPE_UPDATE, } DRM_MediaKeyRequestType; /** - * @brief 离线许可证状态. + * @brief 离线许可证状态。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_OfflineMediaKeyStatus { /** - * 未知状态. + * 未知状态 */ OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, /** - * 可用状态e. + * 可用状态 */ OFFLINE_MEDIA_KEY_STATUS_USABLE, /** - * 失活状态. + * 失活状态 */ OFFLINE_MEDIA_KEY_STATUS_INACTIVE, } DRM_OfflineMediaKeyStatus; /** - * @brief 设备证书状态类型. + * @brief 设备证书状态类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_CertificateStatus { /** - * 设备已安装设备证书. + * 设备已安装设备证书 */ CERT_STATUS_PROVISIONED = 0, /** - * 设备未安装设备证书. + * 设备未安装设备证书 */ CERT_STATUS_NOT_PROVISIONED, /** - * 设备证书过期. + * 设备证书过期 */ CERT_STATUS_EXPIRED, /** - * 无效设备证书. + * 无效设备证书 */ CERT_STATUS_INVALID, /** - * 设备证书不可用. + * 设备证书不可用 */ CERT_STATUS_UNAVAILABLE, } DRM_CertificateStatus; /** - * @brief 在线许可证状态. + * @brief 在线许可证状态。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_MediaKeyStatus { /** - * 可用状态. + * 可用状态 */ MEDIA_KEY_STATUS_OK = 0, /** - * 许可证不存在. + * 许可证不存在 */ MEDIA_KEY_STATUS_UNAVAILABLE = 1, } DRM_MediaKeyStatus; /** - * @brief DRM uint_8 数组类型. + * @brief DRM uint_8 数组类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_Uint8Buffer { /** - * 数组首地址. + * 数组首地址 */ unsigned char *buffer; /** - * 数组长度. + * 数组长度 */ uint32_t bufferLen; } DRM_Uint8Buffer; /** - * @brief DRM 字符数组类型. + * @brief DRM 字符数组类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_CharBuffer { /** - * 数组首地址. + * 数组首地址 */ char *buffer; /** - * 数组长度. + * 数组长度 */ uint32_t bufferLen; } DRM_CharBuffer; /** - * @brief 名值对. + * @brief 字符数组类型的名值对。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_CharBufferPair { - /* 名字. */ + /* 名字 */ DRM_CharBuffer name; - /* 值. */ + /* 值 */ DRM_CharBuffer value; } DRM_CharBufferPair; /** - * @brief 名值对. + * @brief 整形数组类型的名值对。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_Uint8CharBufferPair { - /* 名字. */ + /* 名字 */ DRM_Uint8Buffer key; - /* 值. */ + /* 值 */ DRM_CharBuffer value; } DRM_Uint8CharBufferPair; /** - * @brief 许可证请求参数类型. + * @brief 许可证请求参数类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeyRequestInfo { /** - * 许可证类型. + * 许可证类型 */ DRM_MediaKeyType type; /** - * base64编码后的pssh数据. + * base64编码后的pssh数据 */ DRM_Uint8Buffer data; /** - * 媒体类型. + * 媒体类型 */ DRM_CharBuffer mimeType; /** - * 操作数数组长度. + * 操作数数组长度 */ uint32_t optionsCount; /** - * 操作数数组. + * 操作数数组 */ DRM_CharBufferPair optionsData[0]; } DRM_MediaKeyRequestInfo; /** - * @brief 许可证请求类型. + * @brief 许可证请求类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeyRequest { /** - * 许可证请求类型. + * 许可证请求类型 */ DRM_MediaKeyRequestType type; /** - * 许可证请求数据. + * 许可证请求数据 */ DRM_Uint8Buffer data; /** - * 许可证服务器URL. + * 许可证服务器URL */ DRM_CharBuffer defaultUrl; } DRM_MediaKeyRequest; /** - * @brief DRM度量统计信息. + * @brief DRM度量统计信息。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_Statistics { - /* 度量信息数组长度. */ + /* 度量信息数组长度 */ uint32_t statisticsCount; - /* 度量信息数组. */ + /* 度量信息数组 */ DRM_CharBufferPair info[0]; } DRM_Statistics; /** - * @brief 离线许可证Id数组. + * @brief 离线许可证Id数组。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_MediakeyIdArray { - /* 许可证Id数组长度. */ + /* 许可证Id数组长度 */ uint32_t mediaKeyIdCount; - /* 许可证Id数组. */ + /* 许可证Id数组 */ DRM_Uint8Buffer mediaKeyIds[0]; } DRM_MediakeyIdArray; /** - * @brief 密钥信息. + * @brief 密钥信息。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_KeysInfo { - /* 密钥信息数组长度. */ + /* 密钥信息数组长度 */ uint32_t keysCount; - /* 密钥信息数组. */ + /* 密钥信息数组 */ DRM_Uint8CharBufferPair keysInfo[0]; } DRM_KeysInfo; /** - * @brief 在线许可证描述信息 + * @brief 在线许可证描述信息。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeyDescription { - /* 许可证信息数组长度. */ + /* 许可证信息数组长度*/ uint32_t mediaKeyCount; - /* 许可证信息数组. */ + /* 许可证信息数组 */ DRM_CharBufferPair description[0]; } DRM_MediaKeyDescription; /** - * @brief DRM插件类型名. + * @brief DRM插件类型名。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 @@ -393,43 +393,43 @@ typedef struct DRM_MediaKeyDescription { #define DRM_UUID_LEN 16 /** - * @brief DRM Pssh信息. + * @brief DRM Pssh信息。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_PsshInfo { /** - * DRM插件类型名. + * DRM插件类型名 */ char uuid[DRM_UUID_LEN]; /** - * PSSH数据长度. + * PSSH数据长度 */ uint32_t dataLen; /** - * PSSH数据. + * PSSH数据 */ unsigned char *data; } DRM_PsshInfo; /** - * @brief 从媒体源获取的drm信息. + * @brief 从媒体源获取的DRM信息。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeySystemInfo { - /* PSSH信息数组长度. */ + /* PSSH信息数组长度 */ uint32_t psshCount; - /* PSSH信息数组. */ + /* PSSH信息数组 */ DRM_PsshInfo psshInfo[0]; } DRM_MediaKeySystemInfo; typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeySystemInfo); /** - * @brief MediaKeySystem结构体. + * @brief MediaKeySystem结构体。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 @@ -437,7 +437,7 @@ typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeyS typedef struct MediaKeySystem MediaKeySystem; /** - * @brief MediaKeySession结构体. + * @brief MediaKeySession结构体。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/media/drm/native_drm_err.h b/zh-cn/native_sdk/media/drm/native_drm_err.h index 8e1e9efd..134c0e13 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_err.h +++ b/zh-cn/native_sdk/media/drm/native_drm_err.h @@ -43,7 +43,7 @@ extern "C" { #endif /** - * @brief DRM 错误码 + * @brief DRM错误码。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 -- Gitee From 0fcb1ebe9cfa4c8136cbb817a1b3789111b66825 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Mon, 15 Jan 2024 17:59:42 +0800 Subject: [PATCH 0220/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/ai/mindspore/status.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/en/native_sdk/ai/mindspore/status.h b/en/native_sdk/ai/mindspore/status.h index cef72a14..a2aa035e 100644 --- a/en/native_sdk/ai/mindspore/status.h +++ b/en/native_sdk/ai/mindspore/status.h @@ -51,6 +51,12 @@ extern "C" { /** MindSpore Core code */ OH_AI_COMPCODE_CORE = 0x00000000u, + /** MindSpore MindData code */ + OH_AI_COMPCODE_MD = 0x10000000u, + /** MindSpore MindExpression code */ + OH_AI_COMPCODE_ME = 0x20000000u, + /** MindSpore code */ + OH_AI_COMPCODE_MC = 0x30000000u, /** MindSpore Lite code */ OH_AI_COMPCODE_LITE = 0xF0000000u, }; -- Gitee From b4a6b762b3b49d87a9486b7a97c7e99155427b35 Mon Sep 17 00:00:00 2001 From: wangyulie Date: Mon, 15 Jan 2024 22:22:27 +0800 Subject: [PATCH 0221/2135] update ffrt api Signed-off-by: wangyulie --- zh-cn/native_sdk/ffrt/c/condition_variable.h | 14 + zh-cn/native_sdk/ffrt/c/mutex.h | 14 + zh-cn/native_sdk/ffrt/c/queue.h | 15 +- zh-cn/native_sdk/ffrt/c/sleep.h | 14 + zh-cn/native_sdk/ffrt/c/task.h | 15 +- zh-cn/native_sdk/ffrt/c/type_def.h | 15 +- .../native_sdk/ffrt/cpp/condition_variable.h | 122 --- zh-cn/native_sdk/ffrt/cpp/mutex.h | 60 -- zh-cn/native_sdk/ffrt/cpp/queue.h | 228 ------ zh-cn/native_sdk/ffrt/cpp/sleep.h | 51 -- zh-cn/native_sdk/ffrt/cpp/task.h | 736 ------------------ zh-cn/native_sdk/ffrt/ffrt.h | 33 - 12 files changed, 84 insertions(+), 1233 deletions(-) delete mode 100644 zh-cn/native_sdk/ffrt/cpp/condition_variable.h delete mode 100644 zh-cn/native_sdk/ffrt/cpp/mutex.h delete mode 100644 zh-cn/native_sdk/ffrt/cpp/queue.h delete mode 100644 zh-cn/native_sdk/ffrt/cpp/sleep.h delete mode 100644 zh-cn/native_sdk/ffrt/cpp/task.h delete mode 100644 zh-cn/native_sdk/ffrt/ffrt.h diff --git a/zh-cn/native_sdk/ffrt/c/condition_variable.h b/zh-cn/native_sdk/ffrt/c/condition_variable.h index d5bb7963..56f48067 100644 --- a/zh-cn/native_sdk/ffrt/c/condition_variable.h +++ b/zh-cn/native_sdk/ffrt/c/condition_variable.h @@ -13,6 +13,19 @@ * limitations under the License. */ +/** + * @addtogroup FFRT + * @{ + * + * @brief FFRT(Function Flow运行时)是支持Function Flow编程模型的软件运行时库,用于调度执行开发者基于Function Flow编程模型开发的应用。 + * + * + * @syscap SystemCapability.Resourceschedule.Ffrt.Core + * + * @since 10 + * @version 1.0 + */ + /** * @file condition_variable.h * @@ -147,4 +160,5 @@ FFRT_C_API int ffrt_cond_timedwait(ffrt_cond_t* cond, ffrt_mutex_t* mutex, const * @version 1.0 */ FFRT_C_API int ffrt_cond_destroy(ffrt_cond_t* cond); +/** @} */ #endif diff --git a/zh-cn/native_sdk/ffrt/c/mutex.h b/zh-cn/native_sdk/ffrt/c/mutex.h index 9ea8cd00..8a9091c7 100644 --- a/zh-cn/native_sdk/ffrt/c/mutex.h +++ b/zh-cn/native_sdk/ffrt/c/mutex.h @@ -13,6 +13,19 @@ * limitations under the License. */ + /** + * @addtogroup FFRT + * @{ + * + * @brief FFRT(Function Flow运行时)是支持Function Flow编程模型的软件运行时库,用于调度执行开发者基于Function Flow编程模型开发的应用。 + * + * + * @syscap SystemCapability.Resourceschedule.Ffrt.Core + * + * @since 10 + * @version 1.0 + */ + /** * @file mutex.h * @@ -80,4 +93,5 @@ FFRT_C_API int ffrt_mutex_trylock(ffrt_mutex_t* mutex); * @version 1.0 */ FFRT_C_API int ffrt_mutex_destroy(ffrt_mutex_t* mutex); +/** @} */ #endif diff --git a/zh-cn/native_sdk/ffrt/c/queue.h b/zh-cn/native_sdk/ffrt/c/queue.h index bf97b063..1ef4df76 100644 --- a/zh-cn/native_sdk/ffrt/c/queue.h +++ b/zh-cn/native_sdk/ffrt/c/queue.h @@ -13,6 +13,19 @@ * limitations under the License. */ +/** + * @addtogroup FFRT + * @{ + * + * @brief FFRT(Function Flow运行时)是支持Function Flow编程模型的软件运行时库,用于调度执行开发者基于Function Flow编程模型开发的应用。 + * + * + * @syscap SystemCapability.Resourceschedule.Ffrt.Core + * + * @since 10 + * @version 1.0 + */ + /** * @file queue.h * @@ -135,5 +148,5 @@ FFRT_C_API void ffrt_queue_wait(ffrt_task_handle_t handle); * @version 1.0 */ FFRT_C_API int ffrt_queue_cancel(ffrt_task_handle_t handle); - +/** @} */ #endif // FFRT_API_C_QUEUE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/ffrt/c/sleep.h b/zh-cn/native_sdk/ffrt/c/sleep.h index ba67490f..ba79fe96 100644 --- a/zh-cn/native_sdk/ffrt/c/sleep.h +++ b/zh-cn/native_sdk/ffrt/c/sleep.h @@ -13,6 +13,19 @@ * limitations under the License. */ +/** + * @addtogroup FFRT + * @{ + * + * @brief FFRT(Function Flow运行时)是支持Function Flow编程模型的软件运行时库,用于调度执行开发者基于Function Flow编程模型开发的应用。 + * + * + * @syscap SystemCapability.Resourceschedule.Ffrt.Core + * + * @since 10 + * @version 1.0 + */ + /** * @file sleep.h * @@ -43,4 +56,5 @@ FFRT_C_API int ffrt_usleep(uint64_t usec); * @version 1.0 */ FFRT_C_API void ffrt_yield(void); +/** @} */ #endif diff --git a/zh-cn/native_sdk/ffrt/c/task.h b/zh-cn/native_sdk/ffrt/c/task.h index 59f48454..e20241d9 100644 --- a/zh-cn/native_sdk/ffrt/c/task.h +++ b/zh-cn/native_sdk/ffrt/c/task.h @@ -13,6 +13,19 @@ * limitations under the License. */ +/** + * @addtogroup FFRT + * @{ + * + * @brief FFRT(Function Flow运行时)是支持Function Flow编程模型的软件运行时库,用于调度执行开发者基于Function Flow编程模型开发的应用。 + * + * + * @syscap SystemCapability.Resourceschedule.Ffrt.Core + * + * @since 10 + * @version 1.0 + */ + /** * @file task.h * @@ -201,5 +214,5 @@ FFRT_C_API void ffrt_wait_deps(const ffrt_deps_t* deps); * @version 1.0 */ FFRT_C_API void ffrt_wait(void); - +/** @} */ #endif diff --git a/zh-cn/native_sdk/ffrt/c/type_def.h b/zh-cn/native_sdk/ffrt/c/type_def.h index 7e4b01e3..7e956060 100644 --- a/zh-cn/native_sdk/ffrt/c/type_def.h +++ b/zh-cn/native_sdk/ffrt/c/type_def.h @@ -12,7 +12,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + +/** + * @addtogroup FFRT + * @{ + * + * @brief FFRT(Function Flow运行时)是支持Function Flow编程模型的软件运行时库,用于调度执行开发者基于Function Flow编程模型开发的应用。 + * + * + * @syscap SystemCapability.Resourceschedule.Ffrt.Core + * + * @since 10 + * @version 1.0 + */ + /** * @file type_def.h * diff --git a/zh-cn/native_sdk/ffrt/cpp/condition_variable.h b/zh-cn/native_sdk/ffrt/cpp/condition_variable.h deleted file mode 100644 index 035580c4..00000000 --- a/zh-cn/native_sdk/ffrt/cpp/condition_variable.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ - -/** - * @file condition_variable.h - * - * @brief 声明条件变量提供的C++接口. - * - * @since 10 - * @version 1.0 - */ -#ifndef FFRT_API_CPP_CONDITION_VARIABLE_H -#define FFRT_API_CPP_CONDITION_VARIABLE_H -#include -#include -#include "mutex.h" -#include "c/condition_variable.h" - -namespace ffrt { -enum class cv_status { no_timeout, timeout }; - -class condition_variable : public ffrt_cond_t { -public: - condition_variable() - { - ffrt_cond_init(this, nullptr); - } - - ~condition_variable() noexcept - { - ffrt_cond_destroy(this); - } - - condition_variable(const condition_variable&) = delete; - condition_variable& operator=(const condition_variable&) = delete; - - template - bool wait_until( - std::unique_lock& lk, const std::chrono::time_point& tp, Pred&& pred) noexcept - { - while (!pred()) { - if (wait_until(lk, tp) == cv_status::timeout) { - return pred(); - } - } - return true; - } - - template - cv_status wait_until(std::unique_lock& lk, const std::chrono::time_point& tp) noexcept - { - return _wait_for(lk, tp - Clock::now()); - } - - template - cv_status wait_for(std::unique_lock& lk, const std::chrono::duration& sleep_time) noexcept - { - return _wait_for(lk, sleep_time); - } - - template - bool wait_for( - std::unique_lock& lk, const std::chrono::duration& sleepTime, Pred&& pred) noexcept - { - return wait_until(lk, std::chrono::steady_clock::now() + sleepTime, std::forward(pred)); - } - - template - void wait(std::unique_lock& lk, Pred&& pred) - { - while (!pred()) { - wait(lk); - } - } - - void wait(std::unique_lock& lk) - { - ffrt_cond_wait(this, lk.mutex()); - } - - void notify_one() noexcept - { - ffrt_cond_signal(this); - } - - void notify_all() noexcept - { - ffrt_cond_broadcast(this); - } - -private: - template - cv_status _wait_for(std::unique_lock& lk, const std::chrono::duration& dur) noexcept - { - timespec ts; - std::chrono::nanoseconds T0 = std::chrono::steady_clock::now().time_since_epoch(); - T0 += std::chrono::duration_cast(dur); - ts.tv_sec = std::chrono::duration_cast(T0).count(); - T0 -= std::chrono::seconds(ts.tv_sec); - ts.tv_nsec = static_cast(T0.count()); - - auto ret = ffrt_cond_timedwait(this, lk.mutex(), &ts); - if (ret == ffrt_success) { - return cv_status::no_timeout; - } - return cv_status::timeout; - } -}; -} // namespace ffrt -#endif diff --git a/zh-cn/native_sdk/ffrt/cpp/mutex.h b/zh-cn/native_sdk/ffrt/cpp/mutex.h deleted file mode 100644 index 5f4ef8f1..00000000 --- a/zh-cn/native_sdk/ffrt/cpp/mutex.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - - /** - * @file mutex.h - * - * @brief 声明mutex提供的C++接口. - * - * @since 10 - * @version 1.0 - */ -#ifndef FFRT_API_CPP_MUTEX_H -#define FFRT_API_CPP_MUTEX_H -#include "c/mutex.h" - -namespace ffrt { -class mutex : public ffrt_mutex_t { -public: - mutex() - { - ffrt_mutex_init(this, nullptr); - } - - ~mutex() - { - ffrt_mutex_destroy(this); - } - - mutex(mutex const&) = delete; - void operator=(mutex const&) = delete; - - inline bool try_lock() - { - return ffrt_mutex_trylock(this) == ffrt_success ? true : false; - } - - inline void lock() - { - ffrt_mutex_lock(this); - } - - inline void unlock() - { - ffrt_mutex_unlock(this); - } -}; -} // namespace ffrt -#endif diff --git a/zh-cn/native_sdk/ffrt/cpp/queue.h b/zh-cn/native_sdk/ffrt/cpp/queue.h deleted file mode 100644 index 6e77d9f8..00000000 --- a/zh-cn/native_sdk/ffrt/cpp/queue.h +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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. - */ - -/** - * @file queue.h - * - * @brief 声明串行队列提供的C++接口. - * - * @since 10 - * @version 1.0 - */ -#ifndef FFRT_API_CPP_QUEUE_H -#define FFRT_API_CPP_QUEUE_H - -#include "c/queue.h" -#include "cpp/task.h" - -namespace ffrt { -class queue_attr : public ffrt_queue_attr_t { -public: - queue_attr() - { - ffrt_queue_attr_init(this); - } - - ~queue_attr() - { - ffrt_queue_attr_destroy(this); - } - - queue_attr(const queue_attr&) = delete; - queue_attr& operator=(const queue_attr&) = delete; - - /** - * @brief 设置串行队列qos属性. - * - * @param attr qos属性值. - * @since 10 - * @version 1.0 - */ - inline queue_attr& qos(enum qos qos) - { - ffrt_queue_attr_set_qos(this, static_cast(qos)); - return *this; - } - - /** - * @brief 获取串行队列qos属性. - * - * @return 返回串行队列的qos属性 - * @since 10 - * @version 1.0 - */ - inline enum qos qos() const - { - return static_cast(ffrt_queue_attr_get_qos(this)); - } -}; - -class queue { -public: - queue(const char* name, const queue_attr& attr = {}) - { - queue_handle = ffrt_queue_create(ffrt_queue_serial, name, &attr); - } - - ~queue() - { - ffrt_queue_destroy(queue_handle); - } - - queue(queue const&) = delete; - void operator=(queue const&) = delete; - - /** - * @brief 提交一个任务到队列中调度执行. - * - * @param func 任务执行体函数闭包. - * @since 10 - * @version 1.0 - */ - inline void submit(std::function& func) - { - ffrt_queue_submit(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), nullptr); - } - - /** - * @brief 提交一个特定属性的任务到队列中调度执行. - * - * @param func 任务执行体函数闭包. - * @param attr 任务属性. - * @since 10 - * @version 1.0 - */ - inline void submit(std::function& func, const task_attr& attr) - { - ffrt_queue_submit(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), &attr); - } - - /** - * @brief 提交一个任务到队列中调度执行. - * - * @param func 任务执行体函数闭包. - * @since 10 - * @version 1.0 - */ - inline void submit(std::function&& func) - { - ffrt_queue_submit(queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), nullptr); - } - - /** - * @brief 提交一个特定属性的任务到队列中调度执行. - * - * @param func 任务执行体函数闭包. - * @param attr 任务属性. - * @since 10 - * @version 1.0 - */ - inline void submit(std::function&& func, const task_attr& attr) - { - ffrt_queue_submit(queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), &attr); - } - - /** - * @brief 提交一个任务到队列中调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @return 提交成功返回非空任务句柄 - 提交失败返回空指针 - * @since 10 - * @version 1.0 - */ - inline task_handle submit_h(std::function& func) - { - return ffrt_queue_submit_h(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), nullptr); - } - - /** - * @brief 提交一个特定属性的任务到队列中调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param attr 任务属性. - * @return 提交成功返回非空任务句柄 - 提交失败返回空指针 - * @since 10 - * @version 1.0 - */ - inline task_handle submit_h(std::function& func, const task_attr& attr) - { - return ffrt_queue_submit_h(queue_handle, create_function_wrapper(func, ffrt_function_kind_queue), &attr); - } - - /** - * @brief 提交一个任务到队列中调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @return 提交成功返回非空任务句柄 - 提交失败返回空指针 - * @since 10 - * @version 1.0 - */ - inline task_handle submit_h(std::function&& func) - { - return ffrt_queue_submit_h( - queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), nullptr); - } - - /** - * @brief 提交一个特定属性的任务到队列中调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param attr 任务属性. - * @return 提交成功返回非空任务句柄 - 提交失败返回空指针 - * @since 10 - * @version 1.0 - */ - inline task_handle submit_h(std::function&& func, const task_attr& attr) - { - return ffrt_queue_submit_h( - queue_handle, create_function_wrapper(std::move(func), ffrt_function_kind_queue), &attr); - } - - /** - * @brief 取消任务. - * - * @param handle 任务句柄. - * @return 取消任务成功返回0 - 取消任务成功返回-1 - * @since 10 - * @version 1.0 - */ - inline int cancel(task_handle& handle) - { - return ffrt_queue_cancel(handle); - } - - /** - * @brief 等待任务执行完成. - * - * @param handle 任务句柄. - * @since 10 - * @version 1.0 - */ - inline void wait(task_handle& handle) - { - return ffrt_queue_wait(handle); - } - -private: - ffrt_queue_t queue_handle = nullptr; -}; -} // namespace ffrt - -#endif // FFRT_API_CPP_QUEUE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/ffrt/cpp/sleep.h b/zh-cn/native_sdk/ffrt/cpp/sleep.h deleted file mode 100644 index 42d633b2..00000000 --- a/zh-cn/native_sdk/ffrt/cpp/sleep.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - -/** - * @file sleep.h - * - * @brief 声明sleep和yield C++接口. - * - * @since 10 - * @version 1.0 - */ -#ifndef FFRT_API_CPP_SLEEP_H -#define FFRT_API_CPP_SLEEP_H -#include -#include -#include "c/sleep.h" - -namespace ffrt { -namespace this_task { -static inline void yield() -{ - ffrt_yield(); -} - -template -inline void sleep_for(const std::chrono::duration<_Rep, _Period>& d) -{ - ffrt_usleep(std::chrono::duration_cast(d).count()); -} - -template -inline void sleep_until( - const std::chrono::time_point<_Clock, _Duration>& abs_time) -{ - sleep_for(abs_time.time_since_epoch() - _Clock::now().time_since_epoch()); -} -} // namespace this_task -} // namespace ffrt -#endif diff --git a/zh-cn/native_sdk/ffrt/cpp/task.h b/zh-cn/native_sdk/ffrt/cpp/task.h deleted file mode 100644 index 84599a98..00000000 --- a/zh-cn/native_sdk/ffrt/cpp/task.h +++ /dev/null @@ -1,736 +0,0 @@ -/* - * 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. - */ - - /** - * @file task.h - * - * @brief 声明任务提供的C++接口. - * - * @since 10 - * @version 1.0 - */ -#ifndef FFRT_API_CPP_TASK_H -#define FFRT_API_CPP_TASK_H -#include -#include -#include -#include -#include "c/task.h" - -namespace ffrt { -class task_attr : public ffrt_task_attr_t { -public: - task_attr() - { - ffrt_task_attr_init(this); - } - - ~task_attr() - { - ffrt_task_attr_destroy(this); - } - - task_attr(const task_attr&) = delete; - task_attr& operator=(const task_attr&) = delete; - - /** - * @brief 设置任务名字. - * - * @param name 任务名字. - * @since 10 - * @version 1.0 - */ - inline task_attr& name(const char* name) - { - ffrt_task_attr_set_name(this, name); - return *this; - } - - /** - * @brief 获取任务名字. - * - * @return 返回任务名字. - * @since 10 - * @version 1.0 - */ - inline const char* name() const - { - return ffrt_task_attr_get_name(this); - } - - /** - * @brief 设置任务qos. - * - * @param qos qos类型. - * @since 10 - * @version 1.0 - */ - inline task_attr& qos(enum qos qos) - { - ffrt_task_attr_set_qos(this, static_cast(qos)); - return *this; - } - - /** - * @brief 获取任务qos. - * - * @return 返回任务qos. - * @since 10 - * @version 1.0 - */ - inline enum qos qos() const - { - return static_cast(ffrt_task_attr_get_qos(this)); - } - - /** - * @brief 设置任务延迟时间. - * - * @param delay_us 延迟时间,单位是微妙. - * @since 10 - * @version 1.0 - */ - inline task_attr& delay(uint64_t delay_us) - { - ffrt_task_attr_set_delay(this, delay_us); - return *this; - } - - /** - * @brief 获取任务延迟时间. - * - * @return 返回任务延迟时间. - * @since 10 - * @version 1.0 - */ - inline uint64_t delay() const - { - return ffrt_task_attr_get_delay(this); - } -}; - -class task_handle { -public: - task_handle() : p(nullptr) - { - } - task_handle(ffrt_task_handle_t p) : p(p) - { - } - - ~task_handle() - { - if (p) { - ffrt_task_handle_destroy(p); - } - } - - task_handle(task_handle const&) = delete; - void operator=(task_handle const&) = delete; - - inline task_handle(task_handle&& h) - { - *this = std::move(h); - } - - inline task_handle& operator=(task_handle&& h) - { - if (p) { - ffrt_task_handle_destroy(p); - } - p = h.p; - h.p = nullptr; - return *this; - } - - inline operator void* () const - { - return p; - } - -private: - ffrt_task_handle_t p = nullptr; -}; - -template -struct function { - template - function(ffrt_function_header_t h, CT&& c) : header(h), closure(std::forward(c)) {} - ffrt_function_header_t header; - T closure; -}; - -template -void exec_function_wrapper(void* t) -{ - auto f = reinterpret_cast>*>(t); - f->closure(); -} - -template -void destroy_function_wrapper(void* t) -{ - auto f = reinterpret_cast>*>(t); - f->closure = nullptr; -} - -template -inline ffrt_function_header_t* create_function_wrapper(T&& func, - ffrt_function_kind_t kind = ffrt_function_kind_general) -{ - using function_type = function>; - static_assert(sizeof(function_type) <= ffrt_auto_managed_function_storage_size, - "size of function must be less than ffrt_auto_managed_function_storage_size"); - - auto p = ffrt_alloc_auto_managed_function_storage_base(kind); - auto f = - new (p) function_type({exec_function_wrapper, destroy_function_wrapper, {0}}, std::forward(func)); - return reinterpret_cast(f); -} - -/** - * @brief 提交无输入和输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @since 10 - * @version 1.0 - */ -static inline void submit(std::function&& func) -{ - return ffrt_submit_base(create_function_wrapper(std::move(func)), nullptr, nullptr, nullptr); -} - -/** - * @brief 提交有输入依赖无输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @since 10 - * @version 1.0 - */ -static inline void submit(std::function&& func, std::initializer_list in_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); -} - -/** - * @brief 提交有输入输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @since 10 - * @version 1.0 - */ -static inline void submit(std::function&& func, std::initializer_list in_deps, - std::initializer_list out_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; - return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); -} - -/** - * @brief 提交有输入输出依赖的特定属性的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @param attr 任务属性. - * @since 10 - * @version 1.0 - */ -static inline void submit(std::function&& func, std::initializer_list in_deps, - std::initializer_list out_deps, const task_attr& attr) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; - return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, &attr); -} - -/** - * @brief 提交有输入依赖无输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @since 10 - * @version 1.0 - */ -static inline void submit(std::function&& func, const std::vector& in_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); -} - -/** - * @brief 提交有输入输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @since 10 - * @version 1.0 - */ -static inline void submit(std::function&& func, const std::vector& in_deps, - const std::vector& out_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; - return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); -} - -/** - * @brief 提交有输入输出依赖的特定属性的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @param attr 任务属性. - * @since 10 - * @version 1.0 - */ -static inline void submit(std::function&& func, const std::vector& in_deps, - const std::vector& out_deps, const task_attr& attr) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; - return ffrt_submit_base(create_function_wrapper(std::move(func)), &in, &out, &attr); -} - -/** - * @brief 提交无输入和输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @since 10 - * @version 1.0 - */ -static inline void submit(const std::function& func) -{ - return ffrt_submit_base(create_function_wrapper(func), nullptr, nullptr, nullptr); -} - -/** - * @brief 提交有输入依赖无输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @since 10 - * @version 1.0 - */ -static inline void submit(const std::function& func, std::initializer_list in_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - return ffrt_submit_base(create_function_wrapper(func), &in, nullptr, nullptr); -} - -/** - * @brief 提交有输入输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @since 10 - * @version 1.0 - */ -static inline void submit(const std::function& func, std::initializer_list in_deps, - std::initializer_list out_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; - return ffrt_submit_base(create_function_wrapper(func), &in, &out, nullptr); -} - -/** - * @brief 提交有输入输出依赖的特定属性的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @param attr 任务属性. - * @since 10 - * @version 1.0 - */ -static inline void submit(const std::function& func, std::initializer_list in_deps, - std::initializer_list out_deps, const task_attr& attr) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; - return ffrt_submit_base(create_function_wrapper(func), &in, &out, &attr); -} - -/** - * @brief 提交有输入依赖无输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @since 10 - * @version 1.0 - */ -static inline void submit(const std::function& func, const std::vector& in_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - return ffrt_submit_base(create_function_wrapper(func), &in, nullptr, nullptr); -} - -/** - * @brief 提交有输入输出依赖的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @since 10 - * @version 1.0 - */ -static inline void submit(const std::function& func, const std::vector& in_deps, - const std::vector& out_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; - return ffrt_submit_base(create_function_wrapper(func), &in, &out, nullptr); -} - -/** - * @brief 提交有输入输出依赖的特定属性的任务调度执行. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @param attr 任务属性. - * @since 10 - * @version 1.0 - */ -static inline void submit(const std::function& func, const std::vector& in_deps, - const std::vector& out_deps, const task_attr& attr) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; - return ffrt_submit_base(create_function_wrapper(func), &in, &out, &attr); -} - -/** - * @brief 提交无输入和输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(std::function&& func) -{ - return ffrt_submit_h_base(create_function_wrapper(std::move(func)), nullptr, nullptr, nullptr); -} - -/** - * @brief 提交有输入依赖无输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); -} - -/** - * @brief 提交有输入输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps, - std::initializer_list out_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; - return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); -} - -/** - * @brief 提交有输入输出依赖的特定属性的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @param attr 任务属性. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(std::function&& func, std::initializer_list in_deps, - std::initializer_list out_deps, const task_attr& attr) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; - return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, &attr); -} - -/** - * @brief 提交有输入依赖无输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(std::function&& func, const std::vector& in_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, nullptr, nullptr); -} - -/** - * @brief 提交有输入输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(std::function&& func, const std::vector& in_deps, - const std::vector& out_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; - return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, nullptr); -} - -/** - * @brief 提交有输入输出依赖的特定属性的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @param attr 任务属性. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(std::function&& func, const std::vector& in_deps, - const std::vector& out_deps, const task_attr& attr) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; - return ffrt_submit_h_base(create_function_wrapper(std::move(func)), &in, &out, &attr); -} - -/** - * @brief 提交无输入和输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(const std::function& func) -{ - return ffrt_submit_h_base(create_function_wrapper(func), nullptr, nullptr, nullptr); -} - -/** - * @brief 提交有输入依赖无输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - return ffrt_submit_h_base(create_function_wrapper(func), &in, nullptr, nullptr); -} - -/** - * @brief 提交有输入输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps, - std::initializer_list out_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; - return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, nullptr); -} - -/** - * @brief 提交有输入输出依赖的特定属性的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @param attr 任务属性. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(const std::function& func, std::initializer_list in_deps, - std::initializer_list out_deps, const task_attr& attr) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.begin()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.begin()}; - return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, &attr); -} - -/** - * @brief 提交有输入依赖无输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(const std::function& func, const std::vector& in_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - return ffrt_submit_h_base(create_function_wrapper(func), &in, nullptr, nullptr); -} - -/** - * @brief 提交有输入输出依赖的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(const std::function& func, const std::vector& in_deps, - const std::vector& out_deps) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; - return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, nullptr); -} - -/** - * @brief 提交有输入输出依赖的特定属性的任务调度执行并返回任务句柄. - * - * @param func 任务执行体函数闭包. - * @param in_deps 输入依赖. - * @param out_deps 输出依赖. - * @param attr 任务属性. - * @return 提交任务成功返回非空任务句柄, - 提交任务失败返回空指针. - * @since 10 - * @version 1.0 - */ -static inline task_handle submit_h(const std::function& func, const std::vector& in_deps, - const std::vector& out_deps, const task_attr& attr) -{ - ffrt_deps_t in {static_cast(in_deps.size()), in_deps.data()}; - ffrt_deps_t out {static_cast(out_deps.size()), out_deps.data()}; - return ffrt_submit_h_base(create_function_wrapper(func), &in, &out, &attr); -} - -/** - * @brief 跳过指定任务. - * - * @param handle 任务句柄. - * @return 跳过指定任务成功返回0, - 跳过指定任务失败返回-1. - * @since 10 - * @version 1.0 - */ -static inline int skip(task_handle &handle) -{ - return ffrt_skip(handle); -} - -/** - * @brief 等待之前所有提交任务完成,当前任务开始执行. - * - * @since 10 - * @version 1.0 - */ -static inline void wait() -{ - ffrt_wait(); -} - -/** - * @brief 等待依赖的任务完成,当前任务开始执行. - * - * @param deps 依赖的指针. - * @since 10 - * @version 1.0 - */ -static inline void wait(std::initializer_list deps) -{ - ffrt_deps_t d {static_cast(deps.size()), deps.begin()}; - ffrt_wait_deps(&d); -} - -/** - * @brief 等待依赖的任务完成,当前任务开始执行. - * - * @param deps 依赖的指针. - * @since 10 - * @version 1.0 - */ -static inline void wait(const std::vector& deps) -{ - ffrt_deps_t d {static_cast(deps.size()), deps.data()}; - ffrt_wait_deps(&d); -} - -namespace this_task { -/** - * @brief 获取当前任务id. - * - * @return 返回任务id. - * @since 10 - * @version 1.0 - */ -static inline uint64_t get_id() -{ - return ffrt_this_task_get_id(); -} -} // namespace this_task -} // namespace ffrt -#endif diff --git a/zh-cn/native_sdk/ffrt/ffrt.h b/zh-cn/native_sdk/ffrt/ffrt.h deleted file mode 100644 index e20832e4..00000000 --- a/zh-cn/native_sdk/ffrt/ffrt.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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/thread.h" -#include "cpp/future.h" -#include "cpp/queue.h" -#else -#include "c/task.h" -#include "c/mutex.h" -#include "c/condition_variable.h" -#include "c/sleep.h" -#include "c/thread.h" -#include "c/queue.h" -#endif -#endif -- Gitee From 3a3751b66ed33d95f3fb081b17024f9dde1f6273 Mon Sep 17 00:00:00 2001 From: wangyulie Date: Wed, 17 Jan 2024 22:13:43 +0800 Subject: [PATCH 0222/2135] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E7=BC=BA=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyulie --- zh-cn/native_sdk/ffrt/c/condition_variable.h | 51 --------- zh-cn/native_sdk/ffrt/c/queue.h | 61 ++++++++++- zh-cn/native_sdk/ffrt/c/sleep.h | 4 +- zh-cn/native_sdk/ffrt/c/task.h | 11 -- zh-cn/native_sdk/ffrt/c/type_def.h | 104 +++++++++++++++++-- 5 files changed, 154 insertions(+), 77 deletions(-) diff --git a/zh-cn/native_sdk/ffrt/c/condition_variable.h b/zh-cn/native_sdk/ffrt/c/condition_variable.h index 56f48067..363cf8a1 100644 --- a/zh-cn/native_sdk/ffrt/c/condition_variable.h +++ b/zh-cn/native_sdk/ffrt/c/condition_variable.h @@ -39,57 +39,6 @@ #include #include "type_def.h" -typedef enum { - ffrt_clock_realtime = CLOCK_REALTIME, - ffrt_clock_monotonic = CLOCK_MONOTONIC -} ffrt_clockid_t; - -/** - * @brief 初始化条件变量属性. - * - * @param attr 条件变量属性指针. - * @return 初始化条件变量属性成功返回ffrt_thrd_success, - 初始化条件变量属性失败返回ffrt_thrd_error. - * @since 10 - * @version 1.0 - */ -FFRT_C_API int ffrt_condattr_init(ffrt_condattr_t* attr); - -/** - * @brief 销毁条件变量属性. - * - * @param attr 条件变量属性指针. - * @return 销毁条件变量属性成功返回ffrt_thrd_success, - 销毁条件变量属性失败返回ffrt_thrd_error. - * @since 10 - * @version 1.0 - */ -FFRT_C_API int ffrt_condattr_destroy(ffrt_condattr_t* attr); - -/** - * @brief 设置条件变量的时钟属性. - * - * @param attr 条件变量属性指针. - * @param clock 时钟类型. - * @return 设置条件变量的时钟属性成功返回ffrt_thrd_success, - 设置条件变量的时钟属性失败返回ffrt_thrd_error. - * @since 10 - * @version 1.0 - */ -FFRT_C_API int ffrt_condattr_setclock(ffrt_condattr_t* attr, ffrt_clockid_t clock); - -/** - * @brief 获取条件变量的时钟属性. - * - * @param attr 条件变量属性指针. - * @param clock 时钟属性指针. - * @return 获取条件变量的时钟属性成功返回ffrt_thrd_success, - 获取条件变量的时钟属性失败返回ffrt_thrd_error. - * @since 10 - * @version 1.0 - */ -FFRT_C_API int ffrt_condattr_getclock(const ffrt_condattr_t* attr, ffrt_clockid_t* clock); - /** * @brief 初始化条件变量. * diff --git a/zh-cn/native_sdk/ffrt/c/queue.h b/zh-cn/native_sdk/ffrt/c/queue.h index 1ef4df76..3fcba087 100644 --- a/zh-cn/native_sdk/ffrt/c/queue.h +++ b/zh-cn/native_sdk/ffrt/c/queue.h @@ -39,7 +39,20 @@ #include "type_def.h" -typedef enum { ffrt_queue_serial, ffrt_queue_max } ffrt_queue_type_t; +/** + * @brief 队列类型. + * + */ +typedef enum { + /** 串行队列类型 */ + ffrt_queue_serial, + ffrt_queue_max +} ffrt_queue_type_t; + +/** + * @brief 队列句柄. + * + */ typedef void* ffrt_queue_t; /** @@ -66,7 +79,7 @@ FFRT_C_API void ffrt_queue_attr_destroy(ffrt_queue_attr_t* attr); * @brief 设置串行队列qos属性. * * @param attr 串行队列属性指针. - * @param attr qos属性值. + * @param qos qos属性值. * @since 10 * @version 1.0 */ @@ -76,12 +89,52 @@ FFRT_C_API void ffrt_queue_attr_set_qos(ffrt_queue_attr_t* attr, ffrt_qos_t qos) * @brief 获取串行队列qos属性. * * @param attr 串行队列属性指针. - * @return 返回串行队列的qos属性 + * @return 返回串行队列的qos属性. * @since 10 * @version 1.0 */ FFRT_C_API ffrt_qos_t ffrt_queue_attr_get_qos(const ffrt_queue_attr_t* attr); +/** + * @brief 设置串行队列timeout属性. + * + * @param attr 串行队列属性指针. + * @param timeout_us 串行队列任务执行的timeout时间. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_queue_attr_set_timeout(ffrt_queue_attr_t* attr, uint64_t timeout_us); + +/** + * @brief 获取串行队列任务执行的timeout时间. + * + * @param attr 串行队列属性指针. + * @return 返回串行队列任务执行的timeout时间. + * @since 10 + * @version 1.0 + */ +FFRT_C_API uint64_t ffrt_queue_attr_get_timeout(const ffrt_queue_attr_t* attr); + +/** + * @brief 设置串行队列超时回调方法. + * + * @param attr 串行队列属性指针. + * @param f 超时回调方法执行体. + * @since 10 + * @version 1.0 + */ +FFRT_C_API void ffrt_queue_attr_set_callback(ffrt_queue_attr_t* attr, ffrt_function_header_t* f); + +/** + * @brief 获取串行队列超时回调方法. + * + * @param attr 串行队列属性指针. + * @return 返回串行队列超时回调方法. + * @since 10 + * @version 1.0 + */ +FFRT_C_API ffrt_function_header_t* ffrt_queue_attr_get_callback(const ffrt_queue_attr_t* attr); + /** * @brief 创建队列. * @@ -121,7 +174,7 @@ FFRT_C_API void ffrt_queue_submit(ffrt_queue_t queue, ffrt_function_header_t* f, * @param queue 队列句柄. * @param f 任务的执行体. * @param attr 任务属性. - * @return 提交成功返回非空任务句柄 + * @return 提交成功返回非空任务句柄; 提交失败返回空指针 * @since 10 * @version 1.0 diff --git a/zh-cn/native_sdk/ffrt/c/sleep.h b/zh-cn/native_sdk/ffrt/c/sleep.h index ba79fe96..cb83d46b 100644 --- a/zh-cn/native_sdk/ffrt/c/sleep.h +++ b/zh-cn/native_sdk/ffrt/c/sleep.h @@ -39,9 +39,9 @@ #include "type_def.h" /** - * @brief 延迟usec微妙. + * @brief 延迟usec微秒. * - * @param usec延迟时间,单位微妙. + * @param usec延迟时间,单位微秒. * @return 执行成功时返回ffrt_thrd_success, 执行成功时返回ffrt_thrd_error. * @since 10 diff --git a/zh-cn/native_sdk/ffrt/c/task.h b/zh-cn/native_sdk/ffrt/c/task.h index e20241d9..11277931 100644 --- a/zh-cn/native_sdk/ffrt/c/task.h +++ b/zh-cn/native_sdk/ffrt/c/task.h @@ -187,17 +187,6 @@ FFRT_C_API ffrt_task_handle_t ffrt_submit_h_base(ffrt_function_header_t* f, cons */ FFRT_C_API void ffrt_task_handle_destroy(ffrt_task_handle_t handle); -/** - * @brief 跳过指定任务. - * - * @param handle 任务句柄. - * @return 跳过指定任务成功返回0, - 跳过指定任务失败返回-1. - * @since 10 - * @version 1.0 - */ -FFRT_C_API int ffrt_skip(ffrt_task_handle_t handle); - /** * @brief 等待依赖的任务完成,当前任务开始执行. * diff --git a/zh-cn/native_sdk/ffrt/c/type_def.h b/zh-cn/native_sdk/ffrt/c/type_def.h index 7e956060..da0aed53 100644 --- a/zh-cn/native_sdk/ffrt/c/type_def.h +++ b/zh-cn/native_sdk/ffrt/c/type_def.h @@ -60,8 +60,17 @@ typedef enum { ffrt_qos_default, /** 用户期望 */ ffrt_qos_user_initiated, -} ffrt_qos_t; +} ffrt_qos_default_t; +/** + * @brief qos类型. + * + */ +typedef int ffrt_qos_t; +/** + * @brief 任务执行函数指针类型. + * + */ typedef void(*ffrt_function_t)(void*); /** @@ -73,6 +82,7 @@ typedef struct { ffrt_function_t exec; /** 任务销毁函数 */ ffrt_function_t destroy; + /** 保留位. */ uint64_t reserve[2]; } ffrt_function_header_t; @@ -105,64 +115,140 @@ typedef enum { } ffrt_function_kind_t; /** - * @brief 数据依赖数据结构. + * @brief 依赖类型. + * + */ +typedef enum { + /** 数据依赖类型 */ + ffrt_dependence_data, + /** 任务依赖类型 */ + ffrt_dependence_task, +} ffrt_dependence_type_t; + +/** + * @brief 依赖数据结构. * */ typedef struct { - /** 依赖个数 */ + /** 依赖类型 */ + ffrt_dependence_type_t type; + /** 依赖数据地址 */ + const void* ptr; +} ffrt_dependence_t; + +/** + * @brief 依赖结构定义. + * + */ +typedef struct { + /** 依赖数量 */ uint32_t len; /** 依赖数据 */ - const void* const * items; + const ffrt_dependence_t* items; } ffrt_deps_t; +/** + * @brief 并行任务属性结构. + * + */ typedef struct { + /** 任务属性所占空间 */ uint32_t storage[(ffrt_task_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; } ffrt_task_attr_t; +/** + * @brief 串行队列属性结构. + * + */ typedef struct { + /** 串行队列属性所占空间 */ uint32_t storage[(ffrt_queue_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; } ffrt_queue_attr_t; +/** + * @brief 并行任务句柄. + * + */ typedef void* ffrt_task_handle_t; +/** + * @brief FFRT错误码. + * + */ typedef enum { + /** 失败 */ ffrt_error = -1, + /** 成功 */ ffrt_success = 0, + /** 内存不足 */ ffrt_error_nomem = ENOMEM, + /** 超时 */ ffrt_error_timedout = ETIMEDOUT, + /** 重新尝试 */ ffrt_error_busy = EBUSY, + /** 值无效 */ ffrt_error_inval = EINVAL } ffrt_error_t; +/** + * @brief FFRT条件变量属性结构. + * + */ typedef struct { + /** FFRT条件变量属性所占空间 */ long storage; } ffrt_condattr_t; +/** + * @brief FFRT锁属性结构. + * + */ typedef struct { + /** FFRT锁属性所占空间 */ long storage; } ffrt_mutexattr_t; +/** + * @brief FFRT互斥锁结构. + * + */ typedef struct { - uint32_t storage[(ffrt_thread_attr_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; -} ffrt_thread_attr_t; - -typedef struct { + /** FFRT互斥锁所占空间 */ uint32_t storage[(ffrt_mutex_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; } ffrt_mutex_t; +/** + * @brief FFRT条件变量结构. + * + */ typedef struct { + /** FFRT条件变量所占空间 */ uint32_t storage[(ffrt_cond_storage_size + sizeof(uint32_t) - 1) / sizeof(uint32_t)]; } ffrt_cond_t; #ifdef __cplusplus namespace ffrt { -enum qos { +/** + * @brief 任务的qos类型. + * + */ +enum qos_default { + /** 继承当前任务qos属性 */ qos_inherit = ffrt_qos_inherit, + /** 后台任务 */ qos_background = ffrt_qos_background, + /** 实时工具 */ qos_utility = ffrt_qos_utility, + /** 默认类型 */ qos_default = ffrt_qos_default, + /** 用户期望 */ qos_user_initiated = ffrt_qos_user_initiated, }; +/** + * @brief qos类型. + * + */ +using qos = int; } #endif #endif -- Gitee From 78b635829c0f65752217a8a669570f47ae508b56 Mon Sep 17 00:00:00 2001 From: lengye Date: Tue, 23 Jan 2024 12:06:07 +0000 Subject: [PATCH 0223/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8C=87=E5=AF=BC?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E4=BB=A5=E5=8F=8A=E5=8E=BB=E6=8E=89=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lengye --- .../media/oh_camera/capture_session.h | 2 +- .../media/oh_camera/metadata_output.h | 2 +- .../native_sdk/media/oh_camera/photo_output.h | 54 +++++++++---------- .../media/oh_camera/preview_output.h | 2 +- .../native_sdk/media/oh_camera/video_output.h | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/zh-cn/native_sdk/media/oh_camera/capture_session.h b/zh-cn/native_sdk/media/oh_camera/capture_session.h index 0498e01c..2a07cee7 100644 --- a/zh-cn/native_sdk/media/oh_camera/capture_session.h +++ b/zh-cn/native_sdk/media/oh_camera/capture_session.h @@ -55,7 +55,7 @@ extern "C" { /** * @brief 捕获会话对象 * - * 可以使用{@link Camera_CaptureSession}方法创建指针。 + * 可以使用{@link OH_CameraManager_CreateCaptureSession}方法创建指针。 * * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/media/oh_camera/metadata_output.h b/zh-cn/native_sdk/media/oh_camera/metadata_output.h index 46a0df3e..c82e7e13 100644 --- a/zh-cn/native_sdk/media/oh_camera/metadata_output.h +++ b/zh-cn/native_sdk/media/oh_camera/metadata_output.h @@ -50,7 +50,7 @@ extern "C" { /** * @brief 元数据输出对象 * - * 可以使用{@link Camera_MetadataOutput}方法创建指针。 + * 可以使用{@link OH_CameraManager_CreateMetadataOutput}方法创建指针。 * * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/media/oh_camera/photo_output.h b/zh-cn/native_sdk/media/oh_camera/photo_output.h index 2bace0f5..a36933f4 100644 --- a/zh-cn/native_sdk/media/oh_camera/photo_output.h +++ b/zh-cn/native_sdk/media/oh_camera/photo_output.h @@ -50,7 +50,7 @@ extern "C" { /** * @brief 拍照输出对象 * - * 可以使用{@link Camera_PhotoOutput}方法创建指针。 + * 可以使用{@link OH_CameraManager_CreatePhotoOutput}方法创建指针。 * * @since 11 * @version 1.0 @@ -58,7 +58,7 @@ extern "C" { typedef struct Camera_PhotoOutput Camera_PhotoOutput; /** - * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧启动回调。 + * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧启动回调。 * * @param photoOutput 传递回调的{@link Camera_PhotoOutput}。 * @since 11 @@ -66,16 +66,16 @@ typedef struct Camera_PhotoOutput Camera_PhotoOutput; typedef void (*OH_PhotoOutput_OnFrameStart)(Camera_PhotoOutput* photoOutput); /** - * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧快门回调。 + * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧快门回调。 * * @param photoOutput 传递回调的{@link Camera_PhotoOutput}。 - * @param info 回调传递的{@link Camera_FrameShutterInfo}。 + * @param info 回调传递的{@link Camera_FrameShutterInfo}。 * @since 11 */ typedef void (*OH_PhotoOutput_OnFrameShutter)(Camera_PhotoOutput* photoOutput, Camera_FrameShutterInfo* info); /** - * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧结束回调。 + * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出帧结束回调。 * * @param photoOutput 传递回调的{@link Camera_PhotoOutput}。 * @param frameCount 回调传递的帧计数。 @@ -84,7 +84,7 @@ typedef void (*OH_PhotoOutput_OnFrameShutter)(Camera_PhotoOutput* photoOutput, C typedef void (*OH_PhotoOutput_OnFrameEnd)(Camera_PhotoOutput* photoOutput, int32_t frameCount); /** - * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出错误回调。 + * @brief 在{@link PhotoOutput_Callbacks}中被调用的拍照输出错误回调。 * * @param photoOutput 传递回调的{@link Camera_PhotoOutput}。 * @param errorCode 拍照输出的{@link Camera_ErrorCode}。 @@ -126,10 +126,10 @@ typedef struct PhotoOutput_Callbacks { /** * @brief 注册拍照输出更改事件回调。 * - * @param photoOutput {@link Camera_PhotoOutput}实例。 + * @param photoOutput {@link Camera_PhotoOutput}实例。 * @param callback 要注册的{@link PhotoOutput_Callbacks}。 - * @return {@link#CAMERA_OK}如果方法调用成功。 - * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 * @since 11 */ Camera_ErrorCode OH_PhotoOutput_RegisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback); @@ -137,10 +137,10 @@ Camera_ErrorCode OH_PhotoOutput_RegisterCallback(Camera_PhotoOutput* photoOutput /** * @brief 注销拍照输出更改事件回调。 * - * @param photoOutput {@link Camera_PhotoOutput}实例。 + * @param photoOutput {@link Camera_PhotoOutput}实例。 * @param callback 要注销的{@link PhotoOutput_Callbacks}。 - * @return {@link#CAMERA_OK}如果方法调用成功。 - * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 * @since 11 */ Camera_ErrorCode OH_PhotoOutput_UnregisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback); @@ -149,10 +149,10 @@ Camera_ErrorCode OH_PhotoOutput_UnregisterCallback(Camera_PhotoOutput* photoOutp * @brief 拍摄照片。 * * @param photoOutput 用于捕获拍照的{@link Camera_PhotoOutput}实例。 - * @return {@link#CAMERA_OK}如果方法调用成功。 - * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 - * {@link#CAMERA_SESSION_NOT_RUNNING}如果捕获会话未运行。 - * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_RUNNING}如果捕获会话未运行。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 * @since 11 */ Camera_ErrorCode OH_PhotoOutput_Capture(Camera_PhotoOutput* photoOutput); @@ -162,10 +162,10 @@ Camera_ErrorCode OH_PhotoOutput_Capture(Camera_PhotoOutput* photoOutput); * * @param photoOutput 用于捕获拍照的{@link Camera_PhotoOutput}实例。 * @param setting 用于捕获拍照的{@link Camera_PhotoCaptureSetting}。 - * @return {@link#CAMERA_OK}如果方法调用成功。 - * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 - * {@link#CAMERA_SESSION_NOT_RUNNING}如果捕获会话未运行。 - * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SESSION_NOT_RUNNING}如果捕获会话未运行。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 * @since 11 */ Camera_ErrorCode OH_PhotoOutput_Capture_WithCaptureSetting(Camera_PhotoOutput* photoOutput, @@ -175,9 +175,9 @@ Camera_ErrorCode OH_PhotoOutput_Capture_WithCaptureSetting(Camera_PhotoOutput* p * @brief 释放拍照输出。 * * @param photoOutput 要释放的{@link Camera_PhotoOutput}实例。 - * @return {@link#CAMERA_OK}如果方法调用成功。 - * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 - * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 * @since 11 */ Camera_ErrorCode OH_PhotoOutput_Release(Camera_PhotoOutput* photoOutput); @@ -185,11 +185,11 @@ Camera_ErrorCode OH_PhotoOutput_Release(Camera_PhotoOutput* photoOutput); /** * @brief 检查是否支持镜像拍照。 * - * @param photoOutput {@link Camera_PhotoOutput}实例,用于检查是否支持镜像。 + * @param photoOutput {@link Camera_PhotoOutput}实例,用于检查是否支持镜像。 * @param isSupported 是否支持镜像的结果。 - * @return {@link#CAMERA_OK}如果方法调用成功。 - * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 - * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 + * @return {@link#CAMERA_OK}如果方法调用成功。 + * {@link#INVALID_ARGUMENT}如果参数丢失或参数类型不正确。 + * {@link#CAMERA_SERVICE_FATAL_ERROR}如果相机服务出现致命错误。 * @since 11 */ Camera_ErrorCode OH_PhotoOutput_IsMirrorSupported(Camera_PhotoOutput* photoOutput, bool* isSupported); diff --git a/zh-cn/native_sdk/media/oh_camera/preview_output.h b/zh-cn/native_sdk/media/oh_camera/preview_output.h index 794771c5..8d7bc516 100644 --- a/zh-cn/native_sdk/media/oh_camera/preview_output.h +++ b/zh-cn/native_sdk/media/oh_camera/preview_output.h @@ -50,7 +50,7 @@ extern "C" { /** * @brief 预览输出对象 * - * 可以使用{@link Camera_PreviewOutput}方法创建指针。 + * 可以使用{@link OH_CameraManager_CreatePreviewOutput}方法创建指针。 * * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/media/oh_camera/video_output.h b/zh-cn/native_sdk/media/oh_camera/video_output.h index 05badd48..739204cd 100644 --- a/zh-cn/native_sdk/media/oh_camera/video_output.h +++ b/zh-cn/native_sdk/media/oh_camera/video_output.h @@ -50,7 +50,7 @@ extern "C" { /** * @brief 录像输出对象 * - * 可以使用{@link Camera_VideoOutput}方法创建指针。 + * 可以使用{@link OH_CameraManager_CreateVideoOutput}方法创建指针。 * * @since 11 * @version 1.0 -- Gitee From 0312251d6e75f997fbe038a43096beef1d538e4d Mon Sep 17 00:00:00 2001 From: liuchungang <1397328542@qq.com> Date: Thu, 25 Jan 2024 17:39:53 +0800 Subject: [PATCH 0224/2135] Add qos header with CN language comment Signed-off-by: liuchungang <1397328542@qq.com> --- zh-cn/native_sdk/qos_manager/qos.h | 110 +++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 zh-cn/native_sdk/qos_manager/qos.h diff --git a/zh-cn/native_sdk/qos_manager/qos.h b/zh-cn/native_sdk/qos_manager/qos.h new file mode 100644 index 00000000..6a2328fc --- /dev/null +++ b/zh-cn/native_sdk/qos_manager/qos.h @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef QOS_H +#define QOS_H +/** + * @addtogroup QoS + * @{ + * + * @brief 提供QoS接口,包括设置、取消和查询QoS等级。 + * + * @since 12 + */ + +/** + * @file qos.h + * + * @brief 声明QoS提供的C接口。 + * + * @syscap SystemCapability.Resourceschedule.QoS.Core + * + * @since 12 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 描述QoS等级。 + * + * @since 12 + */ +typedef enum QoS_Level { + /** + * @brief 表示QoS等级为用户不可见任务。 + */ + QOS_BACKGROUND = 0, + + /** + * @brief 表示QoS等级为后台重要任务。 + */ + QOS_UTILITY, + + /** + * @brief 表示QoS等级为默认。 + */ + QOS_DEFAULT, + + /** + * @brief 表示QoS等级为用户触发任务。 + */ + QOS_USER_INITIATED, + + /** + * @brief 表示QoS等级为限时任务。 + */ + QOS_DEADLINE_REQUEST, + + /** + * @brief 表示QoS等级为用户交互任务。 + */ + QOS_USER_INTERACTIVE, +} QoS_Level; + +/** + * @brief 为当前线程设置QoS等级。 + * + * @param level 表示设置的QoS等级,详细信息可以查看{@link QoS_Level}。 + * @return 成功返回0,失败返回负值。 + * @see QoS_Level + * @since 12 + */ +int OH_QoS_SetThreadQoS(QoS_Level level); + +/** + * @brief 取消当前线程的QoS等级。 + * + * @return 成功返回0,失败返回负值。 + * @see QoS_Level + * @since 12 + */ +int OH_QoS_ResetThreadQoS(); + +/** + * @brief 获得当前线程的QoS等级。 + * + * @param level 参数是输出参数,线程的QoS等级会以{@link QoS_Level}形式写入该变量。 + * @return 成功返回0,失败返回负值。 + * @see QoS_Level + * @since 12 + */ +int OH_QoS_GetThreadQoS(QoS_Level *level); +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // QOS_H \ No newline at end of file -- Gitee From 1fba0829263d1d94b99ee68127cc19adfbdd2baa Mon Sep 17 00:00:00 2001 From: fangyunzhong Date: Mon, 29 Jan 2024 09:36:14 +0800 Subject: [PATCH 0225/2135] =?UTF-8?q?rawfile=E8=B5=84=E6=96=99=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangyunzhong --- zh-cn/native_sdk/resmgr/raw_file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/resmgr/raw_file.h b/zh-cn/native_sdk/resmgr/raw_file.h index 51361625..332fb75c 100644 --- a/zh-cn/native_sdk/resmgr/raw_file.h +++ b/zh-cn/native_sdk/resmgr/raw_file.h @@ -17,7 +17,7 @@ * @addtogroup rawfile * @{ * - * @brief 提供操作rawfile目录和rawfile文件的功能,包括遍历、打开、搜索、读取和关闭 + * @brief 提供操作rawfile目录和rawfile文件的功能,包括遍历、打开、搜索、读取和关闭。rawfile是非线程安全的,close和open相关接口是线程安全的。 * * @since 8 * @version 1.0 -- Gitee From 02cbbd2e4c8ae942e0867b027d90557dc37fbbb3 Mon Sep 17 00:00:00 2001 From: zwx1283032 Date: Mon, 29 Jan 2024 12:00:37 +0800 Subject: [PATCH 0226/2135] =?UTF-8?q?usb=E6=96=B0=E5=A2=9Ehdi=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3ManageInterface=E5=90=8C=E6=AD=A5=E5=88=B0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zwx1283032 --- en/device_api/hdi/usb/v1_0/IUsbInterface.idl | 15 +++++++++++++++ zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/en/device_api/hdi/usb/v1_0/IUsbInterface.idl b/en/device_api/hdi/usb/v1_0/IUsbInterface.idl index b556b666..7cccb105 100644 --- a/en/device_api/hdi/usb/v1_0/IUsbInterface.idl +++ b/en/device_api/hdi/usb/v1_0/IUsbInterface.idl @@ -215,6 +215,21 @@ interface IUsbInterface { */ ReleaseInterface([in] struct UsbDev dev, [in] unsigned char interfaceid); + /** + * @brief Support USB device management function. + * + * @param dev USB device address. For details, see {@link UsbDev}. + * @param interfaceid USB interface ID. + * @param disable is the USB device interface disabled. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + ManageInterface([in] struct UsbDev dev, [in] unsigned char interfaceid, [in] bool disable); + /** * @brief Sets the alternate settings for the specified interface of a USB device. This allows you to switch between * two interfaces with the same ID but different alternate settings. diff --git a/zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl b/zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl index 53330795..f5d96aed 100644 --- a/zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl +++ b/zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl @@ -209,6 +209,21 @@ interface IUsbInterface { */ ReleaseInterface([in] struct UsbDev dev, [in] unsigned char interfaceid); + /** + * @brief 支持usb设备管理功能。 + * + * @param dev USB设备地址信息,详见{@link UsbDev}。 + * @param interfaceid USB设备接口ID。 + * @param disable USB设备接口是否禁用。 + * + * @return 0 表示操作成功。 + * @return 非零值 表示操作失败。 + * + * @since 3.2 + * @version 1.0 + */ + ManageInterface([in] struct UsbDev dev, [in] unsigned char interfaceid, [in] bool disable); + /** * @brief 设置USB设备指定接口的备选设置,用于在具有相同ID但不同备用设置的两个接口之间进行选择。 * -- Gitee From 2a2deb6fbbef34228b021a746a2b69f79468776b Mon Sep 17 00:00:00 2001 From: zwx1283032 Date: Mon, 29 Jan 2024 15:29:11 +0800 Subject: [PATCH 0227/2135] =?UTF-8?q?usb=E6=96=B0=E5=A2=9Ehdi=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3ManageInterface=E5=90=8C=E6=AD=A5=E5=88=B0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zwx1283032 --- en/device_api/hdi/usb/v1_0/IUsbInterface.idl | 4 ++-- zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/en/device_api/hdi/usb/v1_0/IUsbInterface.idl b/en/device_api/hdi/usb/v1_0/IUsbInterface.idl index 7cccb105..df5778d1 100644 --- a/en/device_api/hdi/usb/v1_0/IUsbInterface.idl +++ b/en/device_api/hdi/usb/v1_0/IUsbInterface.idl @@ -216,11 +216,11 @@ interface IUsbInterface { ReleaseInterface([in] struct UsbDev dev, [in] unsigned char interfaceid); /** - * @brief Support USB device management function. + * @brief Set USB device interface startup status. * * @param dev USB device address. For details, see {@link UsbDev}. * @param interfaceid USB interface ID. - * @param disable is the USB device interface disabled. + * @param disable Is the USB device interface disabled? True indicates disabled, false indicates not disabled. * * @return Returns 0 if the operation is successful. * @return Returns a non-0 value if the operation fails. diff --git a/zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl b/zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl index f5d96aed..959d3fae 100644 --- a/zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl +++ b/zh-cn/device_api/hdi/usb/v1_0/IUsbInterface.idl @@ -210,11 +210,11 @@ interface IUsbInterface { ReleaseInterface([in] struct UsbDev dev, [in] unsigned char interfaceid); /** - * @brief 支持usb设备管理功能。 + * @brief 设置USB设备接口启动状态。 * * @param dev USB设备地址信息,详见{@link UsbDev}。 * @param interfaceid USB设备接口ID。 - * @param disable USB设备接口是否禁用。 + * @param disable USB设备接口是否禁用,true表示禁用,false表示不禁用。 * * @return 0 表示操作成功。 * @return 非零值 表示操作失败。 -- Gitee From 2cf8bd387be266a2aae875b7d7358bdf4f2f9996 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Tue, 30 Jan 2024 20:37:12 +0800 Subject: [PATCH 0228/2135] commit msg Signed-off-by: xuxuehai --- .../hdi/audio/effect/v1_0/EffectTypes.idl | 77 ++ .../hdi/audio/effect/v1_0/IEffectControl.idl | 77 ++ .../hdi/audio/effect/v1_0/IEffectModel.idl | 89 ++ .../device_api/hdi/audio/v1.1/AudioTypes.idl | 597 -------- .../hdi/audio/v1.1/IAudioAdapter.idl | 333 ----- .../hdi/audio/v1.1/IAudioCallback.idl | 88 -- .../hdi/audio/v1.1/IAudioCapture.idl | 479 ------- .../hdi/audio/v1.1/IAudioManager.idl | 114 -- .../hdi/audio/v1.1/IAudioRender.idl | 602 --------- .../device_api/hdi/audio/v1_0/AudioTypes.idl | 1156 ++++++++-------- .../hdi/audio/v1_0/IAudioAdapter.idl | 161 +-- .../hdi/audio/v1_0/IAudioCallback.idl | 176 +-- .../hdi/audio/v1_0/IAudioCapture.idl | 958 ++++++------- .../hdi/audio/v1_0/IAudioManager.idl | 228 ++-- .../hdi/audio/v1_0/IAudioRender.idl | 1204 ++++++++--------- 15 files changed, 2201 insertions(+), 4138 deletions(-) create mode 100644 zh-cn/device_api/hdi/audio/effect/v1_0/EffectTypes.idl create mode 100644 zh-cn/device_api/hdi/audio/effect/v1_0/IEffectControl.idl create mode 100644 zh-cn/device_api/hdi/audio/effect/v1_0/IEffectModel.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1.1/AudioTypes.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioAdapter.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioCallback.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioCapture.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioManager.idl delete mode 100644 zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl diff --git a/zh-cn/device_api/hdi/audio/effect/v1_0/EffectTypes.idl b/zh-cn/device_api/hdi/audio/effect/v1_0/EffectTypes.idl new file mode 100644 index 00000000..2648a5b5 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/effect/v1_0/EffectTypes.idl @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.audio.effect.v1_0; + +/** + * @brief 定义effect加载的音效信息。 + */ +struct EffectInfo { + String libName; /**< 指定用于创建控制器的音效库名称 */ + String effectId; /**< 音效ID */ + int ioDirection; /**< 确定效果的方向 */ +}; + +/** + * @brief 定义效果控制器信息,包括其所属的库及其effectId。 + */ +struct ControllerId { + String libName; /**< 指定用于创建控制器的音效库名称 */ + String effectId; /**< 音效ID */ +}; + +/** + * @brief 定义音效控制器描述 + */ +struct EffectControllerDescriptor { + String effectId; /**< 音效控制器的ID */ + String effectName; /**< 音效控制器的名字 */ + String libName; /**< 音效库的名称*/ + String supplier; /**< 音效供应商的名字 */ +}; + +/** + * @brief 数据点类型标记,该类型正在按需使用。 + */ +enum AudioEffectBufferTag { + EFFECT_BUFFER_VOID_TYPE = 0, /**< raw模式音频数据指向缓冲区的起点 */ + EFFECT_BUFFER_FLOAT_SIGNED_32 = 1 << 0, /**< 32bit浮点型音频数据指向缓冲区的起点 */ + EFFECT_BUFFER_SINGED_32 = 1 << 1, /**< 32bit整型音频数据指向缓冲区的起点 */ + EFFECT_BUFFER_SIGNED_16 = 1 << 2, /**< 16bit整型音频数据指向缓冲区的起点 */ + EFFECT_BUFFER_UNSIGNED_8 = 1 << 3, /**< 8bit无符号整型音频数据指向缓冲区的起点 */ +}; + +/** + * @brief 定义音效进程输入输出buffer。 + */ +struct AudioEffectBuffer { + unsigned int frameCount; /**< 帧缓冲区中的帧计数 */ + int datatag; /** 用于使用简化的数据点类型标记,祥见 {@link AudioEffectBufferTag} */ + byte[] rawData; /**< 音频数据指向缓冲区的起点, 数据类型由datatag定义*/ +}; + +/** + * @brief 定义音效控制器命令索引。 + */ +enum EffectCommandTableIndex { + AUDIO_EFFECT_COMMAND_INIT_CONTOLLER, /* 初始化音效控制器 */ + AUDIO_EFFECT_COMMAND_SET_CONFIG, /* 设置配置参数 */ + AUDIO_EFFECT_COMMAND_GET_CONFIG, /* 获取配置参数 */ + AUDIO_EFFECT_COMMAND_RESET, /* 重启音效控制器 */ + AUDIO_EFFECT_COMMAND_ENABLE, /* 使能音效 */ + AUDIO_EFFECT_COMMAND_DISABLE, /* 禁用音效 */ + AUDIO_EFFECT_COMMAND_SET_PARAM, /* 设置参数 */ + AUDIO_EFFECT_COMMAND_GET_PARAM, /* 获取参数 */ +}; diff --git a/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectControl.idl b/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectControl.idl new file mode 100644 index 00000000..f1b09dd2 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectControl.idl @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.audio.effect.v1_0; +import ohos.hdi.audio.effect.v1_0.EffectTypes; + +interface IEffectControl { + /** + * @brief 处理音频原始数据。必须指定输入和输出buffer,如果未指定,则进程必须使用命令提供的数据处理功能。 + * + * @param control 指向要操作的音效控件的指针 + * @param input 输入数据的buffer + * @param output 输出数据的buffer + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + EffectProcess([in] struct AudioEffectBuffer input, [out] struct AudioEffectBuffer output); + + /** + * @brief 发送音效处理命令 + * + * @param control 指向要操作的音效控件的指针 + * @param cmdId 用于匹配命令表中的命令选项的命令索引 + * @param cmdData 系统服务的数据 + * @param cmdDataLen 数据长度 + * @param replyData 返回的数据 + * @param replyDataLen 数据长度 + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + SendCommand([in] unsigned int cmdId, [in] byte[] cmdData, [out] byte[] replyData); + + /** + * @brief 获取音效的描述符 + * + * @param control 指向要操作的音效控件的指针 + * @param desc 指定的音效描述符 + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + GetEffectDescriptor([out] struct EffectControllerDescriptor desc); + + /** + * @brief 反转音频处理后的数据。必须指定输入和输出缓冲区,如果未指定,则反转必须使用命令提供的数据反转功能。 + * + * @param control 指向要操作的音效控件的指针 + * @param input 输入数据buffer + * @param output 输出数据buffer + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + EffectReverse([in] struct AudioEffectBuffer input, [out] struct AudioEffectBuffer output); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectModel.idl b/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectModel.idl new file mode 100644 index 00000000..d5f0ac72 --- /dev/null +++ b/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectModel.idl @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.audio.effect.v1_0; +import ohos.hdi.audio.effect.v1_0.EffectTypes; +import ohos.hdi.audio.effect.v1_0.IEffectControl; + +interface IEffectModel { + /** + * @brief 查询供应商/OEM是否提供效果库。如果提供,请使用提供的效果库。如果没有,请使用系统服务软件效果。 + * + * @param model 指向要操作的效果模型的指针 + * @param supply 供应商/OEM是否提供效果库的状态 + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + IsSupplyEffectLibs([out] boolean supply); + + /** + * @brief 获取所有支持的音效的描述符 + * + * @param model 指向要操作的效果模型的指针 + * @param descs 音效描述符列表 + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + GetAllEffectDescriptors([out] struct EffectControllerDescriptor[] descs); + + /** + * @brief 创建一个用于操作音效实例的音效控制器。 + * + * @param model 指向要操作的效果模型的指针 + * @param info 音效信息 + * @param contoller 音效控制器对象 + * @param contollerId 音效控制器ID + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + CreateEffectController([in]struct EffectInfo info, [out] IEffectControl contoller, + [out] struct ControllerId id); + + /** + * @brief 销毁控制器ID指定的音效控制器。 + * + * @param model 指向要操作的效果模型的指针 + * @param contollerId 音效控制器ID + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + DestroyEffectController([in] struct ControllerId id); + + /** + * @brief 获取指定音效的描述符 + * + * @param model 指向要操作的效果模型的指针 + * @param effectId 音效ID + * @param desc 指定音效的描述符 + * + * @return Returns 执行成功返回0,执行失败返回其他值 + * + * @since 4.0 + * @version 1.0 + */ + GetEffectDescriptor([in] String effectId, [out] struct EffectControllerDescriptor desc); +} diff --git a/zh-cn/device_api/hdi/audio/v1.1/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1.1/AudioTypes.idl deleted file mode 100644 index 5b63e5da..00000000 --- a/zh-cn/device_api/hdi/audio/v1.1/AudioTypes.idl +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file AudioTypes.idl - * - * @brief Audio模块接口定义中使用的数据类型。 - * - * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - -/** - * @brief 音频端口的类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortDirection { - PORT_OUT = 1, /**< 音频输出端口。*/ - PORT_IN = 2, /**< 音频输入端口。 */ - PORT_OUT_IN = 3, /**< 音频输出输入端口。 */ -}; - -/** - * @brief 音频端口上的Pin脚。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortPin { - PIN_NONE = 0, /**< 无效端口。*/ - PIN_OUT_SPEAKER = 1 << 0, /**< 喇叭输出。 */ - PIN_OUT_HEADSET = 1 << 1, /**< 有线耳机输出。 */ - PIN_OUT_LINEOUT = 1 << 2, /**< Lineout输出。 */ - PIN_OUT_HDMI = 1 << 3, /**< HDMI输出。 */ - PIN_OUT_USB = 1 << 4, /**< USB输出。*/ - PIN_OUT_USB_EXT = 1 << 5, /**< USB外部声卡输出。*/ - PIN_OUT_EARPIECE = 1 << 5 | 1 << 4, /**< 有线耳机输出。 */ - PIN_OUT_BLUETOOTH_SCO = 1 << 6, /**< 蓝牙SCO输出 */ - PIN_OUT_DAUDIO_DEFAULT = 1 << 7, /**< 音频默认输出 */ - PIN_OUT_HEADPHONE = 1 << 8, /**< 有线耳机输出。*/ - PIN_OUT_USB_HEADSET = 1 << 9, /**< ARM USB输出 */ - PIN_OUT_BLUETOOTH_A2DP = 1 << 10, /**< 蓝牙A2DP输出 */ - PIN_IN_MIC = 1 << 27 | 1 << 0, /**< 麦克风输入 */ - PIN_IN_HS_MIC = 1 << 27 | 1 << 1, /**< 耳机麦克风输入 */ - PIN_IN_LINEIN = 1 << 27 | 1 << 2, /**< Linein输入。 */ - PIN_IN_USB_EXT = 1 << 27 | 1 << 3, /**< USB外部声卡输入。*/ - PIN_IN_BLUETOOTH_SCO_HEADSET = 1 << 27 | 1 << 4, /**< 蓝牙SCO耳机输入 */ - PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5, /**< 音频默认输入 */ - PIN_IN_USB_HEADSET = 1 << 27 | 1 << 6, /**< ARM USB输入 */ -}; - -/** - * @brief 音频类型(场景)。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioCategory { - AUDIO_IN_MEDIA = 0, /**< 媒体。 */ - AUDIO_IN_COMMUNICATION = 1, /**< 通信。 */ - AUDIO_IN_RINGTONE = 2, /**< 电话铃声。 */ - AUDIO_IN_CALL = 3, /**< 呼叫。 */ - AUDIO_MMAP_NOIRQ = 4, /**< Mmap模式 */ - AUDIO_OFFLOAD = 5, /**< 低功耗 */ - AUDIO_MULTI_CHANNEL = 6, /**< 多声道 */ -}; - -/** - * @brief 音频格式。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioFormat { - AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8bit位宽PCM(Pulse Code Modulation)格式。*/ - AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16bit位宽PCM格式。 */ - AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24bit位宽PCM格式。 */ - AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32bit位宽PCM格式。*/ - AUDIO_FORMAT_TYPE_PCM_FLOAT = 1 << 2 | 1 << 0, /**< PCM浮点格式 */ - AUDIO_FORMAT_TYPE_MP3 = 1 << 24, /**< MP3格式 */ - AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main格式 */ - AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC格式 */ - AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD格式 */ - AUDIO_FORMAT_TYPE_AAC_ELD = 1 << 24 | 1 << 2, /**< AAC ELD格式 */ - AUDIO_FORMAT_TYPE_AAC_HE_V1 = 1 << 24 | 1 << 2 | 1 << 0, /**< AAC HE_V1格式 */ - AUDIO_FORMAT_TYPE_AAC_HE_V2 = 1 << 24 | 1 << 2 | 1 << 1, /**< AAC HE_V2格式 */ - AUDIO_FORMAT_TYPE_G711A = 1 << 25 | 1 << 0, /**< PCM G711A格式 */ - AUDIO_FORMAT_TYPE_G711U = 1 << 25 | 1 << 1, /**< PCM G711u格式 */ - AUDIO_FORMAT_TYPE_G726 = 1 << 25 | 1 << 1 | 1 << 0, /**< PCM G726格式 */ -}; - -/** - *@brief 音频通道掩码。 - * - * 定义音频声道的位置掩码。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioChannelMask { - AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。 */ - AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< 声道布局前右。*/ - AUDIO_CHANNEL_MONO = 1, /**< 单声道。 */ - AUDIO_CHANNEL_STEREO = 3, /**< 立体声,由左右声道组成。 */ -}; - -/** - * @brief 音频采样频率掩码。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioSampleRatesMask { - AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< 无效的采样频率。 */ -}; - -/** - * @brief 音频端口的数据透传模式。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortPassthroughMode { - PORT_PASSTHROUGH_LPCM = 1 << 0, /**< 立体声PCM。*/ - PORT_PASSTHROUGH_RAW = 1 << 1, /**< HDMI透传。 */ - PORT_PASSTHROUGH_HBR2LBR = 1 << 2, /**< 蓝光次世代音频降规格输出。 */ - PORT_PASSTHROUGH_AUTO = 1 << 3, /**< 根据HDMI EDID能力自动匹配。 */ -}; - -/** - * @brief 原始音频样本格式。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioSampleFormat { - AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 32bit位宽浮点型非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F64P = 23, /**< 64bit位宽双精度浮点型非交织样本。 **/ -}; - -/** - * @brief 音频播放的通道模式。 - * - * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioChannelMode { - AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。 */ - AUDIO_CHANNEL_BOTH_LEFT = 1, /**< 两个声道全部为左声道声音。 */ - AUDIO_CHANNEL_BOTH_RIGHT = 2, /**< 两个声道全部为右声道声音。 */ - AUDIO_CHANNEL_EXCHANGE = 3, /**< 左右声道数据互换,左声道为右声道声音,右声道为左声道声音。*/ - AUDIO_CHANNEL_MIX = 4, /**< 左右两个声道输出为左右声道相加(混音)。 */ - AUDIO_CHANNEL_LEFT_MUTE = 5, /**< 左声道静音,右声道播放原右声道声音。 */ - AUDIO_CHANNEL_RIGHT_MUTE = 6, /**< 右声道静音,左声道播放原左声道声音。 */ - AUDIO_CHANNEL_BOTH_MUTE = 7, /**< 左右声道均静音。*/ -}; - -/** - * @brief 音频数据结束类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioDrainNotifyType { - AUDIO_DRAIN_NORMAL_MODE = 0, /**< 曲目的所有数据播放完就结束。 */ - AUDIO_DRAIN_EARLY_MODE = 1, /**< 曲目的所有数据未播放完就结束,以便给音频服务做连续性曲目切换留出时间。 */ -}; - -/** - * @brief 回调函数通知事件类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioCallbackType { - AUDIO_NONBLOCK_WRITE_COMPELETED = 0, /**< 非阻塞式写完成。 */ - AUDIO_DRAIN_COMPELETED = 1, /**< DrainBuffer完成,详情参考{@link DrainBuffer}。 */ - AUDIO_FLUSH_COMPLETED = 2, /**< Flush完成,详情参考{@link Flush}。 */ - AUDIO_RENDER_FULL = 3, /**< 录音缓冲区已满。 */ - AUDIO_ERROR_OCCUR = 4, /**< 发生了错误。 */ -}; - -/** - * @brief 音频端口角色。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortRole { - AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。 */ - AUDIO_PORT_SOURCE_ROLE = 1, /**< 指定端口为发送端角色。 */ - AUDIO_PORT_SINK_ROLE = 2, /**< 指定端口为接受端角色。 */ -}; - -/** - * @brief 音频端口类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioPortType { - AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。 */ - AUDIO_PORT_DEVICE_TYPE = 1, /**< 指定端口为设备类型。 */ - AUDIO_PORT_MIX_TYPE = 2, /**< 指定端口为复合类型。 */ - AUDIO_PORT_SESSION_TYPE = 3, /**< 指定端口为会话类型。 */ -}; - -/** - * @brief 端口会话类型。 - * - * @since 4.1 - * @version 1.1 - */ -enum AudioSessionType { - AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。 */ - AUDIO_OUTPUT_MIX_SESSION = 1, /**< 会话绑定到特定音轨。 */ - AUDIO_ALLOCATE_SESSION = 2, /**< 会话ID需重新申请。 */ - AUDIO_INVALID_SESSION = 3, /**< 无效会话类型。 */ -}; - -/** - * @brief 音频设备类型。 - */ -enum AudioDeviceType { - AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。 */ - AUDIO_HEADPHONE = 1 << 1, /**< 耳机。 */ - AUDIO_HEADSET = 1 << 2, /**< 头戴式耳机。 */ - AUDIO_USB_HEADSET = 1 << 3, /**< USB头戴式耳机。 */ - AUDIO_USB_HEADPHONE = 1 << 4, /**< USB耳机。 */ - AUDIO_USBA_HEADSET = 1 << 5, /**< USB模拟头戴式耳机。 */ - AUDIO_USBA_HEADPHONE = 1 << 6, /**< USB模拟耳机。 */ - AUDIO_PRIMARY_DEVICE = 1 << 7, /**< 主音频设备。 */ - AUDIO_USB_DEVICE = 1 << 8, /**< USB音频设备。 */ - AUDIO_A2DP_DEVICE = 1 << 9, /**< 蓝牙音频设备。 */ - AUDIO_HDMI_DEVICE = 1 << 10, /**< HDMI音频设备 */ - AUDIO_ADAPTER_DEVICE = 1 << 11, /**< 声卡设备 */ - AUDIO_DEVICE_UNKNOWN, /**< 未知设备。 */ -}; - -/** - * @brief 音频事件类型。 - */ -enum AudioEventType { - AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。 */ - AUDIO_DEVICE_REMOVE = 2, /**< 音频设备移除。 */ - AUDIO_LOAD_SUCCESS = 3, /**< 声卡加载成功。 */ - AUDIO_LOAD_FAILURE = 4, /**< 声卡加载失败。 */ - AUDIO_UNLOAD = 5, /**< 声卡卸载。 */ - AUDIO_SERVICE_VALID = 7, /**< 音频服务可用。 */ - AUDIO_SERVICE_INVALID = 8, /**< 音频服务不可用。 */ - AUDIO_CAPTURE_THRESHOLD = 9, /**< 录音阈值上报。 */ - AUDIO_EVENT_UNKNOWN = 10, /**< 未知事件。 */ -}; - -/** - * @brief 音频扩展参数键类型。 - */ -enum AudioExtParamKey { - AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。 */ - AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< 分布式音频-音量事件。 */ - AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< 分布式音频-焦点事件。 */ - AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< 分布式音频-媒体按钮事件。 */ - AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< 分布式音频-音频效果事件。 */ - AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< 分布式音频-设备状态事件。 */ - AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< USB设备类型( ARM 或 HIFI)*/ - AUDIO_EXT_PARAM_KEY_PERF_INFO = 201, /**< 分布式音频-dsp加载事件。 */ - AUDIO_EXT_PARAM_KEY_MMI = 301, /**< 分布式音频-主机接口测试。 */ - AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< 低电量事件。 */ -}; - -/** - * @brief 音频设备状态。 - */ -struct AudioDeviceStatus { - unsigned int pnpStatus; /**< PnP设备状态,详情参考{@link AudioDeviceType},{@link AudioEventType}。 */ -}; - -/** - * @brief 音频场景描述。 - */ -union SceneDesc { - unsigned int id; /**< 音频场景的ID,详情参考{@link AudioCategory}。*/ -}; - -/** - * @brief 音频端口。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioPort { - enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。 */ - unsigned int portId; /**< 音频端口的ID。 */ - String portName; /**< 音频端口的名称。 */ -}; - -/** - * @brief 音频适配器描述符。 - * - * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, - * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioAdapterDescriptor { - String adapterName; /**< 音频适配器的名称。 */ - struct AudioPort[] ports; /**< 一个音频适配器支持的端口列表,详情参考{@link AudioPort}。 */ -}; - -/** - * @brief 音频设备描述符。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioDeviceDescriptor { - unsigned int portId; /**< 音频端口ID。 */ - enum AudioPortPin pins; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ - String desc; /**< 以字符串命名的音频设备。 */ -}; - -/** - * @brief 音频场景描述符。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioSceneDescriptor { - union SceneDesc scene; /**< 音频场景描述,详情参考{@link SceneDesc}。 */ - struct AudioDeviceDescriptor desc; /**< 音频设备描述符,详情参考{@link AudioDeviceDescriptor}。 */ -}; - -/** - * @brief 音频输入类型. - */ -enum AudioInputType { - AUDIO_INPUT_DEFAULT_TYPE = 0, /**< 默认输入 */ - AUDIO_INPUT_MIC_TYPE = 1 << 0, /**< 麦克风输入 */ - AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, /**< 语音唤醒输入 */ - AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, /**< 通话 */ - AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< 声音识别 */ - AUDIO_INPUT_VOICE_UPLINK_TYPE = 1 << 4, /**< 上行输入 */ - AUDIO_INPUT_VOICE_DOWNLINK_TYPE = 1 << 5, /**< 下行输入 */ - AUDIO_INPUT_VOICE_CALL_TYPE = 1 << 6, /**< 电话 */ - AUDIO_INPUT_CAMCORDER_TYPE = 1 << 7, /**< 摄像机输入 */ -}; - -/** - * @brief 音频低功耗属性 - */ -struct AudioOffloadInfo -{ - unsigned int sampleRate; /**< 采样率 */ - unsigned int channelCount; /**< 声道数 */ - unsigned int bitRate; /**< 比特率 */ - unsigned int bitWidth; /**< 比特位宽 */ - enum AudioFormat format; /**< 音频格式 */ - unsigned int offloadBufferSize; /**< 音频数据缓存长度 */ - unsigned long duration; /** 音频持续时间,单位纳秒*/ -}; - -/** - * @brief 音频采样属性。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioSampleAttributes { - enum AudioCategory type; /**< 音频类型,详情参考{@link AudioCategory}。 */ - boolean interleaved; /**< 音频数据交织的标记。 */ - enum AudioFormat format; /**< 音频数据格式,详情参考{@link AudioFormat}。 */ - unsigned int sampleRate; /**< 音频采样频率。 */ - unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。*/ - unsigned int period; /**< 音频采样周期,单位赫兹。 */ - unsigned int frameSize; /**< 音频数据的帧大小。 */ - boolean isBigEndian; /**< 音频数据的大端标志。 */ - boolean isSignedData; /**< 音频数据有符号或无符号标志。 */ - unsigned int startThreshold; /**< 音频播放起始阈值。 */ - unsigned int stopThreshold; /**< 音频播放停止阈值。 */ - unsigned int silenceThreshold; /**< 录音缓冲区阈值。 */ - int streamId; /**< 录音或播放的标识符。 */ - int sourceType; /**< 播放或录音的音源类型 */ - struct AudioOffloadInfo offloadInfo; /**< offload流信息 */ -}; - -/** - * @brief 音频时间戳。 - * - * 时间定义,POSIX timespec的替代品。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioTimeStamp { - long tvSec; /**< tvSec时间,单位:秒。 */ - long tvNSec; /**< tvNSec时间,单位:纳秒。 */ -}; - -/** - * @brief 音频子端口的支持能力。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioSubPortCapability { - unsigned int portId; /**< 子端口ID。 */ - String desc; /**< 以字符串命名的子端口。 */ - enum AudioPortPassthroughMode mask; /**< 数据透传模式,详情参考{@link AudioPortPassthroughMode}。 */ -}; - -/** - * @brief 音频端口的支持能力。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioPortCapability { - unsigned int deviceType; /**< 设备输出、输入类型。 */ - unsigned int deviceId; /**< 设备ID,唯一的设备识别符。 */ - boolean hardwareMode; /**< 是否支持设备绑定处理。 */ - unsigned int formatNum; /**< 支持的音频格式数目。 */ - enum AudioFormat[] formats; /**< 支持的音频格式,详情参考{@link AudioFormat}。 */ - unsigned int sampleRateMasks; /**< 支持的音频采样频率(8k、16k、32k、48k)。 */ - enum AudioChannelMask channelMasks; /**< 设备的声道布局掩码,详情参考{@link AudioChannelMask}。 */ - unsigned int channelCount; /**< 最大支持的声道总数。 */ - struct AudioSubPortCapability[] subPorts; /**< 支持的子端口列表,详情参考{@link AudioSubPortCapability}。 */ - enum AudioSampleFormat[] supportSampleFormats; /**< 支持的采样率列表,详情参考{@link AudioSampleFormat}。 */ -}; - -/** - * @brief mmap缓冲区描述符。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioMmapBufferDescripter { - byte[] memoryAddress; /**< 指向mmap缓冲区的指针。 */ - FileDescriptor memoryFd; /**< mmap缓冲区的文件描述符。 */ - int totalBufferFrames; /**< 缓冲区总大小,单位:帧。 */ - int transferFrameSize; /**< 传输大小,单位:帧。 */ - int isShareable; /**< mmap缓冲区是否可以在进程间共享。 */ - unsigned int offset; /**< 文件偏移。 */ - String filePath; /**< mmap文件路径。 */ -}; - -/** - * @brief 音频设备拓展信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioDevExtInfo { - int moduleId; /**< 音频流绑定的模块ID。 */ - enum AudioPortPin type; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ - String desc; /**< 地址描述。 */ -}; - -/** - * @brief 音轨拓展信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioMixExtInfo { - int moduleId; /**< 流所属模块标识符。 */ - int streamId; /**< 由调用者传递的Render或Capture标识符。 */ -}; - -/** - * @brief 会话拓展信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioSessionExtInfo { - enum AudioSessionType sessionType; /**< 音频会话类型,详情参考{@link AudioSessionType}。 */ -}; - -/** - * @brief 音频端口特定信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioInfo { - struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。 */ - struct AudioMixExtInfo mix; /**< 音轨特定信息,详情参考{@link AudioMixExtInfo}。 */ - struct AudioSessionExtInfo session; /**< 会话特定信息,详情参考{@link AudioSessionExtInfo}。 */ -}; - -/** - * @brief 音频路由节点。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioRouteNode { - int portId; /**< 音频端口ID。 */ - enum AudioPortRole role; /**< 指定端口角色为发送端或接收端,详情参考{@link AudioPortRole}。 */ - enum AudioPortType type; /**< 指定端口类型可以为设备类型、复合类型、绘画类型,详情参考{@link AudioPortType}。 */ - struct AudioInfo ext; /**< 音频端口特定信息,详情参考{@link AudioInfo}。 */ -}; - -/** - * @brief 音频路由信息。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioRoute { - struct AudioRouteNode[] sources; /**< 发送端列表,详情参考{@link AudioRouteNode}。 */ - struct AudioRouteNode[] sinks; /**< 接受端列表,详情参考{@link AudioRouteNode}。 */ -}; - -/** - * @brief 音频事件。 - * - * @since 4.1 - * @version 1.1 - */ -struct AudioEvent { - unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。 */ - unsigned int deviceType; /**< 设备类型,详情参考{@link enum AudioDeviceType}。 */ -}; -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioAdapter.idl deleted file mode 100644 index 22c45510..00000000 --- a/zh-cn/device_api/hdi/audio/v1.1/IAudioAdapter.idl +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioAdapter.idl - * - * @brief Audio适配器的接口定义文件。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioRender; -import ohos.hdi.audio.v1_1.IAudioCapture; -import ohos.hdi.audio.v1_1.IAudioCallback; - -/** - * @brief AudioAdapter音频适配器接口。 - * - * 提供音频适配器(声卡)对外支持的驱动能力,包括初始化端口、创建放音、创建录音、获取端口能力集等。 - * - * @see IAudioRender - * @see IAudioCapture - * - * @since 4.1 - * @version 1.1 - */ -interface IAudioAdapter { - /** - * @brief 初始化一个音频适配器所有的端口驱动。 - * 在音频服务中,调用其他驱动接口前需要先调用该接口检查端口是否已经初始化完成,如果端口没有初始化完成, - * 则需要等待一段时间(例如100ms)后重新进行检查,直到端口初始化完成后再继续操作。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * - * @return 初始化完成返回值0,初始化失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - InitAllPorts(); - - /** - * @brief 创建一个音频播放接口的对象。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 - * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 - * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@link IAudioRender}。 - * @param renderId 获取的音频播放接口序号。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetPortCapability - * @see DestroyRender - * - * @since 4.1 - * @version 1.1 - */ - CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, - [out] IAudioRender render, [out] unsigned int renderId); - - /** - * @brief 销毁一个音频播放接口的对象。 - * - * @attention 在音频播放过程中,不能销毁该接口对象。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param renderId 待销毁的音频播放接口的序号 - * - * @return 成功返回值0,失败返回负值。 - * @see CreateRender - * - * @since 4.1 - * @version 1.1 - */ - DestroyRender([in] unsigned int renderId); - - /** - * @brief 创建一个音频录音接口的对象。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 - * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 - * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@link IAudioCapture}。 - * @param captureId 获取的音频录音接口的序号 - * @return 成功返回值0,失败返回负值。 - * - * @see GetPortCapability - * @see DestroyCapture - - * @since 4.1 - * @version 1.1 - */ - CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, - [out] IAudioCapture capture, [out] unsigned int captureId); - - /** - * @brief 销毁一个音频录音接口的对象。 - * - * @attention 在音频录音过程中,不能销毁该接口对象。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param captureId 待销毁的音频录音接口的序号 - * - * @return 成功返回值0,失败返回负值。 - * @see CreateCapture - * - * @since 4.1 - * @version 1.1 - */ - DestroyCapture([in] unsigned int captureId); - - /** - * @brief 获取一个音频适配器的端口驱动的能力集。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param port 待获取的端口,详请参考{@link AudioPort}。 - * @param capability 获取的端口能力保存到capability中,详请参考{@link AudioPortCapability}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); - - /** - * @brief 设置音频端口驱动的数据透传模式。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param port 待设置的端口,详请参考{@link AudioPort}。 - * @param mode 待设置的传输模式,详请参考{@link AudioPortPassthroughMode}。 - * @return 成功返回值0,失败返回负值。 - * @see GetPassthroughMode - * - * @since 4.1 - * @version 1.1 - */ - SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); - - /** - * @brief 获取音频端口驱动的数据透传模式。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param port 待获取的端口,详请参考{@link AudioPort}。 - * @param mode 获取的传输模式保存到mode中,详请参考{@link AudioPortPassthroughMode}。 - * @return 成功返回值0,失败返回负值。 - * @see SetPassthroughMode - * - * @since 4.1 - * @version 1.1 - */ - GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); - - /** - * @brief 获取一个音频适配器的设备状态。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param status 获取的设备状态保存到status中,详请参考{@link AudioDeviceStatus}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetDeviceStatus([out] struct AudioDeviceStatus status); - - /** - * @brief 更新音频路由。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param route 待更新的路由,详请参考{@link AudioRoute}。 - * @param routeHandle 更新后的音频路由句柄保存到routeHandle中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); - - /** - * @brief 释放音频路由。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param routeHandle 待释放的音频路由句柄。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - ReleaseAudioRoute([in] int routeHandle); - - /** - * @brief 设置音频静音。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param mute 表示是否将音频静音,true表示静音,false表示非静音。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetMicMute - * - * @since 4.1 - * @version 1.1 - */ - SetMicMute([in] boolean mute); - - /** - * @brief 获取音频静音状态。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param mute 获取的静音状态保存到mute中,true表示静音,false表示非静音。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetMicMute - * - * @since 4.1 - * @version 1.1 - */ - GetMicMute([out] boolean mute); - - /** - * @brief 设置语音呼叫的音量。 - * - * 音量范围从0.0到1.0。如果音频服务中的音量水平在0到15的范围内, - * 0.0表示音频静音,1.0指示最大音量级别(15)。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param volume 待设置的音量值,范围为(0.0-1.0),0.0表示最小音量值,1.0表示最大音量值。 - * @return 成功返回值0,失败返回负值。 - * @see GetVolume - * - * @since 4.1 - * @version 1.1 - */ - SetVoiceVolume([in] float volume); - - /** - * @brief 根据指定的条件设置音频拓展参数。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 - * @param condition 指定的扩展参数查询条件。 - * @param value 指定的扩展参数条件值。 - * - * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 - * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: - * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" - * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 - * VOLUME_GROUP_ID 表示待设置的音频扩展参数相关的音量组。 - * AUDIO_VOLUME_TYPE 表示待设置的音频扩展参数相关的音量类型。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); - - /** - * @brief 根据指定条件获取音频扩展参数的取值。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 - * @param condition 指定的扩展参数查询条件。 - * @param value 待返回的指定扩展参数条件的当前值。 - * @param lenth value的长度 - * - * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 - * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: - * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" - * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 - * VOLUME_GROUP_ID 表示待查询的音频扩展参数相关的音量组。 - * AUDIO_VOLUME_TYPE 表示待查询的音频扩展参数相关的音量类型。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); - - /** - * @brief 注册扩展参数回调函数。 - * - * @param adapter 调用当前函数的AudioAdapter指针对象。 - * @param callback 待注册的回调函数,详请参考{@link AudioCallback}。 - * @param cookie 用于传递数据。 - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); -} -/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioCallback.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioCallback.idl deleted file mode 100644 index f0386451..00000000 --- a/zh-cn/device_api/hdi/audio/v1.1/IAudioCallback.idl +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioCallback.idl - * - * @brief Audio播放的回调函数定义文件。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - -import ohos.hdi.audio.v1_1.AudioTypes; - -/** - * @brief Audio回调接口。 - * - * @since 4.1 - * @version 1.1 - */ -[callback] interface IAudioCallback { - - /** - * @brief 放音回调函数。 - * - * @param type 回调函数通知事件类型,详请参考{@link AudioCallbackType}。 - * @param reserved 保留字段。 - * @param cookie 用于传递数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RegCallback - * - * @since 4.1 - * @version 1.1 - */ - RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); - /** - * @brief 音频扩展参数回调函数。 - * - * @param key 扩展参数键类型,详请参考{@link AudioExtParamKey}。 - * @param condition 扩展参数条件。 - * @param value 扩展参数条件的值 - * @param reserved 保留字段。 - * @param cookie 用于传递数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see ParamCallback - * - * @since 4.1 - * @version 1.1 - */ - ParamCallback([in] enum AudioExtParamKey key, [in] byte condition, [in] byte value, [out] byte reserved, [out] byte cookie); -} -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioCapture.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioCapture.idl deleted file mode 100644 index 99fec85d..00000000 --- a/zh-cn/device_api/hdi/audio/v1.1/IAudioCapture.idl +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioCapture.idl - * - * @brief Audio录音的接口定义文件。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_0; - -import ohos.hdi.audio.v1_1.AudioTypes; - - -/** - * @brief AudioCapture音频录音接口。 - * - * 提供音频录音支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、录制音频帧数据等。 - * - * @since 4.1 - * @version 1.1 - */ -interface IAudioCapture { - /** - * @brief 从音频驱动中录制一帧输入数据(录音,音频上行数据)。 - * - * @param capture 调用当前函数的IAudioCapture指针对象 - * @param frame 待存放输入数据的音频frame。 - * @param requestBytes 待存放输入数据的音频frame大小(字节数)。 - * @param replyBytes 指向要读取的音频数据的实际长度(以字节为单位)的指针。 - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); - - /** - * @brief Obtains the last number of input audio frames. - * - * @param capture 调用当前函数的IAudioCapture指针对象 - * @param frames 获取的音频帧数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 - * @return 成功返回值0,失败返回负值。 - * @see CaptureFrame - * - * @since 4.1 - * @version 1.1 - */ - GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 判断某个音频场景能力是否支持。 - * - * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SelectScene - * - * @since 4.1 - * @version 1.1 - */ - CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); - - /** - * @brief 选择音频场景。 - * - *
      - *
    • 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 - *
        - *
      • 在媒体播放场景中,scene为media_speaker。
      • - *
      • 在语音通话免提场景中,scene为voice_speaker。
      • - *
      - *
    • 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • - *
    • 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • - *
    - * - * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see CheckSceneCapability - * - * @since 4.1 - * @version 1.1 - */ - SelectScene([in] struct AudioSceneDescriptor scene); - - /** - * @brief 设置音频的静音状态。 - * - * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetMute - * - * @since 4.1 - * @version 1.1 - */ - SetMute([in] boolean mute); - - /** - * @brief 获取音频的静音状态。 - * - * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetMute - * - * @since 4.1 - * @version 1.1 - */ - GetMute([out] boolean mute); - - /** - * @brief 设置一个音频流的音量。 - * - * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级范围是0 ~ 15, - * 则音量的映射关系为0.0(或0)表示静音,1.0(或15)表示最大音量等级。 - * - * @param volume 待设置的音量,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetVolume([in] float volume); - - /** - * @brief 获取一个音频流的音量。 - * - * @param volume 获取的音量保存到volume中,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetVolume - * - * @since 4.1 - * @version 1.1 - */ - GetVolume([out] float volume); - - /** - * @brief 获取音频流增益的阈值。 - * - * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: - * - *
      - *
    • 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • - *
    • 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, - * 则增益的映射关系为0.0表示静音(-50db),1.0表示最大增益(6db)。
    • - *
    - * - * @param min 获取的音频增益的阈值下限保存到min中。 - * @param max 获取的音频增益的阈值上限保存到max中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGain - * @see SetGain - * - * @since 4.1 - * @version 1.1 - */ - GetGainThreshold([out] float min, [out] float max); - - /** - * @brief 获取音频流的增益。 - * - * @param gain 保存当前获取到的增益到gain中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see SetGain - * - * @since 4.1 - * @version 1.1 - */ - GetGain([out] float gain); - - /** - * @brief 设置音频流的增益。 - * - * @param gain 待设置的增益,最小为0.0,最大为1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see GetGain - * - * @since 4.1 - * @version 1.1 - */ - SetGain([in] float gain); - - /** - * @brief 获取一帧音频数据的长度(字节数)大小。 - * - * @param size 获取的音频帧大小(字节数)保存到size中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameSize([out] unsigned long size); - - /** - * @brief 获取音频buffer中的音频帧数。 - * - * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameCount([out] unsigned long count); - - /** - * @brief 设置音频采样的属性参数。 - * - * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetSampleAttributes - * - * @since 4.1 - * @version 1.1 - */ - SetSampleAttributes([in] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频采样的属性参数。 - * - * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetSampleAttributes - * - * @since 4.1 - * @version 1.1 - */ - GetSampleAttributes([out] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频的数据通道ID。 - * - * @param channelId 获取的通道ID保存到channelId中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetCurrentChannelId([out] unsigned int channelId); - - /** - * @brief 设置音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetExtraParams([in] String keyValueList); - - /** - * @brief 获取音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetExtraParams([out] String keyValueList); - - /** - * @brief 请求mmap缓冲区。 - * - * @param reqSize 请求缓冲区的大小,单位:字节。 - * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); - - /** - * @brief 获取当前mmap的读/写位置。 - * - * @param frames 获取的音频帧计数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 添加音频效果。 - * - * @param effectid 添加的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - AddAudioEffect([in] unsigned long effectid); - - /** - * @brief 移除音频效果。 - * - * @param effectid 移除的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - RemoveAudioEffect([in] unsigned long effectid); - - /** - * @brief 获取缓冲区大小。 - * - * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameBufferSize([out] unsigned long bufferSize); - - /** - * @brief 启动一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Stop - * - * @since 4.1 - * @version 1.1 - */ - Start(); - - /** - * @brief 停止一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Start - * - * @since 4.1 - * @version 1.1 - */ - Stop(); - - /** - * @brief 暂停一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Resume - * - * @since 4.1 - * @version 1.1 - */ - Pause(); - - /** - * @brief 恢复一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Pause - * - * @since 4.1 - * @version 1.1 - */ - Resume(); - - /** - * @brief 刷新音频缓冲区buffer中的数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - Flush(); - - /** - * @brief 设置或去设置设备的待机模式。 - * - * @return 设置设备待机模式成功返回值0,再次执行后去设置待机模式成功返回正值,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - TurnStandbyMode(); - - /** - * @brief 保存音频设备信息。 - * - * @param range 需要保存的信息范围(3 ~ 5),分为简要信息(3)、一般信息(4)、全量信息(5)。 - * @param fd 保存到指定的目标文件。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - AudioDevDump([in] int range, [in] int fd); - - /** - * @brief 判断声卡是否支持音频录制的暂停和恢复功能。 - * - * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 - * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); -} -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioManager.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioManager.idl deleted file mode 100644 index 18e0b730..00000000 --- a/zh-cn/device_api/hdi/audio/v1.1/IAudioManager.idl +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup HdiAudio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioManager.idl - * - * @brief Audio适配器管理及加载的接口定义文件。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_0; - -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioAdapter; - -/** - * @brief AudioManager音频适配器管理接口。 - * - * 按照音频服务下发的音频适配器(声卡)描述符加载一个具体的音频适配器驱动程序。 - * - * @see IAudioAdapter - * - * @since 4.1 - * @version 1.1 - */ -interface IAudioManager { - - /** - * @brief 获取音频驱动中支持的所有适配器的列表。 - * - * @param descs 获取到的音频适配器列表保存到descs中,详请参考{@link AudioAdapterDescriptor}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see LoadAdapter - * - * @since 4.1 - * @version 1.1 - */ - GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); - - /** - * @brief 加载一个音频适配器(声卡)的驱动。 - * - * 加载一个具体的音频驱动,例如usb驱动,在具体实现中可能加载的是一个动态链接库(*.so)。 - * - * @param desc 待加载的音频适配器描述符,详请参考{@link AudioAdapterDescriptor}。 - * @param adapter 获取的音频适配器接口的对象实例保存到adapter中,详请参考{@link IAudioAdapter}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetAllAdapters - * @see UnloadAdapter - * - * @since 4.1 - * @version 1.1 - */ - LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); - - /** - * @brief 卸载音频适配器(声卡)的驱动。 - * - * @param adapterName 待卸载的音频适配器接口的对象名称。 - * - * @see LoadAdapter - * - * @since 4.1 - * @version 1.1 - */ - UnloadAdapter([in] String adapterName); - - /** - * @brief 释放音频管理接口对象。 - * - * @return 功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - ReleaseAudioManagerObject(); -} -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl deleted file mode 100644 index acdea6d0..00000000 --- a/zh-cn/device_api/hdi/audio/v1.1/IAudioRender.idl +++ /dev/null @@ -1,602 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup Audio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @file IAudioRender.idl - * - * @brief Audio播放的接口定义文件。 - * - * @since 4.1 - * @version 1.1 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 4.1 - * @version 1.1 - */ -package ohos.hdi.audio.v1_1; - -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioCallback; - -/** - * @brief AudioRender音频播放接口。 - * - * 提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据等。 - * - * @since 4.1 - * @version 1.1 - */ -interface IAudioRender { - /** - * @brief 获取音频硬件驱动的延迟时间。 - * - * @param ms 获取的延迟时间(单位:毫秒)保存到ms中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetLatency([out] unsigned int ms); - - /** - * @brief 向音频驱动中播放一帧输出数据(放音,音频下行数据)。 - * - * @param frame 待写入的输出数据的音频frame。 - * @param replyBytes 实际写入的音频数据长度(字节数),获取后保存到replyBytes中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); - - /** - * @brief 获取音频已输出的帧数。 - * - * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 - * @param time 获取的关联时间戳保存到time中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RenderFrame - * - * @since 4.1 - * @version 1.1 - */ - GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 设置一个音频的播放速度。 - * - * @param speed 待设置的播放速度(倍速),例0.5、0.75、1.0、1.25、1.5、2.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetRenderSpeed - * - * @since 4.1 - * @version 1.1 - */ - SetRenderSpeed([in] float speed); - - /** - * @brief 获取一个音频当前的播放速度。 - * - * @param speed 获取的播放速度保存到speed中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetRenderSpeed - * - * @since 4.1 - * @version 1.1 - */ - GetRenderSpeed([out] float speed); - - /** - * @brief 设置音频播放的通道模式。 - * - * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetChannelMode - * - * @since 4.1 - * @version 1.1 - */ - SetChannelMode([in] enum AudioChannelMode mode); - - /** - * @brief 获取音频播放当前的通道模式。 - * - * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetChannelMode - * - * @since 4.1 - * @version 1.1 - */ - GetChannelMode([out] enum AudioChannelMode mode); - - /** - * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 - * - * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 - * @param cookie 回调函数的入参。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RegCallback - * - * @since 4.1 - * @version 1.1 - */ - RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); - - /** - * @brief 排空缓冲区中的数据。 - * - * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RegCallback - * - * @since 4.1 - * @version 1.1 - */ - DrainBuffer([out] enum AudioDrainNotifyType type); - - /** - * @brief 判断是否支持清空缓冲区数据的功能。 - * - * @param support 是否支持的状态保存到support中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - IsSupportsDrain([out] boolean support); - /** - * @brief 是否支持某个音频场景的配置。 - * - * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SelectScene - * - * @since 4.1 - * @version 1.1 - */ - CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); - - /** - * @brief 选择音频场景。 - * - *
      - *
    • 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 - *
        - *
      • 在媒体播放场景scene为media_speaker。
      • - *
      • 在语音通话免提场景scene为voice_speaker。
      • - *
      - *
    • 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • - *
    • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • - *
    - * - * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see CheckSceneCapability - * - * @since 4.1 - * @version 1.1 - */ - SelectScene([in] struct AudioSceneDescriptor scene); - - /** - * @brief 设置音频的静音状态。 - * - * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetMute - * - * @since 4.1 - * @version 1.1 - */ - SetMute([in] boolean mute); - - /** - * @brief 获取音频的静音状态。 - * - * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetMute - * - * @since 4.1 - * @version 1.1 - */ - GetMute([out] boolean mute); - - /** - * @brief 设置一个音频流的音量。 - * - * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), - * 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15)。 - * - * @param volume 待设置的音量,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetVolume([in] float volume); - - /** - * @brief 获取一个音频流的音量。 - * - * @param volume 获取的音量保存到volume中,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetVolume - * - * @since 4.1 - * @version 1.1 - */ - GetVolume([out] float volume); - - /** - * @brief 获取音频流增益的阈值。 - * - * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: - * - *
      - *
    • 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • - *
    • 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, - * 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db)。
    • - *
    - * - * @param min 获取的音频增益的阈值下限保存到min中。 - * @param max 获取的音频增益的阈值上限保存到max中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGain - * @see SetGain - * - * @since 4.1 - * @version 1.1 - */ - GetGainThreshold([out] float min, [out] float max); - - /** - * @brief 获取音频流的增益。 - * - * @param gain 保存当前获取到的增益到gain中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see SetGain - * - * @since 4.1 - * @version 1.1 - */ - GetGain([out] float gain); - - /** - * @brief 设置音频流的增益。 - * - * @param gain 待设置的增益,最小为0.0,最大为1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see GetGain - * - * @since 4.1 - * @version 1.1 - */ - SetGain([in] float gain); - - /** - * @brief 获取音频帧的大小。 - * - * 获取一帧音频数据的长度(字节数)。 - * - * @param size 获取的音频帧大小(字节数)保存到size中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameSize([out] unsigned long size); - - /** - * @brief 获取音频buffer中的音频帧数。 - * - * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameCount([out] unsigned long count); - - /** - * @brief 设置音频采样的属性参数。 - * - * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetSampleAttributes - * - * @since 4.1 - * @version 1.1 - */ - SetSampleAttributes([in] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频采样的属性参数。 - * - * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) - * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetSampleAttributes - * - * @since 4.1 - * @version 1.1 - */ - GetSampleAttributes([out] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频的数据通道ID。 - * - * @param channelId 获取的通道ID保存到channelId中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetCurrentChannelId([out] unsigned int channelId); - - /** - * @brief 设置音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetExtraParams([in] String keyValueList); - - /** - * @brief 获取音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetExtraParams([out] String keyValueList); - - /** - * @brief 请求mmap缓冲区。 - * - * @param reqSize 请求缓冲区的大小。 - * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - ReqMmapBuffer([in] int reqSize, [in] struct AudioMmapBufferDescripter desc); - - /** - * @brief 获取当前mmap的读/写位置。 - * - * @param frames 获取的音频帧计数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 添加音频效果。 - * - * @param effectid 添加的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - AddAudioEffect([in] unsigned long effectid); - - /** - * @brief 移除音频效果。 - * - * @param effectid 移除的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - RemoveAudioEffect([in] unsigned long effectid); - - /** - * @brief 获取缓冲区大小。 - * - * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - GetFrameBufferSize([out] unsigned long bufferSize); - - /** - * @brief 启动一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Stop - * - * @since 4.1 - * @version 1.1 - */ - Start(); - - /** - * @brief 停止一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Start - * - * @since 4.1 - * @version 1.1 - */ - Stop(); - - /** - * @brief 暂停一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Resume - * - * @since 4.1 - * @version 1.1 - */ - Pause(); - - /** - * @brief 恢复一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Pause - * - * @since 4.1 - * @version 1.1 - */ - Resume(); - - /** - * @brief 刷新音频缓冲区buffer中的数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - Flush(); - - /** - * @brief 设置或去设置设备的待机模式。 - * - * @return 设置设备待机模式成功返回值0,失败返回负值;设置取消设备待机模式成功返回正值,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - TurnStandbyMode(); - - /** - * @brief Dump音频设备信息。 - * - * @param range Dump信息范围,分为简要信息、全量信息。 - * @param fd 指定Dump目标文件。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - AudioDevDump([in] int range, [in] int fd); - - /** - * @brief 判断声卡是否支持音频播放的暂停和恢复功能 - * - * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 - * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); - - /** - * @brief 设置低功耗模式缓存长度。 - * - * @param size 包含音频数据的缓存长度。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 4.1 - * @version 1.1 - */ - SetBufferSize([in] unsigned int size); -} -/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl index 9245767e..fd23a46f 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl @@ -1,566 +1,590 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup Audio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @file AudioTypes.idl - * - * @brief Audio模块接口定义中使用的数据类型。 - * - * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 3.2 - * @version 1.0 - */ -package ohos.hdi.audio.v1_0; - -/** - * @brief 音频端口的类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioPortDirection { - PORT_OUT = 1, /**< 音频输出端口。 */ - PORT_IN = 2, /**< 音频输入端口。 */ - PORT_OUT_IN = 3, /**< 音频输出输入端口。 */ -}; - -/** - * @brief 音频端口上的Pin脚。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioPortPin { - PIN_NONE = 0, /**< 无效端口。 */ - PIN_OUT_SPEAKER = 1, /**< 喇叭输出。 */ - PIN_OUT_HEADSET = 2, /**< 有线耳机输出。 */ - PIN_OUT_LINEOUT = 4, /**< Lineout输出。 */ - PIN_OUT_HDMI = 8, /**< HDMI输出。 */ - PIN_IN_MIC = 134217729, /**< 麦克风输入。 */ - PIN_IN_HS_MIC = 134217730, /**< 有线耳机麦克风输入。 */ - PIN_IN_LINEIN = 134217732, /**< Linein输入。 */ - PIN_IN_USB_EXT = 134217736, /**< USB外部声卡输出。 */ -}; - -/** - * @brief 音频类型(场景)。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioCategory { - AUDIO_IN_MEDIA = 0, /**< 媒体。 */ - AUDIO_IN_COMMUNICATION = 1, /**< 通信。 */ - AUDIO_IN_RINGTONE = 2, /**< 电话铃声。 */ - AUDIO_IN_CALL = 3, /**< 呼叫。 */ -}; - -/** - * @brief 音频格式。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioFormat { - AUDIO_FORMAT_PCM_8_BIT = 1, /**< 8bit位宽PCM(Pulse Code Modulation)格式。 */ - AUDIO_FORMAT_PCM_16_BIT = 2, /**< 16bit位宽PCM格式。 */ - AUDIO_FORMAT_PCM_24_BIT = 3, /**< 24bit位宽PCM格式。 */ - AUDIO_FORMAT_PCM_32_BIT = 4, /**< 32bit位宽PCM格式。 */ - AUDIO_FORMAT_AAC_MAIN = 16777217, /**< AAC(Advanced Audio Coding) MAIN格式。 */ - AUDIO_FORMAT_AAC_LC = 16777218, /**< AAC LC格式。 */ - AUDIO_FORMAT_AAC_LD = 16777219, /**< AAC LD格式。 */ - AUDIO_FORMAT_AAC_ELD = 16777220, /**< AAC ELD格式。 */ - AUDIO_FORMAT_AAC_HE_V1 = 16777221, /**< AAC HE_V1格式。 */ - AUDIO_FORMAT_AAC_HE_V2 = 16777222, /**< AAC HE_V2格式。 */ - AUDIO_FORMAT_G711A = 33554433, /**< PCM G711A格式。 */ - AUDIO_FORMAT_G711U = 33554434, /**< PCM G711u格式。 */ - AUDIO_FORMAT_G726 = 33554435, /**< PCM G726格式。 */ -}; - -/** - *@brief 音频通道掩码。 - * - * 定义音频声道的位置掩码。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioChannelMask { - AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。 */ - AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< 声道布局前右。 */ - AUDIO_CHANNEL_MONO = 1, /**< 单声道。 */ - AUDIO_CHANNEL_STEREO = 3, /**< 立体声,由左右声道组成。 */ -}; - -/** - * @brief 音频采样频率掩码。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioSampleRatesMask { - AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96K 采样频率。 */ - AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< 无效的采样频率。 */ -}; - -/** - * @brief 音频端口的数据透传模式。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioPortPassthroughMode { - PORT_PASSTHROUGH_LPCM = 1, /**< 立体声PCM。 */ - PORT_PASSTHROUGH_RAW = 2, /**< HDMI透传。 */ - PORT_PASSTHROUGH_HBR2LBR = 4, /**< 蓝光次世代音频降规格输出。 */ - PORT_PASSTHROUGH_AUTO = 8, /**< 根据HDMI EDID能力自动匹配。 */ -}; - -/** - * @brief 音频设备类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioDeviceType { - AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。 */ - AUDIO_HEADPHONE = 1 << 1, /**< 耳机。 */ - AUDIO_HEADSET = 1 << 2, /**< 头戴式耳机。 */ - AUDIO_USB_HEADSET = 1 << 3, /**< USB头戴式耳机。 */ - AUDIO_USB_HEADPHONE = 1 << 4, /**< USB耳机。 */ - AUDIO_USBA_HEADSET = 1 << 5, /**< USB模拟头戴式耳机。 */ - AUDIO_USBA_HEADPHONE = 1 << 6, /**< USB模拟耳机。 */ - AUDIO_PRIMARY_DEVICE = 1 << 7, /**< 主音频设备。 */ - AUDIO_USB_DEVICE = 1 << 8, /**< USB音频设备。 */ - AUDIO_A2DP_DEVICE = 1 << 9, /**< 蓝牙音频设备。 */ - AUDIO_DEVICE_UNKOWN, /**< 未知设备。 */ -}; - -/** - * @brief 音频事件类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioEventType { - AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。 */ - AUDIO_DEVICE_REMOVE = 2, /**< 音频设备移除。 */ - AUDIO_LOAD_SUCCESS = 3, /**< 声卡加载成功。 */ - AUDIO_LOAD_FAILURE = 4, /**< 声卡加载失败。 */ - AUDIO_UNLOAD = 5, /**< 声卡卸载。 */ - AUDIO_SERVICE_VALID = 7, /**< 音频服务可用。 */ - AUDIO_SERVICE_INVALID = 8, /**< 音频服务不可用。 */ - AUDIO_CAPTURE_THRESHOLD = 9, /**< 录音阈值上报。 */ - AUDIO_EVENT_UNKOWN = 10, /**< 未知事件。 */ -}; - -/** - * @brief 音频扩展参数键类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioExtParamKey { - AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。 */ - AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< 分布式音频-音量事件。 */ - AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< 分布式音频-焦点事件。 */ - AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< 分布式音频-媒体按钮事件。 */ - AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< 分布式音频-音频效果事件。 */ - AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< 分布式音频-设备状态事件。 */ - AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< 低电量事件。 */ -}; - -/** - * @brief 音频设备状态。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioDeviceStatus { - unsigned int pnpStatus; /**< PnP设备状态,详情参考{@link AudioDeviceType},{@link AudioEventType}。 */ -}; - -/** - * @brief 原始音频样本格式。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioSampleFormat { - /* 8 bits */ - AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。 **/ - /* 16 bits */ - AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。 **/ - /* 24 bits */ - AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。 **/ - /* 32 bits */ - AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。 **/ - /* 64 bits */ - AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。 **/ - AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。 **/ - /* float double */ - AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 64bit位宽浮点型非交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。 **/ - AUDIO_SAMPLE_FORMAT_F64P = 23, /**< 64bit位宽双精度浮点型非交织样本。 **/ -}; - -/** - * @brief 音频播放的通道模式。 - * - * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioChannelMode { - AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。 */ - AUDIO_CHANNEL_BOTH_LEFT, /**< 两个声道全部为左声道声音。 */ - AUDIO_CHANNEL_BOTH_RIGHT, /**< 两个声道全部为右声道声音。 */ - AUDIO_CHANNEL_EXCHANGE, /**< 左右声道数据互换,左声道为右声道声音,右声道为左声道声音。 */ - AUDIO_CHANNEL_MIX, /**< 左右两个声道输出为左右声道相加(混音)。 */ - AUDIO_CHANNEL_LEFT_MUTE, /**< 左声道静音,右声道播放原右声道声音。 */ - AUDIO_CHANNEL_RIGHT_MUTE, /**< 右声道静音,左声道播放原左声道声音。 */ - AUDIO_CHANNEL_BOTH_MUTE, /**< 左右声道均静音。 */ -}; - -/** - * @brief 音频数据结束类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioDrainNotifyType { - AUDIO_DRAIN_NORMAL_MODE, /**< 曲目的所有数据播放完就结束。 */ - AUDIO_DRAIN_EARLY_MODE, /**< 曲目的所有数据未播放完就结束,以便给音频服务做连续性曲目切换留出时间。 */ -}; - -/** - * @brief 回调函数通知事件类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioCallbackType { - AUDIO_NONBLOCK_WRITE_COMPELETED, /**< 非阻塞式写完成。 */ - AUDIO_DRAIN_COMPELETED, /**< DrainBuffer完成,详情参考{@link DrainBuffer}。 */ - AUDIO_FLUSH_COMPLETED, /**< Flush完成,详情参考{@link Flush}。 */ - AUDIO_RENDER_FULL, /**< 录音缓冲区已满。 */ - AUDIO_ERROR_OCCUR, /**< 发生了错误。 */ -}; - -/** - * @brief 音频端口角色。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioPortRole { - AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。 */ - AUDIO_PORT_SOURCE_ROLE = 1, /**< 指定端口为发送端角色。 */ - AUDIO_PORT_SINK_ROLE = 2, /**< 指定端口为接受端角色。 */ -}; - -/** - * @brief 音频端口类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioPortType { - AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。 */ - AUDIO_PORT_DEVICE_TYPE = 1, /**< 指定端口为设备类型。 */ - AUDIO_PORT_MIX_TYPE = 2, /**< 指定端口为复合类型。 */ - AUDIO_PORT_SESSION_TYPE = 3, /**< 指定端口为会话类型。 */ -}; - -/** - * @brief 端口会话类型。 - * - * @since 3.2 - * @version 1.0 - */ -enum AudioSessionType { - AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。 */ - AUDIO_OUTPUT_MIX_SESSION, /**< 会话绑定到特定音轨。 */ - AUDIO_ALLOCATE_SESSION, /**< 会话ID需重新申请。 */ - AUDIO_INVALID_SESSION, /**< 无效会话类型。 */ -}; - -/** - * @brief 音频场景描述。 - * - * @since 3.2 - * @version 1.0 - */ -union SceneDesc { - unsigned int id; /**< 音频场景的ID,详情参考{@link AudioCategory}。 */ -}; - -/** - * @brief 音频端口。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioPort { - enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。 */ - unsigned int portId; /**< 音频端口的ID。 */ - String portName; /**< 音频端口的名称。 */ -}; - -/** - * @brief 音频适配器描述符。 - * - * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, - * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioAdapterDescriptor { - String adapterName; /**< 音频适配器的名称。 */ - struct AudioPort[] ports; /**< 一个音频适配器支持的端口列表,详情参考{@link AudioPort}。 */ -}; - -/** - * @brief 音频设备描述符。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioDeviceDescriptor { - unsigned int portId; /**< 音频端口ID。 */ - enum AudioPortPin pins; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ - String desc; /**< 以字符串命名的音频设备。 */ -}; - -/** - * @brief 音频场景描述符。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioSceneDescriptor { - union SceneDesc scene; /**< 音频场景描述,详情参考{@link SceneDesc}。 */ - struct AudioDeviceDescriptor desc; /**< 音频设备描述符,详情参考{@link AudioDeviceDescriptor}。 */ -}; - -/** - * @brief 音频采样属性。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioSampleAttributes { - enum AudioCategory type; /**< 音频类型,详情参考{@link AudioCategory}。 */ - boolean interleaved; /**< 音频数据交织的标记。 */ - enum AudioFormat format; /**< 音频数据格式,详情参考{@link AudioFormat}。 */ - unsigned int sampleRate; /**< 音频采样频率。 */ - unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。 */ - unsigned int period; /**< 音频采样周期,单位赫兹。 */ - unsigned int frameSize; /**< 音频数据的帧大小。 */ - boolean isBigEndian; /**< 音频数据的大端标志。 */ - boolean isSignedData; /**< 音频数据有符号或无符号标志。 */ - unsigned int startThreshold; /**< 音频播放起始阈值。 */ - unsigned int stopThreshold; /**< 音频播放停止阈值。 */ - unsigned int silenceThreshold; /**< 录音缓冲区阈值。 */ - int streamId; /**< 录音或播放的标识符。 */ -}; - -/** - * @brief 音频时间戳。 - * - * 时间定义,POSIX timespec的替代品。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioTimeStamp { - long tvSec; /**< tvSec时间,单位:秒。 */ - long tvNSec; /**< tvNSec时间,单位:纳秒。 */ -}; - -/** - * @brief 音频子端口的支持能力。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioSubPortCapability { - unsigned int portId; /**< 子端口ID。 */ - String desc; /**< 以字符串命名的子端口。 */ - enum AudioPortPassthroughMode mask; /**< 数据透传模式,详情参考{@link AudioPortPassthroughMode}。 */ -}; - -/** - * @brief 音频端口的支持能力。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioPortCapability { - unsigned int deviceType; /**< 设备输出、输入类型。 */ - unsigned int deviceId; /**< 设备ID,唯一的设备识别符。 */ - boolean hardwareMode; /**< 是否支持设备绑定处理。 */ - unsigned int formatNum; /**< 支持的音频格式数目。 */ - enum AudioFormat[] formats; /**< 支持的音频格式,详情参考{@link AudioFormat}。 */ - unsigned int sampleRateMasks; /**< 支持的音频采样频率(8k、16k、32k、48k)。 */ - enum AudioChannelMask channelMasks; /**< 设备的声道布局掩码,详情参考{@link AudioChannelMask}。 */ - unsigned int channelCount; /**< 最大支持的声道总数。 */ - struct AudioSubPortCapability[] subPorts; /**< 支持的子端口列表,详情参考{@link AudioSubPortCapability}。 */ - enum AudioSampleFormat[] supportSampleFormats; /**< 支持的采样率列表,详情参考{@link AudioSampleFormat}。 */ -}; - -/** - * @brief mmap缓冲区描述符。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioMmapBufferDescripter { - byte[] memoryAddress; /**< 指向mmap缓冲区的指针。 */ - int memoryFd; /**< mmap缓冲区的文件描述符。 */ - int totalBufferFrames; /**< 缓冲区总大小,单位:帧。 */ - int transferFrameSize; /**< 传输大小,单位:帧。 */ - int isShareable; /**< mmap缓冲区是否可以在进程间共享。 */ - unsigned int offset; /**< 文件偏移。 */ - String filePath; /**< mmap文件路径。 */ -}; - -/** - * @brief 音频设备拓展信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioDevExtInfo { - unsigned int moduleId; /**< 音频流绑定的模块ID。 */ - enum AudioPortPin type; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ - String desc; /**< 地址描述。 */ -}; - -/** - * @brief 音轨拓展信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioMixExtInfo { - unsigned int moduleId; /**< 流所属模块标识符。 */ - unsigned int streamId; /**< 由调用者传递的Render或Capture标识符。 */ -}; - -/** - * @brief 会话拓展信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioSessionExtInfo { - enum AudioSessionType sessionType; /**< 音频会话类型,详情参考{@link AudioSessionType}。 */ -}; - -/** - * @brief 音频端口特定信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioInfo { - struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。 */ - struct AudioMixExtInfo mix; /**< 音轨特定信息,详情参考{@link AudioMixExtInfo}。 */ - struct AudioSessionExtInfo session; /**< 会话特定信息,详情参考{@link AudioSessionExtInfo}。 */ -}; - -/** - * @brief 音频路由节点。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioRouteNode { - int portId; /**< 音频端口ID。 */ - enum AudioPortRole role; /**< 指定端口角色为发送端或接收端,详情参考{@link AudioPortRole}。 */ - enum AudioPortType type; /**< 指定端口类型可以为设备类型、复合类型、绘画类型,详情参考{@link AudioPortType}。 */ - struct AudioInfo ext; /**< 音频端口特定信息,详情参考{@link AudioInfo}。 */ -}; - -/** - * @brief 音频路由信息。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioRoute { - struct AudioRouteNode[] sources; /**< 发送端列表,详情参考{@link AudioRouteNode}。 */ - struct AudioRouteNode[] sinks; /**< 接受端列表,详情参考{@link AudioRouteNode}。 */ -}; - -/** - * @brief 音频事件。 - * - * @since 3.2 - * @version 1.0 - */ -struct AudioEvent { - unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。 */ - unsigned int deviceType; /**< 设备类型,详情参考{@link enum AudioDeviceType}。 */ -}; -/** @} */ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file AudioTypes.idl + * + * @brief Audio模块接口定义中使用的数据类型。 + * + * Audio模块接口定义中使用的数据类型,包括音频端口、适配器描述符、设备描述符、场景描述符、采样属性、时间戳等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ +package ohos.hdi.audio.v1_1; + +/** + * @brief 音频端口的类型。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioPortDirection { + PORT_OUT = 1, /**< 音频输出端口。*/ + PORT_IN = 2, /**< 音频输入端口。 */ + PORT_OUT_IN = 3, /**< 音频输出输入端口。 */ +}; + +/** + * @brief 音频端口上的Pin脚。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioPortPin { + PIN_NONE = 0, /**< 无效端口。*/ + PIN_OUT_SPEAKER = 1 << 0, /**< 喇叭输出。 */ + PIN_OUT_HEADSET = 1 << 1, /**< 有线耳机输出。 */ + PIN_OUT_LINEOUT = 1 << 2, /**< Lineout输出。 */ + PIN_OUT_HDMI = 1 << 3, /**< HDMI输出。 */ + PIN_OUT_USB = 1 << 4, /**< USB输出。*/ + PIN_OUT_USB_EXT = 1 << 5, /**< USB外部声卡输出。*/ + PIN_OUT_EARPIECE = 1 << 5 | 1 << 4, /**< 有线耳机输出。 */ + PIN_OUT_BLUETOOTH_SCO = 1 << 6, /**< 蓝牙SCO输出 */ + PIN_OUT_DAUDIO_DEFAULT = 1 << 7, /**< 音频默认输出 */ + PIN_OUT_HEADPHONE = 1 << 8, /**< 有线耳机输出。*/ + PIN_OUT_USB_HEADSET = 1 << 9, /**< ARM USB输出 */ + PIN_IN_MIC = 1 << 27 | 1 << 0, /**< 麦克风输入 */ + PIN_IN_HS_MIC = 1 << 27 | 1 << 1, /**< 耳机麦克风输入 */ + PIN_IN_LINEIN = 1 << 27 | 1 << 2, /**< Linein输入。 */ + PIN_IN_USB_EXT = 1 << 27 | 1 << 3, /**< USB外部声卡输入。*/ + PIN_IN_BLUETOOTH_SCO_HEADSET = 1 << 27 | 1 << 4, /**< 蓝牙SCO耳机输入 */ + PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5, /**< 音频默认输入 */ + PIN_IN_USB_HEADSET = 1 << 27 | 1 << 6, /**< ARM USB输入 */ +}; + +/** + * @brief 音频类型(场景)。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioCategory { + AUDIO_IN_MEDIA = 0, /**< 媒体。 */ + AUDIO_IN_COMMUNICATION = 1, /**< 通信。 */ + AUDIO_IN_RINGTONE = 2, /**< 电话铃声。 */ + AUDIO_IN_CALL = 3, /**< 呼叫。 */ + AUDIO_MMAP_NOIRQ = 4, /**< Mmap模式 */ + AUDIO_OFFLOAD = 5, /**< 低功耗 */ +}; + +/** + * @brief 音频格式。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioFormat { + AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8bit位宽PCM(Pulse Code Modulation)格式。*/ + AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16bit位宽PCM格式。 */ + AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24bit位宽PCM格式。 */ + AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32bit位宽PCM格式。*/ + AUDIO_FORMAT_TYPE_PCM_FLOAT = 1 << 2 | 1 << 0, /**< PCM浮点格式 */ + AUDIO_FORMAT_TYPE_MP3 = 1 << 24, /**< MP3格式 */ + AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main格式 */ + AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC格式 */ + AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD格式 */ + AUDIO_FORMAT_TYPE_AAC_ELD = 1 << 24 | 1 << 2, /**< AAC ELD格式 */ + AUDIO_FORMAT_TYPE_AAC_HE_V1 = 1 << 24 | 1 << 2 | 1 << 0, /**< AAC HE_V1格式 */ + AUDIO_FORMAT_TYPE_AAC_HE_V2 = 1 << 24 | 1 << 2 | 1 << 1, /**< AAC HE_V2格式 */ + AUDIO_FORMAT_TYPE_G711A = 1 << 25 | 1 << 0, /**< PCM G711A格式 */ + AUDIO_FORMAT_TYPE_G711U = 1 << 25 | 1 << 1, /**< PCM G711u格式 */ + AUDIO_FORMAT_TYPE_G726 = 1 << 25 | 1 << 1 | 1 << 0, /**< PCM G726格式 */ +}; + +/** + *@brief 音频通道掩码。 + * + * 定义音频声道的位置掩码。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioChannelMask { + AUDIO_CHANNEL_FRONT_LEFT = 1, /**< 声道布局前左。 */ + AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< 声道布局前右。*/ + AUDIO_CHANNEL_MONO = 1, /**< 单声道。 */ + AUDIO_CHANNEL_STEREO = 3, /**< 立体声,由左右声道组成。 */ +}; + +/** + * @brief 音频采样频率掩码。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioSampleRatesMask { + AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96K 采样频率。 */ + AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< 无效的采样频率。 */ +}; + +/** + * @brief 音频端口的数据透传模式。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioPortPassthroughMode { + PORT_PASSTHROUGH_LPCM = 1 << 0, /**< 立体声PCM。*/ + PORT_PASSTHROUGH_RAW = 1 << 1, /**< HDMI透传。 */ + PORT_PASSTHROUGH_HBR2LBR = 1 << 2, /**< 蓝光次世代音频降规格输出。 */ + PORT_PASSTHROUGH_AUTO = 1 << 3, /**< 根据HDMI EDID能力自动匹配。 */ +}; + +/** + * @brief 原始音频样本格式。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioSampleFormat { + AUDIO_SAMPLE_FORMAT_S8 = 0, /**< 8bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S8P = 1, /**< 8bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U8 = 2, /**< 8bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U8P = 3, /**< 8bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S16 = 4, /**< 16bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S16P = 5, /**< 16bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U16 = 6, /**< 16bit位宽无符号符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U16P = 7, /**< 16bit位宽无符号符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S24 = 8, /**< 24bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S24P = 9, /**< 24bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U24 = 10, /**< 24bit位宽无符号符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U24P = 11, /**< 24bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S32 = 12, /**< 32bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S32P = 13, /**< 32bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U32 = 14, /**< 32bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U32P = 15, /**< 32bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S64 = 16, /**< 64bit位宽有符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_S64P = 17, /**< 64bit位宽有符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U64 = 18, /**< 64bit位宽无符号交织样本。 **/ + AUDIO_SAMPLE_FORMAT_U64P = 19, /**< 64bit位宽无符号非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F32 = 20, /**< 32bit位宽浮点型交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F32P = 21, /**< 32bit位宽浮点型非交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F64 = 22, /**< 64bit位宽双精度浮点型交织样本。 **/ + AUDIO_SAMPLE_FORMAT_F64P = 23, /**< 64bit位宽双精度浮点型非交织样本。 **/ +}; + +/** + * @brief 音频播放的通道模式。 + * + * @attention 下面的模式是针对双通道立体声的音频播放而设置,其他不支持。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioChannelMode { + AUDIO_CHANNEL_NORMAL = 0, /**< 正常模式,不做处理。 */ + AUDIO_CHANNEL_BOTH_LEFT = 1, /**< 两个声道全部为左声道声音。 */ + AUDIO_CHANNEL_BOTH_RIGHT = 2, /**< 两个声道全部为右声道声音。 */ + AUDIO_CHANNEL_EXCHANGE = 3, /**< 左右声道数据互换,左声道为右声道声音,右声道为左声道声音。*/ + AUDIO_CHANNEL_MIX = 4, /**< 左右两个声道输出为左右声道相加(混音)。 */ + AUDIO_CHANNEL_LEFT_MUTE = 5, /**< 左声道静音,右声道播放原右声道声音。 */ + AUDIO_CHANNEL_RIGHT_MUTE = 6, /**< 右声道静音,左声道播放原左声道声音。 */ + AUDIO_CHANNEL_BOTH_MUTE = 7, /**< 左右声道均静音。*/ +}; + +/** + * @brief 音频数据结束类型。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioDrainNotifyType { + AUDIO_DRAIN_NORMAL_MODE = 0, /**< 曲目的所有数据播放完就结束。 */ + AUDIO_DRAIN_EARLY_MODE = 1, /**< 曲目的所有数据未播放完就结束,以便给音频服务做连续性曲目切换留出时间。 */ +}; + +/** + * @brief 回调函数通知事件类型。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioCallbackType { + AUDIO_NONBLOCK_WRITE_COMPELETED = 0, /**< 非阻塞式写完成。 */ + AUDIO_DRAIN_COMPELETED = 1, /**< DrainBuffer完成,详情参考{@link DrainBuffer}。 */ + AUDIO_FLUSH_COMPLETED = 2, /**< Flush完成,详情参考{@link Flush}。 */ + AUDIO_RENDER_FULL = 3, /**< 录音缓冲区已满。 */ + AUDIO_ERROR_OCCUR = 4, /**< 发生了错误。 */ +}; + +/** + * @brief 音频端口角色。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioPortRole { + AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< 未指定端口角色。 */ + AUDIO_PORT_SOURCE_ROLE = 1, /**< 指定端口为发送端角色。 */ + AUDIO_PORT_SINK_ROLE = 2, /**< 指定端口为接受端角色。 */ +}; + +/** + * @brief 音频端口类型。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioPortType { + AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< 未指定端口类型。 */ + AUDIO_PORT_DEVICE_TYPE = 1, /**< 指定端口为设备类型。 */ + AUDIO_PORT_MIX_TYPE = 2, /**< 指定端口为复合类型。 */ + AUDIO_PORT_SESSION_TYPE = 3, /**< 指定端口为会话类型。 */ +}; + +/** + * @brief 端口会话类型。 + * + * @since 4.0 + * @version 1.0 + */ +enum AudioSessionType { + AUDIO_OUTPUT_STAGE_SESSION = 0, /**< 会话绑定到指定输出流。 */ + AUDIO_OUTPUT_MIX_SESSION = 1, /**< 会话绑定到特定音轨。 */ + AUDIO_ALLOCATE_SESSION = 2, /**< 会话ID需重新申请。 */ + AUDIO_INVALID_SESSION = 3, /**< 无效会话类型。 */ +}; + +/** + * @brief 音频设备类型。 + */ +enum AudioDeviceType { + AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。 */ + AUDIO_HEADPHONE = 1 << 1, /**< 耳机。 */ + AUDIO_HEADSET = 1 << 2, /**< 头戴式耳机。 */ + AUDIO_USB_HEADSET = 1 << 3, /**< USB头戴式耳机。 */ + AUDIO_USB_HEADPHONE = 1 << 4, /**< USB耳机。 */ + AUDIO_USBA_HEADSET = 1 << 5, /**< USB模拟头戴式耳机。 */ + AUDIO_USBA_HEADPHONE = 1 << 6, /**< USB模拟耳机。 */ + AUDIO_PRIMARY_DEVICE = 1 << 7, /**< 主音频设备。 */ + AUDIO_USB_DEVICE = 1 << 8, /**< USB音频设备。 */ + AUDIO_A2DP_DEVICE = 1 << 9, /**< 蓝牙音频设备。 */ + AUDIO_HDMI_DEVICE = 1 << 10, /**< HDMI音频设备 */ + AUDIO_ADAPTER_DEVICE = 1 << 11, /**< 声卡设备 */ + AUDIO_DEVICE_UNKNOWN, /**< 未知设备。 */ +}; + +/** + * @brief 音频事件类型。 + */ +enum AudioEventType { + AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。 */ + AUDIO_DEVICE_REMOVE = 2, /**< 音频设备移除。 */ + AUDIO_LOAD_SUCCESS = 3, /**< 声卡加载成功。 */ + AUDIO_LOAD_FAILURE = 4, /**< 声卡加载失败。 */ + AUDIO_UNLOAD = 5, /**< 声卡卸载。 */ + AUDIO_SERVICE_VALID = 7, /**< 音频服务可用。 */ + AUDIO_SERVICE_INVALID = 8, /**< 音频服务不可用。 */ + AUDIO_CAPTURE_THRESHOLD = 9, /**< 录音阈值上报。 */ + AUDIO_EVENT_UNKNOWN = 10, /**< 未知事件。 */ +}; + +/** + * @brief 音频扩展参数键类型。 + */ +enum AudioExtParamKey { + AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。 */ + AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< 分布式音频-音量事件。 */ + AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< 分布式音频-焦点事件。 */ + AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< 分布式音频-媒体按钮事件。 */ + AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< 分布式音频-音频效果事件。 */ + AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< 分布式音频-设备状态事件。 */ + AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< USB设备类型( ARM 或 HIFI)*/ + AUDIO_EXT_PARAM_KEY_PERF_INFO = 201, /**< 分布式音频-dsp加载事件。 */ + AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< 低电量事件。 */ +}; + +/** + * @brief 音频设备状态。 + */ +struct AudioDeviceStatus { + unsigned int pnpStatus; /**< PnP设备状态,详情参考{@link AudioDeviceType},{@link AudioEventType}。 */ +}; + +/** + * @brief 音频场景描述。 + */ +union SceneDesc { + unsigned int id; /**< 音频场景的ID,详情参考{@link AudioCategory}。*/ +}; + +/** + * @brief 音频端口。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioPort { + enum AudioPortDirection dir; /**< 音频端口的类型,详情参考{@link AudioPortDirection}。 */ + unsigned int portId; /**< 音频端口的ID。 */ + String portName; /**< 音频端口的名称。 */ +}; + +/** + * @brief 音频适配器描述符。 + * + * 一个音频适配器(adapter)是一个声卡的端口驱动集合,包含输出端口、输入端口, + * 其中一个端口对应着多个PIN脚,一个Pin脚对应着一个实体的器件(例如喇叭、有线耳机)。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioAdapterDescriptor { + String adapterName; /**< 音频适配器的名称。 */ + struct AudioPort[] ports; /**< 一个音频适配器支持的端口列表,详情参考{@link AudioPort}。 */ +}; + +/** + * @brief 音频设备描述符。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioDeviceDescriptor { + unsigned int portId; /**< 音频端口ID。 */ + enum AudioPortPin pins; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ + String desc; /**< 以字符串命名的音频设备。 */ +}; + +/** + * @brief 音频场景描述符。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioSceneDescriptor { + union SceneDesc scene; /**< 音频场景描述,详情参考{@link SceneDesc}。 */ + struct AudioDeviceDescriptor desc; /**< 音频设备描述符,详情参考{@link AudioDeviceDescriptor}。 */ +}; + +/** + * @brief 音频输入类型. + */ +enum AudioInputType { + AUDIO_INPUT_DEFAULT_TYPE = 0, /**< 默认输入 */ + AUDIO_INPUT_MIC_TYPE = 1 << 0, /**< 麦克风输入 */ + AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, /**< 语音唤醒输入 */ + AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, /**< 通话 */ + AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< 声音识别 */ +}; + +/** + * @brief 音频低功耗属性 + */ +struct AudioOffloadInfo +{ + unsigned int sampleRate; /**< 采样率 */ + unsigned int channelCount; /**< 声道数 */ + unsigned int bitRate; /**< 比特率 */ + unsigned int bitWidth; /**< 比特位宽 */ + enum AudioFormat format; /**< 音频格式 */ + unsigned int offloadBufferSize; /**< 音频数据缓存长度 */ + unsigned long duration; /** 音频持续时间,单位纳秒*/ +}; + +/** + * @brief 音频采样属性。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioSampleAttributes { + enum AudioCategory type; /**< 音频类型,详情参考{@link AudioCategory}。 */ + boolean interleaved; /**< 音频数据交织的标记。 */ + enum AudioFormat format; /**< 音频数据格式,详情参考{@link AudioFormat}。 */ + unsigned int sampleRate; /**< 音频采样频率。 */ + unsigned int channelCount; /**< 音频通道数目,如单通道为1、立体声为2。*/ + unsigned int period; /**< 音频采样周期,单位赫兹。 */ + unsigned int frameSize; /**< 音频数据的帧大小。 */ + boolean isBigEndian; /**< 音频数据的大端标志。 */ + boolean isSignedData; /**< 音频数据有符号或无符号标志。 */ + unsigned int startThreshold; /**< 音频播放起始阈值。 */ + unsigned int stopThreshold; /**< 音频播放停止阈值。 */ + unsigned int silenceThreshold; /**< 录音缓冲区阈值。 */ + int streamId; /**< 录音或播放的标识符。 */ + int sourceType; /**< 播放或录音的音源类型 */ + struct AudioOffloadInfo offloadInfo; /**< offload流信息 */ +}; + +/** + * @brief 音频时间戳。 + * + * 时间定义,POSIX timespec的替代品。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioTimeStamp { + long tvSec; /**< tvSec时间,单位:秒。 */ + long tvNSec; /**< tvNSec时间,单位:纳秒。 */ +}; + +/** + * @brief 音频子端口的支持能力。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioSubPortCapability { + unsigned int portId; /**< 子端口ID。 */ + String desc; /**< 以字符串命名的子端口。 */ + enum AudioPortPassthroughMode mask; /**< 数据透传模式,详情参考{@link AudioPortPassthroughMode}。 */ +}; + +/** + * @brief 音频端口的支持能力。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioPortCapability { + unsigned int deviceType; /**< 设备输出、输入类型。 */ + unsigned int deviceId; /**< 设备ID,唯一的设备识别符。 */ + boolean hardwareMode; /**< 是否支持设备绑定处理。 */ + unsigned int formatNum; /**< 支持的音频格式数目。 */ + enum AudioFormat[] formats; /**< 支持的音频格式,详情参考{@link AudioFormat}。 */ + unsigned int sampleRateMasks; /**< 支持的音频采样频率(8k、16k、32k、48k)。 */ + enum AudioChannelMask channelMasks; /**< 设备的声道布局掩码,详情参考{@link AudioChannelMask}。 */ + unsigned int channelCount; /**< 最大支持的声道总数。 */ + struct AudioSubPortCapability[] subPorts; /**< 支持的子端口列表,详情参考{@link AudioSubPortCapability}。 */ + enum AudioSampleFormat[] supportSampleFormats; /**< 支持的采样率列表,详情参考{@link AudioSampleFormat}。 */ +}; + +/** + * @brief mmap缓冲区描述符。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioMmapBufferDescripter { + byte[] memoryAddress; /**< 指向mmap缓冲区的指针。 */ + FileDescriptor memoryFd; /**< mmap缓冲区的文件描述符。 */ + int totalBufferFrames; /**< 缓冲区总大小,单位:帧。 */ + int transferFrameSize; /**< 传输大小,单位:帧。 */ + int isShareable; /**< mmap缓冲区是否可以在进程间共享。 */ + unsigned int offset; /**< 文件偏移。 */ + String filePath; /**< mmap文件路径。 */ +}; + +/** + * @brief 音频设备拓展信息。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioDevExtInfo { + int moduleId; /**< 音频流绑定的模块ID。 */ + enum AudioPortPin type; /**< 音频端口上的Pin脚(输出、输入),详情参考{@link AudioPortPin}。 */ + String desc; /**< 地址描述。 */ +}; + +/** + * @brief 音轨拓展信息。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioMixExtInfo { + int moduleId; /**< 流所属模块标识符。 */ + int streamId; /**< 由调用者传递的Render或Capture标识符。 */ +}; + +/** + * @brief 会话拓展信息。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioSessionExtInfo { + enum AudioSessionType sessionType; /**< 音频会话类型,详情参考{@link AudioSessionType}。 */ +}; + +/** + * @brief 音频端口特定信息。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioInfo { + struct AudioDevExtInfo device; /**< 设备特定信息,详情参考{@link AudioDevExtInfo}。 */ + struct AudioMixExtInfo mix; /**< 音轨特定信息,详情参考{@link AudioMixExtInfo}。 */ + struct AudioSessionExtInfo session; /**< 会话特定信息,详情参考{@link AudioSessionExtInfo}。 */ +}; + +/** + * @brief 音频路由节点。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioRouteNode { + int portId; /**< 音频端口ID。 */ + enum AudioPortRole role; /**< 指定端口角色为发送端或接收端,详情参考{@link AudioPortRole}。 */ + enum AudioPortType type; /**< 指定端口类型可以为设备类型、复合类型、绘画类型,详情参考{@link AudioPortType}。 */ + struct AudioInfo ext; /**< 音频端口特定信息,详情参考{@link AudioInfo}。 */ +}; + +/** + * @brief 音频路由信息。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioRoute { + struct AudioRouteNode[] sources; /**< 发送端列表,详情参考{@link AudioRouteNode}。 */ + struct AudioRouteNode[] sinks; /**< 接受端列表,详情参考{@link AudioRouteNode}。 */ +}; + +/** + * @brief 音频事件。 + * + * @since 4.0 + * @version 1.0 + */ +struct AudioEvent { + unsigned int eventType; /**< 事件类型,详情参考{@link enum AudioEventType}。 */ + unsigned int deviceType; /**< 设备类型,详情参考{@link enum AudioDeviceType}。 */ +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl index 494451c5..6a6f1c88 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,14 +14,14 @@ */ /** - * @addtogroup Audio + * @addtogroup HdiAudio * @{ * * @brief Audio模块接口定义。 * * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ @@ -30,43 +30,45 @@ * * @brief Audio适配器的接口定义文件。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ /** * @brief 音频接口的包路径。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ -package ohos.hdi.audio.v1_0; +package ohos.hdi.audio.v1_1; -import ohos.hdi.audio.v1_0.AudioTypes; -import ohos.hdi.audio.v1_0.IAudioRender; -import ohos.hdi.audio.v1_0.IAudioCapture; +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioRender; +import ohos.hdi.audio.v1_1.IAudioCapture; +import ohos.hdi.audio.v1_1.IAudioCallback; /** * @brief AudioAdapter音频适配器接口。 * * 提供音频适配器(声卡)对外支持的驱动能力,包括初始化端口、创建放音、创建录音、获取端口能力集等。 * - * @see AudioRender - * @see AudioCapture + * @see IAudioRender + * @see IAudioCapture * - * @since 3.2 + * @since 4.0 * @version 1.0 */ interface IAudioAdapter { /** * @brief 初始化一个音频适配器所有的端口驱动。 - * * 在音频服务中,调用其他驱动接口前需要先调用该接口检查端口是否已经初始化完成,如果端口没有初始化完成, * 则需要等待一段时间(例如100ms)后重新进行检查,直到端口初始化完成后再继续操作。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * * @return 初始化完成返回值0,初始化失败返回负值。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ InitAllPorts(); @@ -74,73 +76,84 @@ interface IAudioAdapter { /** * @brief 创建一个音频播放接口的对象。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 * @param render 获取的音频播放接口的对象实例保存到render中,详请参考{@link IAudioRender}。 + * @param renderId 获取的音频播放接口序号。 * * @return 成功返回值0,失败返回负值。 * * @see GetPortCapability * @see DestroyRender * - * @since 3.2 + * @since 4.0 * @version 1.0 */ - CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, [out] IAudioRender render); + CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioRender render, [out] unsigned int renderId); /** * @brief 销毁一个音频播放接口的对象。 * * @attention 在音频播放过程中,不能销毁该接口对象。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param renderId 待销毁的音频播放接口的序号 + * * @return 成功返回值0,失败返回负值。 - * * @see CreateRender * - * @since 3.2 + * @since 4.0 * @version 1.0 */ - DestroyRender(); + DestroyRender([in] unsigned int renderId); /** * @brief 创建一个音频录音接口的对象。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param desc 待打开的音频设备描述符,详请参考{@link AudioDeviceDescriptor}。 * @param attrs 待打开的音频采样属性,详请参考{@link AudioSampleAttributes}。 * @param capture 获取的音频录音接口的对象实例保存到capture中,详请参考{@link IAudioCapture}。 - * + * @param captureId 获取的音频录音接口的序号 * @return 成功返回值0,失败返回负值。 - * - * @see CreateCapture - * - * @since 3.2 + * + * @see GetPortCapability + * @see DestroyCapture + + * @since 4.0 * @version 1.0 */ - CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, [out] IAudioCapture capture); + CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioCapture capture, [out] unsigned int captureId); /** * @brief 销毁一个音频录音接口的对象。 * * @attention 在音频录音过程中,不能销毁该接口对象。 * - * @return 成功返回值0,失败返回负值。 + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param captureId 待销毁的音频录音接口的序号 * + * @return 成功返回值0,失败返回负值。 * @see CreateCapture * - * @since 3.2 + * @since 4.0 * @version 1.0 */ - DestroyCapture(); + DestroyCapture([in] unsigned int captureId); /** * @brief 获取一个音频适配器的端口驱动的能力集。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param port 待获取的端口,详请参考{@link AudioPort}。 * @param capability 获取的端口能力保存到capability中,详请参考{@link AudioPortCapability}。 * * @return 成功返回值0,失败返回负值。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); @@ -148,14 +161,13 @@ interface IAudioAdapter { /** * @brief 设置音频端口驱动的数据透传模式。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param port 待设置的端口,详请参考{@link AudioPort}。 * @param mode 待设置的传输模式,详请参考{@link AudioPortPassthroughMode}。 - * * @return 成功返回值0,失败返回负值。 - * * @see GetPassthroughMode * - * @since 3.2 + * @since 4.0 * @version 1.0 */ SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); @@ -163,14 +175,13 @@ interface IAudioAdapter { /** * @brief 获取音频端口驱动的数据透传模式。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param port 待获取的端口,详请参考{@link AudioPort}。 * @param mode 获取的传输模式保存到mode中,详请参考{@link AudioPortPassthroughMode}。 - * * @return 成功返回值0,失败返回负值。 - * * @see SetPassthroughMode * - * @since 3.2 + * @since 4.0 * @version 1.0 */ GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); @@ -178,11 +189,12 @@ interface IAudioAdapter { /** * @brief 获取一个音频适配器的设备状态。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param status 获取的设备状态保存到status中,详请参考{@link AudioDeviceStatus}。 * * @return 成功返回值0,失败返回负值。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ GetDeviceStatus([out] struct AudioDeviceStatus status); @@ -190,12 +202,13 @@ interface IAudioAdapter { /** * @brief 更新音频路由。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param route 待更新的路由,详请参考{@link AudioRoute}。 * @param routeHandle 更新后的音频路由句柄保存到routeHandle中。 * * @return 成功返回值0,失败返回负值。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); @@ -203,11 +216,12 @@ interface IAudioAdapter { /** * @brief 释放音频路由。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param routeHandle 待释放的音频路由句柄。 * * @return 成功返回值0,失败返回负值。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ ReleaseAudioRoute([in] int routeHandle); @@ -215,13 +229,14 @@ interface IAudioAdapter { /** * @brief 设置音频静音。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param mute 表示是否将音频静音,true表示静音,false表示非静音。 * * @return 成功返回值0,失败返回负值。 * * @see SetMicMute * - * @since 3.2 + * @since 4.0 * @version 1.0 */ SetMicMute([in] boolean mute); @@ -229,13 +244,14 @@ interface IAudioAdapter { /** * @brief 获取音频静音状态。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param mute 获取的静音状态保存到mute中,true表示静音,false表示非静音。 * * @return 成功返回值0,失败返回负值。 * * @see GetMicMute * - * @since 3.2 + * @since 4.0 * @version 1.0 */ GetMicMute([out] boolean mute); @@ -243,13 +259,15 @@ interface IAudioAdapter { /** * @brief 设置语音呼叫的音量。 * - * @param volume 待设置的音量值,范围为(0.0-1.0),0.0表示最小音量值,1.0表示最大音量值。 + * 音量范围从0.0到1.0。如果音频服务中的音量水平在0到15的范围内, + * 0.0表示音频静音,1.0指示最大音量级别(15)。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param volume 待设置的音量值,范围为(0.0-1.0),0.0表示最小音量值,1.0表示最大音量值。 * @return 成功返回值0,失败返回负值。 + * @see GetVolume * - * @see SetVoiceVolume - * - * @since 3.2 + * @since 4.0 * @version 1.0 */ SetVoiceVolume([in] float volume); @@ -257,26 +275,21 @@ interface IAudioAdapter { /** * @brief 根据指定的条件设置音频拓展参数。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 * @param condition 指定的扩展参数查询条件。 * @param value 指定的扩展参数条件值。 * - *
      - *
    • 1. condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。
    • - *
    • 2. 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为:
    • - *
        - *
      • EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;
      • - *
          - *
        • EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。
        • - *
        • VOLUME_GROUP_ID 表示待设置的音频扩展参数相关的音量组。
        • - *
        • AUDIO_VOLUME_TYPE 表示待设置的音频扩展参数相关的音量类型。
        • - *
        - *
      - *
    - * + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待设置的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待设置的音频扩展参数相关的音量类型。 + * * @return 成功返回值0,失败返回负值。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); @@ -284,26 +297,22 @@ interface IAudioAdapter { /** * @brief 根据指定条件获取音频扩展参数的取值。 * + * @param adapter 调用当前函数的AudioAdapter指针对象。 * @param key 指定的扩展参数键类型,详请参考{@link AudioExtParamKey}。 * @param condition 指定的扩展参数查询条件。 * @param value 待返回的指定扩展参数条件的当前值。 + * @param lenth value的长度 + * + * condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。 + * 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。 + * VOLUME_GROUP_ID 表示待查询的音频扩展参数相关的音量组。 + * AUDIO_VOLUME_TYPE 表示待查询的音频扩展参数相关的音量类型。 * - *
      - *
    • 1. condition为多个键值对组成的字符串,多个键值对之间通过分号分割,键值对的格式为"keytype=keyvalue"。
    • - *
    • 2. 当输入的key值为AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME时,condition的格式必须为:
    • - *
        - *
      • EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;
      • - *
          - *
        • EVENT_TYPE 表示音量事件类型: 其中1表示设置音量, 4表示设置静音。
        • - *
        • VOLUME_GROUP_ID 表示待查询的音频扩展参数相关的音量组。
        • - *
        • AUDIO_VOLUME_TYPE 表示待查询的音频扩展参数相关的音量类型。
        • - *
        - *
      - *
    - * * @return 成功返回值0,失败返回负值。 * - * @since 3.2 + * @since 4.0 * @version 1.0 */ GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); @@ -311,14 +320,14 @@ interface IAudioAdapter { /** * @brief 注册扩展参数回调函数。 * - * @param audioCallback 待注册的回调函数,详请参考{@link IAudioCallback}。 + * @param adapter 调用当前函数的AudioAdapter指针对象。 + * @param callback 待注册的回调函数,详请参考{@link AudioCallback}。 * @param cookie 用于传递数据。 - * * @return 成功返回值0,失败返回负值。 * * @since 3.2 * @version 1.0 - */ + */ RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); } -/** @} */ +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl index 1156becb..176a59f6 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl @@ -1,88 +1,88 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup Audio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @file IAudioCallback.idl - * - * @brief Audio播放的回调函数定义文件。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 3.2 - * @version 1.0 - */ -package ohos.hdi.audio.v1_0; - -import ohos.hdi.audio.v1_0.AudioTypes; - -/** - * @brief Audio回调接口。 - * - * @since 3.2 - * @version 1.0 - */ -[callback] interface IAudioCallback { - - /** - * @brief 放音回调函数。 - * - * @param type 回调函数通知事件类型,详请参考{@link AudioCallbackType}。 - * @param reserved 保留字段。 - * @param cookie 用于传递数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RegCallback - * - * @since 3.2 - * @version 1.0 - */ - RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); - /** - * @brief 音频扩展参数回调函数。 - * - * @param key 扩展参数键类型,详请参考{@link AudioExtParamKey}。 - * @param condition 扩展参数条件。 - * @param value 扩展参数条件的值 - * @param reserved 保留字段。 - * @param cookie 用于传递数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see ParamCallback - * - * @since 3.2 - * @version 1.0 - */ - ParamCallback([in] enum AudioExtParamKey key, [in] byte condition, [in] byte value, [out] byte reserved, [out] byte cookie); -} -/** @} */ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IAudioCallback.idl + * + * @brief Audio播放的回调函数定义文件。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ +package ohos.hdi.audio.v1_1; + +import ohos.hdi.audio.v1_1.AudioTypes; + +/** + * @brief Audio回调接口。 + * + * @since 4.0 + * @version 1.0 + */ +[callback] interface IAudioCallback { + + /** + * @brief 放音回调函数。 + * + * @param type 回调函数通知事件类型,详请参考{@link AudioCallbackType}。 + * @param reserved 保留字段。 + * @param cookie 用于传递数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.0 + * @version 1.0 + */ + RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); + /** + * @brief 音频扩展参数回调函数。 + * + * @param key 扩展参数键类型,详请参考{@link AudioExtParamKey}。 + * @param condition 扩展参数条件。 + * @param value 扩展参数条件的值 + * @param reserved 保留字段。 + * @param cookie 用于传递数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see ParamCallback + * + * @since 4.0 + * @version 1.0 + */ + ParamCallback([in] enum AudioExtParamKey key, [in] byte condition, [in] byte value, [out] byte reserved, [out] byte cookie); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl index 365f6bb7..bd547406 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl @@ -1,479 +1,479 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup Audio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @file IAudioCapture.idl - * - * @brief Audio录音的接口定义文件。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 3.2 - * @version 1.0 - */ -package ohos.hdi.audio.v1_0; - -import ohos.hdi.audio.v1_0.AudioTypes; - -/** - * @brief AudioCapture音频录音接口。 - * - * 提供音频录音支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、录制音频帧数据等。 - * - * @since 3.2 - * @version 1.0 - */ -interface IAudioCapture { - - /** - * @brief 从音频驱动中录制一帧输入数据(录音,音频上行数据)。 - * - * @param frame 待存放输入数据的音频frame。 - * @param requestBytes 待存放输入数据的音频frame大小(字节数)。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - CaptureFrame([out] byte[] frame, [in] unsigned long requestBytes); - - /** - * @brief 获取音频已输入的帧数。 - * - * @param frames 获取的音频帧数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see CaptureFrame - * - * @since 3.2 - * @version 1.0 - */ - GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 判断某个音频场景能力是否支持。 - * - * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SelectScene - * - * @since 3.2 - * @version 1.0 - */ - CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); - - /** - * @brief 选择音频场景。 - * - *
      - *
    • 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 - *
        - *
      • 在媒体播放场景中,scene为media_speaker。
      • - *
      • 在语音通话免提场景中,scene为voice_speaker。
      • - *
      - *
    • 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • - *
    • 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • - *
    - * - * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see CheckSceneCapability - * - * @since 3.2 - * @version 1.0 - */ - SelectScene([in] struct AudioSceneDescriptor scene); - - /** - * @brief 设置音频的静音状态。 - * - * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetMute - * - * @since 3.2 - * @version 1.0 - */ - SetMute([in] boolean mute); - - /** - * @brief 获取音频的静音状态。 - * - * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetMute - * - * @since 3.2 - * @version 1.0 - */ - GetMute([out] boolean mute); - - /** - * @brief 设置一个音频流的音量。 - * - * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级范围是0 ~ 15, - * 则音量的映射关系为0.0(或0)表示静音,1.0(或15)表示最大音量等级。 - * - * @param volume 待设置的音量,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - SetVolume([in] float volume); - - /** - * @brief 获取一个音频流的音量。 - * - * @param volume 获取的音量保存到volume中,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetVolume - * - * @since 3.2 - * @version 1.0 - */ - GetVolume([out] float volume); - - /** - * @brief 获取音频流增益的阈值。 - * - * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: - * - *
      - *
    • 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • - *
    • 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, - * 则增益的映射关系为0.0表示静音(-50db),1.0表示最大增益(6db)。
    • - *
    - * - * @param min 获取的音频增益的阈值下限保存到min中。 - * @param max 获取的音频增益的阈值上限保存到max中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGain - * @see SetGain - * - * @since 3.2 - * @version 1.0 - */ - GetGainThreshold([out] float min, [out] float max); - - /** - * @brief 获取音频流的增益。 - * - * @param gain 保存当前获取到的增益到gain中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see SetGain - * - * @since 3.2 - * @version 1.0 - */ - GetGain([out] float gain); - - /** - * @brief 设置音频流的增益。 - * - * @param gain 待设置的增益,最小为0.0,最大为1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see GetGain - * - * @since 3.2 - * @version 1.0 - */ - SetGain([in] float gain); - - /** - * @brief 获取一帧音频数据的长度(字节数)大小。 - * - * @param size 获取的音频帧大小(字节数)保存到size中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetFrameSize([out] unsigned long size); - - /** - * @brief 获取音频buffer中的音频帧数。 - * - * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetFrameCount([out] unsigned long count); - - /** - * @brief 设置音频采样的属性参数。 - * - * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetSampleAttributes - * - * @since 3.2 - * @version 1.0 - */ - SetSampleAttributes([in] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频采样的属性参数。 - * - * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetSampleAttributes - * - * @since 3.2 - * @version 1.0 - */ - GetSampleAttributes([out] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频的数据通道ID。 - * - * @param channelId 获取的通道ID保存到channelId中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetCurrentChannelId([out] unsigned int channelId); - - /** - * @brief 设置音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - SetExtraParams([in] String keyValueList); - - /** - * @brief 获取音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetExtraParams([out] String keyValueList); - - /** - * @brief 请求mmap缓冲区。 - * - * @param reqSize 请求缓冲区的大小,单位:字节。 - * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - ReqMmapBuffer([in] int reqSize, [in] struct AudioMmapBufferDescripter desc); - - /** - * @brief 获取当前mmap的读/写位置。 - * - * @param frames 获取的音频帧计数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 添加音频效果。 - * - * @param effectid 添加的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - AddAudioEffect([in] unsigned long effectid); - - /** - * @brief 移除音频效果。 - * - * @param effectid 移除的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - RemoveAudioEffect([in] unsigned long effectid); - - /** - * @brief 获取缓冲区大小。 - * - * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetFrameBufferSize([out] unsigned long bufferSize); - - /** - * @brief 启动一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Stop - * - * @since 3.2 - * @version 1.0 - */ - Start(); - - /** - * @brief 停止一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Start - * - * @since 3.2 - * @version 1.0 - */ - Stop(); - - /** - * @brief 暂停一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Resume - * - * @since 3.2 - * @version 1.0 - */ - Pause(); - - /** - * @brief 恢复一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Pause - * - * @since 3.2 - * @version 1.0 - */ - Resume(); - - /** - * @brief 刷新音频缓冲区buffer中的数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - Flush(); - - /** - * @brief 设置或去设置设备的待机模式。 - * - * @return 设置设备待机模式成功返回值0,再次执行后去设置待机模式成功返回正值,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - TurnStandbyMode(); - - /** - * @brief 保存音频设备信息。 - * - * @param range 需要保存的信息范围(3 ~ 5),分为简要信息(3)、一般信息(4)、全量信息(5)。 - * @param fd 保存到指定的目标文件。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - AudioDevDump([in] int range, [in] int fd); - - /** - * @brief 判断声卡是否支持音频录制的暂停和恢复功能。 - * - * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 - * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); -} -/** @} */ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IAudioCapture.idl + * + * @brief Audio录音的接口定义文件。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ +package ohos.hdi.audio.v1_0; + +import ohos.hdi.audio.v1_1.AudioTypes; + + +/** + * @brief AudioCapture音频录音接口。 + * + * 提供音频录音支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、录制音频帧数据等。 + * + * @since 4.0 + * @version 1.0 + */ +interface IAudioCapture { + /** + * @brief 从音频驱动中录制一帧输入数据(录音,音频上行数据)。 + * + * @param capture 调用当前函数的IAudioCapture指针对象 + * @param frame 待存放输入数据的音频frame。 + * @param requestBytes 待存放输入数据的音频frame大小(字节数)。 + * @param replyBytes 指向要读取的音频数据的实际长度(以字节为单位)的指针。 + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief Obtains the last number of input audio frames. + * + * @param capture 调用当前函数的IAudioCapture指针对象 + * @param frames 获取的音频帧数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * @return 成功返回值0,失败返回负值。 + * @see CaptureFrame + * + * @since 4.0 + * @version 1.0 + */ + GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 判断某个音频场景能力是否支持。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.0 + * @version 1.0 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
      + *
    • 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
        + *
      • 在媒体播放场景中,scene为media_speaker。
      • + *
      • 在语音通话免提场景中,scene为voice_speaker。
      • + *
      + *
    • 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • + *
    • 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • + *
    + * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.0 + * @version 1.0 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.0 + * @version 1.0 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.0 + * @version 1.0 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级范围是0 ~ 15, + * 则音量的映射关系为0.0(或0)表示静音,1.0(或15)表示最大音量等级。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.0 + * @version 1.0 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
      + *
    • 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • + *
    • 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音(-50db),1.0表示最大增益(6db)。
    • + *
    + * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.0 + * @version 1.0 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.0 + * @version 1.0 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.0 + * @version 1.0 + */ + SetGain([in] float gain); + + /** + * @brief 获取一帧音频数据的长度(字节数)大小。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.0 + * @version 1.0 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道)保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.0 + * @version 1.0 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小,单位:字节。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); + + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.0 + * @version 1.0 + */ + Start(); + + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.0 + * @version 1.0 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.0 + * @version 1.0 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.0 + * @version 1.0 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,再次执行后去设置待机模式成功返回正值,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + TurnStandbyMode(); + + /** + * @brief 保存音频设备信息。 + * + * @param range 需要保存的信息范围(3 ~ 5),分为简要信息(3)、一般信息(4)、全量信息(5)。 + * @param fd 保存到指定的目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频录制的暂停和恢复功能。 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl index cb2c7374..89c0e8c9 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl @@ -1,114 +1,114 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup Audio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @file IAudioManager.idl - * - * @brief Audio适配器管理及加载的接口定义文件。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 3.2 - * @version 1.0 - */ -package ohos.hdi.audio.v1_0; - -import ohos.hdi.audio.v1_0.AudioTypes; -import ohos.hdi.audio.v1_0.IAudioAdapter; - -/** - * @brief AudioManager音频适配器管理接口。 - * - * 按照音频服务下发的音频适配器(声卡)描述符加载一个具体的音频适配器驱动程序。 - * - * @see IAudioAdapter - * - * @since 3.2 - * @version 1.0 - */ -interface IAudioManager { - - /** - * @brief 获取音频驱动中支持的所有适配器的列表。 - * - * @param descs 获取到的音频适配器列表保存到descs中,详请参考{@link AudioAdapterDescriptor}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see LoadAdapter - * - * @since 3.2 - * @version 1.0 - */ - GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); - - /** - * @brief 加载一个音频适配器(声卡)的驱动。 - * - * 加载一个具体的音频驱动,例如usb驱动,在具体实现中可能加载的是一个动态链接库(*.so)。 - * - * @param desc 待加载的音频适配器描述符,详请参考{@link AudioAdapterDescriptor}。 - * @param adapter 获取的音频适配器接口的对象实例保存到adapter中,详请参考{@link IAudioAdapter}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetAllAdapters - * @see UnloadAdapter - * - * @since 3.2 - * @version 1.0 - */ - LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); - - /** - * @brief 卸载音频适配器(声卡)的驱动。 - * - * @param adapterName 待卸载的音频适配器接口的对象名称。 - * - * @see LoadAdapter - * - * @since 3.2 - * @version 1.0 - */ - UnloadAdapter([in] String adapterName); - - /** - * @brief 释放音频管理接口对象。 - * - * @return 功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - ReleaseAudioManagerObject(); -} -/** @} */ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiAudio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IAudioManager.idl + * + * @brief Audio适配器管理及加载的接口定义文件。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ +package ohos.hdi.audio.v1_0; + +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioAdapter; + +/** + * @brief AudioManager音频适配器管理接口。 + * + * 按照音频服务下发的音频适配器(声卡)描述符加载一个具体的音频适配器驱动程序。 + * + * @see IAudioAdapter + * + * @since 4.0 + * @version 1.0 + */ +interface IAudioManager { + + /** + * @brief 获取音频驱动中支持的所有适配器的列表。 + * + * @param descs 获取到的音频适配器列表保存到descs中,详请参考{@link AudioAdapterDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see LoadAdapter + * + * @since 4.0 + * @version 1.0 + */ + GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); + + /** + * @brief 加载一个音频适配器(声卡)的驱动。 + * + * 加载一个具体的音频驱动,例如usb驱动,在具体实现中可能加载的是一个动态链接库(*.so)。 + * + * @param desc 待加载的音频适配器描述符,详请参考{@link AudioAdapterDescriptor}。 + * @param adapter 获取的音频适配器接口的对象实例保存到adapter中,详请参考{@link IAudioAdapter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetAllAdapters + * @see UnloadAdapter + * + * @since 4.0 + * @version 1.0 + */ + LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); + + /** + * @brief 卸载音频适配器(声卡)的驱动。 + * + * @param adapterName 待卸载的音频适配器接口的对象名称。 + * + * @see LoadAdapter + * + * @since 4.0 + * @version 1.0 + */ + UnloadAdapter([in] String adapterName); + + /** + * @brief 释放音频管理接口对象。 + * + * @return 功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + ReleaseAudioManagerObject(); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl index 9dc6ad7c..7c70671f 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl @@ -1,602 +1,602 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @brief 音频接口的包路径。 - * - * @since 3.2 - * @version 1.0 - */ -package ohos.hdi.audio.v1_0; - -/** - * @addtogroup Audio - * @{ - * - * @brief Audio模块接口定义。 - * - * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 - * - * @since 3.2 - * @version 1.0 - */ - -/** - * @file IAudioRender.idl - * - * @brief Audio播放的接口定义文件。 - * - * @since 3.2 - * @version 1.0 - */ - -import ohos.hdi.audio.v1_0.AudioTypes; -import ohos.hdi.audio.v1_0.IAudioCallback; - -/** - * @brief AudioRender音频播放接口。 - * - * 提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据等。 - * - * @since 3.2 - * @version 1.0 - */ -interface IAudioRender { - /** - * @brief 获取音频硬件驱动的延迟时间。 - * - * @param ms 获取的延迟时间(单位:毫秒)保存到ms中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetLatency([out] unsigned int ms); - - /** - * @brief 向音频驱动中播放一帧输出数据(放音,音频下行数据)。 - * - * @param frame 待写入的输出数据的音频frame。 - * @param replyBytes 实际写入的音频数据长度(字节数),获取后保存到replyBytes中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); - - /** - * @brief 获取音频已输出的帧数。 - * - * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 - * @param time 获取的关联时间戳保存到time中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RenderFrame - * - * @since 3.2 - * @version 1.0 - */ - GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 设置一个音频的播放速度。 - * - * @param speed 待设置的播放速度(倍速),例0.5、0.75、1.0、1.25、1.5、2.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetRenderSpeed - * - * @since 3.2 - * @version 1.0 - */ - SetRenderSpeed([in] float speed); - - /** - * @brief 获取一个音频当前的播放速度。 - * - * @param speed 获取的播放速度保存到speed中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetRenderSpeed - * - * @since 3.2 - * @version 1.0 - */ - GetRenderSpeed([out] float speed); - - /** - * @brief 设置音频播放的通道模式。 - * - * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetChannelMode - * - * @since 3.2 - * @version 1.0 - */ - SetChannelMode([in] enum AudioChannelMode mode); - - /** - * @brief 获取音频播放当前的通道模式。 - * - * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetChannelMode - * - * @since 3.2 - * @version 1.0 - */ - GetChannelMode([out] enum AudioChannelMode mode); - - /** - * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 - * - * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 - * @param cookie 回调函数的入参。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RegCallback - * - * @since 3.2 - * @version 1.0 - */ - RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); - - /** - * @brief 排空缓冲区中的数据。 - * - * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see RegCallback - * - * @since 3.2 - * @version 1.0 - */ - DrainBuffer([out] enum AudioDrainNotifyType type); - - /** - * @brief 判断是否支持清空缓冲区数据的功能。 - * - * @param support 是否支持的状态保存到support中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - IsSupportsDrain([out] boolean support); - /** - * @brief 是否支持某个音频场景的配置。 - * - * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SelectScene - * - * @since 3.2 - * @version 1.0 - */ - CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); - - /** - * @brief 选择音频场景。 - * - *
      - *
    • 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 - *
        - *
      • 在媒体播放场景scene为media_speaker。
      • - *
      • 在语音通话免提场景scene为voice_speaker。
      • - *
      - *
    • 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • - *
    • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • - *
    - * - * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see CheckSceneCapability - * - * @since 3.2 - * @version 1.0 - */ - SelectScene([in] struct AudioSceneDescriptor scene); - - /** - * @brief 设置音频的静音状态。 - * - * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetMute - * - * @since 3.2 - * @version 1.0 - */ - SetMute([in] boolean mute); - - /** - * @brief 获取音频的静音状态。 - * - * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetMute - * - * @since 3.2 - * @version 1.0 - */ - GetMute([out] boolean mute); - - /** - * @brief 设置一个音频流的音量。 - * - * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), - * 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15)。 - * - * @param volume 待设置的音量,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - SetVolume([in] float volume); - - /** - * @brief 获取一个音频流的音量。 - * - * @param volume 获取的音量保存到volume中,范围0.0~1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetVolume - * - * @since 3.2 - * @version 1.0 - */ - GetVolume([out] float volume); - - /** - * @brief 获取音频流增益的阈值。 - * - * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: - * - *
      - *
    • 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • - *
    • 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, - * 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db)。
    • - *
    - * - * @param min 获取的音频增益的阈值下限保存到min中。 - * @param max 获取的音频增益的阈值上限保存到max中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGain - * @see SetGain - * - * @since 3.2 - * @version 1.0 - */ - GetGainThreshold([out] float min, [out] float max); - - /** - * @brief 获取音频流的增益。 - * - * @param gain 保存当前获取到的增益到gain中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see SetGain - * - * @since 3.2 - * @version 1.0 - */ - GetGain([out] float gain); - - /** - * @brief 设置音频流的增益。 - * - * @param gain 待设置的增益,最小为0.0,最大为1.0。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetGainThreshold - * @see GetGain - * - * @since 3.2 - * @version 1.0 - */ - SetGain([in] float gain); - - /** - * @brief 获取音频帧的大小。 - * - * 获取一帧音频数据的长度(字节数)。 - * - * @param size 获取的音频帧大小(字节数)保存到size中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetFrameSize([out] unsigned long size); - - /** - * @brief 获取音频buffer中的音频帧数。 - * - * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetFrameCount([out] unsigned long count); - - /** - * @brief 设置音频采样的属性参数。 - * - * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see GetSampleAttributes - * - * @since 3.2 - * @version 1.0 - */ - SetSampleAttributes([in] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频采样的属性参数。 - * - * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) - * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see SetSampleAttributes - * - * @since 3.2 - * @version 1.0 - */ - GetSampleAttributes([out] struct AudioSampleAttributes attrs); - - /** - * @brief 获取音频的数据通道ID。 - * - * @param channelId 获取的通道ID保存到channelId中。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetCurrentChannelId([out] unsigned int channelId); - - /** - * @brief 设置音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - SetExtraParams([in] String keyValueList); - - /** - * @brief 获取音频拓展参数。 - * - * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetExtraParams([out] String keyValueList); - - /** - * @brief 请求mmap缓冲区。 - * - * @param reqSize 请求缓冲区的大小。 - * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - ReqMmapBuffer([in] int reqSize, [in] struct AudioMmapBufferDescripter desc); - - /** - * @brief 获取当前mmap的读/写位置。 - * - * @param frames 获取的音频帧计数保存到frames中。 - * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); - - /** - * @brief 添加音频效果。 - * - * @param effectid 添加的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - AddAudioEffect([in] unsigned long effectid); - - /** - * @brief 移除音频效果。 - * - * @param effectid 移除的音频效果实例标识符。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - RemoveAudioEffect([in] unsigned long effectid); - - /** - * @brief 获取缓冲区大小。 - * - * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - GetFrameBufferSize([out] unsigned long bufferSize); - - /** - * @brief 启动一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Stop - * - * @since 3.2 - * @version 1.0 - */ - Start(); - - /** - * @brief 停止一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Start - * - * @since 3.2 - * @version 1.0 - */ - Stop(); - - /** - * @brief 暂停一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Resume - * - * @since 3.2 - * @version 1.0 - */ - Pause(); - - /** - * @brief 恢复一个音频播放或录音处理。 - * - * @return 成功返回值0,失败返回负值。 - * - * @see Pause - * - * @since 3.2 - * @version 1.0 - */ - Resume(); - - /** - * @brief 刷新音频缓冲区buffer中的数据。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - Flush(); - - /** - * @brief 设置或去设置设备的待机模式。 - * - * @return 设置设备待机模式成功返回值0,失败返回负值;设置取消设备待机模式成功返回正值,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - TurnStandbyMode(); - - /** - * @brief Dump音频设备信息。 - * - * @param range Dump信息范围,分为简要信息、全量信息。 - * @param fd 指定Dump目标文件。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - AudioDevDump([in] int range, [in] int fd); - - /** - * @brief 判断声卡是否支持音频播放的暂停和恢复功能 - * - * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 - * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); - - /** - * @brief 设置低功耗模式缓存长度。 - * - * @param size 包含音频数据的缓存长度。 - * - * @return 成功返回值0,失败返回负值。 - * - * @since 3.2 - * @version 1.0 - */ - SetBufferSize([in] unsigned int size); -} -/** @} */ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Audio + * @{ + * + * @brief Audio模块接口定义。 + * + * 音频接口涉及数据类型、驱动加载接口、驱动适配器接口、音频播放接口、音频录音接口等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IAudioRender.idl + * + * @brief Audio播放的接口定义文件。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 音频接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ +package ohos.hdi.audio.v1_1; + +import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_1.IAudioCallback; + +/** + * @brief AudioRender音频播放接口。 + * + * 提供音频播放支持的驱动能力,包括音频控制、音频属性、音频场景、音频音量、获取硬件延迟时间、播放音频帧数据等。 + * + * @since 4.0 + * @version 1.0 + */ +interface IAudioRender { + /** + * @brief 获取音频硬件驱动的延迟时间。 + * + * @param ms 获取的延迟时间(单位:毫秒)保存到ms中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetLatency([out] unsigned int ms); + + /** + * @brief 向音频驱动中播放一帧输出数据(放音,音频下行数据)。 + * + * @param frame 待写入的输出数据的音频frame。 + * @param replyBytes 实际写入的音频数据长度(字节数),获取后保存到replyBytes中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief 获取音频已输出的帧数。 + * + * @param frames 获取的音频帧数保存到frames中,详请参考{@link AudioTimeStamp}。 + * @param time 获取的关联时间戳保存到time中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RenderFrame + * + * @since 4.0 + * @version 1.0 + */ + GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 设置一个音频的播放速度。 + * + * @param speed 待设置的播放速度(倍速),例0.5、0.75、1.0、1.25、1.5、2.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetRenderSpeed + * + * @since 4.0 + * @version 1.0 + */ + SetRenderSpeed([in] float speed); + + /** + * @brief 获取一个音频当前的播放速度。 + * + * @param speed 获取的播放速度保存到speed中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetRenderSpeed + * + * @since 4.0 + * @version 1.0 + */ + GetRenderSpeed([out] float speed); + + /** + * @brief 设置音频播放的通道模式。 + * + * @param mode 待设置的通道模式,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetChannelMode + * + * @since 4.0 + * @version 1.0 + */ + SetChannelMode([in] enum AudioChannelMode mode); + + /** + * @brief 获取音频播放当前的通道模式。 + * + * @param mode 获取的通道模式保存到mode中,详请参考{@link AudioChannelMode}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetChannelMode + * + * @since 4.0 + * @version 1.0 + */ + GetChannelMode([out] enum AudioChannelMode mode); + + /** + * @brief 注册音频回调函数,用于放音过程中缓冲区数据写、DrainBuffer完成通知。 + * + * @param audioCallback 注册的回调函数,详请参考{@link IAudioCallback}。 + * @param cookie 回调函数的入参。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.0 + * @version 1.0 + */ + RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); + + /** + * @brief 排空缓冲区中的数据。 + * + * @param type 播放结束的类型,详请参考{@link AudioDrainNotifyType}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see RegCallback + * + * @since 4.0 + * @version 1.0 + */ + DrainBuffer([out] enum AudioDrainNotifyType type); + + /** + * @brief 判断是否支持清空缓冲区数据的功能。 + * + * @param support 是否支持的状态保存到support中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + IsSupportsDrain([out] boolean support); + /** + * @brief 是否支持某个音频场景的配置。 + * + * @param scene 待判断的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * @param supported 是否支持的状态保存到supported中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SelectScene + * + * @since 4.0 + * @version 1.0 + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief 选择音频场景。 + * + *
      + *
    • 1. 选择一个非常具体的音频场景(应用场景和输出设备的组合),例如同样是使用手机中的喇叭作为输出设备。 + *
        + *
      • 在媒体播放场景scene为media_speaker。
      • + *
      • 在语音通话免提场景scene为voice_speaker。
      • + *
      + *
    • 2. 只是选择一个音频场景,例如使用场景为媒体播放(media)、电影播放(movie)、游戏播放(game)。
    • + *
    • 3. 只是选择一个音频输出设备,例如输出设备为听筒(receiver)、喇叭(speaker)、有线耳机(headset)。
    • + *
    + * + * @param scene 待设置的音频场景描述符,详请参考{@link AudioSceneDescriptor}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see CheckSceneCapability + * + * @since 4.0 + * @version 1.0 + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief 设置音频的静音状态。 + * + * @param mute 待设置的静音状态,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetMute + * + * @since 4.0 + * @version 1.0 + */ + SetMute([in] boolean mute); + + /** + * @brief 获取音频的静音状态。 + * + * @param mute 获取的静音状态保存到mute中,true表示静音操作、false表示取消静音操作。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetMute + * + * @since 4.0 + * @version 1.0 + */ + GetMute([out] boolean mute); + + /** + * @brief 设置一个音频流的音量。 + * + * 音量的取值范围是0.0~1.0,如果音频服务中的音量等级为15级(0 ~ 15), + * 则音量的映射关系为0.0表示静音,1.0表示最大音量等级(15)。 + * + * @param volume 待设置的音量,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + SetVolume([in] float volume); + + /** + * @brief 获取一个音频流的音量。 + * + * @param volume 获取的音量保存到volume中,范围0.0~1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetVolume + * + * @since 4.0 + * @version 1.0 + */ + GetVolume([out] float volume); + + /** + * @brief 获取音频流增益的阈值。 + * + * 在具体的功能实现中,可以根据芯片平台的实际情况来进行处理: + * + *
      + *
    • 1. 可以使用实际的增益值,例如增益的范围为-50db ~ 6db。
    • + *
    • 2. 也可以将增益范围设定为0.0~1.0,如果增益的范围为-50db ~ 6db, + * 则增益的映射关系为0.0表示静音,1.0表示最大增益(6db)。
    • + *
    + * + * @param min 获取的音频增益的阈值下限保存到min中。 + * @param max 获取的音频增益的阈值上限保存到max中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGain + * @see SetGain + * + * @since 4.0 + * @version 1.0 + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief 获取音频流的增益。 + * + * @param gain 保存当前获取到的增益到gain中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see SetGain + * + * @since 4.0 + * @version 1.0 + */ + GetGain([out] float gain); + + /** + * @brief 设置音频流的增益。 + * + * @param gain 待设置的增益,最小为0.0,最大为1.0。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetGainThreshold + * @see GetGain + * + * @since 4.0 + * @version 1.0 + */ + SetGain([in] float gain); + + /** + * @brief 获取音频帧的大小。 + * + * 获取一帧音频数据的长度(字节数)。 + * + * @param size 获取的音频帧大小(字节数)保存到size中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief 获取音频buffer中的音频帧数。 + * + * @param count 一个音频buffer中包含的音频帧数,获取后保存到count中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief 设置音频采样的属性参数。 + * + * @param attrs 待设置的音频采样属性,例如采样频率、采样精度、通道,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see GetSampleAttributes + * + * @since 4.0 + * @version 1.0 + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频采样的属性参数。 + * + * @param attrs 获取的音频采样属性(例如采样频率、采样精度、通道) + * 保存到attrs中,详请参考{@link AudioSampleAttributes}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see SetSampleAttributes + * + * @since 4.0 + * @version 1.0 + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief 获取音频的数据通道ID。 + * + * @param channelId 获取的通道ID保存到channelId中。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief 设置音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief 获取音频拓展参数。 + * + * @param keyValueList 拓展参数键值对字符串列表,格式为key=value,多个键值对通过分号分割。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief 请求mmap缓冲区。 + * + * @param reqSize 请求缓冲区的大小。 + * @param desc 缓冲区描述符,详请参考{@link AudioMmapBufferDescripter}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + ReqMmapBuffer([in] int reqSize, [in] struct AudioMmapBufferDescripter desc); + + /** + * @brief 获取当前mmap的读/写位置。 + * + * @param frames 获取的音频帧计数保存到frames中。 + * @param time 获取的关联时间戳保存到time中,详请参考{@link AudioTimeStamp}。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief 添加音频效果。 + * + * @param effectid 添加的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief 移除音频效果。 + * + * @param effectid 移除的音频效果实例标识符。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief 获取缓冲区大小。 + * + * @param bufferSize 获取的缓冲区大小保存在bufferSize中,单位为字节。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief 启动一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Stop + * + * @since 4.0 + * @version 1.0 + */ + Start(); + + /** + * @brief 停止一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Start + * + * @since 4.0 + * @version 1.0 + */ + Stop(); + + /** + * @brief 暂停一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Resume + * + * @since 4.0 + * @version 1.0 + */ + Pause(); + + /** + * @brief 恢复一个音频播放或录音处理。 + * + * @return 成功返回值0,失败返回负值。 + * + * @see Pause + * + * @since 4.0 + * @version 1.0 + */ + Resume(); + + /** + * @brief 刷新音频缓冲区buffer中的数据。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + Flush(); + + /** + * @brief 设置或去设置设备的待机模式。 + * + * @return 设置设备待机模式成功返回值0,失败返回负值;设置取消设备待机模式成功返回正值,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + TurnStandbyMode(); + + /** + * @brief Dump音频设备信息。 + * + * @param range Dump信息范围,分为简要信息、全量信息。 + * @param fd 指定Dump目标文件。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief 判断声卡是否支持音频播放的暂停和恢复功能 + * + * @param supportPause 是否支持暂停功能的状态保存到supportPause中,true表示支持,false表示不支持。 + * @param supportResume 是否支持恢复功能的状态保存到supportResume中,true表示支持,false表示不支持。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); + + /** + * @brief 设置低功耗模式缓存长度。 + * + * @param size 包含音频数据的缓存长度。 + * + * @return 成功返回值0,失败返回负值。 + * + * @since 4.0 + * @version 1.0 + */ + SetBufferSize([in] unsigned int size); +} +/** @} */ -- Gitee From ba2f8aba779bfb582be29f1ef12e1cd88a82bb93 Mon Sep 17 00:00:00 2001 From: qiu-qiu-wang Date: Wed, 3 Jan 2024 09:28:31 +0800 Subject: [PATCH 0229/2135] revise format add idl with CN language comment Signed-off-by: qiu-qiu-wang --- zh-cn/device_api/hdi/drm/v1_0/BUILD.gn | 39 ++ .../hdi/drm/v1_0/IMediaDecryptModule.idl | 82 ++++ .../hdi/drm/v1_0/IMediaKeySession.idl | 215 +++++++++ .../hdi/drm/v1_0/IMediaKeySessionCallback.idl | 83 ++++ .../hdi/drm/v1_0/IMediaKeySystem.idl | 270 ++++++++++++ .../hdi/drm/v1_0/IMediaKeySystemCallback.idl | 67 +++ .../hdi/drm/v1_0/IMediaKeySystemFactory.idl | 83 ++++ .../hdi/drm/v1_0/IOemCertificate.idl | 81 ++++ .../hdi/drm/v1_0/MediaKeySystemTypes.idl | 417 ++++++++++++++++++ 9 files changed, 1337 insertions(+) create mode 100644 zh-cn/device_api/hdi/drm/v1_0/BUILD.gn create mode 100644 zh-cn/device_api/hdi/drm/v1_0/IMediaDecryptModule.idl create mode 100644 zh-cn/device_api/hdi/drm/v1_0/IMediaKeySession.idl create mode 100644 zh-cn/device_api/hdi/drm/v1_0/IMediaKeySessionCallback.idl create mode 100644 zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystem.idl create mode 100644 zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystemCallback.idl create mode 100644 zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystemFactory.idl create mode 100644 zh-cn/device_api/hdi/drm/v1_0/IOemCertificate.idl create mode 100644 zh-cn/device_api/hdi/drm/v1_0/MediaKeySystemTypes.idl diff --git a/zh-cn/device_api/hdi/drm/v1_0/BUILD.gn b/zh-cn/device_api/hdi/drm/v1_0/BUILD.gn new file mode 100644 index 00000000..88a1b6f3 --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libdrm_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("drm") { + module_name = "drm_interface_service" + + sources = [ + "IMediaDecryptModule.idl", + "IMediaKeySession.idl", + "IMediaKeySessionCallback.idl", + "IMediaKeySystem.idl", + "IMediaKeySystemCallback.idl", + "IMediaKeySystemFactory.idl", + "IOemCertificate.idl", + "MediaKeySystemTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_drm" + } +} diff --git a/zh-cn/device_api/hdi/drm/v1_0/IMediaDecryptModule.idl b/zh-cn/device_api/hdi/drm/v1_0/IMediaDecryptModule.idl new file mode 100644 index 00000000..031a5e17 --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/IMediaDecryptModule.idl @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiDrm + * @{ + + * @brief DRM模块接口定义。 + * DRM是数字版权管理,用于对多媒体内容加密,以便保护价值内容不被非法获取, + * DRM模块接口定义了DRM实例管理、DRM会话管理、DRM内容解密的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IMediaDecryptModule.idl + * + * @brief 定义了DRM内容解密接口、解密模块实例释放接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief DRM接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.drm.v1_0; + +import ohos.hdi.drm.v1_0.MediaKeySystemTypes; + +/** +*@brief 定义内容解密、解密模块实例释放函数。用于解密加密的内容。 +* +* @since 4.1 +* @version 1.0 +*/ +interface IMediaDecryptModule { + /** + * @brief 内容解密接口,该接口使用解密描述信息对源缓冲区数据解密 + * 并存放至目标缓冲区,提供安全内存和非安全内存两种类型的目标缓冲区。 + * + * @param secure 是否在安全内存中解密,true表示使用安全内存,false表示使用非安内存。 + * @param cryptoInfo 密钥标识及数据加密的相关信息。 + * @param srcBuffer 待解密数据buffer。 + @param destBuffer 解密后数据buffer。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + DecryptMediaData([in] boolean secure, [in] struct CryptoInfo cryptoInfo, [in] struct DrmBuffer srcBuffer, [in] struct DrmBuffer destBuffer); + + /** + * @brief 释放解密模块。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + Release(); +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySession.idl b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySession.idl new file mode 100644 index 00000000..ed39b147 --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySession.idl @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiDrm + * @{ + + * @brief DRM模块接口定义。 + * DRM是数字版权管理,用于对多媒体内容加密,以便保护价值内容不被非法获取, + * DRM模块接口定义了DRM实例管理、DRM会话管理、DRM内容解密的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IMediaKeySession.idl + * + * @brief 定义了DRM会话功能接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief DRM接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.drm.v1_0; + +import ohos.hdi.drm.v1_0.MediaKeySystemTypes; +import ohos.hdi.drm.v1_0.IMediaKeySessionCallback; +import ohos.hdi.drm.v1_0.IMediaDecryptModule; + +/** +*@brief DRM会话功能接口,获取/设置许可证、查询当前会话许可证状态、删除当前会话许可证、释放许可证、恢复离线许可证、 +* 判断是否需要安全内存中解密、获取解密模块实例、设置会话消息通知接口、销毁会话。 +* +* @since 4.1 +* @version 1.0 +*/ +interface IMediaKeySession { + /** + * @brief 产生获取许可证请求。 + * + * @param mediaKeyRequestInfo 用于产生许可证请求的初始信息。 + * @param mediaKeyRequest 许可证请求。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GenerateMediaKeyRequest([in] struct MediaKeyRequestInfo mediaKeyRequestInfo, [out] struct MediaKeyRequest mediaKeyRequest); + + /** + * @brief 处理许可证响应。 + * + * @param mediaKeyResponse 待处理的许可证响应。 + * @param mediaKeyId 对于离线许可证类型,表示索引;在线许可证类型下,值为空。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + ProcessMediaKeyResponse([in] unsigned char[] mediaKeyResponse, [out] unsigned char[] mediaKeyId); + + /** + * @brief 查询许可证状态(包括策略等信息)。 + * + * @param mediaKeyStatus 许可证状态。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + CheckMediaKeyStatus([out] Map mediaKeyStatus); + + /** + * @brief 删除许可证。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + ClearMediaKeys(); + + /** + * @brief 产生离线许可证释放请求。 + * + * @param mediaKeyId 离线许可证索引。 + * @param releaseRequest 离线许可证释放请求。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetOfflineReleaseRequest([in] unsigned char[] mediaKeyId, [out] unsigned char[] releaseRequest); + + /** + * @brief 处理离线许可证释放响应。 + * + * @param mediaKeyId 离线许可证索引。 + * @param response 离线许可证释放响应。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + ProcessOfflineReleaseResponse([in] unsigned char[] mediaKeyId, [in] unsigned char[] response); + + /** + * @brief 恢复离线许可证至当前会话。 + * + * @param mediaKeyId 离线许可证索引。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + RestoreOfflineMediaKeys([in] unsigned char[] mediaKeyId); + + /** + * @brief 获取当前DRM会话的内容保护级别。 + * + * @param level 内容保护级别。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetContentProtectionLevel([out] enum ContentProtectionLevel level); + + /** + * @brief 判断是否需要安全内存用于存放解密后的数据。 + * + * @param mimeType 待解密内容的MIME类型。 + * @param required 布尔值表示是否需要安全内存,true表示需要安全内存存储解密后的视频帧, + * flase表示不需要安全内存存储解密后的视频帧。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + RequiresSecureDecoderModule([in] String mimeType, [out] boolean required); + + /** + * @brief 设置DRM会话事件通知接口。 + * + * @param sessionCallback DRM实例事件通知接口。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + SetCallback([in] IMediaKeySessionCallback sessionCallback); + + /** + * @brief 获取解密模块实例。 + * + * @param decryptModule 解密模块实例。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetMediaDecryptModule([out] IMediaDecryptModule decryptModule); + + /** + * @brief 销毁DRM会话。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + Destroy(); +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySessionCallback.idl b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySessionCallback.idl new file mode 100644 index 00000000..31a0836b --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySessionCallback.idl @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiDrm + * @{ + + * @brief DRM模块接口定义。 + * DRM是数字版权管理,用于对多媒体内容加密,以便保护价值内容不被非法获取, + * DRM模块接口定义了DRM实例管理、DRM会话管理、DRM内容解密的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IMediaKeySessionCallback.idl + * + * @brief 定义了DRM会话的事件通知接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief DRM接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.drm.v1_0; + +import ohos.hdi.drm.v1_0.MediaKeySystemTypes; + +/** +*@brief 定义DRM会话的事件通知函数,用于DRM驱动通知DRM框架事件。 +* +* @since 4.1 +* @version 1.0 +*/ +[callback] interface IMediaKeySessionCallback { + /** + * @brief 发送事件通知。 + * + * @param eventType 事件类型。 + * @param extra 事件附加信息。 + * @param data 事件详细信息。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + SendEvent([in] enum EventType eventType, [in] int extra, [in] unsigned char[] data); + /** + * @brief 发送事件通知。 + * + * @param keyStatus 许可证中密钥索引及其状态。 + * @param newKeysAvailable 是否有新的许可证密钥可用,true表示有新的许可证密钥, + * false表示无新的许可证密钥。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + SendEventKeyChange([in] Map keyStatus, [in] boolean newKeysAvailable); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystem.idl b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystem.idl new file mode 100644 index 00000000..8891570f --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystem.idl @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiDrm + * @{ + + * @brief DRM模块接口定义。 + * DRM是数字版权管理,用于对多媒体内容加密,以便保护价值内容不被非法获取, + * DRM模块接口定义了DRM实例管理、DRM会话管理、DRM内容解密的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IMediaKeySystem.idl + * + * @brief 定义了DRM实例的功能接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief DRM接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.drm.v1_0; + +import ohos.hdi.drm.v1_0.MediaKeySystemTypes; +import ohos.hdi.drm.v1_0.IMediaKeySession; +import ohos.hdi.drm.v1_0.IMediaKeySystemCallback; +import ohos.hdi.drm.v1_0.IOemCertificate; + +/** +*@brief DRM实例功能接口,判断是否支持特定DRM方案,创建DRM实例。 +* + * @since 4.1 + * @version 1.0 +*/ +interface IMediaKeySystem { + /** + * @brief 获取特定名称属性的字符串值(字符串)。 + * + * @param name 属性名。 + * @param value 返回值。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetConfigurationString([in] String name, [out] String value); + + /** + * @brief 设置特定名称属性的值(字符串)。 + * + * @param name 属性名。 + * @param value 待设置字符串。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + SetConfigurationString([in] String name, [in] String value); + + /** + * @brief 获取特定名称属性的值(字节数组)。 + * + * @param name 属性名。 + * @param value 返回值。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetConfigurationByteArray([in] String name, [out] unsigned char[] value); + + /** + * @brief 设置特定名称属性的值(字节数组)。 + * + * @param name 属性名。 + * @param value 待设置字节数组。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + SetConfigurationByteArray([in] String name, [in] unsigned char[] value); + + /** + * @brief 获取度量统计数据。 + * + * @param statistics DRM驱动自定义的度量统计数据,以字符串对形式表达。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetStatistics([out] Map statistics); + + /** + * @brief 获取DRM方案支持的最大内容保护级别。 + * + * @param level 内容保护级别。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetMaxContentProtectionLevel([out] enum ContentProtectionLevel level); + + /** + * @brief 产生证书下载请求。 + * + * @param defaultUrl 默认的证书服务器URL地址。 + * @param request 证书下载请求报文,以字节数组定义。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GenerateKeySystemRequest([out] String defaultUrl, [out] unsigned char[] request); + + /** + * @brief 处理下载的证书。 + * + * @param response 下载的证书报文。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + ProcessKeySystemResponse([in] unsigned char[] response); + + /** + * @brief 获取证书状态。 + * + * @param status 证书状态。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetOemCertificateStatus([out] enum CertificateStatus status); + + /** + * @brief 设置DRM实例事件通知接口。 + * + * @param systemCallback DRM实例事件通知接口。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + SetCallback([in] IMediaKeySystemCallback systemCallback); + + /** + * @brief 创建DRM会话。 + * + * @param level 待创建会话的内容保护等级。 + * @param keySession 创建的DRM会话。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + CreateMediaKeySession([in] enum ContentProtectionLevel level, [out] IMediaKeySession keySession); + + /** + * @brief 获取离线许可证索引(数组)。 + * + * @param mediaKeyIds 离线许可证索引数组。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetOfflineMediaKeyIds([out] unsigned char[][] mediaKeyIds); + + /** + * @brief 获取离线许可证状态。 + * + * @param mediaKeyId 离线许可证索引。 + * @param mediaKeyStatus 离线许可证状态。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetOfflineMediaKeyStatus([in] unsigned char[] mediaKeyId, [out] enum OfflineMediaKeyStatus mediaKeyStatus); + + /** + * @brief 删除离线许可证。 + * + * @param mediaKeyId 离线许可证索引。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + ClearOfflineMediaKeys([in] unsigned char[] mediaKeyId); + + /** + * @brief 获取证书下载接口。 + * + * @param oemCert 证书下载接口,参见IOemCertificate。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GetOemCertificate([out] IOemCertificate oemCert); + + /** + * @brief 销毁DRM实例。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + Destroy(); +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystemCallback.idl b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystemCallback.idl new file mode 100644 index 00000000..2119b196 --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystemCallback.idl @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiDrm + * @{ + + * @brief DRM模块接口定义。 + * DRM是数字版权管理,用于对多媒体内容加密,以便保护价值内容不被非法获取, + * DRM模块接口定义了DRM实例管理、DRM会话管理、DRM内容解密的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IMediaKeySystemCallback.idl + * + * @brief 定义了DRM实例的事件通知接口。 + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief DRM接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.drm.v1_0; + +import ohos.hdi.drm.v1_0.MediaKeySystemTypes; + +/** +*@brief 定义DRM实例的事件通知函数。 +* +* 用于DRM驱动通知DRM框架事件信息。 +*/ +[callback] interface IMediaKeySystemCallback { + /** + * @brief 发送事件通知。 + * + * @param eventType 事件类型。 + * @param extra 事件附加信息。 + * @param data 事件详细信息。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + SendEvent([in] enum EventType eventType, [in] int extra, [in] unsigned char[] data); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystemFactory.idl b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystemFactory.idl new file mode 100644 index 00000000..52aaceb6 --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/IMediaKeySystemFactory.idl @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiDrm + * @{ + + * @brief DRM模块接口定义。 + * DRM是数字版权管理,用于对多媒体内容加密,以便保护价值内容不被非法获取, + * DRM模块接口定义了DRM实例管理、DRM会话管理、DRM内容解密的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IMediaKeySystemFactory.idl + * + * @brief 定义了DRM实例的工厂方法。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief DRM接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.drm.v1_0; + +import ohos.hdi.drm.v1_0.MediaKeySystemTypes; +import ohos.hdi.drm.v1_0.IMediaKeySystem; + +/** +*@brief DRM实例工厂方法接口,判断是否支持特定DRM方案,创建DRM实例。 +* +* @since 4.1 +* @version 1.0 +*/ +interface IMediaKeySystemFactory { + /** + * @brief 判断是否支持特定DRM方案。 + * + * @param name DRM方案名。 + * @param mimeType 数字内容的MIME类型。 + * @param level 内容保护等级。 + * @param isSupported 是否支持特定DRM方案,true表示支持,false表示失败。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + IsMediaKeySystemSupported([in] String name, [in] String mimeType, [in] enum ContentProtectionLevel level, [out] boolean isSupported); + /** + * @brief 创建DRM实例。 + * + * @param mediaKeySystem DRM实例。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + CreateMediaKeySystem([out] IMediaKeySystem mediaKeySystem); +}; +/** @} */ diff --git a/zh-cn/device_api/hdi/drm/v1_0/IOemCertificate.idl b/zh-cn/device_api/hdi/drm/v1_0/IOemCertificate.idl new file mode 100644 index 00000000..767a602f --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/IOemCertificate.idl @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiDrm + * @{ + + * @brief DRM模块接口定义。 + * DRM是数字版权管理,用于对多媒体内容加密,以便保护价值内容不被非法获取, + * DRM模块接口定义了DRM实例管理、DRM会话管理、DRM内容解密的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IOemCertificate.idl + * + * @brief 定义了不同厂商证书下载的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief DRM接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.drm.v1_0; + +import ohos.hdi.drm.v1_0.MediaKeySystemTypes; + +/** +*@brief 厂商证书下载接口。 +* 产生证书下载请求,处理下载的证书。 +* + * @since 4.1 + * @version 1.0 +*/ +interface IOemCertificate { + /** + * @brief 产生证书下载请求。 + * + * @param defaultUrl 默认的证书服务器URL地址。 + * @param request 证书下载请求报文,以字节数组定义。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + GenerateOemKeySystemRequest([out] String defaultUrl, [out] unsigned char[] request); + /** + * @brief 处理下载的证书。 + * + * @param response 下载的证书报文。 + * + * @return 0 表示执行成功。 + * @return 其他值表示执行失败。 + * + * @since 4.1 + * @version 1.0 + */ + ProcessOemKeySystemResponse([in] unsigned char[] response); +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/drm/v1_0/MediaKeySystemTypes.idl b/zh-cn/device_api/hdi/drm/v1_0/MediaKeySystemTypes.idl new file mode 100644 index 00000000..905b4eb9 --- /dev/null +++ b/zh-cn/device_api/hdi/drm/v1_0/MediaKeySystemTypes.idl @@ -0,0 +1,417 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiDrm + * @{ + + * @brief DRM模块接口定义。 + * DRM是数字版权管理,用于对多媒体内容加密,以便保护价值内容不被非法获取,DRM模块接口定义了DRM实例管理、DRM会话管理、DRM内容解密的接口。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file MediaKeySystemTypes.idl + * + * @brief 定义了HdiDrm使用的类型及结构。 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief DRM接口的包路径。 + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.drm.v1_0; + +/** + * @brief 内容保护等级。 + * + * @since 4.1 + * @version 1.0 + */ +enum ContentProtectionLevel { + /** + * 未知等级。 + */ + SECURE_UNKNOWN = 0, + /** + * 软件安全等级。 + */ + SW_SECURE_CRYPTO, + /** + * 硬件安全等级。 + */ + HW_SECURE_CRYPTO, + /** + * 增强硬件安全等级。 + */ + HW_ENHANCED_SECURE_CRYPTO, + /** + * 安全等级最大值,用于判断非法安全等级。 + */ + HW_SECURE_MAX, +}; + +/** + * @brief 许可证请求类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum MediaKeyRequestType { + /** + * 未知类型。 + */ + MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, + /** + * 初次请求。 + */ + MEDIA_KEY_REQUEST_TYPE_INITIAL, + /** + * 再次许可证请求。 + */ + MEDIA_KEY_REQUEST_TYPE_RENEWAL, + /** + * 释放许可证请求。 + */ + MEDIA_KEY_REQUEST_TYPE_RELEASE, + /** + * 无类型。 + */ + MEDIA_KEY_REQUEST_TYPE_NONE, + /** + * 许可证更新请求。 + */ + MEDIA_KEY_REQUEST_TYPE_UPDATE, +}; + +/** + * @brief DRM插件监听事件类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum EventType { + /** + * 证书下载。 + */ + EVENTTYPE_PROVISIONREQUIRED = 0, + /** + * 许可证获取。 + */ + EVENTTYPE_KEYREQUIRED, + /** + * 许可证过期。 + */ + EVENTTYPE_KEYEXPIRED, + /** + * 厂商自定义事件。 + */ + EVENTTYPE_VENDOR_DEFINED, + /** + * 许可证有效期更新。 + */ + EVENTTYPE_EXPIRATIONUPDATE, + /** + * 许可证变更。 + */ + EVENTTYPE_KEYCHANGE, +}; + +/** + * @brief 加密算法类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum CryptoAlgorithmType { + /** + * 未加密。 + */ + ALGTYPE_UNENCRYPTED = 0, + /** + * aes_ctr加密。 + */ + ALGTYPE_AES_CTR, + /** + * aes_wv加密。 + */ + ALGTYPE_AES_WV, + /** + * aes_cbc加密。 + */ + ALGTYPE_AES_CBC, + /** + * sm4_cbc加密。 + */ + ALGTYPE_SM4_CBC, + /** + * sm4_ctr加密。 + */ + ALGTYPE_SM4_CTR, +}; + +/** + * @brief 离线许可证状态。 + * + * @since 4.1 + * @version 1.0 + */ +enum OfflineMediaKeyStatus { + /** + * 未知状态。 + */ + OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, + /** + * 许可证可用。 + */ + OFFLINE_MEDIA_KEY_STATUS_USABLE, + /** + * 许可证不可用(未在生效时间段内、已过期等)。 + */ + OFFLINE_MEDIA_KEY_STATUS_INACTIVE, +}; + +/** + * @brief 许可证类型。 + * + * @since 4.1 + * @version 1.0 + */ +enum MediaKeyType { + /** + * 离线许可证。 + */ + MEDIA_KEY_TYPE_OFFLINE = 0, + /** + * 在线许可证。 + */ + MEDIA_KEY_TYPE_ONLINE, +}; + +/** + * @brief 证书状态。 + * + * @since 4.1 + * @version 1.0 + */ +enum CertificateStatus { + /** + * 证书已设置。 + */ + CERT_STATUS_PROVISIONED = 0, + /** + * 证书未设置。 + */ + CERT_STATUS_NOT_PROVISIONED, + /** + * 证书过期。 + */ + CERT_STATUS_EXPIRED, + /** + * 证书无效。 + */ + CERT_STATUS_INVALID, + /** + * 获取证书状态失败。 + */ + CERT_STATUS_UNAVAILABLE, +}; + +/** + * @brief 会话许可证状态。 + * + * @since 4.1 + * @version 1.0 + */ +enum MediaKeySessionKeyStatus { + /** + * 许可证可用。 + */ + MEDIA_KEY_SESSION_KEY_STATUS_USABLE = 0, + /** + * 许可证过期。 + */ + MEDIA_KEY_SESSION_KEY_STATUS_EXPIRED, + /** + * 该许可证不允许输出。 + */ + MEDIA_KEY_SESSION_KEY_STATUS_OUTPUT_NOT_ALLOWED, + /** + * 暂时不可用许可证。 + */ + MEDIA_KEY_SESSION_KEY_STATUS_PENDING, + /** + * 许可证内部状态错误。 + */ + MEDIA_KEY_SESSION_KEY_STATUS_INTERNAL_ERROR, + /** + * 许可证待生效。 + */ + MEDIA_KEY_SESSION_KEY_STATUS_USABLE_IN_FUTURE, +}; + +/** + * @brief 定义MediaKeyRequestInfo,该信息由{@link IMediaKeySession::GenerateMediaKeyRequest}使用。 + * + * @since 4.1 + * @version 1.0 + */ +struct MediaKeyRequestInfo { + /** + * 许可证类型。 + */ + enum MediaKeyType mediaKeyType; + /** + * 媒体类型。 + */ + String mimeType; + /** + * 初始信息,从MediaKeySystemInfo中获取。 + */ + unsigned char[] initData; + /** + * 应用自定义数据。 + */ + Map optionalData; +}; + +/** + * @brief 定义MediaKeyRequest,该信息由{@link IMediaKeySession::GenerateMediaKeyRequest}使用。 + * + * @since 4.1 + * @version 1.0 + */ +struct MediaKeyRequest { + /** + * 许可证请求的类型。 + */ + enum MediaKeyRequestType requestType; + /** + * 许可证请求。 + */ + unsigned char[] data; + /** + * 许可证服务器URL。 + */ + String defaultUrl; +}; + +/** + * @brief 定义Pattern,该信息由CryptoInfo使用。 + * + * @since 4.1 + * @version 1.0 + */ +struct Pattern { + /** + * 加密块数。 + */ + unsigned int encryptBlocks; + /** + * 未加密块数。 + */ + unsigned int skipBlocks; +}; + +/** + * @brief 定义SubSample,该信息由CryptoInfo使用。 + * + * @since 4.1 + * @version 1.0 + */ +struct SubSample { + /** + * 头部长度。 + */ + unsigned int clearHeaderLen; + /** + * 负载长度。 + */ + unsigned int payLoadLen; +}; + +/** + * @brief 定义CryptoInfo,该信息由{@link IMediaDecryptModule::DecryptMediaData}使用。 + * + * @since 4.1 + * @version 1.0 + */ +struct CryptoInfo { + /** + * 加密算法类型。 + */ + enum CryptoAlgorithmType type; + /** + * 密钥标识。 + */ + unsigned char[] keyId; + /** + * 秘钥配套的IV。 + */ + unsigned char[] iv; + /** + * 加密模式。 + */ + struct Pattern pattern; + /** + * 加密subsample。 + */ + struct SubSample[] subSamples; +}; + +/** + * @brief 定义DrmBuffer,该信息由{@link IMediaDecryptModule::DecryptMediaData}使用。 + * + * @since 4.1 + * @version 1.0 + */ +struct DrmBuffer { + /** + * buffer类型,由实现平台定义。 + */ + unsigned int bufferType; + /** + * buffer描述符。 + */ + FileDescriptor fd; + /** + * buffer长度。 + */ + unsigned int bufferLen; + /** + * 分配buffer的长度。 + */ + unsigned int allocLen; + /** + * 实际填充数据的长度。 + */ + unsigned int filledLen; + /** + * 数据基于buffer首地址的偏移。 + */ + unsigned int offset; + /** + * 共享内存类型。 + */ + unsigned int sharedMemType; +}; +/** @} */ -- Gitee From 5b76bc0f6dc8441103e77aaaebd4f4c6fca23880 Mon Sep 17 00:00:00 2001 From: xiaojianfeng Date: Wed, 31 Jan 2024 08:40:56 +0000 Subject: [PATCH 0230/2135] update zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h. Signed-off-by: xiaojianfeng --- .../native_sdk/graphic/native_drawing/drawing_text_typography.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 60fb96c7..e65b6077 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -600,7 +600,7 @@ double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回最长行。 + * @return 获取最长行,建议实际使用时将返回值向上取整。 * @since 9 * @version 1.1 */ -- Gitee From 6be7bfd2b19b461e847fc4d3225a7fb9b2a5d466 Mon Sep 17 00:00:00 2001 From: xiaojianfeng Date: Wed, 31 Jan 2024 09:11:37 +0000 Subject: [PATCH 0231/2135] update zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h. Signed-off-by: xiaojianfeng --- .../graphic/native_drawing/drawing_text_typography.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index e65b6077..ec0cb841 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -596,11 +596,11 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); /** - * @brief 获取最长行。 + * @brief 获取最长行,建议实际使用时将返回值向上取整。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 获取最长行,建议实际使用时将返回值向上取整。 + * @return 返回最长行。 * @since 9 * @version 1.1 */ -- Gitee From 08a1f02db0f01f11fd81f784bbf88a2866b9eefb Mon Sep 17 00:00:00 2001 From: yan-shuifeng Date: Thu, 1 Feb 2024 09:55:41 +0800 Subject: [PATCH 0232/2135] update ArkUI interface in Zh Signed-off-by: yan-shuifeng --- zh-cn/native_sdk/ace/native_event.h | 224 + zh-cn/native_sdk/ace/native_interface.h | 123 + .../ace/native_interface_xcomponent.h | 27 + zh-cn/native_sdk/ace/native_node.h | 5247 +++++++++++++++++ zh-cn/native_sdk/ace/native_type.h | 1057 ++++ 5 files changed, 6678 insertions(+) create mode 100644 zh-cn/native_sdk/ace/native_event.h create mode 100644 zh-cn/native_sdk/ace/native_interface.h create mode 100644 zh-cn/native_sdk/ace/native_node.h create mode 100644 zh-cn/native_sdk/ace/native_type.h diff --git a/zh-cn/native_sdk/ace/native_event.h b/zh-cn/native_sdk/ace/native_event.h new file mode 100644 index 00000000..5c01fde5 --- /dev/null +++ b/zh-cn/native_sdk/ace/native_event.h @@ -0,0 +1,224 @@ +/* + * 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 提供ArkUI在Native侧的UI能力,如UI组件创建销毁、树节点操作,属性设置,事件监听等。 + * + * @since 12 + */ + +/** + * @file native_event.h + * + * @brief 提供ArkUI在Native侧的事件类型定义集合。 + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_EVENT +#define ARKUI_NATIVE_EVENT + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Touch事件的工具类型定义。 + * + * @since 12 + */ +typedef enum { + /** 不支持的工具类型。 */ + NODE_TOOL_TYPE_UNKNOWN = -1, + + /** 手指。 */ + NODE_TOOL_TYPE_FINGER = 0, + + /** 笔。 */ + NODE_TOOL_TYPE_STYLUS = 1, +} ArkUI_NodeToolType; + +/** + * @brief 产生Touch事件的来源类型定义。 + * + * @since 12 + */ +typedef enum { + /** 不支持的来源类型。 */ + NODE_SOURCE_TYPE_UNKNOWN = -1, + /** 触摸屏。 */ + NODE_SOURCE_TYPE_TOUCH_SCREEN = 0, + /** 手写笔。 */ + NODE_SOURCE_TYPE_STYLUS = 1, + /** 触控板。 */ + NODE_SOURCE_TYPE_TOUCHPAD = 2, +} ArkUI_NodeSourceType; + +/** + * @brief 定义Touch事件触控点信息的数据结构。 + * + * @since 12 + */ +typedef struct { + /** 触控事件标识。 */ + int32_t id; + + /** 手指按下的时间戳,单位为微秒(us)。*/ + int64_t pressedTime; + + /** 触摸位置所属的屏幕X坐标。 */ + int32_t screenX; + + /** 触摸位置所属的屏幕Y坐标。 */ + int32_t screenY; + + /** 触摸位置在窗口中的X坐标。 */ + int32_t windowX; + + /** 触摸位置在窗口中的Y坐标。 */ + int32_t windowY; + + /** 触摸位置在当前触发事件组件中的X坐标。 */ + int32_t nodeX; + + /** 触摸位置在当前触发事件组件中的Y坐标。 */ + int32_t nodeY; + + /** 压力值,取值范围是[0.0, 1.0],0.0表示不支持。 */ + double pressure; + + /** 触摸区域的宽度。 */ + int32_t contactAreaWidth; + + /** 触摸区域的高度。 */ + int32_t contactAreaHeight; + + /** 相对YZ平面的角度,取值范围是[-90, 90],其中正值是向右倾斜。 */ + double tiltX; + + /** 相对XZ平面的角度,取值范围是[-90, 90],其中正值是向下倾斜。 */ + double tiltY; + + /** 工具区域的中心点X坐标。 */ + int32_t toolX; + + /** 工具区域的中心点Y坐标。 */ + int32_t toolY; + + /** 工具接触区域的宽度。 */ + int32_t toolWidth; + + /** 工具接触区域的高度。 */ + int32_t toolHeight; + + /** 输入设备上的X坐标。 */ + int32_t rawX; + + /** 输入设备上的Y坐标。 */ + int32_t rawY; + + /** 工具类型。 */ + ArkUI_NodeToolType toolType; +} ArkUI_NodeTouchPoint; + +/** + * @brief 定义触屏事件类型的枚举值。 + * + * @since 12 + */ +typedef enum { + /** 触摸取消。 */ + NODE_ACTION_CANCEL = 0, + /** 触摸按下。 */ + NODE_ACTION_DOWN = 1, + /** 触摸移动。 */ + NODE_ACTION_MOVE = 2, + /** 触摸抬起。 */ + NODE_ACTION_UP = 3, +} ArkUI_NodeTouchEventAction; + +/** + * @brief 定义历史点信息的结构类型。 + * + * @since 12 + */ +typedef struct { + /** 触屏事件类型。*/ + ArkUI_NodeTouchEventAction action; + /** 触屏历史事件时间戳,单位为微秒(us)。*/ + int64_t timeStamp; + /** 历史触摸事件来源类型。*/ + ArkUI_NodeTouchPoint actionTouch; + /** 历史触摸事件来源类型。*/ + ArkUI_NodeSourceType sourceType; +} ArkUI_NodeHistoricalTouchPoint; + +/** + * @brief 定义Touch事件的结构类型。 + * + * @since 12 + */ +typedef struct { + /** 触屏事件的类型。*/ + ArkUI_NodeTouchEventAction action; + + /** 触屏事件时间戳,单位为微秒(us)。 */ + int64_t timeStamp; + + /** 当前触屏事件的触控点信息。*/ + ArkUI_NodeTouchPoint actionTouch; + + /** + * @brief 返回此事件发生时所有屏幕接触点信息。 + * @param points 用来接受数据的指针对象。 + * @return 屏幕接触点数据数组元素数量。 + * @note + * ArkUI会在该函数调用时创建触控点信息数组的堆内存对象并返回指针,开发者需要在使用完成后调用delete[]手动释放内存。 + */ + int32_t (*getTouches)(ArkUI_NodeTouchPoint** points); + + /** + * @brief 返回此事件中的历史点信息。这些是在此事件和上一个事件之间发生的运动。 + * @param historicalPoints 用来接受数据的指针对象。 + * @return 历史点数据数组元素数量。 + * @note + * 框架会在该函数调用时创建历史点数据数组的堆内存对象并返回指针,开发者需要在使用完成后调用delete[]手动释放内存。 + */ + int32_t (*getHistoricalPoints)(ArkUI_NodeHistoricalTouchPoint** historicalPoints); + + /** 触发事件来源的类型。*/ + ArkUI_NodeSourceType sourceType; + + /** 阻止事件进一步向父节点冒泡处理。*/ + bool stopPropagation; + + /** 阻止当前节点的默认事件处理行为,允许事件进一步向上冒泡。*/ + bool preventDefault; +} ArkUI_NodeTouchEvent; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_EVENT +/** @} */ diff --git a/zh-cn/native_sdk/ace/native_interface.h b/zh-cn/native_sdk/ace/native_interface.h new file mode 100644 index 00000000..321db3ef --- /dev/null +++ b/zh-cn/native_sdk/ace/native_interface.h @@ -0,0 +1,123 @@ +/* + * 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 提供ArkUI在Native侧的UI能力,如UI组件创建销毁、树节点操作,属性设置,事件监听等。 + * + * @since 12 + */ + +/** + * @file native_interface.h + * + * @brief 提供NativeModule接口的统一入口函数。 + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_INTERFACE_H +#define ARKUI_NATIVE_INTERFACE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 定义任意版本的Native接口类型。 + * + * @since 12 + */ +typedef struct { + /** + * @brief 定义Native接口集合的版本信息。 + * + * 不同于NDK版本,NativeNode接口的version字段标识自身结构体的版本信息。 + */ + int32_t version; +} ArkUI_AnyNativeAPI; + +/** + * @brief 定义Native接口集合类型。 + * + * @since 12 + */ +typedef enum { + /** UI组件相关接口类型。*/ + ARKUI_NATIVE_NODE, +} ArkUI_NativeAPIVariantKind; + +/** + * @brief 定义ARKUI_NATIVE_NODE类型支持的版本号信息。 + * + * @since 12 + */ +typedef enum { + /** ARKUI_NATIVE_NODE类型支持版本1的结构体{@link ArkUI_NativeNodeAPI_1}。*/ + ARKUI_NATIVE_NODE_VERSION_1, +} ArkUI_NativeNodeAPIVersion; + +/** + * @brief 获取指定版本的Native接口集合。 + * + * @param type ArkUI提供的Native接口集合大类,例如UI组件接口类:ARKUI_NATIVE_NODE。 + * @param version native接口结构体的版本信息,通过结构体定义的后缀获得,如版本1的UI组件结构体:ArkUI_NativeNodeAPI_1。 + * @return ArkUI_AnyNativeAPI* 返回携带版本的Native接口抽象对象。 + * @code {.cpp} + * #include + * #include + * + * auto anyNativeAPI = OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1); + * if (anyNativeAPI->version == 1) { + * auto basicNodeApi = reinterpret_cast(anyNativeAPI); + * } + * @endcode + * + * @since 12 + */ +ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32_t version); + +/** + * @brief 获取指定版本的Native模块接口集合。 + * + * @param type ArkUI提供的Native接口集合大类,例如UI组件接口类:ARKUI_NATIVE_NODE。 + * @param version native接口结构体的版本信息,通过结构体支持的版本枚举获得,如ARKUI_NATIVE_NODE的可用版本{@link ARKUI_NATIVE_NODE_VERSION_1}。 + * @return ArkUI_AnyNativeAPI* 返回携带版本的Native接口抽象对象。 + * @code {.cpp} + * #include + * #include + * + * auto anyNativeAPI = OH_ArkUI_QueryModuleInterface(ARKUI_NATIVE_NODE, ARKUI_NATIVE_NODE_VERSION_1); + * if (anyNativeAPI->version == ARKUI_NATIVE_NODE_VERSION_1) { + * auto nativeNodeApi = reinterpret_cast(anyNativeAPI); + * } + * @endcode + * + * @since 12 + */ +ArkUI_AnyNativeAPI* OH_ArkUI_QueryModuleInterface(ArkUI_NativeAPIVariantKind type, int32_t version); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_INTERFACE_H +/** @} */ diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index da9f47bd..89967d3b 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -38,6 +38,9 @@ #include #include + +#include "arkui/native_type.h" + #include "native_xcomponent_key_event.h" #ifdef __cplusplus @@ -577,6 +580,30 @@ int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* compone */ int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* component); +/** + * @brief 将通过ArkUI的native接口创建出来的UI组件挂载到当前XComponent上。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param root 指向Native接口创建的组件实例的指针。 + * @return 0 - 成功。 + * 401 - 参数异常。 + * + * @since 12 + */ +int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); + +/** + * @brief 将ArkUI的native组件从当前XComponent上卸载. + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param root 指向Native接口创建的组件实例的指针。 + * @return 0 - 成功。 + * 401 - 参数异常。 + * + * @since 12 + */ +int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); + #ifdef __cplusplus }; #endif diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h new file mode 100644 index 00000000..4a9fd523 --- /dev/null +++ b/zh-cn/native_sdk/ace/native_node.h @@ -0,0 +1,5247 @@ +/* + * 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 提供ArkUI在Native侧的UI能力,如UI组件创建销毁、树节点操作,属性设置,事件监听等。 + * + * @since 12 + */ + +/** + * @file native_node.h + * + * @brief 提供NativeNode接口的类型定义。 + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_NODE_H +#define ARKUI_NATIVE_NODE_H + +#include "native_event.h" +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_NODE_SCOPE_NUM 1000 + +/** + * @brief 提供ArkUI在Native侧可创建组件类型。 + * + * @since 12 + */ +typedef enum { + /** 自定义节点。 */ + ARKUI_NODE_CUSTOM = 0, + /** 文本。 */ + ARKUI_NODE_TEXT = 1, + /** 文本段落。 */ + ARKUI_NODE_SPAN = 2, + /** 文本图片段落。 */ + ARKUI_NODE_IMAGE_SPAN = 3, + /** 图片。 */ + ARKUI_NODE_IMAGE = 4, + /** 状态开关。 */ + ARKUI_NODE_TOGGLE = 5, + /** 等待图标。 */ + ARKUI_NODE_LOADING_PROGRESS = 6, + /** 单行文本输入。 */ + ARKUI_NODE_TEXT_INPUT = 7, + /** 多行文本。 */ + ARKUI_NODE_TEXT_AREA = 8, + /** 按钮。 */ + ARKUI_NODE_BUTTON = 9, + /** 进度条。 */ + ARKUI_NODE_PROGRESS = 10, + /** 复选框。 */ + ARKUI_NODE_CHECKBOX = 11, + /** XComponent。 */ + ARKUI_NODE_XCOMPONENT = 12, + /** 日期选择器组件。 */ + ARKUI_NODE_DATE_PICKER = 13, + /** 时间选择组件。 */ + ARKUI_NODE_TIME_PICKER = 14, + /** 滑动选择文本内容的组件。 */ + ARKUI_NODE_TEXT_PICKER = 15, + /** 日历选择器组件。*/ + ARKUI_NODE_CALENDAR_PICKER = 16, + /** 滑动条组件 */ + ARKUI_NODE_SLIDER = 17, + /** 堆叠容器。 */ + ARKUI_NODE_STACK = MAX_NODE_SCOPE_NUM, + /** 翻页容器。 */ + ARKUI_NODE_SWIPER, + /** 滚动容器。 */ + ARKUI_NODE_SCROLL, + /** 列表。 */ + ARKUI_NODE_LIST, + /** 列表项。 */ + ARKUI_NODE_LIST_ITEM, + /** 列表item分组。 */ + ARKUI_NODE_LIST_ITEM_GROUP, + /** 垂直布局容器。 */ + ARKUI_NODE_COLUMN, + /** 水平布局容器。 */ + ARKUI_NODE_ROW, + /** 弹性布局容器。 */ + ARKUI_NODE_FLEX, + /** 刷新组件。 */ + ARKUI_NODE_REFRESH, +} ArkUI_NodeType; + +/** + * @brief 定义{@link setAttribute}函数通用入参结构。 + * + * @since 12 + */ +typedef struct { + /** 数字类型数组。*/ + const ArkUI_NumberValue* value; + /** 数字类型数组大小。*/ + int32_t size; + /** 字符串类型。*/ + const char* string; + /** 对象类型。*/ + void* object; +} ArkUI_AttributeItem; + +/** + * @brief 定义ArkUI在Native侧可以设置的属性样式集合。 + * + * @since 12 + */ +typedef enum { + /** + * @brief 宽度属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:宽度数值,单位为vp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:宽度数值,单位为vp;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 1.2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_WIDTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_WIDTH); + * auto nodeWidth = item->value[0].f32; + * @endcode + * + */ + NODE_WIDTH = 0, + /** + * @brief 高度属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:高度数值,单位为vp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:高度数值,单位为vp;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 1.2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_HEIGHT, &item);clang-tid + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_HEIGHT); + * auto nodeHeight = item->value[0].f32; + * @endcode + * + */ + NODE_HEIGHT, + /** + * @brief 背景色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:背景色数值,0xargb格式,形如 0xFFFF0000 表示红色;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:背景色数值,0xargb格式,形如 0xFFFF0000 表示红色;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); + * auto nodeBackgroundColor = item->value[0].u32; + * @endcode + * + */ + NODE_BACKGROUND_COLOR, + /** + * @brief 背景色图片属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 图片地址;\n + * .value[0]?.i32:可选值,repeat参数,参数类型{@link ArkUI_ImageRepeat},默认值为ARKUI_IMAGE_REPEAT_NONE;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 图片地址;\n + * .value[0].i32:repeat参数,参数类型{@link ArkUI_ImageRepeat};\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_IMAGE_REPEAT_NONE} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); + * auto nodeBackgroundImageUrl = item->string; + * auto nodeBackgroundImageRepeat = item->value[0].i32; + * @endcode + * + */ + NODE_BACKGROUND_IMAGE, + /** + * @brief 内间距属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式有两种:\n + * 1:上下左右四个位置的内间距值相等。\n + * .value[0].f32:内间距数值,单位为vp;\n + * 2:分别指定上下左右四个位置的内间距值。\n + * .value[0].f32:上内间距数值,单位为vp;\n + * .value[1].f32:右内间距数值,单位为vp;\n + * .value[2].f32:下内间距数值,单位为vp;\n + * .value[3].f32:左内间距数值,单位为vp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:上内间距数值,单位为vp;\n + * .value[1].f32:右内间距数值,单位为vp;\n + * .value[2].f32:下内间距数值,单位为vp;\n + * .value[3].f32:左内间距数值,单位为vp;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value1[] = { 1, 2, 3, 4}; + * ArkUI_AttributeItem item1 = { value1, sizeof(value1)/sizeof(ArkUI_NumberValue) }; + * ArkUI_NumberValue value2[] = { 10 }; + * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item1); + * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item2); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PADDING); + * auto nodePaddingTop = item->value[0].f32; + * @endcode + * + */ + NODE_PADDING, + /** + * @brief 组件ID属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: ID的内容;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: ID的内容;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "test" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ID, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ID); + * auto nodeId = item->string; + * @endcode + * + */ + NODE_ID, + /** + * @brief 设置组件是否可交互,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false表示不可交互,true表示可交互;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:0表示不可交互,1表示可交互;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = false} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ENABLED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ENABLED); + * auto nodeEnabled = item->value[0].i32; + * @endcode + */ + NODE_ENABLED, + /** + * @brief 外间距属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式有两种:\n + * 1:上下左右四个位置的外间距值相等。\n + * .value[0].f32:外间距数值,单位为vp;\n + * 2:分别指定上下左右四个位置的外间距值。\n + * .value[0].f32:上外间距数值,单位为vp;\n + * .value[1].f32:右外间距数值,单位为vp;\n + * .value[2].f32:下外间距数值,单位为vp;\n + * .value[3].f32:左外间距数值,单位为vp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:上外间距数值,单位为vp;\n + * .value[1].f32:右外间距数值,单位为vp;\n + * .value[2].f32:下外间距数值,单位为vp;\n + * .value[3].f32:左外间距数值,单位为vp;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value1[] = { 1, 2, 3, 4}; + * ArkUI_AttributeItem item1 = { value1, sizeof(value1)/sizeof(ArkUI_NumberValue) }; + * ArkUI_NumberValue value2[] = { 10 }; + * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item1); + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item2); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_MARGIN); + * auto nodeMarginTop = item->value[0].f32; + * @endcode + * + */ + NODE_MARGIN, + /** + * @brief 设置组件平移,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: x轴移动距离,单位vp,默认值0;\n + * .value[1].f32: y轴移动距离,单位vp,默认值0;\n + * .value[2].f32: z轴移动距离,单位vp,默认值0。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32: x轴移动距离,单位vp;\n + * .value[1].f32: y轴移动距离,单位vp;\n + * .value[2].f32: z轴移动距离,单位vp。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 100, 20, 0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE); + * auto nodeTranslate = item->value[0].f32; + * @endcode + * + */ + NODE_TRANSLATE, + /** + * @brief 设置组件缩放,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: x轴的缩放系数,默认值1;\n + * .value[1].f32: y轴的缩放系数,默认值1。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32: x轴的缩放系数;\n + * .value[1].f32: y轴的缩放系数。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 1.0, 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE); + * auto nodeScale = item->value[0].f32; + * @endcode + * + */ + NODE_SCALE, + /** + * @brief 设置组件旋转,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 旋转轴向量x坐标,默认值0;\n + * .value[1].f32: 旋转轴向量y坐标,默认值0;\n + * .value[2].f32: 旋转轴向量z坐标,默认值0;\n + * .value[3].f32: 旋转角度,默认值0;\n + * .value[4].f32: 视距,即视点到z=0平面的距离,单位vp,默认值0。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 旋转轴向量x坐标;\n + * .value[1].f32: 旋转轴向量y坐标;\n + * .value[2].f32: 旋转轴向量z坐标;\n + * .value[3].f32: 旋转角度;\n + * .value[4].f32: 视距,即视点到z=0平面的距离,单位vp。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 0, 0, 1, 300, 0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE); + * auto nodeRotate = item->value[0].f32; + * @endcode + * + */ + NODE_ROTATE, + /** + * @brief 设置组件高光效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 亮度值,默认值1.0,推荐取值范围[0,2]。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 亮度值。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 1.2 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BRIGHTNESS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BRIGHTNESS); + * auto nodeBrightness = item->value[0].f32; + * @endcode + * + */ + NODE_BRIGHTNESS, + /** + * @brief 设置组件饱和度效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 饱和度值,默认值1.0,推荐取值范围[0,FLT_MAX]。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 饱和度值。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 1.0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SATURATION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SATURATION); + * auto nodeSaturate = item->value[0].f32; + * @endcode + * + */ + NODE_SATURATION, + /** + * @brief 设置组件内容模糊效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 模糊半径,模糊半径越大越模糊,为0时不模糊。单位vp,默认值0.0。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 模糊半径,模糊半径越大越模糊,为0时不模糊。单位vp。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 1.0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BLUR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLUR); + * auto nodeBlur = item->value[0].f32; + * @endcode + * + */ + NODE_BLUR, + /** + * @brief 设置组件颜色渐变效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 字符串组合参数,入参4个,以分号分割:\n + * 入参1: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。颜色和位置(单位vp)数组类型,以逗号分割;\n + * 入参2: 线性渐变的起始角度。0点方向顺时针旋转为正向角度,默认值:180;\n + * 入参3: + * 线性渐变的方向,设置angle后不生效。取值("left","top","right","bottom","left-top","left-bottom","right-top",\n + * "right-bottom","none", 默认值 "bottom");\n + * 入参4: 为渐变的颜色重复着色,默认值 false;\n + * 如 "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" 。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * * .string: 字符串组合参数,入参4个,以分号分割:\n + * 入参1: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。颜色和位置(单位vp)数组类型,以逗号分割;\n + * 入参2: 线性渐变的起始角度。0点方向顺时针旋转为正向角度;\n + * 入参3: 线性渐变的方向,设置angle后不生效;\n + * 入参4: 为渐变的颜色重复着色。\n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LINEAR_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LINEAR_GRADIENT); + * auto nodeLinearGradient = item->string; + * @endcode + * + */ + NODE_LINEAR_GRADIENT, + /** + * @brief 设置组件内容在元素绘制区域内的对齐方式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 对齐方式,数据类型{@link ArkUI_Alignment},默认值ARKUI_ALIGNMENT_CENTER。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 对齐方式,数据类型{@link ArkUI_Alignment}。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGNMENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT); + * auto nodeAlign = item->value[0].i32; + * @endcode + * + */ + NODE_ALIGNMENT, + /** + * @brief 透明度属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:透明度数值,取值范围为0到1。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:透明度数值,取值范围为0到1。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY); + * auto nodeOpacity = item->value[0].f32; + * @endcode + * + */ + NODE_OPACITY, + /** + * @brief 边框宽度属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * 1: .value[0].f32:统一设置四条边的边框宽度。 \n + * 2: .value[0].f32:设置上边框的边框宽度。 \n + * .value[1].f32:设置右边框的边框宽度。 \n + * .value[2].f32:设置下边框的边框宽度。 \n + * .value[3].f32:设置左边框的边框宽度。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:设置上边框的边框宽度。 \n + * .value[1].f32:设置右边框的边框宽度。 \n + * .value[2].f32:设置下边框的边框宽度。 \n + * .value[3].f32:设置左边框的边框宽度。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); + * ArkUI_NumberValue value[] = { 5, 5, 10, 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_WIDTH); + * auto nodeBorderWitdh = item->value[0].f32; + * @endcode + * + */ + NODE_BORDER_WIDTH, + /** + * @brief 边框圆角属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * 1: .value[0].f32:统一设置四条边的边框圆角。 \n + * 2: .value[0].f32:设置左上角圆角半径。 \n + * .value[1].f32:设置右上角圆角半径。 \n + * .value[2].f32:设置左下角圆角半径。 \n + * .value[3].f32:设置右下角圆角半径。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:设置左上角圆角半径。 \n + * .value[1].f32:设置右上角圆角半径。 \n + * .value[2].f32:设置左下角圆角半径。 \n + * .value[3].f32:设置右下角圆角半径。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); + * ArkUI_NumberValue value[] = { 5, 5, 10, 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_RADIUS); + * auto nodeBorderRadius = item->value[0].f32; + * @endcode + * + */ + NODE_BORDER_RADIUS, + /** + * @brief 边框颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * 1: .value[0].u32:统一设置四条边的边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * 2: .value[0].u32:设置上侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * .value[1].u32:设置右侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * .value[2].u32:设置下侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * .value[3].u32:设置左侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].u32:设置上侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * .value[1].u32:设置右侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * .value[2].u32:设置下侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * .value[3].u32:设置左侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32 = 0xFFFF11FF} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); + * ArkUI_NumberValue value[] = { {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFFFFFF}, {.u32 = 0x000000} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_COLOR); + * auto nodeBorderColor = item->value[0].u32; + * @endcode + * + */ + NODE_BORDER_COLOR, + /** + * @brief 边框线条样式属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * 1: .value[0].i32:统一设置四条边的边框线条样式,参数类型{@link ArkUI_BorderStyle},默认值为ARKUI_BORDER_STYLE_SOLID。 \n + * 2:.value[0].i32:设置上侧边框线条样式,参数类型{@linkArkUI_BorderStyle},默认值为ARKUI_BORDER_STYLE_SOLID。 \n + * .value[1].i32:设置右侧边框线条样式,参数类型{@link ArkUI_BorderStyle},默认值为ARKUI_BORDER_STYLE_SOLID。 \n + * .value[2].i32:设置下侧边框线条样式,参数类型{@link ArkUI_BorderStyle},默认值为ARKUI_BORDER_STYLE_SOLID。 \n + * .value[3].i32:设置左侧边框线条样式,参数类型{@link ArkUI_BorderStyle},默认值为ARKUI_BORDER_STYLE_SOLID。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:上侧边框线条样式对应的数值。 \n + * .value[1].i32:右侧边框线条样式对应的数值。 \n + * .value[2].i32:下侧边框线条样式对应的数值。 \n + * .value[3].i32:左侧边框线条样式对应的数值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_BORDER_STYLE_DOTTED} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_BORDER_STYLE_DOTTED}, {.i32 = ARKUI_BORDER_STYLE_SOLID}, + * {.i32 = ARKUI_BORDER_STYLE_SOLID}, {.i32 = ARKUI_BORDER_STYLE_DOTTED} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_STYLE); + * auto nodeBorderStyle = item->value[0].i32; + * @endcode + * + */ + NODE_BORDER_STYLE, + /** + * @brief 组件的堆叠顺序属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:堆叠顺序数值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:堆叠顺序数值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_Z_INDEX, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_Z_INDEX); + * auto nodeZIndex = item->value[0].f32; + * @endcode + * + */ + NODE_Z_INDEX, + /** + * @brief 组件是否可见属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制当前组件显示或隐藏,参数类型{@link ArkUI_Visibility},默认值为ARKUI_VISIBILITY_VISIBLE。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制当前组件显示或隐藏,参数类型{@link ArkUI_Visibility},默认值为ARKUI_VISIBILITY_VISIBLE。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_VISIBILITY_NONE} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_VISIBILITY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_VISIBILITY); + * auto nodeVisibility = item->value[0].i32; + * @endcode + * + */ + NODE_VISIBILITY, + /** + * @brief 组件进行裁剪、遮罩处理属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制是否按照父容器边缘轮廓进行裁剪,0表示不裁切,1表示裁切。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制是否按照父容器边缘轮廓进行裁剪,0表示不裁切,1表示裁切。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 0} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); + * auto nodeClip = item->value[0].i32; + * @endcode + * + */ + NODE_CLIP, + /** + * @brief 组件进行裁剪、遮罩处理属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .string:形状描述,可选: \n + * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n + * "circle(10,10)"括号内分别为width、height; \n + * "ellipse(10,10)"括号内分别为width、height; \n + * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .string:形状描述: \n + * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n + * "circle(10,10)"括号内分别为width、height; \n + * "ellipse(10,10)"括号内分别为width、height; \n + * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "rect(10,10,10,10)" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP_SHAPE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); + * auto nodeClipShape = item->string; + * @endcode + * + */ + NODE_CLIP_SHAPE, + /** + * @brief 矩阵变换功能,可对图形进行平移、旋转和缩放等,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .data[0...15].f32: 16个浮点数字。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .data[0...15].f32: 16个浮点数字。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + * {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM); + * auto nodeTransform = item[0].value; + * @endcode + * + */ + NODE_TRANSFORM, + /** + * @brief 触摸测试类型,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制当前组件的触摸测试类型,参数类型{@link ArkUI_HitTestMode},默认值为ARKUI_HIT_TEST_MODE_DEFAULT。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制当前组件的触摸测试类型,参数类型{@link ArkKUI_HitTestMode},默认值为ARKUI_HIT_TEST_MODE_DEFAULT。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_HIT_TEST_MODE_BLOCK} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR); + * auto nodeHitTestBehavior = item->value[0].i32; + * @endcode + * + */ + NODE_HIT_TEST_BEHAVIOR, + /** + * @brief 元素左上角相对于父容器左上角偏移位置,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:x轴坐标。 \n + * .value[1].f32: y轴坐标。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:x轴坐标。 \n + * .value[1].f32: y轴坐标。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 50, 50 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_POSITION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_POSITION); + * auto nodePositionX = item->value[0].f32; + * auto nodePositionY = item->value[1].f32; + * @endcode + * + */ + NODE_POSITION, + /** + * @brief 阴影效果属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:设置当前组件阴影效果,参数类型{@link ArkUI_ShadowStyle}。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:设置当前组件阴影效果,参数类型{@link ArkUI_ShadowStyle}。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SHADOW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SHADOW); + * auto nodePositionX = item->value[0].i32; + * @endcode + * + */ + NODE_SHADOW, + /** + * @brief 自定义阴影效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .string: 字符串组合参数,入参6个,以分号分割: \n + * 入参1:阴影模糊半径。 \n + * 入参2:阴影的X轴偏移量。 \n + * 入参3:阴影的Y轴偏移量。 \n + * 入参4:阴影类型。 \n + * 入参5:阴影的颜色。 \n + * 入参6:阴影是否内部填充。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .string: 字符串组合参数,入参6个,以分号分割: \n + * 入参1:阴影模糊半径。 \n + * 入参2:阴影的X轴偏移量。 \n + * 入参3:阴影的Y轴偏移量。 \n + * 入参4:阴影类型。 \n + * 入参5:阴影的颜色。 \n + * 入参6:阴影是否内部填充。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "5; 10; 10; COLOR; #FFF00FFF; true" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); + * auto nodeCustomShadow = item->string; + * @endcode + * + */ + NODE_CUSTOM_SHADOW, + /** + * @brief 背景图片的宽高属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示图片的宽度值,取值范围[0,+∞),单位为vp。\n + * .value[1].f32 表示图片的高度值,取值范围[0,+∞),单位为vp。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示图片的宽度值,单位为vp。\n + * .value[1].f32 表示图片的高度值,单位为vp。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue sizeArray[] = { 20, 0 } + * ArkUI_AttributeItem item = { .value = sizeArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); + * auto width = item->value[0].f32; + * @endcode + * + */ + NODE_BACKGROUND_IMAGE_SIZE, + /** + * @brief 背景图片的宽高样式属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示背景图片的宽高样式,取{@link ArkUI_ImageSize}枚举值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示背景图片的宽高样式,取{@link ArkUI_ImageSize}枚举值。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue imageSizeStyle[] = { {.i32 = static_cast(ARKUI_IMAGE_SIZE_COVER) } } + * ArkUI_AttributeItem item = { .value = imageSizeStyle, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); + * auto blurStyle = item->value[0].i32 + * @endcode + */ + NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, + /** + * @brief 背景和内容之间的模糊属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示模糊类型,取{@link ArkUI_BlurStyle}枚举值。\n + * .value[1]?.i32 表示深浅色模式,取{@link ArkUI_ColorMode}枚举值。\n + * .value[2]?.i32 表示取色模式,取{@link ArkUI_AdaptiveColor}枚举值。\n + * .value[3]?.f32 表示模糊效果程度,取[0.0,1.0]范围内的值。\n + * .value[4]?.f32 表示灰阶模糊起始边界。\n + * .value[5]?.f32 表示灰阶模糊终点边界。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示模糊类型,取{@link ArkUI_BlurStyle}枚举值。\n + * .value[1]?.i32 表示深浅色模式,取{@link ArkUI_ColorMode}枚举值。\n + * .value[2]?.i32 表示取色模式,取{@link ArkUI_AdaptiveColor}枚举值。\n + * .value[3]?.f32 表示模糊效果程度,取[0.0,1.0]范围内的值。\n + * .value[4]?.f32 表示灰阶模糊起始边界。\n + * .value[5]?.f32 表示灰阶模糊终点边界。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue blurStyle[] = { { .i32 = static_cast(ARKUI_BLUR_STYLE_THICK)}} + * ArkUI_AttributeItem item = { .value = blurStyle, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); + * auto blurStyle = item->value[0].i32 + * @endcode + * + */ + NODE_BACKGROUND_BLUR_STYLE, + /** + * @brief 图形变换和转场的中心点属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.f32 表示中心点X轴坐标值,单位为vp \n + * .value[1]?.f32 表示中心点Y轴坐标,单位为vp \n + * .value[2]?.f32 表示中心点Z轴坐标,单位为vp \n + * .value[3]?.f32 表示中心点X轴坐标的百分比位置,如0.2表示百分之20的位置,该属性覆盖value[0].f32,默认值:0.5f。\n + * .value[4]?.f32 表示中心点Y轴坐标的百分比位置,如0.2表示百分之20的位置,该属性覆盖value[1].f32,默认值:0.5f。\n + * .value[5]?.f32 表示中心点Z轴坐标的百分比位置,如0.2表示百分之20的位置,该属性覆盖value[2].f32,默认值:0.0f。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.f32 表示中心点X轴坐标,单位为vp \n + * .value[1]?.f32 表示中心点Y轴坐标,单位为vp \n + * .value[2]?.f32 表示中心点Z轴坐标,单位为vp \n + * 注:如果设置坐标百分比位置,属性获取方法返回计算后的vp为单位的值。 + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue centerPointArray[] = { 20 }; + * ArkUI_AttributeItem item = { .value = centerPointArray, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM_CENTER , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM_CENTER); + * auto centerX = item->value[0].f32; + * @endcode + */ + NODE_TRANSFORM_CENTER, + /** + * @brief 转场时的透明度效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示起终点的透明度值 \n + * .value[1].i32 表示动画时长,单位ms \n + * .value[2].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值 \n + * .value[3]?.i32 表示动画延迟时长,单位ms \n + * .value[4]?.i32 表示动画播放次数 \n + * .value[5]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值 \n + * .value[6]?.f32 表示动画播放速度 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示起终点的透明度值 \n + * .value[1].i32 表示动画时长,单位ms \n + * .value[2].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值 \n + * .value[3]?.i32 表示动画延迟时长,单位ms \n + * .value[4]?.i32 表示动画播放次数 \n + * .value[5]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值 \n + * .value[6]?.f32 表示动画播放速度 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue opacityTransition[] = { 20, { .i32 = 3000}, + * { .i32 = static_cast(ARKUI_CURVE_EASE_IN_OUT)}}; + * ArkUI_AttributeItem item = { .value = opacityTransition, .size = 3}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY_TRANSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); + * auto opacity = item->value[0].f32; + * @endcode + */ + NODE_OPACITY_TRANSITION, + /** + * @brief 转场时的旋转效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示横向旋转分量。\n + * .value[1].f32 表示纵向的旋转分量。\n + * .value[2].f32 表示竖向的旋转分量。\n + * .value[3].f32 表示角度。\n + * .value[4].f32 表示视距,默认值:0.0f。\n + * .value[5].i32 表示动画时长,单位ms。\n + * .value[6].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n + * .value[7]?.i32 表示动画延迟时长,单位ms。\n + * .value[8]?.i32 表示动画播放次数。\n + * .value[9]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * .value[10]?.f32 表示动画播放速度。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示横向旋转分量。\n + * .value[1].f32 表示纵向的旋转分量。\n + * .value[2].f32 表示竖向的旋转分量。\n + * .value[3].f32 表示角度。\n + * .value[4].f32 表示视距。\n + * .value[5].i32 表示动画时长,单位ms。\n + * .value[6].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n + * .value[7]?.i32 表示动画延迟时长,单位ms。\n + * .value[8]?.i32 表示动画播放次数。\n + * .value[9]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * .value[10]?.f32 表示动画播放速度。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue rotateTransition[] = { 0.0f, 0.0f, 1.0f, 180, 0, { .i32 = 3000}, + * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; + * ArkUI_AttributeItem item = { .value = rotateTransition, .size = 7}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE_TRANSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); + * auto rotateX = item->value[0].f32; + * @endcode + */ + NODE_ROTATE_TRANSITION, + /** + * @brief 转场时的缩放效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 横向放大倍数。\n + * .value[1].f32 纵向放大倍数。\n + * .value[2].f32 竖向放大倍数。\n + * .value[3].i32 表示动画时长,单位ms。\n + * .value[4].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n + * .value[5]?.i32 表示动画延迟时长,单位ms。\n + * .value[6]?.i32 表示动画播放次数。\n + * .value[7]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * .value[8]?.f32 表示动画播放速度。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 横向放大倍数。\n + * .value[1].f32 纵向放大倍数。\n + * .value[2].f32 竖向放大倍数。\n + * .value[3].i32 表示动画时长,单位ms。\n + * .value[4].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n + * .value[5]?.i32 表示动画延迟时长,单位ms。\n + * .value[6]?.i32 表示动画播放次数。\n + * .value[7]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * .value[8]?.f32 表示动画播放速度。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue scaleTransition[] = { 0.0f, 0.0f, 0.0f, { .i32 = 3000}, + * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; + * ArkUI_AttributeItem item = { .value = scaleTransition, .size = 5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE_TRANSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); + * auto scaleX = item->value[0].f32; + * @endcode + */ + NODE_SCALE_TRANSITION, + /** + * @brief 转场时的平移效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * value[0].f32 表示横向平移距离值,单位为vp \n + * value[1].f32 表示纵向平移距离值,单位为vp \n + * value[2].f32 表示竖向平移距离值,单位为vp \n + * value[3].i32 表示动画时长,单位ms。\n + * value[4].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n + * value[5]?.i32 表示动画延迟时长,单位ms。\n + * value[6]?.i32 表示动画播放次数。\n + * value[7]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * value[8]?.f32 表示动画播放速度。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * value[0].f32 表示横向平移距离值,单位为vp \n + * value[1].f32 表示纵向平移距离值,单位为vp \n + * value[2].f32 表示竖向平移距离值,单位为vp \n + * value[3].i32 表示动画时长,单位ms。\n + * value[4].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n + * value[5]?.i32 表示动画延迟时长,单位ms。\n + * value[6]?.i32 表示动画播放次数。\n + * value[7]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * value[8]?.f32 表示动画播放速度。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue translateTransition[] = { 0.0f, 0.0f, 0.0f, + * { .i32 = 3000}, { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; + * ArkUI_AttributeItem item = { .value = translateTransition, .size = 5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); + * auto translateX = item->value[0].f32; + * @endcode + */ + NODE_TRANSLATE_TRANSITION, + + /** + * @brief 获焦属性,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:参数类型为1或者0。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:参数类型为1或者0。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUSABLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUSABLE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_FOCUSABLE, + + /** + * @brief 默认焦点属性,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * value[0].i32:参数类型为1或者0。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * value[0].i32:参数类型为1或者0。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DEFAULT_FOCUS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DEFAULT_FOCUS); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_DEFAULT_FOCUS, + + /** + * @brief 触摸热区属性,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .data[0].f32:触摸点相对于组件左上角的x轴坐标,单位为vp。 \n + * .data[1].f32:触摸点相对于组件左上角的y轴坐标,单位为vp。 \n + * .data[2].f32:触摸热区的宽度 ,单位为%。 \n + * .data[3].f32:触摸热区的高度,单位为%。 \n + * .data[4...].f32:可以设置多个手势响应区域,顺序和上述一致。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .data[0].f32:触摸点相对于组件左上角的x轴坐标,单位为vp。 \n + * .data[1].f32:触摸点相对于组件左上角的y轴坐标,单位为vp。 \n + * .data[2].f32:触摸热区的宽度 ,单位为%。 \n + * .data[3].f32:触摸热区的高度,单位为%。 \n + * .data[4...].f32:可以设置多个手势响应区域,顺序和上述一致。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0, 0, 100, 100 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); + * + * ArkUI_NumberValue value[] = { 0, 0, 100, 100, 0, 0, 100, 100 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RESPONSE_REGION); + * auto x = item->value[0].f32; + * auto y = item->value[1].f32; + * auto width = item->value[2].f32; + * auto height = item->value[3].f32; + * @endcode + * + */ + NODE_RESPONSE_REGION, + + /** + * @brief 遮罩文本属性,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .string 遮罩文本;\n + * .value[0]?.i32:可选值,浮层相对于组件的位置,参数类型{@link ArkUI_Alignment}, + * 默认值为ARKUI_ALIGNMENT_TOP_START。 \n + * .value[1]?.f32:可选值,浮层基于自身左上角的偏移量X,单位为vp。 \n + * .value[2]?.f32:可选值,浮层基于自身左上角的偏移量Y,单位为vp。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .string 遮罩文本; \n + * .value[0]?.i32:可选值,浮层相对于组件的位置,参数类型{@link ArkUI_Alignment}, + * 默认值为ARKUI_ALIGNMENT_TOP_START。 \n + * .value[1]?.f32:可选值,浮层基于自身左上角的偏移量X,单位为vp。 \n + * .value[2]?.f32:可选值,浮层基于自身左上角的偏移量Y,单位为vp。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_TOP_START }, 1.2, 0.3 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OVERLAY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OVERLAY); + * auto text = item->string; + * @endcode + * + */ + NODE_OVERLAY, + /** + * @brief 角度渐变效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .string: 字符串组合参数,入参7个,以分号分割: \n + * 入参1:指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。 \n + * 入参2:为角度渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标。 \n + * 入参3:为角度渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标。 \n + * 入参4:角度渐变的起点,默认值0。 \n + * 入参5:角度渐变的终点,默认值0。 \n + * 入参6:角度渐变的旋转角度,默认值0。 \n + * 入参7:为渐变的颜色重复着色,默认值 false。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .string: 字符串组合参数: \n + * 入参1:指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。 \n + * 入参2:为角度渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标。 \n + * 入参3:为角度渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标。 \n + * 入参4:角度渐变的起点,默认值0。 \n + * 入参5:角度渐变的终点,默认值0。 \n + * 入参6:角度渐变的旋转角度,默认值0。 \n + * 入参7:为渐变的颜色重复着色,默认值 false。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;5;10;60;180;60;true" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); + * auto nodeSweepGradient = item->string; + * @endcode + * + */ + NODE_SWEEP_GRADIENT, + /** + * @brief 径向渐变渐变效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .string: 字符串组合参数,入5个,以分号分割: \n + * 入参1:指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。 \n + * 入参2:为径向渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标。 \n + * 入参3:为径向渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标。 \n + * 入参4:径向渐变的半径,默认值0。 \n + * 入参5:为渐变的颜色重复着色。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .string: 字符串组合参数: \n + * 入参1:指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。 \n + * 入参2:为径向渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标。 \n + * 入参3:为径向渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标。 \n + * 入参4:径向渐变的半径,默认值0。 \n + * 入参5:为渐变的颜色重复着色。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;5;10;50;true" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RADIAL_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RADIAL_GRADIENT); + * auto nodeRadialGradient = item->string; + * @endcode + * + */ + NODE_RADIAL_GRADIENT, + /** + * @brief 组件上加上指定形状的遮罩,支持属性设置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0]?.u32:可选填充颜色,0xargb类型;\n + * .value[1]?.u32:可选描边颜色,0xargb类型;\n + * .value[2]?.f32:可选描边宽度,单位为vp;\n + * .string:形状描述,可选: \n + * "progressMask(10,10,#ff0000ff)"括号内分别为进度遮罩的当前值,进度遮罩的最大值与进度遮罩的颜色; \n + * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n + * "circle(10,10)"括号内分别为width、height; \n + * "ellipse(10,10)"括号内分别为width、height; \n + * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].u32:填充颜色,0xargb类型;\n + * .value[1].u32:描边颜色,0xargb类型;\n + * .value[2].f32:描边宽度,单位为vp;\n + * .string:形状描述: \n + * "progressMask(10,10,#ff0000ff)"括号内分别为进度遮罩的当前值,进度遮罩的最大值与进度遮罩的颜色; \n + * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n + * "circle(10,10)"括号内分别为width、height; \n + * "ellipse(10,10)"括号内分别为width、height; \n + * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "rect(10,10,10,10)" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MASK, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MASK); + * auto nodeMaskFill = item->value[0].u32; + * auto nodeMaskStrokeColor = item->value[1].u32; + * auto nodeMaskStrokeWidth = item->value[1].f32; + * auto nodeMaskShape = item->string; + * @endcode + * + */ + NODE_MASK, + /** + * @brief 当前控件背景与子节点内容进行混合,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制当前组件的混合模式类型,参数类型{@link ArkUI_BlendMode},默认值为ARKUI_BLEND_MODE_NONE。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制当前组件的混合模式类型,参数类型{@link ArkUI_BlendMode},默认值为ARKUI_BLEND_MODE_NONE。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_BLEND_MODE_NONE} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BLEND_MODE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLEND_MODE); + * auto nodeBlendMode = item->value[0].i32; + * @endcode + * + */ + NODE_BLEND_MODE, + /** + * @brief 设置容器元素内主轴方向上的布局,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:设置容器元素内主轴方向上的布局类型, \n + * 参数类型{@link ArkUI_Direction},默认值为ARKUI_DIRECTION_AUTO。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:设置容器元素内主轴方向上的布局类型, \n + * 参数类型{@link ArkUI_Direction},默认值为ARKUI_DIRECTION_AUTO。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_DIRECTION_RTL} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DIRECTION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DIRECTION); + * auto nodeDirection = item->value[0].i32; + * @endcode + * + */ + NODE_DIRECTION, + /** + * @brief 约束尺寸属性,组件布局时,进行尺寸范围限制,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:最小宽度,单位vp; \n + * .value[1].f32:最大宽度,单位vp; \n + * .value[2].f32:最小高度,单位vp; \n + * .value[3].f32:最大高度,单位vp; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:最小宽度,单位vp; \n + * .value[1].f32:最大宽度,单位vp; \n + * .value[2].f32:最小高度,单位vp; \n + * .value[3].f32:最大高度,单位vp; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0, 5, 0, 5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CONSTRAINT_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); + * auto nodeMinWidth = item->value[0].f32; + * auto nodeMaxWidth = item->value[1].f32; + * auto nodeMinHeight = item->value[2].f32; + * auto nodeMaxHeight = item->value[3].f32; + * @endcode + * + */ + NODE_CONSTRAINT_SIZE, + /** + * @brief 灰度效果属性,支持属性设置,属性重置和属性获取接口. + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:灰度转换比例,范围0-1之间,比如0.5指按照50%进行灰度处理; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:灰度转换比例,范围0-1之间; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_GRAY_SCALE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_GRAY_SCALE); + * auto nodeGrayScale = item->value[0].f32; + * @endcode + */ + NODE_GRAY_SCALE, + /** + * @brief 反转输入的图像比例属性,支持属性设置,属性重置和属性获取接口. + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:图像反转比例,范围0-1之间,比如0.5指按照50%进行反转处理; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:图像反转比例,范围0-1之间; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_INVERT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_INVERT); + * auto nodeInvert = item->value[0].f32; + * @endcode + */ + NODE_INVERT, + /** + * @brief 图像转换为深褐色比例属性,支持属性设置,属性重置和属性获取接口. + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:图像转换为深褐色比例,范围0-1之间,比如0.5指按照50%进行深褐色处理; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:图像转换为深褐色比例,范围0-1之间; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SEPIA, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SEPIA); + * auto nodeSepia = item->value[0].f32; + * @endcode + */ + NODE_SEPIA, + /** + * @brief 对比度属性,支持属性设置,属性重置和属性获取接口. + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:对比度,等于1时为原图,越大则对比度越高; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:对比度; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CONTRAST, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONTRAST); + * auto nodeContrast = item->value[0].f32; + * @endcode + */ + NODE_CONTRAST, + /** + * @brief 前景颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式,支持两种入参格式:\n + * 1:.value[0].u32:颜色数值,0xargb类型,如0xFFFF0000表示红色;\n + * 2:.value[0].i32:颜色数值枚举{@link ArkUI_ColoringStrategy};\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb类型;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { {.u32=0xFFFF0000} }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FOREGROUND_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); + * auto nodeForegroundColor = item->value[0].u32; + * @endcode + */ + NODE_FOREGROUND_COLOR, + + /** + * @brief 组件子元素相对组件自身的额外偏移属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示x轴方向的偏移值, 单位为vp。 \n + * .value[1].f32 表示y轴方向的偏移值, 单位为vp。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示x轴方向的偏移值, 单位为vp。 \n + * .value[1].f32 表示y轴方向的偏移值, 单位为vp。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue offsetArray[] = { 20, 0 }; + * ArkUI_AttributeItem item = { .value = offsetArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OFFSET , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); + * auto offsetX = item->value[0].f32; + * @endcode + * + */ + NODE_OFFSET, + /** + * @brief 组件子元素在位置定位时的锚点属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示锚点x坐标值, 单位为vp \n + * .value[1].f32 表示锚点y坐标值, 单位为vp \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示锚点x坐标值, 单位为vp \n + * .value[1].f32 表示锚点y坐标值, 单位为vp \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue pointArray[] = { 20, 0 }; + * ArkUI_AttributeItem item = { .value = pointArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARK_ANCHOR , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); + * auto pointX = item->value[0].f32; + * @endcode + * + */ + NODE_MARK_ANCHOR, + /** + * @brief 背景图在组件中显示位置,即相对于组件左上角的坐标,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示x轴方向的位置, 单位为vp。 \n + * .value[1].f32 表示y轴方向的位置, 单位为vp。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示x轴方向的位置, 单位为vp。 \n + * .value[1].f32 表示y轴方向的位置, 单位为vp。 \n + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue possitionArray[] = { 20, 0 }; + * ArkUI_AttributeItem item = { .value = possitionArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_POSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_POSITION); + * auto offsetX = item->value[0].f32; + * @endcode + */ + NODE_BACKGROUND_IMAGE_POSITION, + /** + * @brief 相对容器中子组件的对齐规则属性,支持属性设置,属性重置,获取属性接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.i32 左对齐规则锚点组件id。\n + * .value[1]?.i32 左对齐规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[2]?.i32 横向居中规则锚点组件id。\n + * .value[3]?.i32 横向居中规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[4]?.i32 右对齐规则锚点组件id。\n + * .value[5]?.i32 右对齐规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[6]?.i32 顶部对齐规则锚点组件id。\n + * .value[7]?.i32 顶部对齐规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[8]?.i32 纵向居中规则锚点组件id。\n + * .value[9]?.i32 纵向居中规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[10]?.i32 底部对齐规则锚点组件id。\n + * .value[11]?.i32 底部对齐规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[12]?.f32 水平方向的bias值。\n + * .value[13]?.f32 垂直方向的bias值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.i32 左对齐规则锚点组件id。\n + * .value[1]?.i32 左对齐规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[2]?.i32 横向居中规则锚点组件id。\n + * .value[3]?.i32 横向居中规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[4]?.i32 右对齐规则锚点组件id。\n + * .value[5]?.i32 右对齐规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[6]?.i32 顶部对齐规则锚点组件id。\n + * .value[7]?.i32 顶部对齐规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[8]?.i32 纵向居中规则锚点组件id。\n + * .value[9]?.i32 纵向居中规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[10]?.i32 底部对齐规则锚点组件id。\n + * .value[11]?.i32 底部对齐规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[12]?.f32 水平方向的bias值。\n + * .value[13]?.f32 垂直方向的bias值。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue alignRulesArray[] = { { .i32 = 2000}, { .i32 = + * static_cast(ARKUI_HORIZONTAL_ALIGNMENT_START)}}; + * ArkUI_AttributeItem item = { .value = alignRulesArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGN_RULES , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT_RULES); + * auto id = item->value[0].i32; + * @endcode + * + */ + NODE_ALIGN_RULES, + /** + * @brief 设置子组件在父容器交叉轴的对齐格式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:设置子组件在父容器交叉轴的对齐格式类型, \n + * 参数类型{@link ArkUI_ItemAlign},默认值为ARKUI_ITEM_ALIGN_AUTO。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:设置子组件在父容器交叉轴的对齐格式类型, \n + * 参数类型{@link ArkUI_ItemAlign},默认值为ARKUI_ITEM_ALIGN_AUTO。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_ITEM_ALIGN_STRETCH} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGN_SELF, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGN_SELF); + * auto nodeHitTestBehavior = item->value[0].f32; + * @endcode + * + */ + NODE_ALIGN_SELF, + /** + * @brief 组件的基准尺寸,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:组件的基准尺寸数值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:组件的基准尺寸数值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_GROW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_GROW); + * auto nodeFlexGrow = item->value[0].f32; + * @endcode + * + */ + NODE_FLEX_GROW, + /** + * @brief 父容器压缩尺寸分配给此属性所在组件的比例,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:父容器压缩尺寸分配给此属性所在组件的比例数值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:父容器压缩尺寸分配给此属性所在组件的比例数值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_SHRINK, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_SHRINK); + * auto nodeFlexShrink = item->value[0].f32; + * @endcode + * + */ + NODE_FLEX_SHRINK, + /** + * @brief 设置组件的基准尺寸,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:组件的基准尺寸数值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:组件的基准尺寸数值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_BASIS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_BASIS); + * auto nodeFlexBasis = item->value[0].f32; + * @endcode + * + */ + NODE_FLEX_BASIS, + /** + * @brief 无障碍组属性, 支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:为1时表示该组件及其所有子组件为一整个可以选中的组件 + * 无障碍服务将不再关注其子组件内容。参数类型为1或者0。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:为1时表示该组件及其所有子组件为一整个可以选中的组件 + * 无障碍服务将不再关注其子组件内容。参数类型为1或者0。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_GROUP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_GROUP); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_ACCESSIBILITY_GROUP, + + /** + * @brief 无障碍文本属性,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .string:无障碍文本。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:为1时表示该组件及其所有子组件为一整个可以选中的组件 + * 无障碍服务将不再关注其子组件内容。参数类型为1或者0。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "test"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_TEXT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_TEXT); + * auto value = item->string; + * @endcode + * + */ + NODE_ACCESSIBILITY_TEXT, + + /** + * @brief 无障碍重要性属性,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:障碍重要性,参数类型{@link ArkUI_AccessibilityLevel}。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:障碍重要性,参数类型{@link ArkUI_AccessibilityLevel}。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ACCESSIBILITY_LEVEL_AUTO } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_LEVEL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_LEVEL); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_ACCESSIBILITY_LEVEL, + + /** + * @brief 无障碍说明属性,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .string:无障碍说明。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .string:无障碍说明。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "test" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_DESCRIPTION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_DESCRIPTION); + * auto value = item->string; + * @endcode + * + */ + NODE_ACCESSIBILITY_DESCRIPTION, + + /** + * @brief text组件设置文本内容属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string 表示文本内容 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string 表示文本内容 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CONTENT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); + * auto content = item->string + * @endcode + */ + NODE_TEXT_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT, + /** + * @brief 组件字体颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:字体颜色数值,0xargb格式,形如 0xFFFF0000 表示红色;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:字体颜色数值,0xargb格式;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_COLOR); + * auto nodeFontColor = item->value[0].u32; + * @endcode + * + */ + NODE_FONT_COLOR, + /** + * @brief 组件字体大小属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:字体大小数值,单位为fp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:字体大小数值,单位为fp;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_SIZE); + * auto nodeFontSize = item->value[0].f32; + * @endcode + * + */ + NODE_FONT_SIZE, + /** + * @brief 组件字体样式属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:字体样式{@link ArkUI_FontStyle},默认值为ARKUI_FONT_STYLE_NORMAL;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:字体样式{@link ArkUI_FontStyle};\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_STYLE_NORMAL} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_STYLE); + * auto nodeFontStyle = item->value[0].i32; + * @endcode + * + */ + NODE_FONT_STYLE, + /** + * @brief 组件字体粗细属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:字体粗细样式{@link ArkUI_FontWeight},默认值为ARKUI_FONT_WEIGHT_NORMAL;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:字体粗细样式{@link ArkUI_FontWeight};\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_WEIGHT_NORMAL} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_WEIGHT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_WEIGHT); + * auto nodeFontWeight = item->value[0].i32; + * @endcode + * + */ + NODE_FONT_WEIGHT, + /** + * @brief 文本行高属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示lineHeight值,单位为fp \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示lineHeight值,单位为fp \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue lineHeight[] = { 20 }; + * ArkUI_AttributeItem item = { .value = lineHeight, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); + * auto pointX = item->value[0].f32; + * @endcode + */ + NODE_TEXT_LINE_HEIGHT, + /** + * @brief 置文本装饰线样式及其颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:文本装饰线样式{@link ArkUI_TextDecorationType},默认值为ARKUI_TEXT_DECORATION_TYPE_NONE;\n + * .value[1]?.u32:可选值,装饰线颜色,0xargb格式,形如 0xFFFF0000 表示红色;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:文本装饰线样式{@link ArkUI_TextDecorationType};\n + * .value[1].u32:装饰线颜色,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); + * auto nodeDecorationStyle = item->value[0].i32; + * auto nodeDecorationColor = item->value[1].u32; + * @endcode + * + */ + NODE_TEXT_DECORATION, + /** + * @brief 文本大小写属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示文本大小写类型 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示文本大小写类型 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textCase[] = { {.i32 = static_cast(ARKUI_TEXT_CASE_LOWER) } }; + * ArkUI_AttributeItem item = { .value = textCase, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CASE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); + * auto textCase = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_CASE, + /** + * @brief 文本字符间距属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示字符间距值,单位为fp \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32 表示字符间距值,单位为fp \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue letterSpacing[] = { 20 }; + * ArkUI_AttributeItem item = { .value = letterSpacing, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); + * auto letterSpacing = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_LETTER_SPACING, + /** + * @brief 文本最大行数属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示最大行数 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示最大行数 \n + + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue maxLine[] = { { .i32 = 2 } }; + * ArkUI_AttributeItem item = { .value = maxLine, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_LINES , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); + * auto maxLines = item->value[0].i32; + * @endcode + */ + NODE_TEXT_MAX_LINES, + /** + * @brief 文本水平对齐方式, 支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:表示文本水平对齐方式,取{@link ArkUI_TextAlignment}枚举值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:表示文本水平对齐方式,取{@link ArkUI_TextAlignment}枚举值。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue alignMent[] = {{.i32 = static_cast(ARKUI_TEXT_ALIGNMENT_CENTER)}}; + * ArkUI_AttributeItem item = { .value = alignMent, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_ALIGN , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); + * auto alignMent = item->value[0].i32; + * @endcode + */ + NODE_TEXT_ALIGN, + /** + * @brief 文本超长时的显示方式属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:表示文本超长时的显示方式。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:表示文本超长时的显示方式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textOverFlow[] = { { .i32 = static_cast(ARKUI_TEXT_OVERFLOW_CLIP) } }; + * ArkUI_AttributeItem item = { .value = textOverFlow, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle,NODE_TEXT_OVERFLOW , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); + * auto textOverFlow = item->value[0].i32; + * @endcode + */ + NODE_TEXT_OVERFLOW, + /** + * @brief Text字体列表属性,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .string:字体字符串,多个用,分隔。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .string:字体字符串,多个用,分隔。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "HarmonyOS Sans"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_FAMILY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_FAMILY); + * auto font = item->string; + * @endcode + * + */ + NODE_FONT_FAMILY, + /** + * @brief 文本复制粘贴属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:复制粘贴方式{@link ArkUI_CopyOptions},默认值为ARKUI_COPY_OPTIONS_NONE;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:复制粘贴方式{@link ArkUI_CopyOptions}。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_COPY_OPTIONS_NONE} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_COPY_OPTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); + * auto nodeTextCopyOption = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_COPY_OPTION, + /** + * @brief 文本基线的偏移量属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:偏移量数值,单位为fp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:偏移量数值,单位为fp。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); + * auto nodeTextBaselineOffset = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_BASELINE_OFFSET, + /** + * @brief 文字阴影效果属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:阴影模糊半径,单位为vp;\n + * .value[1].i32:阴影类型{@link ArkUI_ShadowType},默认值为ARKUI_SHADOW_TYPE_COLOR;\n + * .value[2].u32:阴影颜色,0xargb格式,形如 0xFFFF0000 表示红色;\n + * .value[3].f32:阴影X轴偏移量,单位为vp;\n + * .value[4].f32:阴影Y轴偏移量,单位为vp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:阴影模糊半径,单位为vp;\n + * .value[1].i32:阴影类型{@link ArkUI_ShadowType};\n + * .value[2].u32:阴影颜色,0xargb格式;\n + * .value[3].f32:阴影X轴偏移量,单位为vp;\n + * .value[4].f32:阴影Y轴偏移量,单位为vp;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, 10, 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); + * auto nodeTextShadowRadius = item->value[0].f32; + * auto nodeTextShadowType = item->value[1].i32; + * auto nodeTextShadowColor = item->value[2].u32; + * auto nodeTextShadowOffsetX = item->value[3].f32; + * auto nodeTextShadowOffsetY = item->value[4].f32; + * @endcode + * + */ + NODE_TEXT_TEXT_SHADOW, + /** + * @brief Text最小显示字号,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].f32:文本最小显示字号,单位FP。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:文本最小显示字号,单位FP。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 20 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_MIN_FONT_SIZE, + + /** + * @brief Text最大显示字号,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].f32:文本最大显示字号 单位FP。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:文本最大显示字号 单位FP。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 20 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_MAX_FONT_SIZE, + + /** + * @brief Text样式,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .string?:可选值 字体列表,使用多个字体,使用','进行分割。 \n + * .value[0].f32:文本尺寸 单位FP。 \n + * .value[1]?.i32:可选值,文本的字体粗细,参数类型{@link ArkUI_FontWeight}。 + * 默认值为ARKUI_FONT_WEIGHT_NORMAL。 \n + * .value[2]?.i32:可选值,字体样式,参数类型{@link ArkUI_FontStyle}。 + * 默认值为ARKUI_FONT_STYLE_NORMAL。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .string?:可选值 字体列表,使用多个字体,使用','进行分割。 \n + * .value[0].f32:文本尺寸 单位FP。 \n + * .value[1]?.i32:可选值,文本的字体粗细,参数类型{@link ArkUI_FontWeight}。 + * 默认值为ARKUI_FONT_WEIGHT_NORMAL。 \n + * .value[2]?.i32:可选值,字体样式,参数类型{@link ArkUI_FontStyle}。 + * 默认值为ARKUI_FONT_STYLE_NORMAL。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 16, { .i32 = ARKUI_FONT_STYLE_NORMAL }, + * { .i32 = ARKUI_FONT_STYLE_NORMAL } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_FONT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_FONT); + * auto size = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_FONT, + + /** + * @brief Text自适应高度的方式,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:参数类型{@link ArkUI_TextHeightAdaptivePolicy}。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:参数类型{@link ArkUI_TextHeightAdaptivePolicy}。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY); + * auto size = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, + /** + * @brief 文本首行缩进属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 表示首行缩进值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 表示首行缩进值。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textIndent[] = { 20 }; + * ArkUI_AttributeItem item = { .value = textIndent, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INDENT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); + * auto indentValue = item->value[0].f32; + * @endcode + */ + NODE_TEXT_INDENT, + /** + * @brief 文本内容属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string 表示span的文本内容。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string 表示span的文本内容。\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SPAN_CONTENT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SPAN_CONTENT); + * auto spanContent = item->string; + * @endcode + */ + NODE_SPAN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SPAN, + /** + * @brief imageSpan组件图片地址属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string 表示imageSpan的图片地址 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string 表示imageSpan的图片地址 \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC); + * auto spanScr = item->string; + * @endcode + */ + NODE_IMAGE_SPAN_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE_SPAN, + /** + * @brief 图片基于文本的对齐方式属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示图片基于文本的对齐方式,取{@link ArkUI_ImageSpanAlignment}枚举值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示图片基于文本的对齐方式,取{@link ArkUI_ImageSpanAlignment}枚举值。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue alignValue[] = { {.i32 = static_cast(ARKUI_IMAGE_SPAN_ALIGNMENT_TOP) } }; + * ArkUI_AttributeItem item = {.value = alignValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN); + * auto verticalAlign = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_SPAN_VERTICAL_ALIGN, + /** + * @brief image组件设置图片地址属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string 表示image组件地址 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string 表示image组件地址 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SRC , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); + * auto imageSrc = item->string; + * @endcode + */ + NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, + /** + * @brief 图片填充效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示图片填充效果,取{@link ArkUI_ObjectFit}枚举值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示图片填充效果,取{@link ArkUI_ObjectFit}枚举值。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue objectFitValue[] = { { .i32 = static_cast(ARKUI_OBJECT_FIT_FILL) } }; + * ArkUI_AttributeItem item = { .value = objectFitValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); + * auto objectFit = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_OBJECT_FIT, + /** + * @brief 图片插值效果效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示插值效果效果,取{@link ArkUI_ImageInterpolation}枚举值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示插值效果效果,取{@link ArkUI_ImageInterpolation}枚举值。 \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue interpolationValue[] = { { .i32 = ARKUI_INTERPOLATION_LOW } }; + * ArkUI_AttributeItem item = { .value = interpolationValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); + * auto interpolation = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_INTERPOLATION, + /** + * @brief 图片重复样式属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示图片重复样式,取{@link ArkUI_ImageRepeat}枚举值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示图片重复样式,取{@link ArkUI_ImageRepeat}枚举值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue repeatValue[] = { { .i32 = static_cast(ARKUI_IMAGE_REPEAT_X) } }; + * ArkUI_AttributeItem item = { .value = repeatValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); + * auto repeat = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_OBJECT_REPEAT, + /** + * @brief 图片滤镜效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 ~ .value[19].i32 表示滤镜矩阵数组。 \n + * .size 表示滤镜数组大小 5*4。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 ~ .value[19].i32 表示滤镜矩阵数组。 \n + * .size 表示滤镜数组大小 5*4。 \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue filterValue[] = { {.i32 = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 + * = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = + * 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0} }; + * ArkUI_AttributeItem item = { .value = filterValue, .size = sizeof(filterValue)/ sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); + * auto colorFilter = item->value + * @endcode + */ + NODE_IMAGE_COLOR_FILTER, + /** + * @brief 图源自动缩放属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示是否缩放布尔值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示是否缩放布尔值。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue resizeValue[] = { {.i32 = true} }; + * ArkUI_AttributeItem item = { .value = resizeValue, .size = 1}}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); + * auto autoResize = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_AUTO_RESIZE, + /** + * @brief 占位图地址属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string 表示image组件占位图地址。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string 表示image组件占位图地址。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "/pages/loading.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_ALT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); + * auto altStr = item->string; + * @endcode + */ + NODE_IMAGE_ALT, + /** + * @brief 组件打开状态的背景颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:背景色数值,0xargb格式,形如 0xFFFF0000 表示红色。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:背景色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR); + * auto nodeToggleSelectedColor = item->value[0].u32; + * @endcode + * + */ + NODE_TOGGLE_SELECTED_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, + /** + * @brief Switch类型的圆形滑块颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:圆形滑块颜色数值,0xargb格式,形如 0xFFFF0000 表示红色。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:圆形滑块颜色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); + * auto nodeSwitchPointColor = item->value[0].u32; + * @endcode + * + */ + NODE_TOGGLE_SWITCH_POINT_COLOR, + + /** + * @brief 加载进度条前景色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:前景颜色数值,0xargb格式,形如 0xFFFF0000 表示红色。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:前景颜色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0x99666666 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR); + * auto nodeLoadingProgressColor = item->value[0].u32; + * @endcode + * + */ + NODE_LOADING_PROGRESS_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LOADING_PROGRESS, + /** + * @brief LoadingProgress动画显示属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false时不显示动画,true时可以显示动画;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:0时不显示动画,1时可以显示动画。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING); + * auto nodeLoadingProgressEnableLoading = item->value[0].i32; + * @endcode + */ + NODE_LOADING_PROGRESS_ENABLE_LOADING, + + /** + * @brief 单行文本输入框的默认提示文本内容属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string:默认提示文本的内容。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string:默认提示文本的内容。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="input" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER); + * auto nodeTextInputPlaceholder = item->string; + * @endcode + * + */ + NODE_TEXT_INPUT_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, + /** + * @brief 单行文本输入框的默认文本内容属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string:默认文本的内。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string:默认文本的内容。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="input" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT); + * auto nodeTextInputText = item->string; + * @endcode + * + */ + NODE_TEXT_INPUT_TEXT, + /** + * @brief 光标颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:光标颜色数值,0xargb格式,形如 0xFFFF0000 表示红色;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:光标颜色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR); + * auto nodeTextInputCaretColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_INPUT_CARET_COLOR, + /** + * @brief 光标风格属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:光标宽度数值,单位为vp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:光标宽度数值,单位为vp。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE); + * auto nodeTextInputCaretStyle = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_INPUT_CARET_STYLE, + /** + * @brief 单行文本输入框下划线属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false表示不展示下划线,true表示展示下划线;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:0表示不展示下划线,1表示展示下划线。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = true} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE); + * auto nodeTextInputUnderline = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_SHOW_UNDERLINE, + /** + * @brief 输入框支持的最大文本数属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:最大文本数的数字,无单位。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:最大文本数的数字。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 50 } }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH); + * auto nodeTextInputMaxlength = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_MAX_LENGTH, + /** + * @brief 回车键类型属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:回车键类型枚举{@link ArkUI_EnterKeyType},默认值为ARKUI_ENTER_KEY_TYPE_DONE。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:回车键类型枚举{@link ArkUI_EnterKeyType}。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_ENTER_KEY_TYPE_DONE} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE); + * auto nodeTextInputMaxlength = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_ENTER_KEY_TYPE, + /** + * @brief 无输入时默认提示文本的颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb格式,形如 0xFFFF0000 表示红色。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR); + * auto nodeTextInputPlaceholderColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_INPUT_PLACEHOLDER_COLOR, + /** + * @brief 无输入时默认提示文本的字体配置(包括大小、字重、样式、字体列表)属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.f32:可选字体大小数值,默认值16.0,单位为fp;\n + * .value[1]?.i32:可选字体样式{@link ArkUI_FontStyle},默认值为ARKUI_FONT_STYLE_NORMAL;\n + * .value[2]?.i32:可选字体粗细样式{@link ArkUI_FontWeight},默认值为ARKUI_FONT_WEIGHT_NORMAL;\n + * ?.string: 字体族内容,多个字体族之间使用逗号分隔,形如“字重;字体族1,字体族2”。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:字体大小数值,单位为fp;\n + * .value[1].i32:字体样式{@link ArkUI_FontStyle};\n + * .value[2].i32:字体粗细样式{@link ArkUI_FontWeight};\n + * .string: 字体族内容,多个字体族之间使用逗号分隔。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT); + * auto nodeTextInputPlaceholderFontSize = item->value[0].f32; + * auto nodeTextInputPlaceholderFontStyle = item->value[1].i32; + * auto nodeTextInputPlaceholderFontWeight = item->value[2].i32; + * auto nodeTextInputPlaceholderFontFamily = item->string; + * @endcode + * + */ + NODE_TEXT_INPUT_PLACEHOLDER_FONT, + /** + * @brief 聚焦时是否绑定输入法属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false表示聚焦不拉起输入法,true表示拉起。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:0表示聚焦不拉起输入法,1表示拉起。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = true} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS); + * auto nodeTextInputFocusKeyboard = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, + /** + * @brief 输入框的类型属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:输入框类型枚举{@link ArkUI_TextInputType},默认值为ARKUI_TEXTINPUT_TYPE_NORMAL。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:输入框类型枚举{@link ArkUI_TextInputType}。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXTINPUT_TYPE_NORMAL} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE); + * auto nodeTextInputType = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_TYPE, + /** + * @brief 输入框文本选中时的背景色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb格式,形如 0xFFFF0000 表示红色。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR); + * auto nodeTextInputSelectedColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, + /** + * @brief 密码输入模式时是否显示末尾图标属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false表示不显示图标,true表示显示图标;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:0表示不显示图标,1表示显示图标。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = true} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON); + * auto nodeTextInputPasswordIcon = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, + /** + * @brief 控制单行文本输入框编辑态属性,支持属性设置。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false表示退出编辑态,true表示维持现状。\n + * \n + * 属性获取方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false表示退出编辑态,true表示维持现状。 + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = false} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_EDITING, &item); + * @endcode + * + */ + NODE_TEXT_INPUT_EDITING, + /** + * @brief 单行文本右侧清除按钮样式属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:按钮样式{@link ArkUI_CancelButtonStyle},默认值为ARKUI_CANCELBUTTON_STYLE_INPUT;\n + * .value[1]?.f32:图标大小数值,单位为vp;\n + * .value[2]?.u32:按钮图标颜色数值,0xargb格式,形如 0xFFFF0000 表示红色;\n + * ?.string:按钮图标地址,入参内容为图片本地地址,例如 /pages/icon.png。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:按钮样式{@link ArkUI_CancelButtonStyle};\n + * .value[1].f32:图标大小数值,单位为vp;\n + * .value[2].u32:按钮图标颜色数值,0xargb格式;\n + * .string:按钮图标地址。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_CANCELBUTTON_STYLE_INPUT}, 10.0, {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON); + * auto nodeCancelButtonStyle = item->value[0].i32; + * auto nodeCancelButtonSize = item->value[1].f32; + * auto nodeCancelButtonColor = item->value[2].u32; + * auto nodeCancelButtonImage = item->string; + * @endcode + * + */ + NODE_TEXT_INPUT_CANCEL_BUTTON, + + /** + * @brief 多行文本输入框的默认提示文本内容属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string:默认提示文本的内容。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string:默认提示文本的内容。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="input" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER); + * auto nodeTextAreaPlaceholder = item->string; + * @endcode + * + */ + NODE_TEXT_AREA_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, + /** + * @brief 多行文本输入框的默认文本内容属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string:默认文本的内容。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string:默认文本的内容。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="input" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_TEXT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_TEXT); + * auto nodeTextAreaText = item->string; + * @endcode + * + */ + NODE_TEXT_AREA_TEXT, + /** + * @brief 输入框支持的最大文本数属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:最大文本数的数字。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:最大文本数的数字。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 50 } }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH); + * auto nodeTextAreaMaxlength = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_AREA_MAX_LENGTH, + /** + * @brief 无输入时默认提示文本的颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb格式,形如 0xFFFF0000 表示红色。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR); + * auto nodeTextAreaPlaceholderColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_AREA_PLACEHOLDER_COLOR, + /** + * @brief 无输入时默认提示文本的字体配置(包括大小、字重、样式、字体列表)属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.f32:可选字体大小数值,默认值16.0,单位为fp;\n + * .value[1]?.i32:可选字体样式{@link ArkUI_FontStyle},默认值为ARKUI_FONT_STYLE_NORMAL;\n + * .value[2]?.i32:可选字体粗细样式{@link ArkUI_FontWeight},默认值为ARKUI_FONT_WEIGHT_NORMAL;\n + * ?.string: 字体族内容,多个字体族之间使用逗号分隔,形如“字重;字体族1,字体族2”。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:字体大小数值,单位为fp;\n + * .value[1].i32:字体样式{@link ArkUI_FontStyle};\n + * .value[2].i32:字体粗细样式{@link ArkUI_FontWeight};\n + * .string: 字体族内容,多个字体族之间使用逗号分隔。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT); + * auto nodeTextAreaPlaceholderFontSize = item->value[0].f32; + * auto nodeTextAreaPlaceholderFontStyle = item->value[1].i32; + * auto nodeTextAreaPlaceholderFontWeight = item->value[2].i32; + * auto nodeTextAreaPlaceholderFontFamily = item->string; + * @endcode + * + */ + NODE_TEXT_AREA_PLACEHOLDER_FONT, + /** + * @brief 光标颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:背景色数值,0xargb格式,形如 0xFFFF0000 表示红色。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:背景色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR); + * auto nodeTextAreaCaretColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_AREA_CARET_COLOR, + /** + * @brief 控制多行文本输入框编辑态属性,支持属性设置。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false表示退出编辑态,true表示维持现状。\n + * \n + * 属性获取方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:false表示退出编辑态,true表示维持现状。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = false} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_EDITING, &item); + * @endcode + * + */ + NODE_TEXT_AREA_EDITING, + + /** + * @brief button按钮的文本内容属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string:默认文本的内容。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string:默认文本的内容。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="click" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BUTTON_LABEL); + * auto nodeButtonLabelr = item->string; + * @endcode + * + */ + NODE_BUTTON_LABEL = MAX_NODE_SCOPE_NUM * ARKUI_NODE_BUTTON, + + /** + * @brief 进度条的当前进度值属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:进度条当前值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:进度条当前值。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_VALUE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_VALUE); + * auto nodeProgressValue = item->value[0].f32; + * @endcode + * + */ + NODE_PROGRESS_VALUE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_PROGRESS, + /** + * @brief 进度条的总长属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:进度条总长。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:进度条总长。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TOTAL, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_TOTAL); + * auto nodeProgressTotal = item->value[0].f32; + * @endcode + * + */ + NODE_PROGRESS_TOTAL, + /** + * @brief 进度条显示进度值的颜色属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb格式,形如 0xFFFF0000 表示红色。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:颜色数值,0xargb格式。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_COLOR); + * auto nodeProgressColor = item->value[0].u32; + * @endcode + * + */ + NODE_PROGRESS_COLOR, + /** + * @brief 进度条的类型属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:进度条类型枚举值{@link ArkUI_ProgressType},默认值为ARKUI_PROGRESS_LINEAR。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:进度条类型枚举值{@link ArkUI_ProgressType}。\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_PROGRESS_LINEAR} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TYPE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_TYPE); + * auto nodeProgressType = item->value[0].i32; + * @endcode + */ + NODE_PROGRESS_TYPE, + + /** + * @brief CheckBox多选框是否选中,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:1表示选中,0表示不选中。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:1表示选中,0表示不选中。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 0 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SELECT); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_CHECKBOX_SELECT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, + + /** + * @brief CheckBox多选框选中状态颜色,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].u32:多选框选中状态颜色, 类型为0xargb,如0xFF1122FF。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].u32:多选框选中状态颜色, 类型为0xargb,如0xFF1122FF。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_CHECKBOX_SELECT_COLOR, + + /** + * @brief CheckBox多选框非选中状态边框颜色,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].u32:边框颜色, 类型为0xargb,如0xFF1122FF。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].u32:边框颜色, 类型为0xargb,如0xFF1122FF。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_CHECKBOX_UNSELECT_COLOR, + + /** + * @brief CheckBox多选框内部图标样式,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:边框颜色, 类型为0xargb,如0xFF1122FF;\n + * .value[1]?.f32:可选,内部图标大小,单位vp;\n + * .value[2]?.f32:可选,内部图标粗细,单位vp,默认值2。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].u32:边框颜色, 类型为0xargb,如0xFF1122FF;\n + * .value[1]?.f32:可选,内部图标大小,单位vp;\n + * .value[2]?.f32:可选,内部图标粗细,单位vp,默认值2。\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 0xFF1122FF }, 20.0f, 2.0f }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_MARK, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_MARK); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_CHECKBOX_MARK, + + /** + * @brief CheckBox组件形状, 支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:组件形状,参数类型{@link ArkUI_CheckboxShape}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:组件形状,参数类型{@link ArkUI_CheckboxShape}。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ArkUI_CHECKBOX_SHAPE_CIRCLE } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SHAPE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SHAPE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_CHECKBOX_SHAPE, + + /** + * @brief XComponent组件ID属性,支持属性设置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: ID的内容。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: ID的内容。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "test" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_ID, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_ID); + * auto nodeXcomponentId = item->string; + * @endcode + * + */ + NODE_XCOMPONENT_ID = MAX_NODE_SCOPE_NUM * ARKUI_NODE_XCOMPONENT, + /** + * @brief XComponent的类型,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:字体样式{@link ArkUI_XComponentType},默认值为ARKUI_XCOMPONENT_TYPE_SURFACE;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:字体样式{@link ArkUI_XComponentType}。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_XCOMPONENT_TYPE_SURFACE} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_TYPE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_TYPE); + * auto nodeXcomponentType = item->value[0].i32; + * @endcode + * + */ + NODE_XCOMPONENT_TYPE, + /** + * @brief 设置XComponent的宽高,支持属性设置和获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:宽数值,单位为vp;\n + * .value[1].u32:高数值,单位为vp;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:宽数值,单位为vp;\n + * .value[1].u32:高数值,单位为vp;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=300}, {.u32=50} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * auto nodeXcomponentSurfaceWidth = item->value[0].u32; + * auto nodeXcomponentSurfaceHeight = item->value[1].u32; + * @endcode + * + */ + NODE_XCOMPONENT_SURFACE_SIZE, + + /** + * @brief 设置日期选择器组件的日期是否显示农历,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 是否显示农历,默认值false。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 是否显示农历。 + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR); + * auto nodeDatePickerLunar = item->value[0].i32; + * @endcode + */ + NODE_DATE_PICKER_LUNAR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_DATE_PICKER, + /** + * @brief 设置日期选择器组件选择器的起始日期,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 日期,默认值"1970-1-1"。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 日期。\n + * + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "1970-1-1" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_START, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_START); + * auto nodeDatePickerStart = item->string; + * @endcode + */ + NODE_DATE_PICKER_START, + /** + * @brief 设置日期选择器组件选择器的结束日期,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 日期,默认值"2100-12-31"。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 日期。\n + * + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "2100-12-31" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_END, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_END); + * auto nodeDatePickerEnd = item->string; + * @endcode + */ + NODE_DATE_PICKER_END, + /** + * @brief 设置日期选择器组件选中项的日期,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 日期,默认值"2024-01-22"。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 日期。 + * + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "2024-01-22" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED); + * auto nodeDatePickerSelected = item->string; + * @endcode + */ + NODE_DATE_PICKER_SELECTED, + /** + * @brief 设置日期选择器组件的所有选项中最上和最下两个选项的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型\n + * 入参2: 文本大小,数字类型,单位fp\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 入参4: 文本字体列表,使用 ',' 进行分割\n + * 入参5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型\n + * 参数2: 文本大小,数字类型,单位fp\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 参数4: 文本字体列表,使用 ',' 进行分割\n + * 参数5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); + * auto nodeDatePickerDisappearTextStyle = item->string; + * @endcode + */ + NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, + /** + * @brief 设置日期选择器组件的所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型\n + * 入参2: 文本大小,数字类型,单位fp\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 入参4: 文本字体列表,使用 ',' 进行分割\n + * 入参5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型\n + * 参数2: 文本大小,数字类型,单位fp\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 参数4: 文本字体列表,使用 ',' 进行分割\n + * 参数5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE); + * auto nodeDatePickerTextStyle = item->string; + * @endcode + */ + NODE_DATE_PICKER_TEXT_STYLE, + /** + * @brief 设置日期选择器组件的选中项的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型\n + * 入参2: 文本大小,数字类型,单位fp\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 入参4: 文本字体列表,使用 ',' 进行分割\n + * 入参5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型\n + * 参数2: 文本大小,数字类型,单位fp\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 参数4: 文本字体列表,使用 ',' 进行分割\n + * 参数5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE); + * auto nodeDatePickerSelectedTextStyle = item->string; + * @endcode + */ + NODE_DATE_PICKER_SELECTED_TEXT_STYLE, + /** + * @brief 设置时间选择组件选中项的时间,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 时间,默认值当前系统时间。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 时间。 + * + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "17-11" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED); + * auto nodeTimePickerSelected = item->string; + * @endcode + */ + + NODE_TIME_PICKER_SELECTED = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TIME_PICKER, + /** + * @brief 设置时间选择组件展示时间是否为24小时制,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 是否为24小时制,默认值false。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 是否为24小时制。 + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME); + * auto nodeTimePickerUseMilitaryTime = item->value[0].i32; + * @endcode + */ + NODE_TIME_PICKER_USE_MILITARY_TIME, + /** + * @brief 设置时间选择组件所有选项中最上和最下两个选项的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型\n + * 入参2: 文本大小,数字类型,单位fp\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 入参4: 文本字体列表,使用 ',' 进行分割\n + * 入参5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型\n + * 参数2: 文本大小,数字类型,单位fp\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 参数4: 文本字体列表,使用 ',' 进行分割\n + * 参数5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); + * auto nodeDatePickerDisappearTextStyle = item->string; + * @endcode + */ + NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, + /** + * @brief 设置时间选择组件所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型\n + * 入参2: 文本大小,数字类型,单位fp\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 入参4: 文本字体列表,使用 ',' 进行分割\n + * 入参5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型\n + * 参数2: 文本大小,数字类型,单位fp\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 参数4: 文本字体列表,使用 ',' 进行分割\n + * 参数5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE); + * auto nodeTimePickerTextStyle = item->string; + * @endcode + */ + NODE_TIME_PICKER_TEXT_STYLE, + /** + * @brief 设置时间选择组件选中项的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型\n + * 入参2: 文本大小,数字类型,单位fp\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 入参4: 文本字体列表,使用 ',' 进行分割\n + * 入参5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型\n + * 参数2: 文本大小,数字类型,单位fp\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 参数4: 文本字体列表,使用 ',' 进行分割\n + * 参数5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.c} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE); + * auto nodeDatePickerSelectedTextStyle = item->string; + * @endcode + */ + NODE_TIME_PICKER_SELECTED_TEXT_STYLE, + + /** + * @brief 设置滑动选择文本选择器的选择列表,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:使用的选择器类型{@link ArkUI_TextPickerRangeType},默认值为ARKUI_TEXTPICKER_RANGETYPE_SINGLE;\n + * ?.string:针对不同选择器类型有如下输入范式:\n + * 1:单列选择器,入参格式为用分号分隔的一组字符串;\n + * 2:多列选择器,支持多对纯文本字符串对,多对之间使用分号分隔,每对内部使用逗号分隔;\n + * ?.object:针对不同选择器类型有如下输入范式:\n + * 1:单列支持图片的选择器,输入结构体为{@link ARKUI_TextPickerRangeContent};\n + * 2:多列联动选择器,输入结构体为{@link ARKUI_TextPickerCascadeRangeContent};\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:使用的选择器类型{@link ArkUI_TextPickerRangeType};\n + * ?.string:针对不同选择器类型有如下输出范式:\n + * 1:单列选择器,输出格式为用分号分隔的一组字符串;\n + * 2:多列选择器,输出多对纯文本字符串对,多对之间使用分号分隔,每对内部使用逗号分隔;\n + * ?.object:针对不同选择器类型有如下输出范式:\n + * 1:单列支持图片的选择器,输出结构体为{@link ARKUI_TextPickerRangeContent};\n + * 2:多列联动选择器,输出结构体为{@link ARKUI_TextPickerCascadeRangeContent};\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_TEXTPICKER_RANGETYPE_MULTI} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "1,2,3;A,B,C" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE); + * auto nodeTextPickerRangeType = item->value[0].i32; + * auto nodeTextPickerMultiRange = item->string; + * @endcode + * + */ + NODE_TEXT_PICKER_OPTION_RANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, + /** + * @brief 设置滑动选择文本内容的组件默认选中项在数组中的索引值,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:索引值,如存在多个索引值则逐个添加。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:索引值,如存在多个索引值则逐个添加;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32 = 1}, {.u32 = 2} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED); + * auto nodeTextPickerSelected = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_PICKER_OPTION_SELECTED, + /** + * @brief 设置滑动选择文本内容的组件默认选中项的值,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string:选中项的值,如存在多个值则逐个添加,用分号分隔。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string:选中项的值,如存在多个值则逐个添加,用分号分隔;\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "A;B" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE); + * auto nodeTextPickerValue = item->string; + * @endcode + * + */ + NODE_TEXT_PICKER_OPTION_VALUE, + /** + * @brief 设置滑动选择文本内容的组件所有选项中最上和最下两个选项的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型\n + * 入参2: 文本大小,数字类型,单位fp\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 入参4: 文本字体列表,使用 ',' 进行分割\n + * 入参5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型\n + * 参数2: 文本大小,数字类型,单位fp\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 参数4: 文本字体列表,使用 ',' 进行分割\n + * 参数5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.c} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE); + * auto nodeDatePickerDisappearTextStyle = item->string; + * @endcode + */ + NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, + /** + * @brief 设置滑动选择文本内容的组件所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型\n + * 入参2: 文本大小,数字类型,单位fp\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 入参4: 文本字体列表,使用 ',' 进行分割\n + * 入参5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型\n + * 参数2: 文本大小,数字类型,单位fp\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular")\n + * 参数4: 文本字体列表,使用 ',' 进行分割\n + * 参数5: 文本样式,字符串枚举("normal", "italic")\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.c} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE); + * auto nodeDatePickerTextStyle = item->string; + * @endcode + */ + NODE_TEXT_PICKER_TEXT_STYLE, + /** + * @brief 设置滑动选择文本内容的组件选中项的文本颜色、字号、字体粗细,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .string: 入参5个,格式为字符串,以 ';' 分割:\n + * 入参1: 文本颜色,#argb类型;\n + * 入参2: 文本大小,数字类型,单位fp;\n + * 入参3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular");\n + * 入参4: 文本字体列表,使用 ',' 进行分割;\n + * 入参5: 文本样式,字符串枚举("normal", "italic");\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .string: 参数5个,格式为字符串,以 ';' 分割:\n + * 参数1: 文本颜色,#argb类型;\n + * 参数2: 文本大小,数字类型,单位fp;\n + * 参数3: 文本粗细,字符串枚举("bold", "normal", "bolder", "lighter", "medium", "regular");\n + * 参数4: 文本字体列表,使用 ',' 进行分割;\n + * 参数5: 文本样式,字符串枚举("normal", "italic");\n + * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n + * @code {.c} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE); + * auto nodeTextPickerSelectedTextStyle = item->string; + * @endcode + */ + NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, + /** + * @brief 设置滑动选择文本内容的组件默认选中项在数组中的索引值,支持属性设置,属性重置和属性获取接口。 + * + * {@link ArkUI_AttributeItem}参数类型:\n + * .value[0...].i32:默认选中项在数组中的索引值数组。 + * + * @code {.c} + * ArkUI_NumberValue value[] = { { .i32 = 0 }, { .i32 = 1 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_INDEX, &item); + * @endcode + */ + NODE_TEXT_PICKER_SELECTED_INDEX, + /** + * @brief Picker组件可循环滚动属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:false表示不可循环,true表示可循环。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * value[0].i32:0表示不可循环,1表示可循环。\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=true} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP); + * auto nodePickerCanLoop = item->value[0].i32; + * @endcode + */ + NODE_TEXT_PICKER_CAN_LOOP, + /** + * @brief Picker各选择项的高度属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:子项高度属性,单位为vp。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * value[0].f32:子项高度属性,单位为vp。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT); + * auto nodePickerItemHeight = item->value[0].f32; + * @endcode + */ + NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, + + /** + * @brief Slider滑块的颜色,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].u32:滑块的颜色, 类型为0xargb,如0xFF1122FF。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].u32:滑块的颜色, 类型为0xargb,如0xFF1122FF。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_SLIDER_BLOCK_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, + + /** + * @brief Slider滑轨的背景颜色,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].u32:背景颜色, 类型为0xargb,如0xFF1122FF。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].u32:背景颜色, 类型为0xargb,如0xFF1122FF。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_TRACK_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_TRACK_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_SLIDER_TRACK_COLOR, + + /** + * @brief Slider滑轨的已滑动部分颜色,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].u32:已滑动部分颜色, 类型为0xargb,如0xFF1122FF。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].u32:已滑动部分颜色, 类型为0xargb,如0xFF1122FF。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_SLIDER_SELECTED_COLOR, + + /** + * @brief Slider滑动时是否显示气泡提示,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:是否显示气泡,1表示显示,0表示不显示,默认值为0。\n + * .string? 可选值,气泡提示的文本内容,默认显示当前百分比字符串。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:是否显示气泡,1表示显示,0表示不显示,默认值为0。\n + * .string? 可选值,气泡提示的文本内容,默认显示当前百分比字符串。\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SHOW_TIPS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_SHOW_TIPS, + + /** + * @brief Slider滑块形状参数,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:形状参数。参数类型{@link ArkUI_SliderBlockStyle}。\n + * .string? 可选值,根据形状参数而定。\n + * ARKUI_SLIDER_BLOCK_STYLE_IMAGE: 滑块图片资源。如/pages/common/icon.png。\n + * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: 滑块使用的自定义形状。\n + * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n + * "circle(10,10)"括号内分别为width、height; \n + * "ellipse(10,10)"括号内分别为width、height; \n + * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:形状参数。参数类型{@link ArkUI_SliderBlockStyle}。\n + * .string? 可选值,根据形状参数而定。\n + * ARKUI_SLIDER_BLOCK_STYLE_IMAGE: 滑块图片资源。如/pages/common/icon.png。\n + * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: 滑块使用的自定义形状。\n + * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n + * "circle(10,10)"括号内分别为width、height; \n + * "ellipse(10,10)"括号内分别为width、height; \n + * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_DEFAULT}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_BLOCK_STYLE, + + /** + * @brief slider进度值,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].f32:进度值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:进度值。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_VALUE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_VALUE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_SLIDER_VALUE, + + /** + * @brief slider最小值,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].f32:进度值的最小值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:进度值的最小值。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_SLIDER_MIN_VALUE, + + /** + * @brief slider最大值,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].f32:进度值的最大值。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:进度值的最大值。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_SLIDER_MAX_VALUE, + + /** + * @brief Slider滑动步长,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].f32:滑动步长,取值范围:[0.01, 100]。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:滑动步长,取值范围:[0.01, 100]。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_STEP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_STEP); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_SLIDER_STEP, + + /** + * @brief Slider滑动条滑动方向,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:显示样式,参数类型{@link ArkUI_SliderDirection}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:显示样式,参数类型{@link ArkUI_SliderDirection}。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SLIDER_DIRECTION_VERTICAL } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_DIRECTION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_DIRECTION); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_DIRECTION, + + /** + * @brief Slider滑动条取值范围是否反向,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:是否反向,1表示反向,0表示不反向。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:是否反向,1表示反向,0表示不反向。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 0} }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_REVERSE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_REVERSE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_REVERSE, + + /** + * @brief Slider的滑块与滑轨显示样式,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:显示样式,参数类型{@link ArkUI_SliderStyle}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:显示样式,参数类型{@link ArkUI_SliderStyle}。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SLIDER_STYLE_OUT_SET } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_STYLE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_STYLE, + + /** + * @brief 设置子组件在容器内的对齐方式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 对齐方式,数据类型{@link ArkUI_Alignment},默认值ARKUI_ALIGNMENT_CENTER。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 对齐方式,数据类型{@link ArkUI_Alignment}。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); + * auto nodeStackAlignContent = item->value[0].i32; + * @endcode + */ + NODE_STACK_ALIGN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_STACK, + + /** + * @brief 设置滚动条状态,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 滚动条状态,数据类型{@link ArkUI_ScrollBarDisplayMode},默认值ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 滚动条状态,数据类型{@link ArkUI_ScrollBarDisplayMode}。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); + * auto nodeScrollBarDisplayMode = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_BAR_DISPLAY_MODE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, + /** + * @brief 设置滚动条的宽度,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 滚动条宽度,单位vp,默认值4。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 滚动条宽度,单位vp。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 20 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); + * auto nodeScrollBarWidth = item->value[0].f32; + * @endcode + * + */ + NODE_SCROLL_BAR_WIDTH, + /** + * @brief 设置滚动条的颜色,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .data[0].u32: 滚动条颜色,0xargb类型。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .data[0].u32: 滚动条颜色,0xargb类型。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); + * auto nodeScrollBarColor = item->value[0].u32; + * @endcode + * + */ + NODE_SCROLL_BAR_COLOR, + /** + * @brief 设置滚动方向,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:滚动方向,数据类型{@link ArkUI_Axis},默认值ARKUI_AXIS_VERTICAL。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:滚动方向,数据类型{@link ArkUI_Axis}。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); + * auto nodeScrollBarDirection = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_SCROLL_DIRECTION, + /** + * @brief 设置边缘滑动效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 边缘滑动效果,参数类型{@link ArkUI_EdgeEffect},默认值ARKUI_EDGE_EFFECT_NONE;\n + * .value[1]?.i32: 可选值,组件内容大小小于组件自身时,设置是否开启滑动效果,开启为1,关闭为0,默认值1。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 边缘滑动效果,参数类型{@link ArkUI_EdgeEffect};\n + * .value[1]?.i32: 可选值,组件内容大小小于组件自身时,设置是否开启滑动效果,开启为1,关闭为0。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_EDGE_EFFECT_NONE }, { .i32 = 1 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); + * auto nodeScrollEdgeEffect = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_EDGE_EFFECT, + /** + * @brief 设置是否支持滚动手势,当设置为false时,无法通过手指或者鼠标滚动,但不影响控制器的滚动接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 是否支持滚动手势,默认值true。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 是否支持滚动手势。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); + * auto nodeScrollEnableScroll = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_ENABLE_SCROLL_INTERACTION, + /** + * @brief 设置摩擦系数,手动划动滚动区域时生效,只对惯性滚动过程有影响,对惯性滚动过程中的链式效果有间接影响。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 摩擦系数,默认值:非可穿戴设备为0.6,可穿戴设备为0.9。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 摩擦系数。 + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 0.6 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_FRICTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_FRICTION); + * auto nodeScrollFriction = item->value[0].f32; + * @endcode + * + */ + NODE_SCROLL_FRICTION, + /** + * @brief 设置Scroll组件的限位滚动模式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: Scroll组件限位滚动时的对其方式,数据类型{@link ArkUI_ScrollSnapAlign},默认值ARKUI_SCROLL_SNAP_ALIGN_NONE;\n + * .value[1].i32: 在Scroll组件限位滚动模式下,该属性设置为false后,运行Scroll在开头和第一个限位点间自由滑动。默认值true,仅在限位点为多个时生效;\n + * .value[2].i32: 在Scroll组件限位滚动模式下,该属性设置为false后,运行Scroll在最后一个限位点和末尾间自由滑动。默认值true,仅在限位点为多个时生效;\n + * .value[3...].f32: Scroll组件限位滚动时的限位点,限位点即为Scroll组件能滑动停靠的偏移量。可以1个或多个。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: Scroll组件限位滚动时的对其方式,数据类型{@link ArkUI_ScrollSnapAlign};\n + * .value[1].i32: 在Scroll组件限位滚动模式下,该属性设置为false后,运行Scroll在开头和第一个限位点间自由滑动;\n + * .value[2].i32: 在Scroll组件限位滚动模式下,该属性设置为false后,运行Scroll在最后一个限位点和末尾间自由滑动;\n + * .value[3...].f32: Scroll组件限位滚动时的限位点,限位点即为Scroll组件能滑动停靠的偏移量。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { + * { .i32=ARKUI_SCROLL_SNAP_ALIGN_NONE }, { .i32=true }, { .i32=true }, + * { .f32=0 }, { .f32=500 }, { .f32=1000 }, { .f32=1500 } + * }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SNAP, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SNAP); + * auto nodeScrollSnap = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_SNAP, + + /** + * @brief Scroll嵌套滚动选项,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0]?.i32:可滚动组件往末尾端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n + * .value[1]?.i32:可滚动组件往起始端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.i32:可滚动组件往末尾端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n + * .value[1]?.i32:可滚动组件往起始端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY }, + * { .i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL); + * auto first = item->value[0].i32; + * auto second = item->value[1].i32; + * @endcode + * + */ + NODE_SCROLL_NESTED_SCROLL, + /** + * @brief Scroll滑动到指定位置,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].f32:水平滑动偏移,单位为vp。\n + * .value[1].f32:垂直滑动偏移,单位为vp。\n + * .value[2]?.i32:可选值,滚动时长,单位为毫秒。\n + * .value[3]?.i32:可选值,滚动曲线,参数类型{@link ArkUI_AnimationCurve}。默认值为ARKUI_CURVE_EASE。\n + * .value[4]?.i32:可选值,是否使能默认弹簧动效,默认值为0不使能。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:水平滑动偏移,单位为vp。\n + * .value[1].f32:垂直滑动偏移,单位为vp。\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10, 100, { .i32 = 1000 }, { .i32 = ARKUI_CURVE_EASE }, { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_OFFSET, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_OFFSET); + * auto x = item->value[0].f32; + * auto y = item->value[1].f32; + * @endcode + * + */ + NODE_SCROLL_OFFSET, + + /** + * @brief Scroll滚动到容器边缘,支持属性设置,属性重置和属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:容器边缘,参数类型{@link ArkUI_ScrollEdge}。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:容器边缘,参数类型{@link ArkUI_ScrollEdge}。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_EDGE_TOP } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_EDGE, + + /** + * @brief 设置是否支持滑动翻页,支持属性设置,属性重置和属性获取接口。 + * + * 如果同时设置了划动翻页enablePaging和限位滚动scrollSnap,则scrollSnap优先生效,enablePaging不生效。\n + * \n + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 是否支持划动翻页,默认值false。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 是否支持划动翻页。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); + * auto nodeScrollEnablePaging = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_ENABLE_PAGING, + + /** + * @brief 设置List组件排列方向,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:List组件排列方向,数据类型{@link ArkUI_Axis},默认值ARKUI_AXIS_VERTICAL。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:List组件排列方向,数据类型{@link ArkUI_Axis}。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_DIRECTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_DIRECTION); + * auto nodeListDirection = item->value[0].i32; + * @endcode + * + */ + NODE_LIST_DIRECTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST, + /** + * @brief 配合ListItemGroup组件使用,设置ListItemGroup中header和footer是否要吸顶或吸底,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:配合ListItemGroup组件使用,设置ListItemGroup中header和footer是否要吸顶或吸底。数据类型{@link ArkUI_StickyStyle},默认值ARKUI_STICKY_STYLE_NONE。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:配合ListItemGroup组件使用,设置ListItemGroup中header和footer是否要吸顶或吸底。数据类型{@link ArkUI_StickyStyle}。 + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_STICKY_STYLE_NONE } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_STICKY, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_STICKY); + * auto nodeListSticky = item->value[0].i32; + * @endcode + * + */ + NODE_LIST_STICKY, + /** + * @brief 设置列表项间距,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 子组件主轴方向的间隔。默认值0。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 子组件主轴方向的间隔。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_SPACE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_SPACE); + * auto nodeListSpace = item->value[0].f32; + * @endcode + * + */ + NODE_LIST_SPACE, + + /** + * @brief Swiper是否开启循环,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制是否开启循环,0表示不循环,1表示循环,默认值为1。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制是否开启循环,0表示不循环,1表示循环,默认值为1。 \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { {.i32 = 0} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_LOOP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_LOOP); + * auto nodeSwiperLoop = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_LOOP = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SWIPER, + /** + * @brief Swiper子组件是否自动播放,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制子组件是否自动播放,0表示不自动播放,1表示自动播放,默认值为0。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:控制子组件是否自动播放,0表示不自动播放,1表示自动播放,默认值为0。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY); + * auto nodeSwiperAutoPlay = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_AUTO_PLAY, + /** + * @brief Swiper是否显示导航点指示器,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:是否显示导航点指示器,0表示不显示导航点指示器,1表示显示导航点指示器,默认值为1。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:是否显示导航点指示器,0表示不显示导航点指示器,1表示显示导航点指示器,默认值为1。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 0} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR); + * auto nodeSwiperShowIndicator = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_SHOW_INDICATOR, + /** + * @brief 设置Swiper自动播放时播放的时间间隔,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:使用自动播放时播放的时间间隔,单位为毫秒。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:使用自动播放时播放的时间间隔,单位为毫秒。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 3000 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INTERVAL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_INTERVAL); + * auto nodeSwiperInterval = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_INTERVAL, + /** + * @brief 设置Swiper是否为纵向滑动,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:是否为纵向滑动,0表示横向滑动,1表示纵向滑动,默认值为0。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:是否为纵向滑动,0表示横向滑动,1表示纵向滑动,默认值为0。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_VERTICAL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_VERTICAL); + * auto nodeSwiperVertical = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_VERTICAL, + + /** + * @brief 设置Swiper子组件切换的动画时长,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:子组件切换的动画时长,单位为毫秒, 默认值为400。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:子组件切换的动画时长,单位为毫秒, 默认值为400。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10000 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DURATION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DURATION); + * auto nodeSwiperDuration = item->value[0].f32; + * @endcode + * + */ + NODE_SWIPER_DURATION, + + /** + * @brief 设置Swiper的动画曲线,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:设置动画曲线参数,参数类型{@link ArkUI_AnimationCurve},默认值为ARKUI_CURVE_LINEAR。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:设置动画曲线参数,参数类型{@link ArkUI_AnimationCurve},默认值为ARKUI_CURVE_LINEAR。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_CURVE_SHARP} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_CURVE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_CURVE); + * auto nodeSwiperCurve = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_CURVE, + + /** + * @brief 设置Swiper子组件与子组件之间间隙,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:子组件与子组件之间间隙数值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:子组件与子组件之间间隙数值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperItemSpace = item->value[0].f32; + * @endcode + * + */ + NODE_SWIPER_ITEM_SPACE, + + /** + * @brief 设置Swiper当前在容器中显示的子组件的索引值,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件的索引值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件的索引值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {i32 = 3} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INDEX, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperIndex = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_INDEX, + + /** + * @brief 设置Swiper一页内元素显示个数,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件的索引值。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件的索引值。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {i32 = 3} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISPLAY_COUNT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperDisplayCount = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_DISPLAY_COUNT, + + /** + * @brief 设置Swiper禁用组件滑动切换功能,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:是否禁用组件滑动切换功能,0表示不禁用滑动切换功能,1表示禁用滑动切换功能,默认值为0。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:是否禁用组件滑动切换功能,0表示不禁用滑动切换功能,1表示禁用滑动切换功能,默认值为0。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE); + * auto nodeSwiperDisableSwipe = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_DISABLE_SWIPE, + + /** + * @brief 设置Swiper是否显示导航点箭头,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:设置是否显示导航点箭头,参数类型{@link ArkUI_SwiperArrow}, \n + * 默认值为ARKUI_SWIPER_ARROW_HIDE。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:设置是否显示导航点箭头,参数类型{@link ArkUI_SwiperArrow}, \n + * 默认值为ARKUI_SWIPER_ARROW_HIDE。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SWIPER_ARROW_SHOW_ON_HOVER} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW); + * auto nodeSwiperShowDisplayArrow = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_SHOW_DISPLAY_ARROW, + + /** + * @brief 设置 ListItemGroup 头部组件,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .object:使用{@link ArkUI_NodeHandle}对象作为ListItemGroup头部组件。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .object:使用{@link ArkUI_NodeHandle}对象作为ListItemGroup头部组件。\n + * + * @code {.cpp} + * auto header = nodeAPI->createNode(ARKUI_NODE_TEXT); + * ArkUI_AttributeItem item = { .object = header }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); + * auto nodeListItemGroupSetHeader = item->object; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_HEADER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST_ITEM_GROUP, + /** + * @brief 设置 ListItemGroup 尾部组件,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .object:使用{@link ArkUI_NodeHandle}对象作为ListItemGroup尾部组件。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .object:使用{@link ArkUI_NodeHandle}对象作为ListItemGroup尾部组件。\n + * + * @code {.cpp} + * auto footer = nodeAPI->createNode(ARKUI_NODE_TEXT); + * ArkUI_AttributeItem item = { .object = footer }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); + * auto nodeListItemGroupSetFooter = item->value[0].object; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_FOOTER, + /** + * @brief 设置ListItem分割线样式,默认无分割线,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32: 颜色,0xargb类型;\n + * .value[1].f32: 分割线宽,单位vp;\n + * .value[2].f32: 分割线距离列表侧边起始端的距离,单位vp;\n + * .value[3].f32: 分割线距离列表侧边结束端的距离,单位vp。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32: 颜色,0xargb类型;\n + * .value[1].f32: 分割线宽,单位vp;\n + * .value[2].f32: 分割线距离列表侧边起始端的距离,单位vp;\n + * .value[3].f32: 分割线距离列表侧边结束端的距离,单位vp。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF }, 1, 0, 0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * auto nodeListItemDividerColor = item->value[0].u32; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_DIVIDER, + /** + * @brief 设置日历选中态底板圆角半径的参数,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 日历选中态底板圆角半径,取值范围[0,+∞),其中取值为0表示底板样式为直角矩形; + * 取值范围为(0, 16)时,底板样式为圆角矩形;取值范围为[16,+∞)时,底板样式为圆形。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 日历选中态底板圆角半径,取值范围[0,+∞),其中取值为0表示底板样式为直角矩形; + * 取值范围为(0, 16)时,底板样式为圆角矩形;取值范围为[16,+∞)时,底板样式为圆形。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 16.0f }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); + * auto borderRadius = item->value[0].f32; + * @endcode + */ + NODE_CALENDAR_PICKER_HINT_RADIUS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + /** + * @brief 设置日历选择选中日期的参数,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[1].u32: 选中的年。\n + * .value[2].u32: 选中的月。\n + * .value[3].u32: 选中的日。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[1].u32: 选中的年。\n + * .value[2].u32: 选中的月。\n + * .value[3].u32: 选中的日。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED); + * auto selectYear = item->value[0].u32; + * @endcode + */ + NODE_CALENDAR_PICKER_SELECTED, + /** + * @brief 设置日历选择器与入口组件的对齐方式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 对齐方式类型,参数类型{@link ArkUI_CalendarAlignment}。\n + * .value[1]?.f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n + * .value[2]?.f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 对齐方式类型,参数类型{@link ArkUI_CalendarAlignment}。\n + * .value[1]?.f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n + * .value[2]?.f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGN_END) }, 10.0f, 0.0f }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGN, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGN); + * auto alignType = item->value[0].i32; + * @endcode + */ + NODE_CALENDAR_PICKER_EDGE_ALIGN, + /** + * @brief 设置日历选择器入口区的文本颜色、字号、字体粗细。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.u32: 入口区的文本颜色。\n + * .value[1]?.f32: 入口区的文本字号,单位为fp。\n + * .value[2]?.i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.u32: 入口区的文本颜色。\n + * .value[1]?.f32: 入口区的文本字号,单位为fp。\n + * .value[2]?.i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = + * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); + * auto textColor = item->value[0].u32; + * @endcode + */ + NODE_CALENDAR_PICKER_TEXT_STYLE, +} ArkUI_NodeAttributeType; + +#define MAX_COMPONENT_EVENT_ARG_NUM 12 +/** + * @brief 定义组件回调事件的参数类型。 + * + * @since 12 + */ +typedef struct { + /** 数据数组对象。*/ + ArkUI_NumberValue data[MAX_COMPONENT_EVENT_ARG_NUM]; +} ArkUI_NodeComponentEvent; + +/** + * @brief 定义组件回调事件使用字符串参数的类型。 + * + * @since 12 + */ +typedef struct { + /** 字符串数据。*/ + const char* pStr; +} ArkUI_StringAsyncEvent; + +/** + * @brief 提供NativeNode组件支持的事件类型定义。 + * + * @since 12 + */ +typedef enum { + /** + * @brief 手势事件类型。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_TouchEvent}。 + */ + NODE_TOUCH_EVENT = 0, + + /** + * @brief 挂载事件。 + * + * 触发该事件的条件 :组件挂载显示时触发此回调。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数。 + */ + NODE_EVENT_ON_APPEAR, + + /** + * @brief 组件区域变化事件 + * + * 触发该事件的条件:组件区域变化时触发该回调。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含12个参数:\n + * ArkUI_NodeComponentEvent.data[0].f32:表示过去目标元素的宽度,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[1].f32:表示过去目标元素的高度,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[2].f32:表示过去目标元素左上角相对父元素左上角的位置的x轴坐标,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[3].f32:表示过去目标元素左上角相对父元素左上角的位置的y轴坐标,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[4].f32:表示过去目标元素目标元素左上角相对页面左上角的位置的x轴坐标,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[5].f32:表示过去目标元素目标元素左上角相对页面左上角的位置的y轴坐标,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[6].f32:表示最新目标元素的宽度,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[7].f32:表示最新目标元素的高度,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[8].f32:表示最新目标元素左上角相对父元素左上角的位置的x轴坐标,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[9].f32:表示最新目标元素左上角相对父元素左上角的位置的y轴坐标,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[10].f32:表示最新目标元素目标元素左上角相对页面左上角的位置的x轴坐标,类型为number,单位vp。\n + * ArkUI_NodeComponentEvent.data[11].f32:表示最新目标元素目标元素左上角相对页面左上角的位置的y轴坐标,类型为number,单位vp。\n + */ + NODE_EVENT_ON_AREA_CHANGE, + /** + * @brief 获焦事件。 + * + * 触发该事件的条件:组件获焦时触发此回调。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数。 + */ + NODE_ON_FOCUS, + /** + * @brief 失去焦点事件。 + * + * 触发该事件的条件:组件失去焦点时触发此回调。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数。 + */ + NODE_ON_BLUR, + /** + * @brief 组件点击事件。 + * + * 触发该事件的条件:组件被点击时触发此回调。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含12个参数:\n + * ArkUI_NodeComponentEvent.data[0].f32:点击位置相对于被点击元素原始区域左上角的X坐标,单位vp。\n + * ArkUI_NodeComponentEvent.data[1].f32:点击位置相对于被点击元素原始区域左上角的Y坐标,单位vp。\n + * ArkUI_NodeComponentEvent.data[2].f32:事件时间戳。触发事件时距离系统启动的时间间隔,单位微妙。\n + * ArkUI_NodeComponentEvent.data[3].i32:事件输入设备,1表示鼠标,2表示触屏,4表示按键。\n + * ArkUI_NodeComponentEvent.data[4].f32:点击位置相对于应用窗口左上角的X坐标,单位vp。\n + * ArkUI_NodeComponentEvent.data[5].f32:点击位置相对于应用窗口左上角的Y坐标,单位vp。\n + * ArkUI_NodeComponentEvent.data[6].f32:点击位置相对于应用屏幕左上角的X坐标,单位vp。\n + * ArkUI_NodeComponentEvent.data[7].f32:点击位置相对于应用屏幕左上角的Y坐标,单位vp。\n + */ + NODE_ON_CLICK, + /** + * @brief 图片加载成功事件。 + * + * 触发该事件的条件 :图片数据加载成功和解码成功均触发该回调。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含9个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示加载状态,0表示数据加载成功,1表示解码成功。\n + * ArkUI_NodeComponentEvent.data[1].f32:表示图片的宽度,单位px。\n + * ArkUI_NodeComponentEvent.data[2].f32:表示图片的高度,单位px。\n + * ArkUI_NodeComponentEvent.data[3].f32:表示当前组件的宽度,单位px。\n + * ArkUI_NodeComponentEvent.data[4].f32:表示当前组件的高度,单位px。\n + * ArkUI_NodeComponentEvent.data[5].f32:图片绘制区域相对组件X轴位置,单位px。\n + * ArkUI_NodeComponentEvent.data[6].f32:图片绘制区域相对组件Y轴位置,单位px。\n + * ArkUI_NodeComponentEvent.data[7].f32:图片绘制区域宽度,单位px。\n + * ArkUI_NodeComponentEvent.data[8].f32:图片绘制区域高度,单位px。\n + */ + NODE_IMAGE_ON_COMPLETE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, + /** + * @brief 图片加载失败事件。 + * + * 触发该事件的条件:图片加载异常时触发该回调。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32错误码信息:\n + * 401: 图片路径参数异常,无法获取到图片数据。\n + * 103101: 图片格式不支持。\n + */ + NODE_IMAGE_ON_ERROR, + /** + * @brief SVG图片动效播放完成事件。 + * + * 触发该事件的条件:带动效的SVG图片动画结束时触发。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数。 + */ + NODE_IMAGE_ON_SVG_PLAY_FINISH, + /** + * @brief 开关状态发生变化时触发给事件。 + * + * 触发该事件的条件:开关状态发生变化。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:当前开关状态,1表示开,0表示关。 + * + */ + NODE_TOGGLE_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, + + NODE_TEXT_INPUT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, + NODE_TEXT_INPUT_ON_SUBMIT, + NODE_TEXT_INPUT_ON_CUT, + NODE_TEXT_INPUT_ON_PASTE, + + NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, + + NODE_REFRESH_STATE_CHANGE = 1000 * ARKUI_NODE_REFRESH + 1, + NODE_REFRESH_ON_REFRESH, + + /** + * @brief 定义ARKUI_NODE_DATE_PICKER列表组件的滚动触摸事件枚举值。 + * + * 触发该事件的条件:选择日期时触发该事件。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含3个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示选中时间的年。\n + * ArkUI_NodeComponentEvent.data[1].i32:表示选中时间的月,取值范围:[0-11]。\n + * ArkUI_NodeComponentEvent.data[2].i32:表示选中时间的天。\n + */ + NODE_DATE_PICKER_EVENT_ON_DATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_DATE_PICKER, + + /** + * @brief 定义ARKUI_NODE_TIME_PICKER列表组件的滚动触摸事件枚举值。 + * + * 触发该事件的条件:选择时间时触发该事件。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示选中时间的时,取值范围:[0-23]。\n + * ArkUI_NodeComponentEvent.data[1].i32:表示选中时间的分,取值范围:[0-59]。\n + */ + NODE_TIME_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TIME_PICKER, + + /** + * @brief 定义ARKUI_NODE_TEXT_PICKER列表组件的滚动触摸事件枚举值。 + * + * 触发该事件的条件 :选择时间时触发该事件。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32表示 选中时间的时,取值范围:[0-23]。\n + * ArkUI_NodeComponentEvent.data[1].i32表示 选中时间的分,取值范围:[0-59]。\n + */ + NODE_TEXT_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, + + /** + * @brief 定义ARKUI_NODE_CHECKBOX当选中状态发生变化时,触发该回调。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * ArkUI_NodeComponentEvent.data[0].i321:表示已选中, 0: 表示未选中\n + */ + NODE_CHECKBOX_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, + /** + * @brief 定义ARKUI_NODE_SLIDER拖动或点击时触发事件回调。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].f32:当前滑动进度值。\n + * ArkUI_NodeComponentEvent.data[1].i32:事件触发的相关状态值\n + */ + NODE_SLIDER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, + + /** + * @brief 定义ARKUI_NODE_SCROLL滚动组件的滚动事件枚举值。 + * + * 触发该事件的条件 :\n + * 1、滚动组件触发滚动时触发,支持键鼠操作等其他触发滚动的输入设置。\n + * 2、通过滚动控制器API接口调用。\n + * 3、越界回弹。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].f32:表示距离上一次事件触发的X轴增量。\n + * ArkUI_NodeComponentEvent.data[1].f32:表示距离上一次事件触发的Y轴增量。\n + */ + NODE_SCROLL_EVENT_ON_SCROLL = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, + /** + * @brief 定义ARKUI_NODE_SCROLL滚动组件的滚动帧始事件枚举值。 + * + * 触发该事件的条件 :\n + * 1、滚动组件触发滚动时触发,包括键鼠操作等其他触发滚动的输入设置。\n + * 2、调用控制器接口时不触发。\n + * 3、越界回弹不触发。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].f32:表示即将发生的滚动量。\n + * ArkUI_NodeComponentEvent.data[1].i32:表示当前滚动状态。\n + * ::ArkUI_NodeComponentEvent中包含1个返回值:\n + * ArkUI_NodeComponentEvent.data[0].f32:事件处理函数中可根据应用场景计算实际需要的滚动量并存于data[0].f32中,Scroll将按照返回值的实际滚动量进行滚动。\n + */ + NODE_SCROLL_EVENT_ON_SCROLL_FRAME_BEGIN, + /** + * @brief 定义ARKUI_NODE_SCROLL滚动组件的滚动开始事件枚举值。 + * + * 触发该事件的条件 :\n + * 1、滚动组件开始滚动时触发,支持键鼠操作等其他触发滚动的输入设置。\n + * 2、通过滚动控制器API接口调用后开始,带过渡动效。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数。\n + */ + NODE_SCROLL_EVENT_ON_SCROLL_START, + /** + * @brief 定义ARKUI_NODE_SCROLL滚动组件的滚动停止事件枚举值。 + * + * 触发该事件的条件 :\n + * 1、滚动组件触发滚动后停止,支持键鼠操作等其他触发滚动的输入设置。\n + * 2、通过滚动控制器API接口调用后停止,带过渡动效。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数。\n + */ + NODE_SCROLL_EVENT_ON_SCROLL_STOP, + /** + * @brief 定义ARKUI_NODE_SCROLL滚动组件的滚动边缘事件枚举值。 + * + * 触发该事件的条件 :\n + * 1、滚动组件滚动到边缘时触发,支持键鼠操作等其他触发滚动的输入设置。\n + * 2、通过滚动控制器API接口调用。\n + * 3、越界回弹。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数。\n + * ArkUI_NodeComponentEvent.data[0].i32表示当前碰到的是上下左右哪个边。\n + */ + NODE_SCROLL_EVENT_ON_SCROLL_EDGE, + /** + * @brief 定义NODE_CALENDAR_PICKER选中日期时触发的事件。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * ArkUI_NodeComponent.data[0].u32选中的年。\n + * ArkUI_NodeComponent.data[1].u32选中的月。\n + * ArkUI_NodeComponent.data[2].u32选中的日。\n + */ + NODE_CALENDAR_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, +} ArkUI_NodeEventType; + +/** + * @brief 定义组件事件的通用结构类型。 + * + * @since 12 + */ +typedef struct { + /** + * @brief 事件类型。 + * + * @see ArkUI_NodeEventType + */ + int32_t kind; + + /** + * @brief 事件自定义标识ID。 + * + * 该事件id在调用{@link registerNodeEvent}函数时作为参数传递进来,可应用于同一事件入口函数{@link + * registerNodeEventReceiver}分发逻辑。 + */ + int32_t eventId; + + /** 触发该组件的组件对象。*/ + ArkUI_NodeHandle node; + union { + /** touch事件类型回调参数。*/ + ArkUI_NodeTouchEvent touchEvent; + /** 通用组件事件使用数字类型回调参数。*/ + ArkUI_NodeComponentEvent componentEvent; + /** 通用组件事件使用字符串类型回调参数。*/ + ArkUI_StringAsyncEvent stringEvent; + }; +} ArkUI_NodeEvent; + +/** + * @brief 自定义组件调用::markDirty是传递的藏区标识类型。 + * + * @since 12 + */ +typedef enum { + /** + * @brief 重新测算大小。 + * + * 该flag类型触发时,同时也默认会触发重新布局。 + */ + NODE_NEED_MEASURE = 1, + + /** 重新布局位置。*/ + NODE_NEED_LAYOUT, + /** 重新进行绘制。*/ + NODE_NEED_RENDER, +} ArkUI_NodeDirtyFlag; + +/** + * @brief ArkUI提供的Native侧Node类型接口集合。 + * + * @version 1 + * @since 12 + */ +typedef struct { + /** 结构体版本。 */ + int32_t version; + + /** + * @brief 基于{@link ArkUI_NodeType}生成对应的组件并返回组件对象指针。 + * + * @param type 创建指定类型的UI组件节点。 + * @return 返回创建完成的组件操作指针,如果创建失败返回NULL。 + */ + ArkUI_NodeHandle (*createNode)(ArkUI_NodeType type); + + /** + * @brief 销毁组件指针指向的组件对象。 + * + * @param node 组件指针对象。 + */ + void (*disposeNode)(ArkUI_NodeHandle node); + + /** + * @brief 将组件挂载到某个父节点之下。 + * + * @param parent 父节点指针。 + * @param child 子节点指针。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + */ + int32_t (*addChild)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child); + + /** + * @brief 将组件从父节点中移除。 + * + * @param parent 父节点指针。 + * @param child 子节点指针。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + */ + int32_t (*removeChild)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child); + + /** + * @brief 将组件挂载到某个父节点之下,挂载位置在sibling节点之后。 + * + * @param parent 父节点指针。 + * @param child 子节点指针。 + * @param sibling 前一个兄弟节点指针,如果为空则插入位置在最前面。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + */ + int32_t (*insertChildAfter)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, ArkUI_NodeHandle sibling); + + /** + * @brief 将组件挂载到某个父节点之下,挂载位置在sibling节点之前。 + * + * @param parent 父节点指针。 + * @param child 子节点指针。 + * @param sibling 后一个兄弟节点指针,如果为空则插入位置在最后面。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + */ + int32_t (*insertChildBefore)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, ArkUI_NodeHandle sibling); + + /** + * @brief 将组件挂载到某个父节点之下,挂载位置由position指定。 + * + * @param parent 父节点指针。 + * @param child 子节点指针。 + * @param postion 插入位置,如果插入位置为负数或者不存在,则默认插入位置在最后面。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + */ + int32_t (*insertChildAt)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, int32_t position); + + /** + * @brief 属性设置函数。 + * + * @param node 需要设置属性的节点对象。 + * @param attribute 需要设置的属性类型。 + * @param item 需要设置的属性值。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + * 106102 - 系统中未找到Native接口的动态实现库。 + */ + int32_t (*setAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute, const ArkUI_AttributeItem* item); + + /** + * @brief 属性获取函数。 + * + * 该接口返回的指针是ArkUI框架内部的缓冲区指针,不需要开发者主动调用delete释放内存,但是需要在该函数下一次被调用前使用,否则可能会被其他值所覆盖。 + * + * @param node 需要获取属性的节点对象。 + * @param attribute 需要获取的属性类型。 + * @return 当前属性类型的属性值,失败返回空指针。 + */ + const ArkUI_AttributeItem* (*getAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute); + + /** + * @brief 重置属性函数。 + * + * @param node 需要重置属性的节点对象。 + * @param attribute 需要重置的属性类型。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + * 106102 - 系统中未找到Native接口的动态实现库。 + */ + int32_t (*resetAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute); + + /** + * @brief 注册节点事件函数。 + * + * @param node 需要注册事件的节点对象。 + * @param eventType 需要注册的事件类型。 + * @param eventId 自定义事件ID,当事件触发时在回调参数<@link ArkUI_NodeEvent>中携带回来。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + * 106102 - 系统中未找到Native接口的动态实现库。 + */ + int32_t (*registerNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, int32_t eventId); + + /** + * @brief 反注册节点事件函数。 + * + * @param node 需要反注册事件的节点对象。 + * @param eventType 需要反注册的事件类型。 + */ + void (*unregisterNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType); + + /** + * @brief 注册事件回调统一入口函数。 + * + * ArkUI框架会统一收集过程中产生的组件事件并通过注册的eventReceiver函数回调给开发者。\n + * 重复调用时会覆盖前一次注册的函数。 + * + * @param eventReceiver 事件回调统一入口函数。 + */ + void (*registerNodeEventReceiver)(void (*eventReceiver)(ArkUI_NodeEvent* event)); + + /** + * @brief 反注册事件回调统一入口函数。 + * + */ + void (*unregisterNodeEventReceiver)(); + + /** + * @brief 强制标记当前节点需要重新测算,布局或者绘制。 + * + * 系统属性设置更新场景下ArkUI框架会自动标记藏区并重新执行测算,布局或者绘制,不需要开发者主动调用该函数。 + * + * @param node 需要标记藏区的节点对象。 + * @param dirtyFlag 藏区类型。 + */ + void (*markDirty)(ArkUI_NodeHandle node, ArkUI_NodeDirtyFlag dirtyFlag); +} ArkUI_NativeNodeAPI_1; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_NODE_H +/** @}*/ diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h new file mode 100644 index 00000000..79b10f29 --- /dev/null +++ b/zh-cn/native_sdk/ace/native_type.h @@ -0,0 +1,1057 @@ +/* + * 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 提供ArkUI在Native侧的UI能力,如UI组件创建销毁、树节点操作,属性设置,事件监听等。 + * + * @since 12 + */ + +/** + * @file native_type.h + * + * @brief 提供NativeModule公共的类型定义。 + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_TYPE_H +#define ARKUI_NATIVE_TYPE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 提供ArkUI native组件实例对象定义。 + * + * @since 12 + */ +struct ArkUI_Node; + +/** + * @brief 定义ArkUI native组件实例对象指针定义。 + * + * @since 12 + */ +typedef struct ArkUI_Node* ArkUI_NodeHandle; + +/** + * @brief ArkUI在native侧的数字类型定义。 + * + * @since 12 + */ +typedef union { + /** 浮点类型。*/ + float f32; + /** 有符号整型。*/ + int32_t i32; + /** 无符号整型。*/ + uint32_t u32; +} ArkUI_NumberValue; + +/** + * @brief 定义布局对齐枚举值。 + * + * @since 12 + */ +typedef enum { + /** 顶部起始。 */ + ARKUI_ALIGNMENT_TOP_START = 0, + /** 顶部居中。*/ + ARKUI_ALIGNMENT_TOP, + /** 顶部尾端。*/ + ARKUI_ALIGNMENT_TOP_END, + /** 起始端纵向居中。*/ + ARKUI_ALIGNMENT_START, + /** 横向和纵向居中。*/ + ARKUI_ALIGNMENT_CENTER, + /** 尾端纵向居中。*/ + ARKUI_ALIGNMENT_END, + /** 底部起始端。*/ + ARKUI_ALIGNMENT_BOTTOM_START, + /** 底部横向居中。*/ + ARKUI_ALIGNMENT_BOTTOM, + /** 底部尾端。*/ + ARKUI_ALIGNMENT_BOTTOM_END, +} ArkUI_Alignment; + +/** + * @brief 定义图片重复铺设枚举值。 + * + * @since 12 + */ +typedef enum { + /** 不重复。 */ + ARKUI_IMAGE_REPEAT_NONE = 0, + /** 在X轴方向重复。 */ + ARKUI_IMAGE_REPEAT_X, + /** 在Y轴方向重复。 */ + ARKUI_IMAGE_REPEAT_Y, + /** 在X轴和Y轴方向重复。 */ + ARKUI_IMAGE_REPEAT_XY, +} ArkUI_ImageRepeat; + +/** + * @brief 定义字体样式枚举值。 + * + * @since 12 + */ +typedef enum { + /** 标准字体样式。 */ + ARKUI_FONT_STYLE_NORMAL = 0, + /** 斜体字体样式。 */ + ARKUI_FONT_STYLE_ITALIC +} ArkUI_FontStyle; + +/** + * @brief 定义字体粗细/字重枚举值。 + * + * @since 12 + */ +typedef enum { + /** 100 */ + ARKUI_FONT_WEIGHT_W100 = 0, + /** 200 */ + ARKUI_FONT_WEIGHT_W200, + /** 300 */ + ARKUI_FONT_WEIGHT_W300, + /** 400 */ + ARKUI_FONT_WEIGHT_W400, + /** 500 */ + ARKUI_FONT_WEIGHT_W500, + /** 600 */ + ARKUI_FONT_WEIGHT_W600, + /** 700 */ + ARKUI_FONT_WEIGHT_W700, + /** 800 */ + ARKUI_FONT_WEIGHT_W800, + /** 900 */ + ARKUI_FONT_WEIGHT_W900, + /** 字体较粗。 */ + ARKUI_FONT_WEIGHT_BOLD, + /** 字体粗细正常 */ + ARKUI_FONT_WEIGHT_NORMAL, + /** 字体非常粗。 */ + ARKUI_FONT_WEIGHT_BOLDER, + /** 字体较细。 */ + ARKUI_FONT_WEIGHT_LIGHTER, + /** 字体粗细适中。 */ + ARKUI_FONT_WEIGHT_MEDIUM, + /** 字体粗细正常 */ + ARKUI_FONT_WEIGHT_REGULAR, +} ArkUI_FontWeight; + +/** + * @brief 定义字体水平对齐样式枚举值。 + * + * @since 12 + */ +typedef enum { + /** 水平对齐首部。 */ + ARKUI_TEXT_ALIGNMENT_START = 0, + /** 水平居中对齐。 */ + ARKUI_TEXT_ALIGNMENT_CENTER, + /** 水平对齐尾部。 */ + ARKUI_TEXT_ALIGNMENT_END, + /** 双端对齐。 */ + ARKUI_TEXT_ALIGNMENT_JUSTIFY, +} ArkUI_TextAlignment; + +/** + * @brief 定义单行文本输入法回车键类型枚举值。 + * + * @since 12 + */ +typedef enum { + /** 显示为开始样式。 */ + ARKUI_ENTER_KEY_TYPE_GO = 2, + /** 显示为搜索样式。 */ + ARKUI_ENTER_KEY_TYPE_SEARCH = 3, + /** 显示为发送样式。 */ + ARKUI_ENTER_KEY_TYPE_SEND, + /** 显示为下一个样式。 */ + ARKUI_ENTER_KEY_TYPE_NEXT, + /** 显示为完成样式。 */ + ARKUI_ENTER_KEY_TYPE_DONE, + /** 显示为上一个样式。 */ + ARKUI_ENTER_KEY_TYPE_PREVIOUS, + /** 显示为换行样式。 */ + ARKUI_ENTER_KEY_TYPE_NEW_LINE, +} ArkUI_EnterKeyType; + +/** + * @brief 定义单行文本输入法类型枚举值。 + * + * @since 12 + */ +typedef enum { + /** 基本输入模式。 */ + ARKUI_TEXTINPUT_TYPE_NORMAL = 0, + /** 纯数字模式。 */ + ARKUI_TEXTINPUT_TYPE_NUMBER = 2, + /** 电话号码输入模式。 */ + ARKUI_TEXTINPUT_TYPE_PHONE_NUMBER = 3, + /** 邮箱地址输入模式。 */ + ARKUI_TEXTINPUT_TYPE_EMAIL = 5, + /** 密码输入模式。 */ + ARKUI_TEXTINPUT_TYPE_PASSWORD = 7, + /** 纯数字密码输入模式。 */ + ARKUI_TEXTINPUT_TYPE_NUMBER_PASSWORD = 8, + /** 锁屏应用密码输入模式。 */ + ARKUI_TEXTINPUT_TYPE_SCREEN_LOCK_PASSWORD = 9, + /** 用户名输入模式。 */ + ARKUI_TEXTINPUT_TYPE_USER_NAME = 10, + /** 新密码输入模式。 */ + ARKUI_TEXTINPUT_TYPE_NEW_PASSWORD = 11, + /** 带小数点的数字输入模式。 */ + ARKUI_TEXTINPUT_TYPE_NUMBER_DECIMAL = 12, +} ArkUI_TextInputType; + +/** + * @brief 定义清除按钮样式枚举值。 + * + * @since 12 + */ +typedef enum { + /** 清除按钮常显样式。*/ + ARKUI_CANCELBUTTON_STYLE_CONSTANT = 0, + /** 清除按钮常隐样式。*/ + ARKUI_CANCELBUTTON_STYLE_INVISIBLE, + /** 清除按钮输入样式。*/ + ARKUI_CANCELBUTTON_STYLE_INPUT, +} ArkUI_CancelButtonStyle; + +/** + * @brief 定义XComponent类型枚举值。 + * + * @since 12 + */ +typedef enum { + /** 用于EGL/OpenGLES和媒体数据写入,开发者定制绘制内容单独显示在屏幕上。*/ + ARKUI_XCOMPONENT_TYPE_SURFACE = 0, + /** 用于EGL/OpenGLES和媒体数据写入,开发者定制绘制内容和XComponent组件内容合成后展示在屏幕上。*/ + ARKUI_XCOMPONENT_TYPE_TEXTURE = 2, +} ArkUI_XComponentType; + +/** + * @brief 定义进度条类型枚举值。 + * + * @since 12 + */ +typedef enum { + /** 线性样式。*/ + ARKUI_PROGRESS_LINEAR = 0, + /** 环形无刻度样式。*/ + ARKUI_PROGRESS_RING, + /** 圆形样式。*/ + ARKUI_PROGRESS_ECLIPSE, + /** 唤醒有刻度样式。*/ + ARKUI_PROGRESS_SCALERING, + /** 胶囊样式。*/ + ARKUI_PROGRESS_CAPSULE, +}ArkUI_ProgressType; + +typedef enum { + /** 不使用装饰线。*/ + ARKUI_TEXT_DECORATION_TYPE_NONE = 0, + /** 文字下划线修饰。*/ + ARKUI_TEXT_DECORATION_TYPE_UNDERLINE, + /** 文字上划线修饰。*/ + ARKUI_TEXT_DECORATION_TYPE_OVERLINE, + /** 穿过文本的修饰线。*/ + ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH, +} ArkUI_TextDecorationType; + +typedef enum { + /** 保持原有大小写。*/ + ARKUI_TEXT_CASE_NORMAL = 0, + /** 文本全小写。*/ + ARKUI_TEXT_CASE_LOWER, + /** 文本全大写。*/ + ARKUI_TEXT_CASE_UPPER, +} ArkUI_TextCase; + +typedef enum { + /** 不支持复制。*/ + ARKUI_COPY_OPTIONS_NONE = 0, + /** 支持应用内复制。*/ + ARKUI_COPY_OPTIONS_IN_APP, + /** 支持设备内复制。*/ + ARKUI_COPY_OPTIONS_LOCAL_DEVICE, + /** 支持跨设备复制。*/ + ARKUI_COPY_OPTIONS_CROSS_DEVICE, +} ArkUI_CopyOptions; + +typedef enum { + /** 颜色。*/ + ARKUI_SHADOW_TYPE_COLOR = 0, + /** 模糊。*/ + ARKUI_SHADOW_TYPE_BLUR +} ArkUI_ShadowType; + +/** + * @brief 定义滑动选择文本选择器输入类型。 + * + * @since 12 + */ +typedef enum { + /** 单列数据选择器。*/ + ARKUI_TEXTPICKER_RANGETYPE_SINGLE = 0, + /** 多列数据选择器。*/ + ARKUI_TEXTPICKER_RANGETYPE_MULTI, + /** 支持图片资源的单列数据选择器。*/ + ARKUI_TEXTPICKER_RANGETYPE_RANGE_C0NTENT, + /** 支持联动的多列数据选择器。*/ + ARKUI_TEXTPICKER_RANGETYPE_CASCADE_RANGE_CONTENT, +} ArkUI_TextPickerRangeType; + +/** + * @brief 定义单列滑动数据选择器支持图片资源的输入结构体。 + * + * @since 12 + */ +typedef struct { + /** 图片资源。*/ + const char* icon; + /** 文本信息。*/ + const char* text; +} ARKUI_TextPickerRangeContent; + +/** + * @brief 定义多列带联动能力的滑动数据选择器的输入结构体。 + * + * @since 12 + */ +typedef struct { + /** 文本信息。*/ + const char* text; + /** 联动数据。*/ + const ARKUI_TextPickerRangeContent* children; + /** 联动数据数组大小。*/ + int32_t size; +} ARKUI_TextPickerCascadeRangeContent; + +/** + * @brief 定义边缘滑动效果枚举值。 + * + * @since 12 + */ +typedef enum { + /** 弹性物理动效,滑动到边缘后可以根据初始速度或通过触摸事件继续滑动一段距离,松手后回弹。*/ + ARKUI_EDGE_EFFECT_SPRING = 0, + /** 阴影效果,滑动到边缘后会有圆弧状的阴影。*/ + ARKUI_EDGE_EFFECT_FADE, + /** 滑动到边缘后无效果。*/ + ARKUI_EDGE_EFFECT_NONE, +} ArkUI_EdgeEffect; + +/** + * @brief 定义列表项滚动结束对齐效果枚举值。 + * + * @since 12 + */ +typedef enum { + /** 默认无项目滚动对齐效果。*/ + ARKUI_SCROLL_SNAP_ALIGN_NONE = 0, + /** 视图中的第一项将在列表的开头对齐。*/ + ARKUI_SCROLL_SNAP_ALIGN_START, + /** 视图中的中间项将在列表中心对齐。*/ + ARKUI_SCROLL_SNAP_ALIGN_CENTER, + /** 视图中的最后一项将在列表末尾对齐。*/ + ARKUI_SCROLL_SNAP_ALIGN_END, +} ArkUI_ScrollSnapAlign; + +/** + * @brief 定义滚动条状态枚举值。 + * + * @since 12 + */ +typedef enum { + /** 不显示。*/ + ARKUI_SCROLL_BAR_DISPLAY_MODE_OFF = 0, + /** 按需显示(触摸时显示,2s后消失)。*/ + ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO, + /** 常驻显示。*/ + ARKUI_SCROLL_BAR_DISPLAY_MODE_ON, +} ArkUI_ScrollBarDisplayMode; + +/** + * @brief 定义滚动方向和List组件排列方向枚举值。 + * + * @since 12 + */ +typedef enum { + /** 仅支持竖直方向滚动。*/ + ARKUI_AXIS_VERTICAL = 0, + /** 仅支持水平方向滚动。*/ + ARKUI_AXIS_HORIZONTAL, +} ArkUI_Axis; + +/** + * @brief 定义列表是否吸顶和吸底枚举值。 + * + * @since 12 + */ +typedef enum { + /** ListItemGroup的header不吸顶,footer不吸底。*/ + ARKUI_STICKY_STYLE_NONE = 0, + /** ListItemGroup的header吸顶,footer不吸底。*/ + ARKUI_STICKY_STYLE_HEADER = 1, + /** ListItemGroup的footer吸底,header不吸顶。*/ + ARKUI_STICKY_STYLE_FOOTER = 2, + /** ListItemGroup的footer吸底,header吸顶。*/ + ARKUI_STICKY_STYLE_BOTH = 3, +} ArkUI_StickyStyle; + + +/** + * @brief 边框线条样式枚举值。 + * + * @since 12 + */ +typedef enum { + /** 显示为一条实线。 */ + ARKUI_BORDER_STYLE_SOLID = 0, + /** 显示为一系列短的方形虚线。*/ + ARKUI_BORDER_STYLE_DASHED, + /** 显示为一系列圆点。*/ + ARKUI_BORDER_STYLE_DOTTED, +} ArkUI_BorderStyle; + +/** + * @brief 触摸测试控制枚举值。 + * + * @since 12 + */ +typedef enum { + /** 默认触摸测试效果。 */ + ARKUI_HIT_TEST_MODE_DEFAULT = 0, + /** 自身响应触摸测试。*/ + ARKUI_HIT_TEST_MODE_BLOCK, + /** 自身和子节点都响应触摸测试。*/ + ARKUI_HIT_TEST_MODE_TRANSPARENT, + /** 自身不响应触摸测试。*/ + ARKUI_HIT_TEST_MODE_NONE +} ArkUI_HitTestMode; + +/** + * @brief 阴影效果枚举值。 + * + * @since 12 + */ +typedef enum { + /** 超小阴影。 */ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS = 0, + /** 小阴影。*/ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM, + /** 中阴影。*/ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD, + /** 大阴影。*/ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG, + /** 浮动小阴影。*/ + ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM, + /** 浮动中阴影。*/ + ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD, +} ArkUI_ShadowStyle; + +/** + * @brief 动画曲线枚举值。 + * + * @since 12 + */ +typedef enum { + /** 动画从头到尾的速度都是相同。 */ + ARKUI_CURVE_LINEAR = 0, + /** 动画以低速开始,然后加快,在结束前变慢。 */ + ARKUI_CURVE_EASE, + /** 动画以低速开始。 */ + ARKUI_CURVE_EASE_IN, + /** 动画以低速结束。 */ + ARKUI_CURVE_EASE_OUT, + /** 动画以低速开始和结束。 */ + ARKUI_CURVE_EASE_IN_OUT, + /** 动画标准曲线。 */ + ARKUI_CURVE_FAST_OUT_SLOW_IN, + /** 动画减速曲线。 */ + ARKUI_CURVE_LINEAR_OUT_SLOW_IN, + /** 动画加速曲线。 */ + ARKUI_CURVE_FAST_OUT_LINEAR_IN, + /** 动画急缓曲线。 */ + ARKUI_CURVE_EXTREME_DECELERATION, + /** 动画锐利曲线。 */ + ARKUI_CURVE_SHARP, + /** 动画节奏曲线。 */ + ARKUI_CURVE_RHYTHM, + /** 动画平滑曲线。 */ + ARKUI_CURVE_SMOOTH, + /** 动画阻尼曲线。 */ + ARKUI_CURVE_FRICTION, +} ArkUI_AnimationCurve; + +/** + * @brief Swiper导航点箭头枚举值。 + * + * @since 12 + */ +typedef enum { + /** 不显示swiper中导航点箭头。 */ + ARKUI_SWIPER_ARROW_HIDE = 0, + /** 显示swiper中导航点箭头。 */ + ARKUI_SWIPER_ARROW_SHOW, + /** 在hover状态下显示swiper中导航点箭头。 */ + ARKUI_SWIPER_ARROW_SHOW_ON_HOVER, +} ArkUI_SwiperArrow; + + +/** + * @brief 定义无障碍重要性。 + * + * @since 12 + */ +typedef enum { + /** 根据组件不同会转换为“yes”或者“no”。 */ + ARKUI_ACCESSIBILITY_LEVEL_AUTO = 0, + /** 当前组件可被无障碍辅助服务所识别。*/ + ARKUI_ACCESSIBILITY_LEVEL_YES, + /** 当前组件不可被无障碍辅助服务所识别。*/ + ARKUI_ACCESSIBILITY_LEVEL_NO, + /** 当前组件及其所有子组件不可被无障碍辅助服务所识别。*/ + ARKUI_ACCESSIBILITY_LEVEL_NO_HIDE_DESCENDANTS, +} ArkUI_AccessibilityLevel; + +/** + * @brief 定义组件支持设置文本是否可复制粘贴。 + * + * @since 12 + */ +typedef enum { + /** 不支持复制。 */ + ARKUI_TEXT_COPY_OPTIONS_NONE = 0, + /** 支持应用内复制。*/ + ARKUI_TEXT_COPY_OPTIONS_IN_APP, + /** 支持设备内复制。*/ + ARKUI_TEXT_COPY_OPTIONS_LOCAL_DEVICE, + /** 支持跨设备复制。*/ + ARKUI_TEXT_COPY_OPTIONS_CROSS_DEVICE, +} ArkUI_TextCopyOptions; + + +/** + * @brief 定义文本自适应高度的方式。 + * + * @since 12 + */ +typedef enum { + /** 设置文本高度自适应方式为以MaxLines优先。 */ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST = 0, + /** 设置文本高度自适应方式为以缩小字体优先。*/ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MIN_FONT_SIZE_FIRST, + /** 设置文本高度自适应方式为以布局约束(高度)优先。*/ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_LAYOUT_CONSTRAINT_FIRST, +} ArkUI_TextHeightAdaptivePolicy; + + +/** + * @brief 定义嵌套滚动选项。 + * + * @since 12 + */ +typedef enum { + /** 只自身滚动,不与父组件联动。 */ + ARKUI_SCROLL_NESTED_MODE_SELF_ONLY = 0, + /** 自身先滚动,自身滚动到边缘以后父组件滚动。父组件滚动到边缘以后 + 如果父组件有边缘效果,则父组件触发边缘效果,否则子组件触发边缘效果。*/ + ARKUI_SCROLL_NESTED_MODE_SELF_FIRST, + /** 父组件先滚动,父组件滚动到边缘以后自身滚动。 + 身滚动到边缘后,如果有边缘效果,会触发自身的边缘效果,否则触发父组件的边缘效果。*/ + ARKUI_SCROLL_NESTED_MODE_PARENT_FIRST, + /** 自身和父组件同时滚动,自身和父组件都到达边缘以后 + 如果自身有边缘效果,则自身触发边缘效果,否则父组件触发边缘效果。*/ + ARKUI_SCROLL_NESTED_MODE_PARALLEL, +} ArkUI_ScrollNestedMode; + + +/** + * @brief 定义滚动到的边缘位置。 + * + * @since 12 + */ +typedef enum { + /** 竖直方向上边缘。*/ + ARKUI_SCROLL_EDGE_TOP = 0, + /** 竖直方向居中位置。*/ + ARKUI_SCROLL_EDGE_CENTER, + /** 竖直方向下边缘。*/ + ARKUI_SCROLL_EDGE_BOTTOM, + /** 交叉轴方向文本基线位置。*/ + ARKUI_SCROLL_EDGE_BASELINE, + /** 水平方向起始位置。*/ + ARKUI_SCROLL_EDGE_START, + /** 水平方向居中位置。*/ + ARKUI_SCROLL_EDGE_MIDDLE, + /** 水平方向末尾位置。*/ + ARKUI_SCROLL_EDGE_END, +} ArkUI_ScrollEdge; + +/** + * @brief 定义滑块形状。 + * + * @since 12 + */ +typedef enum { + /** 使用默认滑块(圆形)。*/ + ARKUI_SLIDER_BLOCK_STYLE_DEFAULT = 0, + /** 使用图片资源作为滑块。*/ + ARKUI_SLIDER_BLOCK_STYLE_IMAGE, + /** 使用自定义形状作为滑块。*/ + ARKUI_SLIDER_BLOCK_STYLE_SHAPE, +} ArkUI_SliderBlockStyle; + +/** + * @brief 定义滑动条滑动方向。 + * + * @since 12 + */ +typedef enum { + /** 方向为纵向。*/ + ARKUI_SLIDER_DIRECTION_VERTICAL = 0, + /** 方向为横向。*/ + ARKUI_SLIDER_DIRECTION_HORIZONTAL, +} ArkUI_SliderDirection; + +/** + * @brief 定义滑块与滑轨显示样式。 + * + * @since 12 + */ +typedef enum { + /** 滑块在滑轨上。*/ + ARKUI_SLIDER_STYLE_OUT_SET = 0, + /** 滑块在滑轨内。*/ + ARKUI_SLIDER_STYLE_IN_SET, +} ArkUI_SliderStyle; + +/** + * @brief 定义CheckBox组件形状。 + * + * @since 12 + */ +typedef enum { + /** 圆形。*/ + ArkUI_CHECKBOX_SHAPE_CIRCLE = 0, + /** 圆角方形。*/ + ArkUI_CHECKBOX_SHAPE_ROUNDED_SQUARE, +} ArkUI_CheckboxShape; + +/** + * @brief 定义动画播放模式。 + * + * @since 12 + */ +typedef enum { + /** 动画正向播放。*/ + ARKUI_ANIMATION_PLAY_MODE_NORMAL = 0, + /** 动画反向播放。*/ + ARKUI_ANIMATION_PLAY_MODE_REVERSE, + /** 动画在奇数次(1、3、5...)正向播放,在偶数次(2、4、6...)反向播放。*/ + ARKUI_ANIMATION_PLAY_MODE_ALTERNATE, + /** 动画在奇数次(1、3、5...)反向播放,在偶数次(2、4、6...)正向播放。*/ + ARKUI_ANIMATION_PLAY_MODE_ALTERNATE_REVERSE, +} ArkUI_AnimationPlayMode; + +/** + * @brief 定义图片宽高样式。 + * + * @since 12 + */ +typedef enum { + /** 保持原图的比例不变。*/ + ARKUI_IMAGE_SIZE_AUTO = 0, + /** 默认值,保持宽高比进行缩小或者放大,使得图片两边都大于或等于显示边界。*/ + ARKUI_IMAGE_SIZE_COVER, + /** 保持宽高比进行缩小或者放大,使得图片完全显示在显示边界内。*/ + ARKUI_IMAGE_SIZE_CONTAIN, +} ArkUI_ImageSize; + +/** + * @brief 定义取色模式。 + * + * @since 12 + */ +typedef enum { + /** 不使用取色模糊。*/ + ARKUI_ADAPTIVE_COLOR_DEFAULT = 0, + /** 使用取色模糊。*/ + ARKUI_ADAPTIVE_COLOR_AVERAGE, +} ArkUI_AdaptiveColor; + +/** + * @brief 定义深浅色模式。 + * + * @since 12 + */ +typedef enum { + /** 跟随系统深浅色模式。*/ + ARKUI_COLOR_MODE_SYSTEM = 0, + /** 固定使用浅色模式。*/ + ARKUI_COLOR_MODE_LIGHT, + /** 固定使用深色模式。 */ + ARKUI_COLOR_MODE_DARK, +} ArkUI_ColorMode; + +/** + * @brief 定义背景模糊样式。 + * + * @since 12 + */ +typedef enum { + /** 轻薄材质模糊。 */ + ARKUI_BLUR_STYLE_THIN = 0, + /** 普通厚度材质模糊。 */ + ARKUI_BLUR_STYLE_REGULAR, + /** 厚材质模糊。 */ + ARKUI_BLUR_STYLE_THICK, + /** 近距景深模糊。 */ + ARKUI_BLUR_STYLE_BACKGROUND_THIN, + /** 中距景深模糊。 */ + ARKUI_BLUR_STYLE_BACKGROUND_REGULAR, + /** 远距景深模糊。 */ + ARKUI_BLUR_STYLE_BACKGROUND_THICK, + /** 超远距景深模糊。 */ + ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK, + /** 关闭模糊。 */ + ARKUI_BLUR_STYLE_NONE, + /** 组件超轻薄材质模糊。 */ + ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN, + /** 组件轻薄材质模糊。 */ + ARKUI_BLUR_STYLE_COMPONENT_THIN, + /** 组件普通材质模糊。 */ + ARKUI_BLUR_STYLE_COMPONENT_REGULAR, + /** 组件厚材质模糊。 */ + ARKUI_BLUR_STYLE_COMPONENT_THICK, + /** 组件超厚材质模糊。 */ + ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK, +} ArkUI_BlurStyle; + +/** + * @brief 定义垂直对齐方式。 + * + * @since 12 + */ +typedef enum { + /** 顶部对齐。 */ + ARKUI_VERTICAL_ALIGNMENT_TOP = 0, + /** 居中对齐,默认对齐方式。 */ + ARKUI_VERTICAL_ALIGNMENT_CENTER, + /** 底部对齐。 */ + ARKUI_VERTICAL_ALIGNMENT_BOTTOM, +} ArkUI_VerticalAlignment; + +/** + * @brief 定义语言方向对齐方式。 + * + * @since 12 + */ +typedef enum { + /** 按照语言方向起始端对齐。 */ + ARKUI_HORIZONTAL_ALIGNMENT_START = 0, + /** 居中对齐,默认对齐方式。 */ + ARKUI_HORIZONTAL_ALIGNMENT_CENTER, + /** 按照语言方向末端对齐。 */ + ARKUI_HORIZONTAL_ALIGNMENT_END, +} ArkUI_HorizontalAlignment; + +/** + * @brief 定义文本超长时的显示方式。 + * + * @since 12 + */ +typedef enum { + /** 文本超长时不裁剪显示。 */ + ARKUI_TEXT_OVERFLOW_NONE = 0, + /** 文本超长时进行裁剪显示。 */ + ARKUI_TEXT_OVERFLOW_CLIP, + /** 文本超长时显示不下的文本用省略号代替。 */ + ARKUI_TEXT_OVERFLOW_ELLIPSIS, + /** 文本超长时以跑马灯的方式展示。 */ + ARKUI_TEXT_OVERFLOW_MARQUEE, +} ArkUI_TextOverflow; + +/** + * @brief 定义图片基于文本的对齐方式。 + * + * @since 12 + */ +typedef enum { + /** 图片下边沿与文本BaseLine对齐。*/ + ARKUI_IMAGE_SPAN_ALIGNMENT_BASELINE = 0, + /** 图片下边沿与文本下边沿对齐。*/ + ARKUI_IMAGE_SPAN_ALIGNMENT_BOTTOM, + /** 图片中间与文本中间对齐。*/ + ARKUI_IMAGE_SPAN_ALIGNMENT_CENTER, + /** 图片上边沿与文本上边沿对齐。 */ + ARKUI_IMAGE_SPAN_ALIGNMENT_TOP, +} ArkUI_ImageSpanAlignment; + +/** + * @brief 定义image填充效果。 + *ImageSpanAlignment + * @since 12 + */ +typedef enum { + /** 保持宽高比进行缩小或者放大,使得图片完全显示在显示边界内。 */ + ARKUI_OBJECT_FIT_CONTAIN = 0, + /** 保持宽高比进行缩小或者放大,使得图片两边都大于或等于显示边界。*/ + ARKUI_OBJECT_FIT_COVER, + /** 自适应显示。*/ + ARKUI_OBJECT_FIT_AUTO, + /** 不保持宽高比进行放大缩小,使得图片充满显示边界。*/ + ARKUI_OBJECT_FIT_FILL, + /** 保持宽高比显示,图片缩小或者保持不变。*/ + ARKUI_OBJECT_FIT_SCALE_DOWN, + /** 保持原有尺寸显示。*/ + ARKUI_OBJECT_FIT_NONE, +} ArkUI_ObjectFit; + +/** + * @brief 定义图片插值效果。 + * + * @since 12 + */ +typedef enum { + /** 不使用图片插值。*/ + ARKUI_IMAGE_INTERPOLATION_NONE = 0, + /** 低图片插值。*/ + ARKUI_IMAGE_INTERPOLATION_LOW, + /** 中图片插值。*/ + ARKUI_IMAGE_INTERPOLATION_MEDIUM, + /** 高图片插值,插值质量最高。*/ + ARKUI_IMAGE_INTERPOLATION_HIGH, +} ArkUI_ImageInterpolation; + + +/** + * @brief 混合模式枚举值。 + * + * @since 12 + */ +typedef enum { + /** 将上层图像直接覆盖到下层图像上,不进行任何混合操作。 */ + ARKUI_BLEND_MODE_NONE = 0, + /** 将源像素覆盖的目标像素清除为完全透明。 */ + ARKUI_BLEND_MODE_CLEAR, + /** r = s,只显示源像素。 */ + ARKUI_BLEND_MODE_SRC, + /** r = d,只显示目标像素。 */ + ARKUI_BLEND_MODE_DST, + /** r = s + (1 - sa) * d,将源像素按照透明度进行混合,覆盖在目标像素上。 */ + ARKUI_BLEND_MODE_SRC_OVER, + /** r = d + (1 - da) * s,将目标像素按照透明度进行混合,覆盖在源像素上。 */ + ARKUI_BLEND_MODE_DST_OVER, + /** r = s * da,只显示源像素中与目标像素重叠的部分。 */ + ARKUI_BLEND_MODE_SRC_IN, + /** r = d * sa,只显示目标像素中与源像素重叠的部分。 */ + ARKUI_BLEND_MODE_DST_IN, + /** r = s * (1 - da),只显示源像素中与目标像素不重叠的部分。 */ + ARKUI_BLEND_MODE_SRC_OUT, + /** r = d * (1 - sa),只显示目标像素中与源像素不重叠的部分。 */ + ARKUI_BLEND_MODE_DST_OUT, + /** r = s * da + d * (1 - sa),在源像素和目标像素重叠的地方绘制源像素,在源像素和目标像素不重叠的地方绘制目标像素。 + */ + ARKUI_BLEND_MODE_SRC_ATOP, + /** r = d * sa + s * (1 - da),在源像素和目标像素重叠的地方绘制目标像素,在源像素和目标像素不重叠的地方绘制源像素。 + */ + ARKUI_BLEND_MODE_DST_ATOP, + /** r = s * (1 - da) + d * (1 - sa),只显示源像素与目标像素不重叠的部分。 */ + ARKUI_BLEND_MODE_XOR, + /** r = min(s + d, 1),将源像素值与目标像素值相加,并将结果作为新的像素值。 */ + ARKUI_BLEND_MODE_PLUS, + /** r = s * d,将源像素与目标像素进行乘法运算,并将结果作为新的像素值。 */ + ARKUI_BLEND_MODE_MODULATE, + /** r = s + d - s * d,将两个图像的像素值相加,然后减去它们的乘积来实现混合。 */ + ARKUI_BLEND_MODE_SCREEN, + /** 根据目标像素来决定使用MULTIPLY混合模式还是SCREEN混合模式。 */ + ARKUI_BLEND_MODE_OVERLAY, + /** rc = s + d - max(s * da, d * sa), ra = kSrcOver,当两个颜色重叠时,较暗的颜色会覆盖较亮的颜色。 */ + ARKUI_BLEND_MODE_DARKEN, + /** rc = s + d - min(s * da, d * sa), ra = + kSrcOver,将源图像和目标图像中的像素进行比较,选取两者中较亮的像素作为最终的混合结果。 */ + ARKUI_BLEND_MODE_LIGHTEN, + /** 使目标像素变得更亮来反映源像素。 */ + ARKUI_BLEND_MODE_COLOR_DODGE, + /** 使目标像素变得更暗来反映源像素。 */ + ARKUI_BLEND_MODE_COLOR_BURN, + /** 根据源像素的值来决定目标像素变得更亮或者更暗。根据源像素来决定使用MULTIPLY混合模式还是SCREEN混合模式。 */ + ARKUI_BLEND_MODE_HARD_LIGHT, + /** 根据源像素来决定使用LIGHTEN混合模式还是DARKEN混合模式。 */ + ARKUI_BLEND_MODE_SOFT_LIGHT, + /** rc = s + d - 2 * (min(s * da, d * sa)), ra = + kSrcOver,对比源像素和目标像素,亮度更高的像素减去亮度更低的像素,产生高对比度的效果。 */ + ARKUI_BLEND_MODE_DIFFERENCE, + /** rc = s + d - two(s * d), ra = kSrcOver,对比源像素和目标像素,亮度更高的像素减去亮度更低的像素,产生柔和的效果。 + */ + ARKUI_BLEND_MODE_EXCLUSION, + /** r = s * (1 - da) + d * (1 - sa) + s * d,将源图像与目标图像进行乘法混合,得到一张新的图像。 */ + ARKUI_BLEND_MODE_MULTIPLY, + /** 保留源图像的亮度和饱和度,但会使用目标图像的色调来替换源图像的色调。 */ + ARKUI_BLEND_MODE_HUE, + /** 保留目标像素的亮度和色调,但会使用源像素的饱和度来替换目标像素的饱和度。 */ + ARKUI_BLEND_MODE_SATURATION, + /** 保留源像素的饱和度和色调,但会使用目标像素的亮度来替换源像素的亮度。 */ + ARKUI_BLEND_MODE_COLOR, + /** 保留目标像素的色调和饱和度,但会用源像素的亮度替换目标像素的亮度。 */ + ARKUI_BLEND_MODE_LUMINOSITY, +} ArkUI_BlendMode; + +/** + * @brief 设置容器元素内主轴方向上的布局枚举值。 + * + * @since 12 + */ +typedef enum { + /** 元素从左到右布局。 */ + ARKUI_DIRECTION_LTR = 0, + /** 元素从右到左布局。 */ + ARKUI_DIRECTION_RTL, + /** 使用系统默认布局方向。 */ + ARKUI_DIRECTION_AUTO = 3, +} ArkUI_Direction; + +/** + * @brief 设置子组件在父容器交叉轴的对齐格式枚举值。 + * + * @since 12 + */ +typedef enum { + /** 使用Flex容器中默认配置。 */ + ARKUI_ITEM_ALIGN_AUTO = 0, + /** 元素在Flex容器中,交叉轴方向首部对齐。 */ + ARKUI_ITEM_ALIGN_START, + /** 元素在Flex容器中,交叉轴方向居中对齐。 */ + ARKUI_ITEM_ALIGN_CENTER, + /** 元素在Flex容器中,交叉轴方向底部对齐。 */ + ARKUI_ITEM_ALIGN_END, + /** 元素在Flex容器中,交叉轴方向拉伸填充。 */ + ARKUI_ITEM_ALIGN_STRETCH, + /** 元素在Flex容器中,交叉轴方向文本基线对齐。 */ + ARKUI_ITEM_ALIGN_BASELINE, +} ArkUI_ItemAlign; + +/** + * @brief 前景色枚举值。 + * + * @since 12 + */ +typedef enum { + /** 前景色为控件背景色的反色。 */ + ARKUI_COLOR_STRATEGY_INVERT = 0, + /** 控件背景阴影色为控件背景阴影区域的平均色。 */ + ARKUI_COLOR_STRATEGY_AVERAGE, + /** 控件背景阴影色为控件背景阴影区域的主色。 */ + ARKUI_COLOR_STRATEGY_PRIMARY, +} ArkUI_ColorStrategy; + +/** + * @brief 定义垂直方向对齐方式。 + * + * @since 12 + */ +typedef enum { + /** 主轴方向首端对齐。 */ + ARKUI_FLEX_ALIGN_START = 1, + /** 主轴方向中心对齐。 */ + ARKUI_FLEX_ALIGN_CENTER = 2, + /** 主轴方向尾部对齐。 */ + ARKUI_FLEX_ALIGN_END = 3, + /** Flex主轴方向均匀分配弹性元素,相邻元素之间距离相同,第一个元素行首对齐,最后的元素行尾对齐。 */ + ARKUI_FLEX_ALIGN_SPACE_BETWEEN = 6, + /** Flex主轴方向均匀分配弹性元素,相邻元素之间距离相同,第一个元素到行首的距离时相邻元素间距离的一半。 */ + ARKUI_FLEX_ALIGN_SPACE_AROUND = 7, + /** Flex主轴方向均匀分配弹性元素,相邻元素之间距离、第一个元素到行首的距离和最后的元素到行尾的距离均相等。 */ + ARKUI_FLEX_ALIGN_SPACE_EVENLY = 8, +} ArkUI_FlexAlign; + +/** + * @brief 定义Flex容器的主轴方向。 + * + * @since 12 + */ +typedef enum { + /** 主轴与行方向一致。 */ + ARKUI_FLEX_DIRECTION_ROW = 0, + /** 主轴与列方向一致。 */ + ARKUI_FLEX_DIRECTION_COLUMN, + /** 主轴与行方向相反。 */ + ARKUI_FLEX_DIRECTION_ROW_REVERSE, + /** 主轴与列方向相反。 */ + ARKUI_FLEX_DIRECTION_COLUMN_REVERSE, +} ArkUI_FlexDirection; + +/** + * @brief 定义Flex行列布局模式模式。 + * + * @since 12 + */ +typedef enum { + /** 单行/单列布局,子项不能超出容器。 */ + ARKUI_FLEX_WRAP_NO_WRAP = 0, + /** 多行/多列布局,子项允许超出容器。 */ + ARKUI_FLEX_WRAP_WRAP, + /** 反向多行/多列布局,子项允许超出容器。 */ + ARKUI_FLEX_WRAP_WRAP_REVERSE, +} ArkUI_FlexWrap; + +/** + * @brief 控制组件的显隐枚举值。 + * + * @since 12 + */ +typedef enum { + /** 显示。 */ + ARKUI_VISIBILITY_VISIBLE = 0, + /** 隐藏,但参与布局进行占位。 */ + ARKUI_VISIBILITY_HIDDEN, + /** 隐藏,但不参与布局,不进行占位。 */ + ARKUI_VISIBILITY_NONE, +} ArkUI_Visibility; + +/** + * @brief 日历选择器与入口组件对齐方式。 + * + * @since 12 + */ +typedef enum { + /** 选择器和入口组件左对齐方式。 */ + ARKUI_CALENDAR_ALIGNMENT_START = 0, + /** 选择器和入口组件居中对齐方式。 */ + ARKUI_CALENDAR_ALIGNMENT_CENTER, + /** 选择器和入口组件右对齐方式。 */ + ARKUI_CALENDAR_ALIGNMENT_END, +} ArkUI_CalendarAlignment; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_TYPE_H +/** @} */ -- Gitee From 8d818b1554b358a8a0ecee81342cc14faf146989 Mon Sep 17 00:00:00 2001 From: echoorchid Date: Mon, 29 Jan 2024 15:45:55 +0800 Subject: [PATCH 0233/2135] add interface web Signed-off-by: echoorchid --- .../native_sdk/web/native_interface_arkweb.h | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 zh-cn/native_sdk/web/native_interface_arkweb.h diff --git a/zh-cn/native_sdk/web/native_interface_arkweb.h b/zh-cn/native_sdk/web/native_interface_arkweb.h new file mode 100644 index 00000000..c867b536 --- /dev/null +++ b/zh-cn/native_sdk/web/native_interface_arkweb.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Web + * @{ + * + * @brief 提供注入对象和执行JavaScript代码的API接口。 + * @since 11 + */ +/** + * @file native_interface_arkweb.h + * + * @brief 声明API接口供开发者使用注入对象和执行JavaScript代码等功能。 + * @library libohweb.so + * @syscap SystemCapability.Web.Webview.Core + * @since 11 + */ +#ifndef NATIVE_INTERFACE_ARKWEB_H +#define NATIVE_INTERFACE_ARKWEB_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** +* @brief 定义执行JavaScript代码后返回结果的回调函数的类型。 +* +* @since 11 +*/ +typedef void (*NativeArkWeb_OnJavaScriptCallback)(const char*); + +/** +* @brief 定义注入对象的回调函数的类型。 +* +* @since 11 +*/ +typedef char* (*NativeArkWeb_OnJavaScriptProxyCallback)(const char** argv, int32_t argc); + +/** +* @brief 定义Web组件可用时的回调函数的类型。 +* +* @since 11 +*/ +typedef void (*NativeArkWeb_OnValidCallback)(const char*); + +/** +* @brief 定义Web组件销毁时的回调函数的类型。 +* +* @since 11 +*/ +typedef void (*NativeArkWeb_OnDestroyCallback)(const char*); + +/** + * @brief 在当前显示页面的环境下,加载并执行一段JavaScript代码。 + * + * @param webTag Web组件的名称。 + * @param jsCode 一段JavaScript的代码脚本。 + * @param callback 代码执行完后通知开发者结果的回调函数。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 11 + */ +void OH_NativeArkWeb_RunJavaScript(const char* webTag, const char* jsCode, NativeArkWeb_OnJavaScriptCallback callback); + +/** + * @brief 注册对象及函数名称列表。 + * + * @param webTag Web组件的名称。 + * @param objName 注入对象的名称。 + * @param methodList 注入函数列表的名称。 + * @param callback 注入的回调函数。 + * @param size 注入的回调函数的个数。 + * @param needRefresh 是否需要刷新页面。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 11 + */ +void OH_NativeArkWeb_RegisterJavaScriptProxy(const char* webTag, const char* objName, const char** methodList, + NativeArkWeb_OnJavaScriptProxyCallback* callback, int32_t size, bool needRefresh); + +/** + * @brief 删除已注册的对象及其下的回调函数。 + * + * @param webTag Web组件的名称。 + * @param objName 注入对象的名称。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 11 + */ +void OH_NativeArkWeb_UnregisterJavaScriptProxy(const char* webTag, const char* objName); + +/** + * @brief 设置对象可注册时的回调函数。 + * + * @param webTag Web组件的名称。 + * @param callback 对象可注册时的回调函数。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 11 + */ +void OH_NativeArkWeb_SetJavaScriptProxyValidCallback(const char* webTag, NativeArkWeb_OnValidCallback callback); + +/** + * @brief 获取已注册的对象可注册时的回调函数。 + * + * @param webTag Web组件的名称。 + * @return return 已注册的对象可注册时的回调函数。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 11 + */ +NativeArkWeb_OnValidCallback OH_NativeArkWeb_GetJavaScriptProxyValidCallback(const char* webTag); + +/** + * @brief 设置组件销毁时的回调函数。 + * + * @param webTag Web组件的名称。 + * @param callback 组件销毁时的回调函数。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 11 + */ +void OH_NativeArkWeb_SetDestroyCallback(const char* webTag, NativeArkWeb_OnDestroyCallback callback); + +/** + * @brief 获取已注册的组件销毁时的回调函数。 + * + * @param webTag Web组件的名称。 + * @return return 已注册的组件销毁时的回调函数。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 11 + */ +NativeArkWeb_OnDestroyCallback OH_NativeArkWeb_GetDestroyCallback(const char* webTag); + +#ifdef __cplusplus +}; +#endif +#endif // NATIVE_INTERFACE_ARKWEB_H \ No newline at end of file -- Gitee From a870cf2ae715d96cd4b7828f85ba8fa5d7f98890 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Thu, 1 Feb 2024 19:39:55 +0800 Subject: [PATCH 0234/2135] commit msg Signed-off-by: xuxuehai --- .../hdi/audio/effect/v1_0/EffectTypes.idl | 66 ++++++++++++++++--- .../hdi/audio/effect/v1_0/IEffectControl.idl | 46 +++++++++++-- .../hdi/audio/effect/v1_0/IEffectModel.idl | 45 +++++++++++-- 3 files changed, 138 insertions(+), 19 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/effect/v1_0/EffectTypes.idl b/zh-cn/device_api/hdi/audio/effect/v1_0/EffectTypes.idl index 2648a5b5..27e371bd 100644 --- a/zh-cn/device_api/hdi/audio/effect/v1_0/EffectTypes.idl +++ b/zh-cn/device_api/hdi/audio/effect/v1_0/EffectTypes.idl @@ -13,10 +13,42 @@ * limitations under the License. */ +/** + * @addtogroup HdiEffect + * @{ + * + * @brief Effect模块接口定义。 + * + * 音效接口涉及数据类型、音效模型接口、音效控制器接口等。 + * + * @since 4.0 + * @version 1.0 + */ + + /** + * @file EffectTypes.idl + * + * @brief Effect模块接口定义中使用的数据类型。 + * + * Effect模块接口定义中使用的控制器参数、控制器描述符、音效输入输出buffer参数、控制命令等。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 音效接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ package ohos.hdi.audio.effect.v1_0; /** * @brief 定义effect加载的音效信息。 + * + * @since 4.0 + * @version 1.0 */ struct EffectInfo { String libName; /**< 指定用于创建控制器的音效库名称 */ @@ -26,6 +58,9 @@ struct EffectInfo { /** * @brief 定义效果控制器信息,包括其所属的库及其effectId。 + * + * @since 4.0 + * @version 1.0 */ struct ControllerId { String libName; /**< 指定用于创建控制器的音效库名称 */ @@ -34,6 +69,9 @@ struct ControllerId { /** * @brief 定义音效控制器描述 + * + * @since 4.0 + * @version 1.0 */ struct EffectControllerDescriptor { String effectId; /**< 音效控制器的ID */ @@ -44,6 +82,9 @@ struct EffectControllerDescriptor { /** * @brief 数据点类型标记,该类型正在按需使用。 + * + * @since 4.0 + * @version 1.0 */ enum AudioEffectBufferTag { EFFECT_BUFFER_VOID_TYPE = 0, /**< raw模式音频数据指向缓冲区的起点 */ @@ -55,23 +96,30 @@ enum AudioEffectBufferTag { /** * @brief 定义音效进程输入输出buffer。 + * + * @since 4.0 + * @version 1.0 */ struct AudioEffectBuffer { unsigned int frameCount; /**< 帧缓冲区中的帧计数 */ - int datatag; /** 用于使用简化的数据点类型标记,祥见 {@link AudioEffectBufferTag} */ + int datatag; /**< 用于使用简化的数据点类型标记,祥见 {@link AudioEffectBufferTag} */ byte[] rawData; /**< 音频数据指向缓冲区的起点, 数据类型由datatag定义*/ }; /** * @brief 定义音效控制器命令索引。 + * + * @since 4.0 + * @version 1.0 */ enum EffectCommandTableIndex { - AUDIO_EFFECT_COMMAND_INIT_CONTOLLER, /* 初始化音效控制器 */ - AUDIO_EFFECT_COMMAND_SET_CONFIG, /* 设置配置参数 */ - AUDIO_EFFECT_COMMAND_GET_CONFIG, /* 获取配置参数 */ - AUDIO_EFFECT_COMMAND_RESET, /* 重启音效控制器 */ - AUDIO_EFFECT_COMMAND_ENABLE, /* 使能音效 */ - AUDIO_EFFECT_COMMAND_DISABLE, /* 禁用音效 */ - AUDIO_EFFECT_COMMAND_SET_PARAM, /* 设置参数 */ - AUDIO_EFFECT_COMMAND_GET_PARAM, /* 获取参数 */ + AUDIO_EFFECT_COMMAND_INIT_CONTOLLER, /*< 初始化音效控制器 */ + AUDIO_EFFECT_COMMAND_SET_CONFIG, /*< 设置配置参数 */ + AUDIO_EFFECT_COMMAND_GET_CONFIG, /*< 获取配置参数 */ + AUDIO_EFFECT_COMMAND_RESET, /*< 重启音效控制器 */ + AUDIO_EFFECT_COMMAND_ENABLE, /*< 使能音效 */ + AUDIO_EFFECT_COMMAND_DISABLE, /*< 禁用音效 */ + AUDIO_EFFECT_COMMAND_SET_PARAM, /*< 设置参数 */ + AUDIO_EFFECT_COMMAND_GET_PARAM, /*< 获取参数 */ }; +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectControl.idl b/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectControl.idl index f1b09dd2..ddb7c69e 100644 --- a/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectControl.idl +++ b/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectControl.idl @@ -13,9 +13,44 @@ * limitations under the License. */ +/** + * @addtogroup HdiEffect + * @{ + * + * @brief Effect模块接口定义。 + * + * 音效接口涉及数据类型、音效模型接口、音效控制器接口等。 + * + * @since 4.0 + * @version 1.0 + */ + + /** + * @file IEffectControl.idl + * + * @brief 音效控制器的接口定义文件。 + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @brief 音效接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ package ohos.hdi.audio.effect.v1_0; import ohos.hdi.audio.effect.v1_0.EffectTypes; +/** + * @brief 音效控制器接口。 + * + * 提供音效控制器支持的驱动能力,包括音效数据处理、音效命令发送、获取当前音效描述符等 + * + * @since 4.0 + * @version 1.0 + */ interface IEffectControl { /** * @brief 处理音频原始数据。必须指定输入和输出buffer,如果未指定,则进程必须使用命令提供的数据处理功能。 @@ -24,7 +59,7 @@ interface IEffectControl { * @param input 输入数据的buffer * @param output 输出数据的buffer * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 @@ -41,7 +76,7 @@ interface IEffectControl { * @param replyData 返回的数据 * @param replyDataLen 数据长度 * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 @@ -54,7 +89,7 @@ interface IEffectControl { * @param control 指向要操作的音效控件的指针 * @param desc 指定的音效描述符 * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 @@ -68,10 +103,11 @@ interface IEffectControl { * @param input 输入数据buffer * @param output 输出数据buffer * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 */ EffectReverse([in] struct AudioEffectBuffer input, [out] struct AudioEffectBuffer output); -} \ No newline at end of file +} +/** @} */ diff --git a/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectModel.idl b/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectModel.idl index d5f0ac72..745436fb 100644 --- a/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectModel.idl +++ b/zh-cn/device_api/hdi/audio/effect/v1_0/IEffectModel.idl @@ -12,11 +12,45 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/** + * @addtogroup HdiEffect + * @{ + * + * @brief Effect模块接口定义。 + * + * 音效接口涉及数据类型、音效模型接口、音效控制器接口等。 + * + * @since 4.0 + * @version 1.0 + */ + + /** + * @file IEffectModel.idl + * + * @brief 音效模型的接口定义文件。 + * + * @since 4.0 + * @version 1.0 + */ +/** + * @brief 音效接口的包路径。 + * + * @since 4.0 + * @version 1.0 + */ package ohos.hdi.audio.effect.v1_0; import ohos.hdi.audio.effect.v1_0.EffectTypes; import ohos.hdi.audio.effect.v1_0.IEffectControl; +/** + * @brief 音效模型接口。 + * + * 提供音效模型支持的驱动能力,包括获取描述符列表、创建音效控制器、销毁音效控制器、获取指定描述符等 + * + * @since 4.0 + * @version 1.0 + */ interface IEffectModel { /** * @brief 查询供应商/OEM是否提供效果库。如果提供,请使用提供的效果库。如果没有,请使用系统服务软件效果。 @@ -24,7 +58,7 @@ interface IEffectModel { * @param model 指向要操作的效果模型的指针 * @param supply 供应商/OEM是否提供效果库的状态 * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 @@ -37,7 +71,7 @@ interface IEffectModel { * @param model 指向要操作的效果模型的指针 * @param descs 音效描述符列表 * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 @@ -52,7 +86,7 @@ interface IEffectModel { * @param contoller 音效控制器对象 * @param contollerId 音效控制器ID * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 @@ -66,7 +100,7 @@ interface IEffectModel { * @param model 指向要操作的效果模型的指针 * @param contollerId 音效控制器ID * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 @@ -80,10 +114,11 @@ interface IEffectModel { * @param effectId 音效ID * @param desc 指定音效的描述符 * - * @return Returns 执行成功返回0,执行失败返回其他值 + * @return 执行成功返回0,执行失败返回其他值 * * @since 4.0 * @version 1.0 */ GetEffectDescriptor([in] String effectId, [out] struct EffectControllerDescriptor desc); } +/** @} */ -- Gitee From 3885c5717343ecbb47b8d8d21b010f45b186cc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Thu, 1 Feb 2024 11:45:11 +0000 Subject: [PATCH 0235/2135] update zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl index fd23a46f..59bfdc02 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl @@ -42,7 +42,7 @@ * @since 4.0 * @version 1.0 */ -package ohos.hdi.audio.v1_1; +package ohos.hdi.audio.v1_0; /** * @brief 音频端口的类型。 @@ -421,7 +421,7 @@ struct AudioOffloadInfo unsigned int bitWidth; /**< 比特位宽 */ enum AudioFormat format; /**< 音频格式 */ unsigned int offloadBufferSize; /**< 音频数据缓存长度 */ - unsigned long duration; /** 音频持续时间,单位纳秒*/ + unsigned long duration; /**< 音频持续时间,单位纳秒*/ }; /** -- Gitee From 846ba7cd2e66eeb0dccbcb0c5bb49f79b7c9325a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Thu, 1 Feb 2024 11:45:45 +0000 Subject: [PATCH 0236/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl index 6a6f1c88..785fdafa 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioAdapter.idl @@ -40,12 +40,12 @@ * @since 4.0 * @version 1.0 */ -package ohos.hdi.audio.v1_1; +package ohos.hdi.audio.v1_0; -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioRender; -import ohos.hdi.audio.v1_1.IAudioCapture; -import ohos.hdi.audio.v1_1.IAudioCallback; +import ohos.hdi.audio.v1_0.AudioTypes; +import ohos.hdi.audio.v1_0.IAudioRender; +import ohos.hdi.audio.v1_0.IAudioCapture; +import ohos.hdi.audio.v1_0.IAudioCallback; /** * @brief AudioAdapter音频适配器接口。 -- Gitee From 310008d6a0989a19715ab813916b185b986d96d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Thu, 1 Feb 2024 11:46:27 +0000 Subject: [PATCH 0237/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl index bd547406..11ad6e06 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioCapture.idl @@ -42,7 +42,7 @@ */ package ohos.hdi.audio.v1_0; -import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_0.AudioTypes; /** -- Gitee From b8bf09c0a4be5b899087e1733e2b5a46502dd506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Thu, 1 Feb 2024 11:46:48 +0000 Subject: [PATCH 0238/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl index 176a59f6..b0155f7a 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioCallback.idl @@ -40,9 +40,9 @@ * @since 4.0 * @version 1.0 */ -package ohos.hdi.audio.v1_1; +package ohos.hdi.audio.v1_0; -import ohos.hdi.audio.v1_1.AudioTypes; +import ohos.hdi.audio.v1_0.AudioTypes; /** * @brief Audio回调接口。 -- Gitee From 7b347d5a1f3f5398b976fd8097e67ca2a4166c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Thu, 1 Feb 2024 11:47:12 +0000 Subject: [PATCH 0239/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl index 89c0e8c9..6c68ef0a 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioManager.idl @@ -42,8 +42,8 @@ */ package ohos.hdi.audio.v1_0; -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioAdapter; +import ohos.hdi.audio.v1_0.AudioTypes; +import ohos.hdi.audio.v1_0.IAudioAdapter; /** * @brief AudioManager音频适配器管理接口。 -- Gitee From 97b4eea351ebd6b014ad012c6e13ca29e457b5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Thu, 1 Feb 2024 11:47:29 +0000 Subject: [PATCH 0240/2135] update zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl b/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl index 7c70671f..d3080a47 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/IAudioRender.idl @@ -40,10 +40,10 @@ * @since 4.0 * @version 1.0 */ -package ohos.hdi.audio.v1_1; +package ohos.hdi.audio.v1_0; -import ohos.hdi.audio.v1_1.AudioTypes; -import ohos.hdi.audio.v1_1.IAudioCallback; +import ohos.hdi.audio.v1_0.AudioTypes; +import ohos.hdi.audio.v1_0.IAudioCallback; /** * @brief AudioRender音频播放接口。 -- Gitee From 06b90f9e6a28cde95942e6b035bad46fd3cd4ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Thu, 1 Feb 2024 12:25:30 +0000 Subject: [PATCH 0241/2135] update zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl b/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl index 59bfdc02..e118709f 100644 --- a/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl +++ b/zh-cn/device_api/hdi/audio/v1_0/AudioTypes.idl @@ -289,6 +289,9 @@ enum AudioSessionType { /** * @brief 音频设备类型。 + * + * @since 4.0 + * @version 1.0 */ enum AudioDeviceType { AUDIO_LINEOUT = 1 << 0, /**< LINEOUT设备。 */ @@ -308,6 +311,9 @@ enum AudioDeviceType { /** * @brief 音频事件类型。 + * + * @since 4.0 + * @version 1.0 */ enum AudioEventType { AUDIO_DEVICE_ADD = 1, /**< 音频设备添加。 */ @@ -323,6 +329,9 @@ enum AudioEventType { /** * @brief 音频扩展参数键类型。 + * + * @since 4.0 + * @version 1.0 */ enum AudioExtParamKey { AUDIO_EXT_PARAM_KEY_NONE = 0, /**< 分布式音频-无效事件。 */ @@ -338,6 +347,9 @@ enum AudioExtParamKey { /** * @brief 音频设备状态。 + * + * @since 4.0 + * @version 1.0 */ struct AudioDeviceStatus { unsigned int pnpStatus; /**< PnP设备状态,详情参考{@link AudioDeviceType},{@link AudioEventType}。 */ @@ -345,6 +357,9 @@ struct AudioDeviceStatus { /** * @brief 音频场景描述。 + * + * @since 4.0 + * @version 1.0 */ union SceneDesc { unsigned int id; /**< 音频场景的ID,详情参考{@link AudioCategory}。*/ -- Gitee From a96d1926a06d131d53ff5501ff426108113182b5 Mon Sep 17 00:00:00 2001 From: gezhe Date: Sun, 4 Feb 2024 15:32:42 +0800 Subject: [PATCH 0242/2135] =?UTF-8?q?=E6=9B=B4=E6=96=B0drm=E6=A8=A1?= =?UTF-8?q?=E5=9D=97capi=E5=A4=B4=E6=96=87=E4=BB=B6=20Signed-off-by:=20gez?= =?UTF-8?q?he=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../native_sdk/media/drm/native_drm_common.h | 395 ++++++++++-------- zh-cn/native_sdk/media/drm/native_drm_err.h | 60 +-- .../media/drm/native_mediakeysession.h | 152 +++---- .../media/drm/native_mediakeysystem.h | 238 ++++++----- 4 files changed, 456 insertions(+), 389 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_drm_common.h b/zh-cn/native_sdk/media/drm/native_drm_common.h index 6776f7e5..b58aa497 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_common.h +++ b/zh-cn/native_sdk/media/drm/native_drm_common.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, @@ -17,7 +17,7 @@ * @addtogroup Drm * @{ * - * @brief 提供数字版权保护能力的API。 + * @brief Provides APIs of Drm. * @kit Drm. * @since 11 * @version 1.0 @@ -26,7 +26,7 @@ /** * @file native_drm_common.h * - * @brief 定义DRM数据类型 + * @brief Defines the Drm common struct. * @library libnative_drm.z.so * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 @@ -44,401 +44,458 @@ extern "C" { #endif /** - * @brief 监听类型。 - * @syscap SystemCapability.Multimedia.Drm.Core. - * @since 11 - * @version 1.0 -*/ -typedef enum DRM_ListenerType { + * @brief Enumerates event types of listener. + * @since 11 + * @version 1.0 + */ +typedef enum DRM_EventType { /** - * DRM基础事件 + * DRM event base. */ - LISTENER_DRM_EVENT = 200, + EVENT_DRM_BASE = 200, /** - * 设备证书请求事件 + * Provision required event. */ - LISTENER_PROVISION_REQUIRED = 201, + EVENT_PROVISION_REQUIRED = 201, /** - * 密钥请求事件 + * Media key required event. */ - LISTENER_KEY_REQUIRED = 202, + EVENT_KEY_REQUIRED = 202, /** - * 密钥过期事件 + * Media key expired event. */ - LISTENER_KEY_EXPIRED = 203, + EVENT_KEY_EXPIRED = 203, /** - * 第三方定义事件 + * Vendor defined event. */ - LISTENER_VENDOR_DEFINED = 204, + EVENT_VENDOR_DEFINED = 204, /** - * 密钥过期更新事件 + * Expiration update event. */ - LISTENER_EXPIRATION_UPDATE = 206, - } DRM_ListenerType; + EVENT_EXPIRATION_UPDATE = 206, +} DRM_EventType; /** - * @brief 内容保护级别类型。 + * @brief Content potection level. * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_ContentProtectionLevel { /** - * 未知级别 + * Content potection level unknown. */ CONTENT_PROTECTION_LEVEL_UNKNOWN = 0, /** - * 软件安全级别 + * Content potection level software crypto. */ CONTENT_PROTECTION_LEVEL_SW_CRYPTO, /** - * 硬件安全级别 + * Content potection level hardware crypto. */ CONTENT_PROTECTION_LEVEL_HW_CRYPTO, /** - * 硬件增强级别 + * Content potection level enhanced hardware crypto. */ CONTENT_PROTECTION_LEVEL_ENHANCED_HW_CRYPTO, /** - * 最大安全级别 + * Content potection level max stub. */ CONTENT_PROTECTION_LEVEL_MAX, } DRM_ContentProtectionLevel; /** - * @brief 许可证类型。 + * @brief Media key type. * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_MediaKeyType { /** - * 离线 + * Media key type offline. */ MEDIA_KEY_TYPE_OFFLINE = 0, /** - * 在线 + * Media key type online */ MEDIA_KEY_TYPE_ONLINE, } DRM_MediaKeyType; /** - * @brief 许可证请求类型。 + * @brief Media key request type. * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_MediaKeyRequestType { /** - * 未知请求类型 + * Media key request type unknown. */ MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, /** - * 初始化请求 + * Media key request type initial. */ MEDIA_KEY_REQUEST_TYPE_INITIAL, /** - * 续订请求 + * Media key request type renewal. */ MEDIA_KEY_REQUEST_TYPE_RENEWAL, /** - * 释放请求 + * Media key request type release. */ MEDIA_KEY_REQUEST_TYPE_RELEASE, /** - * 无请求 + * Media key request type none. */ MEDIA_KEY_REQUEST_TYPE_NONE, /** - * 更新请求 + * Media key request type update. */ MEDIA_KEY_REQUEST_TYPE_UPDATE, } DRM_MediaKeyRequestType; /** - * @brief 离线许可证状态。 + * @brief Offline media key status. * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_OfflineMediaKeyStatus { /** - * 未知状态 + * Offline media key status unknown. */ OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, /** - * 可用状态 + * Offline media key status usable. */ OFFLINE_MEDIA_KEY_STATUS_USABLE, /** - * 失活状态 + * Offline media key status inactive. */ OFFLINE_MEDIA_KEY_STATUS_INACTIVE, } DRM_OfflineMediaKeyStatus; /** - * @brief 设备证书状态类型。 + * @brief Certificate status. * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_CertificateStatus { /** - * 设备已安装设备证书 + * Device already provisioned. */ CERT_STATUS_PROVISIONED = 0, /** - * 设备未安装设备证书 + * Device not provisioned. */ CERT_STATUS_NOT_PROVISIONED, /** - * 设备证书过期 + * Cert already expired. */ CERT_STATUS_EXPIRED, /** - * 无效设备证书 + * Certs are invalid. */ CERT_STATUS_INVALID, /** - * 设备证书不可用 + * Get certs status failed. */ CERT_STATUS_UNAVAILABLE, } DRM_CertificateStatus; /** - * @brief 在线许可证状态。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max count of media key request option. * @since 11 * @version 1.0 */ -typedef enum DRM_MediaKeyStatus { - /** - * 可用状态 - */ - MEDIA_KEY_STATUS_OK = 0, - /** - * 许可证不存在 - */ - MEDIA_KEY_STATUS_UNAVAILABLE = 1, -} DRM_MediaKeyStatus; - +#define MAX_MEDIA_KEY_REQUEST_OPTION_COUNT 16 /** - * @brief DRM uint_8 数组类型。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max len of media key request option name. * @since 11 * @version 1.0 */ -typedef struct DRM_Uint8Buffer { - /** - * 数组首地址 - */ - unsigned char *buffer; - /** - * 数组长度 - */ - uint32_t bufferLen; -} DRM_Uint8Buffer; - +#define MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN 64 /** - * @brief DRM 字符数组类型。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max len of media key request option data. * @since 11 * @version 1.0 */ -typedef struct DRM_CharBuffer { - /** - * 数组首地址 - */ - char *buffer; - /** - * 数组长度 - */ - uint32_t bufferLen; -} DRM_CharBuffer; - +#define MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN 128 /** - * @brief 字符数组类型的名值对。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max len of media key request init data. * @since 11 * @version 1.0 */ -typedef struct DRM_CharBufferPair { - /* 名字 */ - DRM_CharBuffer name; - /* 值 */ - DRM_CharBuffer value; -} DRM_CharBufferPair; - +#define MAX_INIT_DATA_LEN 2048 /** - * @brief 整形数组类型的名值对。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max len of media mimetype. * @since 11 * @version 1.0 */ -typedef struct DRM_Uint8CharBufferPair { - /* 名字 */ - DRM_Uint8Buffer key; - /* 值 */ - DRM_CharBuffer value; -} DRM_Uint8CharBufferPair; +#define MAX_MIMETYPE_LEN 64 /** - * @brief 许可证请求参数类型。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Media key request info. * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeyRequestInfo { /** - * 许可证类型 + * Offline or online media key type. */ DRM_MediaKeyType type; /** - * base64编码后的pssh数据 + * Initial data len. + */ + int32_t initDataLen; + /** + * Initial data format as PSSH after base64 encoding. */ - DRM_Uint8Buffer data; + uint8_t initData[MAX_INIT_DATA_LEN]; /** - * 媒体类型 + * Media content mime type. */ - DRM_CharBuffer mimeType; + char mimeType[MAX_MIMETYPE_LEN]; /** - * 操作数数组长度 + * OptionsData count. */ uint32_t optionsCount; /** - * 操作数数组 + * Options name the application set to drm framework. + */ + char optionName[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN]; + /** + * Options data the application set to drm framework. */ - DRM_CharBufferPair optionsData[0]; + char optionData[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN]; } DRM_MediaKeyRequestInfo; /** - * @brief 许可证请求类型。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max len of media key request. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_REQUEST_DATA_LEN 8192 +/** + * @brief Max len of URL. + * @since 11 + * @version 1.0 + */ +#define MAX_DEFAULT_URL_LEN 2048 +/** + * @brief Media key request. * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeyRequest { /** - * 许可证请求类型 + * Media key request type. */ DRM_MediaKeyRequestType type; /** - * 许可证请求数据 + * Media key request data len. + */ + int32_t dataLen; + /** + * Media key request data sent to media key server. */ - DRM_Uint8Buffer data; + uint8_t data[MAX_MEDIA_KEY_REQUEST_DATA_LEN]; /** - * 许可证服务器URL + * Media key server URL. */ - DRM_CharBuffer defaultUrl; + char defaultUrl[MAX_DEFAULT_URL_LEN]; } DRM_MediaKeyRequest; /** - * @brief DRM度量统计信息。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max count of statistics item. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_COUNT 10 +/** + * @brief Max len of statistics item name. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_NAME_LEN 64 +/** + * @brief Max len of statistics item buffer. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_BUFFER_LEN 256 + +/** + * @brief Statistics of MediaKeySystem. * @since 11 * @version 1.0 */ typedef struct DRM_Statistics { - /* 度量信息数组长度 */ + /* Statistics count. */ uint32_t statisticsCount; - /* 度量信息数组 */ - DRM_CharBufferPair info[0]; + /* Statistics name. */ + char statisticsName[MAX_STATISTICS_COUNT][MAX_STATISTICS_NAME_LEN]; + /* Statistics description. */ + char statisticsDescription[MAX_STATISTICS_COUNT][MAX_STATISTICS_BUFFER_LEN]; } DRM_Statistics; /** - * @brief 离线许可证Id数组。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max count of offline media key id. * @since 11 * @version 1.0 */ -typedef struct DRM_MediakeyIdArray { - /* 许可证Id数组长度 */ - uint32_t mediaKeyIdCount; - /* 许可证Id数组 */ - DRM_Uint8Buffer mediaKeyIds[0]; -} DRM_MediakeyIdArray; +#define MAX_OFFLINE_MEDIA_KEY_ID_COUNT 512 +/** + * @brief Max len of offline media key id. + * @since 11 + * @version 1.0 + */ +#define MAX_OFFLINE_MEDIA_KEY_ID_LEN 64 /** - * @brief 密钥信息。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Offline media key ids array. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_OfflineMediakeyIdArray { + /* Ids count. */ + uint32_t idsCount; + /* Ids len. */ + int32_t idsLen[MAX_OFFLINE_MEDIA_KEY_ID_COUNT]; + /* Ids. */ + uint8_t ids[MAX_OFFLINE_MEDIA_KEY_ID_COUNT][MAX_OFFLINE_MEDIA_KEY_ID_LEN]; +} DRM_OfflineMediakeyIdArray; + +/** + * @brief Max count of key info. + * @since 11 + * @version 1.0 + */ +#define MAX_KEY_INFO_COUNT 64 +/** + * @brief Max len of key id. + * @since 11 + * @version 1.0 + */ +#define MAX_KEY_ID_LEN 16 +/** + * @brief Max len of key status value. + * @since 11 + * @version 1.0 + */ +#define MAX_KEY_STATUS_VALUE_LEN 128 + +/** + * @brief Media key info. * @since 11 * @version 1.0 */ typedef struct DRM_KeysInfo { - /* 密钥信息数组长度 */ - uint32_t keysCount; - /* 密钥信息数组 */ - DRM_Uint8CharBufferPair keysInfo[0]; + /* Keys count. */ + uint32_t keysInfoCount; + /* Key id. */ + uint8_t keyId[MAX_KEY_INFO_COUNT][MAX_KEY_ID_LEN]; + /* Key status value. */ + char statusValue[MAX_KEY_INFO_COUNT][MAX_KEY_STATUS_VALUE_LEN]; } DRM_KeysInfo; /** - * @brief 在线许可证描述信息。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max count of media key status. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_STATUS_COUNT 64 +/** + * @brief Max len of media key status name. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_STATUS_NAME_LEN 64 +/** + * @brief Max len of media key status value. * @since 11 * @version 1.0 */ -typedef struct DRM_MediaKeyDescription { - /* 许可证信息数组长度*/ - uint32_t mediaKeyCount; - /* 许可证信息数组 */ - DRM_CharBufferPair description[0]; -} DRM_MediaKeyDescription; +#define MAX_MEDIA_KEY_STATUS_VALUE_LEN 256 /** - * @brief DRM插件类型名。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Media key status like pocily etc. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeyStatus { + /* Status count. */ + uint32_t statusCount; + /* Status name. */ + char statusName[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_NAME_LEN]; + /* Status value. */ + char statusValue[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_VALUE_LEN]; +} DRM_MediaKeyStatus; + +/** + * @brief Drm system uuid len. * @since 11 * @version 1.0 */ #define DRM_UUID_LEN 16 +/** + * @brief Max len of PSSH data. + * @since 11 + * @version 1.0 + */ +#define MAX_PSSH_DATA_LEN 2048 /** - * @brief DRM Pssh信息。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief PSSH info by uuid. * @since 11 * @version 1.0 */ typedef struct DRM_PsshInfo { /** - * DRM插件类型名 + * Uuid. */ - char uuid[DRM_UUID_LEN]; + uint8_t uuid[DRM_UUID_LEN]; /** - * PSSH数据长度 + * PSSH data len. */ - uint32_t dataLen; + int32_t dataLen; /** - * PSSH数据 + * uint8_t PSSH data. */ - unsigned char *data; + uint8_t data[MAX_PSSH_DATA_LEN]; } DRM_PsshInfo; /** - * @brief 从媒体源获取的DRM信息。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Max count of PSSH info. + * @since 11 + * @version 1.0 + */ +#define MAX_PSSH_INFO_COUNT 8 + +/** + * @brief MediaKeySystemInfo used for player to get media key system info from media source. * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeySystemInfo { - /* PSSH信息数组长度 */ + /* PSSH count. */ uint32_t psshCount; - /* PSSH信息数组 */ - DRM_PsshInfo psshInfo[0]; + /* PSSH info. */ + DRM_PsshInfo psshInfo[MAX_PSSH_INFO_COUNT]; } DRM_MediaKeySystemInfo; -typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeySystemInfo); +typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo *mediaKeySystemInfo); /** - * @brief MediaKeySystem结构体。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Media key system struct. * @since 11 * @version 1.0 */ typedef struct MediaKeySystem MediaKeySystem; /** - * @brief MediaKeySession结构体。 - * @syscap SystemCapability.Multimedia.Drm.Core + * @brief Media key session struct. * @since 11 * @version 1.0 */ @@ -448,4 +505,4 @@ typedef struct MediaKeySession MediaKeySession; } #endif -#endif // NATIVE_DRM_COMMON_H \ No newline at end of file +#endif // NATIVE_DRM_COMMON_H diff --git a/zh-cn/native_sdk/media/drm/native_drm_err.h b/zh-cn/native_sdk/media/drm/native_drm_err.h index 134c0e13..9ff1adc9 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_err.h +++ b/zh-cn/native_sdk/media/drm/native_drm_err.h @@ -17,7 +17,7 @@ * @addtogroup Drm * @{ * - * @brief 提供数字版权保护能力的API。 + * @brief Provides APIs of Drm. * @kit Drm. * @since 11 * @version 1.0 @@ -25,7 +25,7 @@ /** * @file native_drm_err.h - * @brief 定义DRM错误码 + * @brief Defines the Drm errors. * @library libnative_drm.z.so * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 @@ -43,64 +43,68 @@ extern "C" { #endif /** - * @brief DRM错误码。 + * @brief DRM error code * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum Drm_ErrCode { /** - * 操作成功完成。 + * the operation completed successfully. */ DRM_ERR_OK = 0, /** - * 内存不足。 + * DRM_CAPI_ERR_BASE. */ - DRM_ERR_NO_MEMORY, + DRM_CAPI_ERR_BASE = 24700500, /** - * 不支持的操作。 + * no memory. */ - DRM_ERR_OPERATION_NOT_PERMITTED, + DRM_ERR_NO_MEMORY = DRM_CAPI_ERR_BASE + 1, /** - * 无效参数。 + * opertation not be permitted. */ - DRM_ERR_INVALID_VAL, + DRM_ERR_OPERATION_NOT_PERMITTED = DRM_CAPI_ERR_BASE + 2, /** - * IO 错误。 + * invalid argument. */ - DRM_ERR_IO, + DRM_ERR_INVALID_VAL = DRM_CAPI_ERR_BASE + 3, /** - * 网络超时。 + * IO error. */ - DRM_ERR_TIMEOUT, + DRM_ERR_IO = DRM_CAPI_ERR_BASE + 4, /** - * 未知错误。 + * network timeout. */ - DRM_ERR_UNKNOWN, + DRM_ERR_TIMEOUT = DRM_CAPI_ERR_BASE + 5, /** - * drm服务挂死。 + * unknown error. */ - DRM_ERR_SERVICE_DIED, + DRM_ERR_UNKNOWN = DRM_CAPI_ERR_BASE + 6, /** - * 无效的操作状态。 + * drm service died. */ - DRM_ERR_INVALID_STATE, + DRM_ERR_SERVICE_DIED = DRM_CAPI_ERR_BASE + 7, /** - * 不支持的操作。 + * not support this operation in this state. */ - DRM_ERR_UNSUPPORTED, + DRM_ERR_INVALID_STATE = DRM_CAPI_ERR_BASE + 8, /** - * MediaKeySystem最大实例数。 + * unsupport interface. */ - DRM_ERR_MAX_SYSTEM_NUM_REACHED, + DRM_ERR_UNSUPPORTED = DRM_CAPI_ERR_BASE + 9, /** - * MediaKeySession最大实例数。 + * Meet max MediaKeySystem num limit. */ - DRM_ERR_MAX_SESSION_NUM_REACHED, + DRM_ERR_MAX_SYSTEM_NUM_REACHED = DRM_CAPI_ERR_BASE + 10, /** - * 扩展错误。 + * Meet max MediaKeySession num limit. */ - DRM_ERR_EXTEND_START = 100, + DRM_ERR_MAX_SESSION_NUM_REACHED = DRM_CAPI_ERR_BASE + 11, + /** + * extend err start. + */ + DRM_ERR_EXTEND_START = DRM_CAPI_ERR_BASE + 100, } Drm_ErrCode; #ifdef __cplusplus diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysession.h b/zh-cn/native_sdk/media/drm/native_mediakeysession.h index 846d568f..999aa04e 100644 --- a/zh-cn/native_sdk/media/drm/native_mediakeysession.h +++ b/zh-cn/native_sdk/media/drm/native_mediakeysession.h @@ -17,7 +17,7 @@ * @addtogroup Drm * @{ * - * @brief 提供数字版权保护能力的API。 + * @brief Provides APIs of Drm. * @kit Drm. * @since 11 * @version 1.0 @@ -25,9 +25,9 @@ /** * @file native_mediakeysession.h - * @brief 定义Drm MediaKeySession API。提供以下功能: - * 生成媒体密钥请求、处理媒体密钥响应、事件侦听、获取内容保护级别、 - * 检查媒体密钥状态、删除媒体密钥等。 + * @brief Defines the Drm MediaKeySession APIs. Provide following function: + * generate media key request, process media key response, event listening, + * get content protection level, check media key status, remove media key etc.. * @library libnative_drm.z.so * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 @@ -48,127 +48,137 @@ extern "C" #endif /** - * @brief 事件触发时将调用的回调。 - * @param eventType 事件类型。 - * @param eventInfo 从MediaKeySystem中获取的事件信息。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Call back will be invoked when event triggers. + * @param eventType Event type. + * @param info Event info gotten from media key session. + * @param infoLen Event info len. + * @param extra Extra info gotten from media key session. + * @return Drm_ErrCode. * @since 11 * @version 1.0 */ -typedef Drm_ErrCode (*MediaKeySession_EventCallback)(DRM_ListenerType eventType, DRM_Uint8CharBufferPair *eventInfo); +typedef Drm_ErrCode (*MediaKeySession_EventCallback)(DRM_EventType eventType, uint8_t *info, + int32_t infoLen, char *extra); /** - * @brief 注册监听,监听密钥变化。 - * @param keysInfo 密钥信息。 - * @param newKeysAvailable 新密钥释放可用。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Call back will be invoked when key changes. + * @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 11 * @version 1.0 */ typedef Drm_ErrCode (*MediaKeySession_KeyChangeCallback)(DRM_KeysInfo *keysInfo, bool newKeysAvailable); /** - * @brief MediaKeySession回调结构体, 用来监听密钥过期、密钥变化等事件。 + * @brief MediaKeySession_Callback struct, used to listen event like key expired and key change etc.. * @since 11 * @version 1.0 */ typedef struct MediaKeySession_Callback { /** - * KeySession回调事件,如许可证过期。 + * Normal event callback like key expired etc.. */ MediaKeySession_EventCallback eventCallback; /** - * 密钥变化事件触发的keyChange事件。 + * Key change callback for keys change event. */ MediaKeySession_KeyChangeCallback keyChangeCallback; } MediaKeySession_Callback; /** - * @brief 生成许可证请求。 - * @param mediaKeySession mediaKeySession实例。 - * @param info 许可证请求信息。 - * @param mediaKeyRequest 许可证请求 + * @brief Generate media key request. + * @param mediaKeySession Media key session instance. + * @param info Media key request info. + * @param mediaKeyRequest Media key request. * @return Drm_ErrCode. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_GenerateMediaKeyRequest(MediaKeySession *mediaKeySession, - DRM_MediaKeyRequestInfo *info, DRM_MediaKeyRequest **mediaKeyRequest); + DRM_MediaKeyRequestInfo *info, DRM_MediaKeyRequest *mediaKeyRequest); /** - * @brief 处理许可证响应。 - * @param mediaKeySession mediaKeySession实例。 - * @param response 许可证响应。 - * @param mediaKeyId 许可证Id。 - * @param mediaKeyIdLen 许可证Id长度。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Process media key response. + * @param mediaKeySession Media key session instance. + * @param response Media Key resposne. + * @param responseLen Media Key resposne len. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len for in buffer and out data. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse(MediaKeySession *keySession, - DRM_Uint8Buffer *response, unsigned char **mediaKeyId, int32_t *mediaKeyIdLen); +Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse(MediaKeySession *mediaKeySession, + uint8_t *response, int32_t responseLen, uint8_t *offlineMediaKeyId, int32_t *offlineMediaKeyIdLen); /** - * @brief 检查许可证状态. - * @param mediaKeySession mediaKeySession实例。 - * @param mediaKeyDescription 许可证状态描述。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Check media key status. + * @param mediaKeySession Media key session instance. + * @param mediaKeyStatus Media key status. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus(MediaKeySession *mediaKeySessoin, - DRM_MediaKeyDescription **mediaKeyDescription); + DRM_MediaKeyStatus *mediaKeyStatus); /** - * @brief 清除当前会话的许可证 . - * @param mediaKeySession mediaKeySession实例。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Clear media keys of the current session . + * @param mediaKeySession Media key session instance. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin); /** - * @brief 生成离线许可证释放请求。 - * @param mediaKeySession mediaKeySession实例。 - * @param mediaKeyId 许可证Id。 - * @param releaseRequest 离线许可证请求。 - * @param releaseRequestLen 离线许可证请求长度。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Generate offline media key release request. + * @param mediaKeySession Media key session instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @param releaseRequest Media Key release request. + * @param releaseRequestLen Media Key release request len for in buffer and out data. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *mediaKeySessoin, - DRM_Uint8Buffer *mediaKeyId, unsigned char **releaseRequest, int32_t *releaseRequestLen); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseRequest, + int32_t *releaseRequestLen); /** - * @brief 处理离线许可证释放响应。 - * @param mediaKeySession mediaKeySession实例。 - * @param mediaKeyId 许可证Id。 - * @param releaseReponse 许可证响应。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Process offline media key release response. + * @param mediaKeySession Media key session instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @param releaseReponse Media Key resposne. + * @param releaseReponseLen Media Key resposne len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse(MediaKeySession *mediaKeySessoin, - DRM_Uint8Buffer *mediaKeyId, DRM_Uint8Buffer *releaseReponse); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseReponse, + int32_t releaseReponseLen); /** - * @brief 根据许可证ID恢复对应许可证状态。 - * @param mediaKeySession mediaKeySession实例。 - * @param mediaKeyId 许可证Id。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Restore offline media keys by ID. + * @param mediaKeySession Media key session instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys(MediaKeySession *mediaKeySessoin, - DRM_Uint8Buffer *mediaKeyId); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); /** - * @brief 获取当前会话的内容保护级别。 - * @param mediaKeySession mediaKeySession实例。 - * @param contentProtectionLevel 内容保护级别。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Get content protection level of the session. + * @param mediaKeySession Media key session instance. + * @param contentProtectionLevel Content protection level. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ @@ -176,11 +186,11 @@ Drm_ErrCode OH_MediaKeySession_GetContentProtectionLevel(MediaKeySession *mediaK DRM_ContentProtectionLevel *contentProtectionLevel); /** - * @brief 查询是否需要安全解码. - * @param mediaKeySession mediaKeySession实例。 - * @param mimeType 媒体类型。 - * @param status 是否安全解码。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Whether the encrypted content require a secure decoder or not. + * @param mediaKeySession Media key session instance. + * @param mimeType The media type. + * @param status Whether secure decoder is required. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ @@ -188,10 +198,10 @@ Drm_ErrCode OH_MediaKeySession_RequireSecureDecoderModule(MediaKeySession *media const char *mimeType, bool *status); /** - * @brief 设置MediaKeySession事件回调。 - * @param mediaKeySession mediaKeySession实例。 - * @param callback 设置到MediaKeySession中的回调. - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Set media key session event callback. + * @param mediaKeySession Media key session instance. + * @param callback Callback to be set to the media key session. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ @@ -199,9 +209,9 @@ Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *media MediaKeySession_Callback *callback); /** - * @brief MediaKeySession资源销毁. - * @param mediaKeySession mediaKeySession实例。 - * @return 参数检查错误返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Release the resource before the session gonna be unused. + * @param mediaKeySession Media key session instance. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h index 5ce82d5f..c1b2a67e 100644 --- a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h +++ b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h @@ -17,7 +17,7 @@ * @addtogroup Drm * @{ * - * @brief 提供数字版权保护能力的API。 + * @brief Provides APIs of Drm. * @kit Drm. * @since 11 * @version 1.0 @@ -25,10 +25,11 @@ /** * @file native_mediakeysystem.h - * @brief 定义Drm MediaKeySystem API。提供以下功能: - * 查询是否支持特定的drm,创建媒体密钥会话,获取和设置配置, - * 获取统计信息,获取内容保护级别,生成提供请求,处理提供响应, - * 事件监听,获取内容防护级别,管理离线媒体密钥等。 + * @brief Defines the Drm MediaKeySystem APIs. Provide following function: + * query if specific drm supported or not, create media key session, + * get and set configurations, get statistics, get content protection level, + * generate provision request, process provision response, event listening, + * get content protection level, manage offline media key etc.. * @library libnative_drm.z.so * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 @@ -49,48 +50,41 @@ extern "C" { #endif /** - * @brief 事件触发时将调用的回调。 - * @param eventType 事件类型。 - * @param eventInfo MediaKeySystem获取到的事件信息。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Call back will be invoked when event triggers. + * @param eventType Event type. + * @param info Event info gotten from media key system. + * @param infoLen Event info len. + * @param extra Extra info gotten from media key system. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ -typedef Drm_ErrCode (*MediaKeySystem_Callback)(DRM_ListenerType eventType, DRM_Uint8CharBufferPair *eventInfo); -/** - * @brief 通过MediaKeySystem方案唯一编号获取MediaKeySystem方案名。 - * @param uuid MediaKeySystem方案唯一编号。 - * @param name MediaKeySystem方案名。 - * @param nameLen MediaKeySystem方案名长度。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 - * @since 11 - * @version 1.0 - */ -Drm_ErrCode OH_MediaKeySystem_GetMediaKeySystemName(const char *uuid, unsigned char **name, int32_t *nameLen); +typedef Drm_ErrCode (*MediaKeySystem_Callback)(DRM_EventType eventType, uint8_t *info, + int32_t infoLen, char *extra); /** - * @brief 查询设备是否支持指定MediaKeySystem方案。 - * @param name MediaKeySystem方案名。 - * @return 支持与否。 + * @brief Query if media key system is supported. + * @param name Used to point a Digital Right Management solution. + * @return Supported or not in boolean. * @since 11 * @version 1.0 */ bool OH_MediaKeySystem_IsSupported(const char *name); /** - * @brief 查询设备是否支持指定MediaKeySystem方案、指定媒体类型。 - * @param name MediaKeySystem方案名。 - * @param mimeType 媒体类型。 - * @return 支持与否。 + * @brief Query if media key system is supported. + * @param name Used to point a Digital Right Management solution. + * @param mimeType Used to specifies the media type. + * @return Supported or not in boolean. * @since 11 * @version 1.0 */ bool OH_MediaKeySystem_IsSupported2(const char *name, const char *mimeType); /** - * @brief 查询设备是否支持指定MediaKeySystem方案、指定媒体类型、指定内容保护级别。 - * @param name MediaKeySystem方案名。 - * @param mimeType 媒体类型。 - * @param contentProtectionLevel 内容保护级别。 - * @return 支持与否。 + * @brief Query if media key system is supported. + * @param name Used to point a Digital Right Management solution. + * @param mimeType Used to specifies the media type. + * @param contentProtectionLevel Used to specifies the ContentProtectionLevel. + * @return Supported or not in boolean. * @since 11 * @version 1.0 */ @@ -98,87 +92,86 @@ bool OH_MediaKeySystem_IsSupported3(const char *name, const char *mimeType, DRM_ContentProtectionLevel contentProtectionLevel); /** - * @brief 根据方案名创建一个MediaKeySystem实例。 - * @param name MediaKeySystem方案名 - * @param mediaKeySystem MediaKeySystem实例。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 - * 达到MediaKeySession实例最大数量返回{@link DRM_ERR_MAX_SYSTEM_NUM_REACHED}。 + * @brief Creates a media key system instance from the name. + * @param name Secifies which drm system will be created by name. + * @param mediaKeySystem Media key system instance. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully, + * return DRM_ERR_MAX_SYSTEM_NUM_REACHED when max num media key system reached. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_Create(const char *name, MediaKeySystem **mediaKeySystem); /** - * @brief 通过配置名设置MediaKeySystem的配置值。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param configName 字符串类型配置名。 - * @param value 字符串形式配置值。 - * @param valueLen 字符串形式配置值长度。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Set media key system configuration value by name. + * @param mediaKeySystem Media key system instance. + * @param configName Configuration name string. + * @param value Configuration vaule string to be set. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_SetConfigurationString(MediaKeySystem *mediaKeySystem, const char *configName, const char *value); /** - * @brief 通过配置名获取MediaKeySystem的配置值。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param configName 字符串类型配置名。 - * @param value 字符串形式配置值。 - * @param valueLen 字符串形式配置值长度。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Get media key system configuration value by name. + * @param mediaKeySystem Media key system instance. + * @param configName Configuration name string. + * @param value Configuration vaule string to be get. + * @param valueLen Configuration vaule string len for in buffer. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetConfigurationString(MediaKeySystem *mediaKeySystem, - const char *configName, char **value, int32_t *valueLen); + const char *configName, char *value, int32_t valueLen); /** - * @brief 通过配置名设置MediaKeySystem的配置值。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param configName 字符串类型配置名。 - * @param value 字节数组形式配置值。 - * @param valueLen 字节数组形式配置值长度。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Set media key system configuration value by name. + * @param mediaKeySystem Media key system instance. + * @param configName Configuration name string. + * @param value Configuration vaule in byte array to be set. + * @param valueLen Value array len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_SetConfigurationByteArray(MediaKeySystem *mediaKeySystem, - const char *configName, DRM_Uint8Buffer *value); + const char *configName, uint8_t *value, int32_t valueLen); /** - * @brief 通过配置名获取MediaKeySystem的配置值。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param configName 字符串类型配置名。 - * @param value 字节数组形式配置值。 - * @param valueLen 字节数组形式配置值长度。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Get media key system configuration value by name. + * @param mediaKeySystem Media key system instance. + * @param configName Configuration name string. + * @param value Configuration vaule in byte array to be get. + * @param valueLen Configuration vaule len for in buffer and out data. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray(MediaKeySystem *mediaKeySystem, - const char *configName, unsigned char **value, int32_t *valueLen); + const char *configName, uint8_t *value, int32_t *valueLen); /** - * @brief 获取MediaKeySystem的度量统计信息。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param statistics 度量统计信息。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Get media key system statistics info. + * @param mediaKeySystem Media key system instance. + * @param statistics Statistic info gotten. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySystem_GetStatistics(MediaKeySystem *mediaKeySystem, DRM_Statistics **statistics); +Drm_ErrCode OH_MediaKeySystem_GetStatistics(MediaKeySystem *mediaKeySystem, DRM_Statistics *statistics); /** - * @brief 获取MediaKeySystem支持的最大内容保护级别。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param contentProtectionLevel 内容保护级别。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Get the max content protection level media key system supported. + * @param mediaKeySystem Media key system instance. + * @param contentProtectionLevel Content protection level. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetMaxContentProtectionLevel(MediaKeySystem *mediaKeySystem, DRM_ContentProtectionLevel *contentProtectionLevel); /** - * @brief 设置MediaKeySystem回调监听。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param callback 设置到MediaKeySystem中的回调函数。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Set media key system event callback. + * @param mediaKeySystem Media key system instance. + * @param callback Callback to be set to the media key system. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ @@ -186,12 +179,12 @@ Drm_ErrCode OH_MediaKeySystem_SetMediaKeySystemCallback(MediaKeySystem *mediaKey MediaKeySystem_Callback callback); /** - * @brief 创建一个MediaKeySession实例。 - * @param mediaKeySystem 用来创建MediaKeySession实例的MediaKeySystem实例。 - * @param level 内容保护级别。 - * @param mediaKeySession MediaKeySession实例。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 - * 达到MediaKeySession实例最大数量返回{@link DRM_ERR_MAX_SESSION_NUM_REACHED}。 + * @brief Create a media key session instance. + * @param mediaKeySystem Media key system instance which will create the media key session. + * @param level Specifies the content protection level. + * @param mediaKeySession Media key session instance. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully, + * return DRM_ERR_MAX_SESSION_NUM_REACHED when max num media key system reached. * @since 11 * @version 1.0 */ @@ -199,69 +192,72 @@ Drm_ErrCode OH_MediaKeySystem_CreateMediaKeySession(MediaKeySystem *mediaKeySyst DRM_ContentProtectionLevel *level, MediaKeySession **mediaKeySession); /** - * @brief 生成设备证书请求。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param request Provision请求数据。 - * @param requestLen Provision请求长度。 - * @param defaultUrl Provision服务器URL。 - * @param defaultUrlLen Provision服务器URL长度。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Generate a media key system provision request. + * @param mediaKeySystem Media key system instance. + * @param request Provision request data sent to provision server. + * @param requestLen Provision request data len for in buffer and out data. + * @param defaultUrl Provision server URL. + * @param defaultUrlLen Provision server URL len for in buffer. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest(MediaKeySystem *mediaKeySystem, unsigned char **request, - int32_t *requestLen, char **defaultUrl, int32_t *defaultUrlLen); +Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest(MediaKeySystem *mediaKeySystem, uint8_t *request, + int32_t *requestLen, char *defaultUrl, int32_t defaultUrlLen); /** - * @brief 处理设备证书响应。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param response 设备证书响应。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Process a media key system provision response. + * @param mediaKeySystem Media key system instance. + * @param response The provision reponse will be processed. + * @param responseLen The response len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_ProcessKeySystemResponse(MediaKeySystem *mediaKeySystem, - DRM_Uint8Buffer *response); + uint8_t *response, int32_t responseLen); /** - * @brief 获取离线许可证状态。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param mediaKeyIds 离线许可证Id。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Get offline media key ids . + * @param mediaKeySystem Media key system instance. + * @param offlineMediaKeyIds Media key ids of all offline media keys. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyIds(MediaKeySystem *mediaKeySystem, - DRM_MediakeyIdArray **mediaKeyIds); + DRM_OfflineMediakeyIdArray *offlineMediaKeyIds); /** - * @brief 获取离线许可证状态。 - * @param mediaKeySystem MediaKeySystem实例。 - * @param mediaKeyId 许可证Id。 - * @param status 获取到的许可证状态。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Get offline media key status. + * @param mediaKeySystem Media key system instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @param status The media key status gotten. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyStatus(MediaKeySystem *mediaKeySystem, - DRM_Uint8Buffer *mediaKeyId, DRM_OfflineMediaKeyStatus *status); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, DRM_OfflineMediaKeyStatus *status); /** - * @brief 根据许可证Id清理许可证. - * @param mediaKeySystem MediaKeySystem实例。 - * @param mediaKeyId 许可证Id. - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Clear an offline media key by id. + * @param mediaKeySystem Media key system instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_ClearOfflineMediaKeys(MediaKeySystem *mediaKeySystem, - DRM_Uint8Buffer *mediaKeyId); + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); /** - * @brief 获取设备证书状态. - * @param mediaKeySystem MediaKeySystem实例。 - * @param certStatus 获取的设备证书状态。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Get certificate status of media key system. + * @param mediaKeySystem Media key system instance. + * @param certStatus Status will be gotten. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ @@ -269,9 +265,9 @@ Drm_ErrCode OH_MediaKeySystem_GetCertificateStatus(MediaKeySystem *mediaKeySyste DRM_CertificateStatus *certStatus); /** - * @brief 销毁MediaKeySystem实例。 - * @param mediaKeySystem 被销毁的MediaKeySystem实例。 - * @return 参数检查失败返回{@link DRM_ERR_INVALID_VAL}, 调用成功返回{@link DRM_ERR_OK}。 + * @brief Destroy a media key system instance. + * @param mediaKeySystem Secifies which media key system instance will be destroyed. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 11 * @version 1.0 */ @@ -282,4 +278,4 @@ Drm_ErrCode OH_MediaKeySystem_Destroy(MediaKeySystem *mediaKeySystem); } #endif -#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H \ No newline at end of file +#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H -- Gitee From afd3ab918f1c8ebf917108a64691e09272d681ac Mon Sep 17 00:00:00 2001 From: wujie <1255071198@qq.com> Date: Sun, 4 Feb 2024 17:28:21 +0800 Subject: [PATCH 0243/2135] Signed-off-by: wujie <1255071198@qq.com> fix: Chinese documentation for SE HDI interface --- .../v1_0/ISecureElementCallback.idl | 32 ++++++ .../v1_0/ISecureElementInterface.idl | 105 ++++++++++++++++++ .../v1_0/SecureElementTypes.idl | 56 ++++++++++ 3 files changed, 193 insertions(+) create mode 100644 zh-cn/device_api/hdi/secure_element/v1_0/ISecureElementCallback.idl create mode 100644 zh-cn/device_api/hdi/secure_element/v1_0/ISecureElementInterface.idl create mode 100644 zh-cn/device_api/hdi/secure_element/v1_0/SecureElementTypes.idl diff --git a/zh-cn/device_api/hdi/secure_element/v1_0/ISecureElementCallback.idl b/zh-cn/device_api/hdi/secure_element/v1_0/ISecureElementCallback.idl new file mode 100644 index 00000000..84379a5b --- /dev/null +++ b/zh-cn/device_api/hdi/secure_element/v1_0/ISecureElementCallback.idl @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.secure_element.v1_0; + +/** + * @brief 声明从SecureElement HDF到SecureElement服务的报告状态回调。 + * + * @since 4.0 + * @version 1.0 + */ +[callback] interface ISecureElementCallback { + /** + * @brief 通知SE状态已更改。 + * @param connected 表示SE是否已连接。 + * + * @since 4.0 + */ + OnSeStateChanged([in] boolean connected); +} diff --git a/zh-cn/device_api/hdi/secure_element/v1_0/ISecureElementInterface.idl b/zh-cn/device_api/hdi/secure_element/v1_0/ISecureElementInterface.idl new file mode 100644 index 00000000..0cd05791 --- /dev/null +++ b/zh-cn/device_api/hdi/secure_element/v1_0/ISecureElementInterface.idl @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ohos.hdi.secure_element.v1_0; + +import ohos.hdi.secure_element.v1_0.ISecureElementCallback; +import ohos.hdi.secure_element.v1_0.SecureElementTypes; + +/** + * @brief 声明由SecureElement模块提供的用于获取SecureElement操作的API, + * 请参阅“开放移动API规范”。 + * + * @since 4.0 + * @version 1.0 + */ +interface ISecureElementInterface { + + /** + * 初始化安全单元 + * + * @param callback 用于通知SE状态更改的回调。 + * @param status 初始化SE的状态。 + * @since 4.0 + * @version 1.0 + */ + init([in] ISecureElementCallback clientCallback, [out] enum SecureElementStatus status); + + /** + * 获取此SE的ATR。 + * + * @return response 返回SE的ATR,SE的ATR不可用时,返回空的数组。 + * @since 4.0 + * @version 1.0 + */ + getAtr([out] List response); + + /** + * 检查当前的安全单元是否可用。 + * + * @param 如果安全单元可用,则present等于True,否则为false。 + */ + isSecureElementPresent([out] boolean present); + + /** + * 使用SE打开一个逻辑通道,选择由给定AID代表的应用(当AID不为Null且AID的长度不为0时)。 + * + * @param aid 要在此通道上选择的应用的AID的byte数组。 + * @param p2 在该通道上执行的SELECT APDU。 + * @param response 对SELECT指令的响应,如果失败则为空。 + * @param channelNumber 新逻辑通道的通道编号。 + * @param status 打开逻辑通道的状态。 + */ + openLogicalChannel([in] List aid, [in] unsigned char p2, [out] List response, + [out] unsigned char channelNumber, [out] enum SecureElementStatus status); + + /** + * 访问[ISO 7816-4]中定义的基本通道(编号为0的通道)。所获得的对象是Channel类的一个实例。 + * + * @param aid 要在此通道上选择的应用的AID的byte数组。 + * @param p2 在该通道上执行的SELECT APDU。 + * @param response SELECT指令的响应,如果失败则为空。 + * @param status 打开基本通道的状态。 + */ + openBasicChannel([in] List aid, [in] unsigned char p2, [out] List response, + [out] enum SecureElementStatus status); + + /** + * 关闭此SE的逻辑通道。关闭基本通道必须返回SecureElementStatus::FAILED。 + * + * @param channelNumber 要关闭的逻辑通道编号。 + * @param status 需要关闭的逻辑通道的状态。 + */ + closeChannel([in] unsigned char channelNumber, [out] enum SecureElementStatus status); + + /** + * 向SE发送APDU指令(根据协议ISO/IEC 7816)。 + * + * @param command 要发送的byte数组格式的APDU指令。 + * @param response 以byte数组接收到的响应。 + * @param status 传输指令的状态。 + * @since 4.0 + * @version 1.0 + */ + transmit([in] List command, [out] List response, [out] enum SecureElementStatus status); + + /** + * 向SE发送APDU指令(根据协议ISO/IEC 7816)。 + * + * @param status 重置安全单元的状态。 + * @since 4.0 + * @version 1.0 + */ + reset([out] enum SecureElementStatus status); +} diff --git a/zh-cn/device_api/hdi/secure_element/v1_0/SecureElementTypes.idl b/zh-cn/device_api/hdi/secure_element/v1_0/SecureElementTypes.idl new file mode 100644 index 00000000..71dc07b5 --- /dev/null +++ b/zh-cn/device_api/hdi/secure_element/v1_0/SecureElementTypes.idl @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file SecureElementTypes.idl + * + * @brief Open Mobile API规范中定义的错误类型。 + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.secure_element.v1_0; + +/** + * @brief Open Mobile API规范中定义的错误类型。 + * + * @since 4.0 + */ +enum SecureElementStatus { + /** 成功状态 */ + SE_SUCCESS = 0, + /** 空指针异常错误 */ + SE_NULL_POINTER_ERROR, + /** 非法参数错误 */ + SE_ILLEGAL_PARAMETER_ERROR, + /** 非法状态错误 */ + SE_ILLEGAL_STATE_ERROR, + /** 安全错误 */ + SE_SECURITY_ERROR, + /** 通道不存在错误 */ + SE_CHANNEL_NOT_AVAILABLE_ERROR, + /** 没有更多元素错误 */ + SE_NO_SUCH_ELEMENT_ERROR, + /** 非法引用错误 */ + SE_ILLEGAL_REFERENCE_ERROR, + /** 不支持的操作错误 */ + SE_OPERATION_NOT_SUPPORTED_ERROR, + /** IO异常错误 */ + SE_IO_ERROR, + /** 其他错误 */ + SE_GENERAL_ERROR, +}; + -- Gitee From 9db45e98d218a6a00ad3a6c615e18197b806c474 Mon Sep 17 00:00:00 2001 From: Gloria Date: Sun, 4 Feb 2024 17:34:20 +0800 Subject: [PATCH 0244/2135] updated EN docs Signed-off-by: Gloria --- .../graphic/native_drawing/drawing_bitmap.h | 29 +- .../graphic/native_drawing/drawing_brush.h | 75 +- .../graphic/native_drawing/drawing_canvas.h | 257 +++++- .../graphic/native_drawing/drawing_color.h | 14 +- .../native_drawing/drawing_color_filter.h | 129 ++++ .../graphic/native_drawing/drawing_filter.h | 94 +++ .../graphic/native_drawing/drawing_font.h | 129 ++++ .../native_drawing/drawing_font_collection.h | 10 +- .../native_drawing/drawing_mask_filter.h | 100 +++ .../graphic/native_drawing/drawing_matrix.h | 92 +++ .../graphic/native_drawing/drawing_path.h | 70 +- .../graphic/native_drawing/drawing_pen.h | 105 ++- .../graphic/native_drawing/drawing_point.h | 74 ++ .../graphic/native_drawing/drawing_rect.h | 76 ++ .../native_drawing/drawing_round_rect.h | 75 ++ .../native_drawing/drawing_shader_effect.h | 142 ++++ .../native_drawing/drawing_text_blob.h | 125 +++ .../native_drawing/drawing_text_declaration.h | 37 +- .../native_drawing/drawing_text_typography.h | 729 ++++++++++++++++-- .../graphic/native_drawing/drawing_typeface.h | 74 ++ .../graphic/native_drawing/drawing_types.h | 242 +++++- 21 files changed, 2442 insertions(+), 236 deletions(-) create mode 100644 en/native_sdk/graphic/native_drawing/drawing_color_filter.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_filter.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_font.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_mask_filter.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_matrix.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_point.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_rect.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_round_rect.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_shader_effect.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_text_blob.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_typeface.h diff --git a/en/native_sdk/graphic/native_drawing/drawing_bitmap.h b/en/native_sdk/graphic/native_drawing/drawing_bitmap.h index 3e7fecfc..30405b8c 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/en/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,8 +31,10 @@ /** * @file drawing_bitmap.h * - * @brief Declares functions related to the bitmap object in the drawing module. + * @brief Declares the functions related to the bitmap in the drawing module. * + * File to include: native_drawing/drawing_bitmap.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -50,9 +52,9 @@ extern "C" { * @version 1.0 */ typedef struct { - /** Storage format of bitmap pixels */ + /** Storage format of bitmap pixels. */ OH_Drawing_ColorFormat colorFormat; - /** Alpha format of bitmap pixels */ + /** Alpha format of bitmap pixels. */ OH_Drawing_AlphaFormat alphaFormat; } OH_Drawing_BitmapFormat; @@ -70,20 +72,21 @@ 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 OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object. * @since 8 * @version 1.0 */ void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); /** - * @brief Initializes the width and height of an OH_Drawing_Bitmap object and sets the pixel format for the bitmap. + * @brief Initializes the width and height of a bitmap 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 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, including the pixel color type and alpha type. + * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object. + * @param width Width of the bitmap to be initialized. + * @param height Height of the bitmap to be initialized. + * @param OH_Drawing_BitmapFormat Pointer to the pixel format of the bitmap to be initialized, + * including the pixel color type and alpha type. * @since 8 * @version 1.0 */ @@ -94,7 +97,7 @@ void OH_Drawing_BitmapBuild( * @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 OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object. * @return Returns the width. * @since 8 * @version 1.0 @@ -105,7 +108,7 @@ uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_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 OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object. * @return Returns the height. * @since 8 * @version 1.0 @@ -116,7 +119,7 @@ uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_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 Pointer to an OH_Drawing_Bitmap object. * @return Returns the pixel address. * @since 8 * @version 1.0 diff --git a/en/native_sdk/graphic/native_drawing/drawing_brush.h b/en/native_sdk/graphic/native_drawing/drawing_brush.h index e81d367e..8d096aeb 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/en/native_sdk/graphic/native_drawing/drawing_brush.h @@ -20,8 +20,8 @@ * @addtogroup Drawing * @{ * - * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. - * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -31,8 +31,10 @@ /** * @file drawing_brush.h * - * @brief Declares functions related to the brush object in the drawing module. + * @brief Declares the functions related to the brush in the drawing module. * + * File to include: native_drawing/drawing_brush.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -57,17 +59,18 @@ OH_Drawing_Brush* OH_Drawing_BrushCreate(void); * @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 OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. * @since 8 * @version 1.0 */ void OH_Drawing_BrushDestroy(OH_Drawing_Brush*); /** - * @brief Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled, edges will be drawn with partial transparency. + * @brief Checks whether anti-aliasing is enabled for a brush. + * Anti-aliasing makes the pixels around the shape edges semi-transparent. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. * @return Returns true if anti-aliasing is enabled; returns false otherwise. * @since 8 * @version 1.0 @@ -75,11 +78,13 @@ void OH_Drawing_BrushDestroy(OH_Drawing_Brush*); bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); /** - * @brief Enables or disables anti-aliasing for a brush. If anti-aliasing is enabled, edges will be drawn with partial transparency. + * @brief Enables or disables anti-aliasing for a brush. + * Anti-aliasing makes the pixels around the shape edges semi-transparent. * * @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 to enable anti-aliasing, and false means the opposite. + * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. + * @param bool Whether to enable anti-aliasing. The value true means to enable anti-aliasing, + * and false means the opposite. * @since 8 * @version 1.0 */ @@ -89,7 +94,7 @@ void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool); * @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 OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. * @return Returns a 32-bit (ARGB) variable that describes the color. * @since 8 * @version 1.0 @@ -97,16 +102,60 @@ void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool); uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*); /** - * @brief Sets the color for a brush. The color will be used by the brush to fill in a shape. + * @brief Sets the color for 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 color Indicates the color to set, which is a 32-bit (ARGB) variable. + * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. + * @param color Color, which is a 32-bit (ARGB) variable. * @since 8 * @version 1.0 */ void OH_Drawing_BrushSetColor(OH_Drawing_Brush*, uint32_t color); +/** + * @brief Obtains the alpha value of a brush. This value is used by the alpha channel when the brush fills in a shape. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. + * @return Returns an 8-bit variable that describes the alpha value. + * @since 11 + * @version 1.0 + */ +uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush*); + +/** + * @brief Sets the alpha value for a brush. This value is used by the alpha channel when the brush fills in a shape. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. + * @param alpha Alpha value, which is an 8-bit variable. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha); + +/** + * @brief Sets the shader effect for a brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. + * @param OH_Drawing_ShaderEffect Pointer to an OH_Drawing_ShaderEffect object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*); + +/** + * @brief Sets a filter for a brush. The filter is a container that holds a mask filter and color filter. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. + * @param OH_Drawing_Filter Pointer to an OH_Drawing_Filter object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_canvas.h b/en/native_sdk/graphic/native_drawing/drawing_canvas.h index 490caa8d..a1b19041 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/en/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,8 +20,8 @@ * @addtogroup Drawing * @{ * - * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. - * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -31,8 +31,10 @@ /** * @file drawing_canvas.h * - * @brief Declares functions related to the canvas object in the drawing module. + * @brief Declares the functions related to the canvas in the drawing module. * + * File to include: native_drawing/drawing_canvas.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -57,60 +59,63 @@ 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 OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ void OH_Drawing_CanvasDestroy(OH_Drawing_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). + * @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 OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object. * @since 8 * @version 1.0 */ void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_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. + * @brief Attaches a pen to a canvas so that the canvas can 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 OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. * @since 8 * @version 1.0 */ void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_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. + * @brief Detaches the pen from a canvas so that the canvas can no longer 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_Canvas Pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ void OH_Drawing_CanvasDetachPen(OH_Drawing_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. + * @brief Attaches a brush to a canvas so that the canvas can 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 OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Brush Pointer to an OH_Drawing_Brush object. * @since 8 * @version 1.0 */ void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_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. + * @brief Detaches the brush from a canvas so that the canvas can no longer 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_Canvas Pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ @@ -120,7 +125,7 @@ void OH_Drawing_CanvasDetachBrush(OH_Drawing_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 OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ @@ -130,21 +135,43 @@ void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); * @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 OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*); +/** + * @brief Obtains the number of canvas statuses (canvas matrices) saved in the stack. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @return Returns a 32-bit value that describes the number of canvas statuses (canvas matrices). + * @since 11 + * @version 1.0 + */ +uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*); + +/** + * @brief Restores to a given number of canvas statuses (canvas matrices). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param saveCount Number of canvas statuses (canvas matrices). + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasRestoreToCount(OH_Drawing_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 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. - * @param y2 Indicates the y coordinate of the end point of the line segment. + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param x1 X coordinate of the start point of the line segment. + * @param y1 Y coordinate of the start point of the line segment. + * @param x2 X coordinate of the end point of the line segment. + * @param y2 Y coordinate of the end point of the line segment. * @since 8 * @version 1.0 */ @@ -154,19 +181,189 @@ void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, * @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 OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. * @since 8 * @version 1.0 */ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); /** - * @brief Clears a canvas by using a specified color. + * @brief Draws a bitmap. A bitmap, also referred to as a dot matrix image, a pixel map image, or a grid image, + * includes single points called pixels (image elements). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object. + * @param left X coordinate of the upper left corner of the bitmap. + * @param top Y coordinate of the upper left corner of the bitmap. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); + +/** + * @brief Draws a rectangle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*); + +/** + * @brief Draws a circle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Point Pointer to an OH_Drawing_Point object, which indicates the center of the circle. + * @param radius Radius of the circle. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius); + +/** + * @brief Draws an oval. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*); + +/** + * @brief Draws an arc. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object. + * @param startAngle Start angle of the arc. + * @param sweepAngle Sweep angle of the arc. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); + +/** + * @brief Draws a rounded rectangle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_RoundRect Pointer to an OH_Drawing_RoundRect object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*); + +/** + * @brief Draws a text blob. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_TextBlobPointer to an OH_Drawing_TextBlob object. + * @param x X coordinate of the lower left corner of the text blob. + * @param y Y coordinate of the lower left corner of the text blob. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob*, float x, float y); + +/** + * @brief Enumerates the canvas clipping modes. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** + * Clips a specified area. That is, the difference set is obtained. + */ + DIFFERENCE, + /** + * Retains a specified area. That is, the intersection is obtained. + */ + INTERSECT, +} OH_Drawing_CanvasClipOp; + +/** + * @brief Clips a rectangle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object. + * @param clipOp Clip mode. For details about the available options, see @{link OH_Drawing_CanvasClipOp}. + * @param doAntiAlias Whether to enable anti-aliasing. The value true means to enable anti-aliasing, + * and false means the opposite. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*, + OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); + +/** + * @brief Clips a path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. + * @param clipOp Clip mode. For details about the available options, see @{link OH_Drawing_CanvasClipOp}. + * @param doAntiAlias Whether to enable anti-aliasing. The value true means to enable anti-aliasing, + * and false means the opposite. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, + OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); + +/** + * @brief Rotates a canvas by a given angle. A positive number indicates clockwise rotation, and a negative number + * indicates clockwise rotation. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param degrees Angle to rotate. + * @param px X coordinate of the rotation center. + * @param py Y coordinate of the rotation center. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py); + +/** + * @brief Translates a canvas by a given distance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param dx Distance to translate in the horizontal direction. + * @param dy Distance to translate in the vertical direction. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); + +/** + * @brief Scales a canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param sx Horizontal scale factor. + * @param sy Vertical scale factor. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); + +/** + * @brief Clears a canvas by using a given color. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param color Indicates the color, which is a 32-bit (ARGB) variable. + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. + * @param color Color, which is a 32-bit (ARGB) variable. * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_color.h b/en/native_sdk/graphic/native_drawing/drawing_color.h index 2aef9851..df868295 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_color.h +++ b/en/native_sdk/graphic/native_drawing/drawing_color.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,8 +31,10 @@ /** * @file drawing_color.h * - * @brief Declares functions related to the color object in the drawing module. + * @brief Declares the functions related to the color in the drawing module. * + * File to include: native_drawing/drawing_color.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -47,10 +49,10 @@ extern "C" { * @brief Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param alpha Indicates a variable that describes alpha. The value ranges from 0x00 to 0xFF. - * @param red Indicates a variable that describes red. The value ranges from 0x00 to 0xFF. - * @param green Indicates a variable that describes green. The value ranges from 0x00 to 0xFF. - * @param blue Indicates a variable that describes blue. The value ranges from 0x00 to 0xFF. + * @param alpha Alpha, which is a variable ranging from 0x00 to 0xFF. + * @param red Read, which is a variable ranging from 0x00 to 0xFF. + * @param green Green, which is a variable ranging from 0x00 to 0xFF. + * @param blue Blue, which is a variable ranging from 0x00 to 0xFF. * @return Returns a 32-bit (ARGB) variable that describes the color. * @since 8 * @version 1.0 diff --git a/en/native_sdk/graphic/native_drawing/drawing_color_filter.h b/en/native_sdk/graphic/native_drawing/drawing_color_filter.h new file mode 100644 index 00000000..b41d8fca --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_color_filter.h @@ -0,0 +1,129 @@ +/* + * 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 C_INCLUDE_DRAWING_COLOR_FILTER_H +#define C_INCLUDE_DRAWING_COLOR_FILTER_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_color_filter.h + * + * @brief Declares the functions related to the color filter in the drawing module. + * + * File to include: native_drawing/drawing_color_filter.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_ColorFilter object with a given blend mode. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param color Color, which is a 32-bit (ARGB) variable. + * @param OH_Drawing_BlendMode Blend mode. For details about the available options, see {@link OH_Drawing_BlendMode}. + * @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); + +/** + * @brief Creates an OH_Drawing_ColorFilter object by combining another two color filters. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_ColorFilter Pointer to the first color filter. + * @param OH_Drawing_ColorFilter Pointer to the second color filter. + * @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); + +/** + * @brief Creates an OH_Drawing_ColorFilter object with a given 5x4 color matrix. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param matrix Matrix, which is represented by a floating-point array with a length of 20. + * @return Returns the pointer to the OH_Drawing_ColorFilter object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateMatrix(const float matrix[20]); + +/** + * @brief Creates an OH_Drawing_ColorFilter object that applies the sRGB gamma curve to the RGB channels. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_ColorFilter object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLinearToSrgbGamma(void); + +/** + * @brief Creates an OH_Drawing_ColorFilter object that applies the RGB channels to the sRGB gamma curve. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_ColorFilter object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateSrgbGammaToLinear(void); + +/** + * @brief Creates an OH_Drawing_ColorFilter object that multiplies the passed-in luma into the alpha channel + * and sets the RGB channels to zero. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_ColorFilter object created. + * @since 11 + * @version 1.0 + */ +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 to an OH_Drawing_ColorFilter object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_ColorFilterDestroy(OH_Drawing_ColorFilter*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_filter.h b/en/native_sdk/graphic/native_drawing/drawing_filter.h new file mode 100644 index 00000000..dbb9faa2 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_filter.h @@ -0,0 +1,94 @@ +/* + * 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 C_INCLUDE_DRAWING_FILTER_H +#define C_INCLUDE_DRAWING_FILTER_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_filter.h + * + * @brief Declares the functions related to the filter in the drawing module. + * + * File to include: native_drawing/drawing_filter.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_Filter object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_Filter object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Filter* OH_Drawing_FilterCreate(void); + +/** + * @brief Sets an OH_Drawing_MaskFilter object for an OH_Drawing_Filter object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Filter Pointer to an OH_Drawing_Filter object. + * @param OH_Drawing_MaskFilter Pointer to an OH_Drawing_MaskFilter object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FilterSetMaskFilter(OH_Drawing_Filter*, OH_Drawing_MaskFilter*); + +/** + * @brief Sets an OH_Drawing_ColorFilter object for an OH_Drawing_Filter object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Filter Pointer to an OH_Drawing_Filter object. + * @param OH_Drawing_ColorFilter to an OH_Drawing_ColorFilter object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FilterSetColorFilter(OH_Drawing_Filter*, OH_Drawing_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 Pointer to an OH_Drawing_Filter object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FilterDestroy(OH_Drawing_Filter*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_font.h b/en/native_sdk/graphic/native_drawing/drawing_font.h new file mode 100644 index 00000000..a6b22459 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_font.h @@ -0,0 +1,129 @@ +/* + * 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 C_INCLUDE_DRAWING_FONT_H +#define C_INCLUDE_DRAWING_FONT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_font.h + * + * @brief Declares the functions related to the font in the drawing module. + * + * File to include: native_drawing/drawing_font.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_Font object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_Font object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Font* OH_Drawing_FontCreate(void); + +/** + * @brief Sets the typeface for a font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. + * @param OH_Drawing_Typeface Pointer to an OH_Drawing_Typeface object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); + +/** + * @brief Sets the font size. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. + * @param textSize Font size. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); + +/** + * @brief Sets linear scaling for a font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. + * @param isLinearText Whether to set linear scaling. The value true means to set linear scaling, + * and false means the opposite. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetLinearText(OH_Drawing_Font*, bool isLinearText); + +/** + * @brief Sets a horizontal skew factor for a font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. + * @param skewX Skew of the X axis relative to the Y axis. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); + +/** + * @brief Sets fake bold for a font by increasing the stroke width. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. + * @param isFakeBoldText Whether to set fake bold. The value true means to set fake bold, + * and false means the opposite. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); + +/** + * @brief Destroys an OH_Drawing_Font object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_FontDestroy(OH_Drawing_Font*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_font_collection.h b/en/native_sdk/graphic/native_drawing/drawing_font_collection.h index 8c9b231b..2aab1772 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/en/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Provides the 2D drawing capability. + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,8 +31,10 @@ /** * @file drawing_font_collection.h * - * @brief Declares functions related to FontCollection in the drawing module. + * @brief Declares the functions related to the font collection in the drawing module. * + * File to include: native_drawing/drawing_font_collection.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -53,10 +55,10 @@ extern "C" { OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void); /** - * @brief Releases the memory occupied by an OH_Drawing_FontCollection object. + * @brief Destroys an OH_Drawing_FontCollection object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @param OH_Drawing_FontCollection Pointer to an OH_Drawing_FontCollection object. * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h new file mode 100644 index 00000000..89b8432b --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -0,0 +1,100 @@ +/* + * 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 C_INCLUDE_DRAWING_MASK_FILTER_H +#define C_INCLUDE_DRAWING_MASK_FILTER_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_mask_filter.h + * + * @brief Declares the functions related to the mask filter in the drawing module. + * + * File to include: native_drawing/drawing_mask_filter.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the blur types. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** + * Blurs both inside and outside the original border. + */ + NORMAL, + /** + * Draws solid inside the border, and blurs outside. + */ + SOLID, + /** + * Draws nothing inside the border, and blurs outside. + */ + OUTER, + /** + * Blurs inside the border, and draws nothing outside. + */ + INNER, +} OH_Drawing_BlurType; + +/** + * @brief Creates an OH_Drawing_MaskFilter object with a given blur type. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param blurType Blur type. + * @param sigma Standard deviation of the Gaussian blur to apply. The value must be greater than 0. + * @param respectCTM Whether the blur's sigma is modified by the CTM. The default value is true. + * @return Returns the pointer to the OH_Drawing_MaskFilter object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur(OH_Drawing_BlurType blurType, float sigma, bool respectCTM); + +/** + * @brief Destroys an OH_Drawing_MaskFilter object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_MaskFilter Pointer to an OH_Drawing_MaskFilter object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_MaskFilterDestroy(OH_Drawing_MaskFilter*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_matrix.h b/en/native_sdk/graphic/native_drawing/drawing_matrix.h new file mode 100644 index 00000000..0bcfff4d --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -0,0 +1,92 @@ +/* + * 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 C_INCLUDE_DRAWING_MATRIX_H +#define C_INCLUDE_DRAWING_MATRIX_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_matrix.h + * + * @brief Declares the functions related to the matrix in the drawing module. + * + * File to include: native_drawing/drawing_matrix.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_Matrix object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_Matrix object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); + +/** + * @brief Sets matrix parameters for an OH_Drawing_Matrix object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an OH_Drawing_Matrix object. + * @param scaleX Horizontal scale factor. + * @param skewX Horizontal skew coefficient. + * @param transX Horizontal translation coefficient. + * @param skewY Vertical skew coefficient. + * @param scaleY Vertical scale factor. + * @param transY Vertical translation coefficient. + * @param persp0 Perspective coefficient of the X axis. + * @param persp1 Perspective coefficient of the Y axis. + * @param persp2 Perspective scale coefficient. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, float transX, + float skewY, float scaleY, float transY, float persp0, float persp1, float persp2); + +/** + * @brief Destroys an OH_Drawing_Matrix object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an OH_Drawing_Matrix object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_MatrixDestroy(OH_Drawing_Matrix*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_path.h b/en/native_sdk/graphic/native_drawing/drawing_path.h index 361ab3f4..8d0e5dcf 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_path.h +++ b/en/native_sdk/graphic/native_drawing/drawing_path.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,8 +31,10 @@ /** * @file drawing_path.h * - * @brief Declares functions related to the path object in the drawing module. + * @brief Declares the functions related to the path in the drawing module. * + File to include: native_drawing/drawing_path.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -57,7 +59,7 @@ OH_Drawing_Path* OH_Drawing_PathCreate(void); * @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 OH_Drawing_Path Pointer to an OH_Drawing_Path object. * @since 8 * @version 1.0 */ @@ -67,9 +69,9 @@ void OH_Drawing_PathDestroy(OH_Drawing_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 x Indicates the x coordinate of the start point. - * @param y Indicates the y coordinate of the start point. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. + * @param x X coordinate of the start point. + * @param y Y coordinate of the start point. * @since 8 * @version 1.0 */ @@ -79,26 +81,28 @@ void OH_Drawing_PathMoveTo(OH_Drawing_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 x Indicates the x coordinate of the target point. - * @param y Indicates the y coordinate of the target point. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. + * @param x X coordinate of the target point. + * @param y Y coordinate of the target point. * @since 8 * @version 1.0 */ void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y); /** - * @brief Draws an arc to a path. This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first, - * and then a start angle and a sweep angle are specified. The arc is a portion of the ellipse defined by the start angle and the sweep angle. By default, a line segment from the last point of the path to the start point of the arc is also added. + * @brief Draws an arc to a path. This is done by using angle arc mode. In this mode, a rectangle that encloses an + * ellipse is specified first, and then a start angle and a sweep angle are specified. The arc is a portion of the + * ellipse defined by the start angle and the sweep angle. + * 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 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. - * @param y2 Indicates the y coordinate of the lower right corner of the rectangle. - * @param startDeg Indicates the start angle, in degrees. - * @param sweepDeg Indicates the angle to sweep, in degrees. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. + * @param x1 X coordinate of the upper left corner of the rectangle. + * @param y1 Y coordinate of the upper left corner of the rectangle. + * @param x2 X coordinate of the lower right corner of the rectangle. + * @param y2 Y coordinate of the lower right corner of the rectangle. + * @param startDeg Start angle. + * @param sweepDeg Sweep degree. * @since 8 * @version 1.0 */ @@ -108,11 +112,11 @@ void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float * @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 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. - * @param endY Indicates the y coordinate of the target point. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. + * @param ctrlX X coordinate of the control point. + * @param ctrlY Y coordinate of the control point. + * @param endX X coordinate of the target point. + * @param endY Y coordinate of the target point. * @since 8 * @version 1.0 */ @@ -122,13 +126,13 @@ void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float end * @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 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. - * @param ctrlY2 Indicates the y coordinate of the second control point. - * @param endX Indicates the x coordinate of the target point. - * @param endY Indicates the y coordinate of the target point. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. + * @param ctrlX1 X coordinate of the first control point. + * @param ctrlY1 Y coordinate of the first control point. + * @param ctrlX2 X coordinate of the second control point. + * @param ctrlY2 Y coordinate of the second control point. + * @param endX X coordinate of the target point. + * @param endY Y coordinate of the target point. * @since 8 * @version 1.0 */ @@ -136,10 +140,10 @@ void OH_Drawing_PathCubicTo( OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); /** - * @brief Closes a path. A line segment from the start point to the last point of the path is added. + * @brief Closes a path by drawing a line segment from the current point to the start point of the path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. * @since 8 * @version 1.0 */ @@ -149,7 +153,7 @@ void OH_Drawing_PathClose(OH_Drawing_Path*); * @brief Resets path data. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param OH_Drawing_Path Pointer to an OH_Drawing_Path object. * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_pen.h b/en/native_sdk/graphic/native_drawing/drawing_pen.h index 5d781bf6..14cc4d92 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/en/native_sdk/graphic/native_drawing/drawing_pen.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,8 +31,10 @@ /** * @file drawing_pen.h * - * @brief Declares functions related to the pen object in the drawing module. + * @brief Declares the functions related to the pen the drawing module. * + * File to include: native_drawing/drawing_pen.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -57,17 +59,18 @@ OH_Drawing_Pen* OH_Drawing_PenCreate(void); * @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 OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. * @since 8 * @version 1.0 */ void OH_Drawing_PenDestroy(OH_Drawing_Pen*); /** - * @brief Checks whether anti-aliasing is enabled for a pen. If anti-aliasing is enabled, edges will be drawn with partial transparency. + * @brief Checks whether anti-aliasing is enabled for a pen. + * Anti-aliasing makes the pixels around the shape edges semi-transparent. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. * @return Returns true if anti-aliasing is enabled; returns false otherwise. * @since 8 * @version 1.0 @@ -75,11 +78,13 @@ void OH_Drawing_PenDestroy(OH_Drawing_Pen*); bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen*); /** - * @brief Enables or disables anti-aliasing for a pen. If anti-aliasing is enabled, edges will be drawn with partial transparency. + * @brief Enables or disables anti-aliasing for a pen. + * Anti-aliasing makes the pixels around the shape edges semi-transparent. * * @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 to enable anti-aliasing, and false means the opposite. + * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. + * @param bool Whether to enable anti-aliasing. The value true means to enable anti-aliasing, + * and false means the opposite. * @since 8 * @version 1.0 */ @@ -89,7 +94,7 @@ void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen*, bool); * @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 OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. * @return Returns a 32-bit (ARGB) variable that describes the color. * @since 8 * @version 1.0 @@ -100,18 +105,41 @@ uint32_t OH_Drawing_PenGetColor(const OH_Drawing_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 color Indicates the color to set, which is a 32-bit (ARGB) variable. + * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. + * @param color Color, which is a 32-bit (ARGB) variable. * @since 8 * @version 1.0 */ void OH_Drawing_PenSetColor(OH_Drawing_Pen*, uint32_t color); +/** + * @brief Obtains the alpha value of a pen. This value is used by the alpha channel when the pen outlines a shape. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. + * @return Returns an 8-bit variable that describes the alpha value. + * @since 11 + * @version 1.0 + */ +uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen*); + +/** + + * @brief Sets the alpha value for a pen. This value is used by the alpha channel when the pen outlines a shape. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. + * @param alpha Alpha value, which is an 8-bit variable. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_PenSetAlpha(OH_Drawing_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 OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. * @return Returns the thickness. * @since 8 * @version 1.0 @@ -122,18 +150,19 @@ float OH_Drawing_PenGetWidth(const OH_Drawing_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 width Indicates the thickness to set, which is a variable. + * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. + * @param width Thickness, which is a variable. * @since 8 * @version 1.0 */ void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width); /** - * @brief Obtains the stroke miter limit of a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded. + * @brief Obtains the stroke miter limit of a polyline drawn by a pen. When the corner type is bevel, a beveled corner + * is displayed if the miter limit is exceeded, 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 OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. * @return Returns the miter limit. * @since 8 * @version 1.0 @@ -141,28 +170,36 @@ void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width); float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen*); /** - * @brief Sets the stroke miter limit for a polyline drawn by a pen. When the corner type is bevel, a beveled corner is displayed if the miter limit is exceeded, and a mitered corner is displayed if the miter limit is not exceeded. + * @brief Sets the stroke miter limit for a polyline drawn by a pen. When the corner type is bevel, a beveled corner + * is displayed if the miter limit is exceeded, 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 miter Indicates a variable that describes the miter limit. + * @param OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. + * @param miter Stroke miter limit, which is a variable. * @since 8 * @version 1.0 */ void OH_Drawing_PenSetMiterLimit(OH_Drawing_Pen*, float miter); /** - * @brief Enumerates line cap styles of a pen. The line cap style defines the style of both ends of a line segment drawn by the pen. - * + * @brief Enumerates the line cap styles of a pen. The line cap style defines the style of both ends of a line segment + * drawn by the pen. + * * @since 8 * @version 1.0 */ typedef enum { /** There is no cap style. Both ends of the line segment are cut off square. */ LINE_FLAT_CAP, - /** Square cap style. Both ends have a square, the height of which is half of the width of the line segment, with the same width. */ + /** + * Square cap style. Both ends have a square, the height of which is half of the width of the line segment, + * with the same width. + */ LINE_SQUARE_CAP, - /** Round cap style. Both ends have a semicircle centered, the diameter of which is the same as the width of the line segment. */ + /** + * Round cap style. Both ends have a semicircle centered, the diameter of which is the same as the width of + * the line segment. + */ LINE_ROUND_CAP } OH_Drawing_PenLineCapStyle; @@ -170,7 +207,7 @@ 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 OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. * @return Returns the line cap style. * @since 8 * @version 1.0 @@ -181,21 +218,25 @@ OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap(const OH_Drawing_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 OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. + * @param OH_Drawing_PenLineCapStyle Line cap style, which is a variable. * @since 8 * @version 1.0 */ void OH_Drawing_PenSetCap(OH_Drawing_Pen*, OH_Drawing_PenLineCapStyle); /** - * @brief Enumerates pen line join styles. The line join style defines the shape of the joints of a polyline segment drawn by the pen. - * + * @brief Enumerates the line join styles of a pen. The line join style defines the shape of the joints of a polyline + * segment drawn by the pen. + * * @since 8 * @version 1.0 */ typedef enum { - /** Mitered corner. If the angle of a polyline is small, its miter length may be inappropriate. In this case, you need to use the miter limit to limit the miter length. */ + /** + * Mitered corner. If the angle of a polyline is small, its miter length may be inappropriate. In this case, + * you need to use the miter limit to limit the miter length. + */ LINE_MITER_JOIN, /** Round corner. */ LINE_ROUND_JOIN, @@ -207,7 +248,7 @@ 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 OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. * @return Returns the line join style. * @since 8 * @version 1.0 @@ -218,8 +259,8 @@ OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_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 OH_Drawing_Pen Pointer to an OH_Drawing_Pen object. + * @param OH_Drawing_PenLineJoinStyle Line join style. * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_point.h b/en/native_sdk/graphic/native_drawing/drawing_point.h new file mode 100644 index 00000000..6f740f3e --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_point.h @@ -0,0 +1,74 @@ +/* + * 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 C_INCLUDE_DRAWING_POINT_H +#define C_INCLUDE_DRAWING_POINT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_point.h + * + * @brief Declares the functions related to the coordinate point in the drawing module. + * + * File to include: native_drawing/drawing_point.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_Point object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param x X coordinate of the point. + * @param y Y coordinate of the point. + * @return Returns the pointer to the OH_Drawing_Point object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Point* OH_Drawing_PointCreate(float x, float y); + +/** + * @brief Destroys an OH_Drawing_Point object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Point Pointer to an OH_Drawing_Point object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_PointDestroy(OH_Drawing_Point*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_rect.h b/en/native_sdk/graphic/native_drawing/drawing_rect.h new file mode 100644 index 00000000..4c1e4847 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_rect.h @@ -0,0 +1,76 @@ +/* + * 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 C_INCLUDE_DRAWING_RECT_H +#define C_INCLUDE_DRAWING_RECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_rect.h + * + * @brief Declares the functions related to the rectangle in the drawing module. + * + * File to include: native_drawing/drawing_rect.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_Rect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param left X coordinate of the upper left corner of the rectangle. + * @param top Y coordinate of the upper left corner of the rectangle. + * @param right X coordinate of the lower right corner of the rectangle. + * @param bottom Y coordinate of the lower right corner of the rectangle. + * @return Returns the pointer to the OH_Drawing_Rect object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Rect* OH_Drawing_RectCreate(float left, float top, float right, float bottom); + +/** + * @brief Destroys an OH_Drawing_Rect object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_RectDestroy(OH_Drawing_Rect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_round_rect.h b/en/native_sdk/graphic/native_drawing/drawing_round_rect.h new file mode 100644 index 00000000..22206d51 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -0,0 +1,75 @@ +/* + * 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 C_INCLUDE_DRAWING_ROUND_RECT_H +#define C_INCLUDE_DRAWING_ROUND_RECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_round_rect.h + * + * @brief Declares the functions related to the rounded rectangle in the drawing module. + * + * File to include: native_drawing/drawing_round_rect.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_RoundRect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Rect Pointer to an OH_Drawing_Rect object. + * @param xRad Radius of the rounded corner on the X axis. + * @param yRad Radius of the rounded corner on the 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); + +/** + * @brief Destroys an OH_Drawing_RoundRect object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_RoundRect Pointer to an OH_Drawing_RoundRect object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_RoundRectDestroy(OH_Drawing_RoundRect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h new file mode 100644 index 00000000..83f396e1 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -0,0 +1,142 @@ +/* + * 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 C_INCLUDE_DRAWING_SHADER_EFFECT_H +#define C_INCLUDE_DRAWING_SHADER_EFFECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_shader_effect.h + * + * @brief Declares the functions related to the shader effect in the drawing module. + * + * File to include: native_drawing/drawing_shader_effect.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the tile modes of the shader effect. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** + * Replicates the edge color if the shader effect draws outside of its original boundary. + */ + CLAMP, + /** + * Repeats the shader effect's image in both horizontal and vertical directions. + */ + REPEAT, + /** + * Repeats the shader effect's image in both horizontal and vertical directions, alternating mirror images. + */ + MIRROR, + /** + * Renders the shader effect's image only within the original boundary, and returns transparent black elsewhere. + */ + DECAL, +} OH_Drawing_TileMode; + +/** + * @brief Creates an OH_Drawing_ShaderEffect object that generates a linear gradient between two points. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param startPt Start point. + * @param endPt End point. + * @param colors Colors to distribute. + * @param pos Relative position of each color in the color array. + * @param size Number of colors and positions. + * @param OH_Drawing_TileMode Tile mode of the shader effect. + * For details about the available options, see {@link OH_Drawing_TileMoe}. + * @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); + +/** + * @brief Creates an OH_Drawing_ShaderEffect object that generates a radial gradient based on + * the center and radius of a circle. + * The radial gradient transitions colors from the center to the ending shape in a radial manner. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param centerPt Center of the circle. + * @param radius Radius of the circle. + * @param colors Colors to distribute. + * @param pos Relative position of each color in the color array. + * @param size Number of colors and positions. + * @param OH_Drawing_TileMode Tile mode of the shader effect. + * For details about the available options, see {@link OH_Drawing_TileMoe}. + * @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); + +/** + * @brief Creates an OH_Drawing_ShaderEffect object that generates a sweep gradient based on the center. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param centerPt Center of the circle. + * @param colors Colors to distribute. + * @param pos Relative position of each color in the color array. + * @param size Number of colors and positions. + * @param OH_Drawing_TileMode Tile mode of the shader effect. + * For details about the available options, see {@link OH_Drawing_TileMoe}. + * @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); + +/** + * @brief Destroys an OH_Drawing_ShaderEffect object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_ShaderEffect Pointer to an OH_Drawing_ShaderEffect object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_ShaderEffectDestroy(OH_Drawing_ShaderEffect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_blob.h b/en/native_sdk/graphic/native_drawing/drawing_text_blob.h new file mode 100644 index 00000000..84257ec5 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -0,0 +1,125 @@ +/* + * 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 C_INCLUDE_DRAWING_TEXT_BLOB_H +#define C_INCLUDE_DRAWING_TEXT_BLOB_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_text_blob.h + * + * @brief Declares the functions related to the text blob in the drawing module. + * + * File to include: native_drawing/drawing_text_blob.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_TextBlobBuilder object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_TextBlobBuilder object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void); + +/** + * @brief Describes a run, which provides storage for glyphs and positions. + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** Storage for glyph indexes in the run. */ + uint16_t* glyphs; + /** Storage for glyph positions in the run. */ + float* pos; + /** Storage for UTF-8 encoded text units in the run. */ + char* utf8text; + /** Storage for glyph clusters (index of the UTF-8 encoded text unit) in the run. */ + uint32_t* clusters; +} OH_Drawing_RunBuffer; + +/** + * @brief Allocates a run to store glyphs and positions. The pointer returned does not need to be managed by the caller. + * It can no longer be used after {@link OH_Drawing_TextBlobBuilderMake} is called. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlobBuilder Pointer to an OH_Drawing_TextBlobBuilder object. + * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. + * @param count Number of text blobs. + * @param OH_Drawing_Rect Rectangle of the text blob. + * @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*); + +/** + * @brief Makes an OH_Drawing_TextBlob object from an OH_Drawing_TextBlobBuilder. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlobBuilder Pointer to an OH_Drawing_TextBlobBuilder object. + * @return Returns the pointer to the OH_Drawing_TextBlob object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder*); + +/** + * @brief Destroys an OH_Drawing_TextBlob object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlobPointer to an OH_Drawing_TextBlob object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TextBlobDestroy(OH_Drawing_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 Pointer to an OH_Drawing_TextBlobBuilder object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TextBlobBuilderDestroy(OH_Drawing_TextBlobBuilder*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h index d8856233..2ce58973 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Provides the 2D drawing capability. + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,8 +31,10 @@ /** * @file drawing_text_declaration.h * - * @brief Declares the data structure related to text in 2D drawing. + * @brief Declares the structs related to text in 2D drawing. * + * File to include: native_drawing/drawing_text_declaration.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -66,7 +68,8 @@ typedef struct OH_Drawing_Typography OH_Drawing_Typography; typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle; /** - * @brief Defines an OH_Drawing_TypographyStyle, which is used to manage the typography style, such as the text direction. + * @brief Defines an OH_Drawing_TypographyStyle, which is used to manage the typography style, + * such as the text direction. * * @since 8 * @version 1.0 @@ -74,13 +77,39 @@ typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle; typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle; /** - * @brief Defines an OH_Drawing_TypographyCreate, which is used to create an OH_Drawing_Typography object. + * @brief Creates an {@link OH_Drawing_Typography}. * * @since 8 * @version 1.0 */ typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate; +/** + * @brief Defines an OH_Drawing_TextBox, which is used to receive the rectangle size, direction, and quantity + * of text boxes. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_TextBox OH_Drawing_TextBox; + +/** + * @brief Defines an OH_Drawing_PositionAndAffinity, which is used to receive the position and affinity + * of the font. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity; + +/** + * @brief Defines an OH_Drawing_Range, which is used to receive the start position and end position of the font. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Range OH_Drawing_Range; + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_typography.h b/en/native_sdk/graphic/native_drawing/drawing_text_typography.h index 4fcd20c2..6b0ea042 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/en/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -20,7 +20,7 @@ * @addtogroup Drawing * @{ * - * @brief Provides the 2D drawing capability. + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -31,8 +31,10 @@ /** * @file drawing_text_typography.h * - * @brief Declares functions related to typography in the drawing module. + * @brief Declares the functions related to the typography in the drawing module. * + * File to include: native_drawing/drawing_text_typography.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -49,24 +51,24 @@ extern "C" { #endif /** - * @brief Enumerates text directions. + * @brief Enumerates the text directions. */ enum OH_Drawing_TextDirection { - /** Right to left (RTL) */ + /** Right to left (RTL). */ TEXT_DIRECTION_RTL, - /** Left to right (LTR) */ + /** Left to right (LTR). */ TEXT_DIRECTION_LTR, }; /** - * @brief Enumerates text alignment modes. + * @brief Enumerates the text alignment modes. */ enum OH_Drawing_TextAlign { - /** Left-aligned */ + /** Left-aligned. */ TEXT_ALIGN_LEFT, - /** Right-aligned */ + /** Right-aligned. */ TEXT_ALIGN_RIGHT, - /** Center-aligned */ + /** Center-aligned. */ TEXT_ALIGN_CENTER, /** * Justified, which means that each line (except the last line) is stretched so that every line has equal width, @@ -90,31 +92,31 @@ enum OH_Drawing_TextAlign { }; /** - * @brief Enumerates font weights. + * @brief Enumerates the font weights. */ enum OH_Drawing_FontWeight { - /** Thin */ + /** Thin. */ FONT_WEIGHT_100, - /** Extra-light */ + /** Extra-light. */ FONT_WEIGHT_200, - /** Light */ + /** Light. */ FONT_WEIGHT_300, - /** Normal/Regular */ + /** Normal/Regular. */ FONT_WEIGHT_400, - /** Medium*/ + /** Medium. */ FONT_WEIGHT_500, - /** Semi-bold */ + /** Semi-bold. */ FONT_WEIGHT_600, - /** Bold */ + /** Bold. */ FONT_WEIGHT_700, - /** Extra-bold */ + /** Extra-bold. */ FONT_WEIGHT_800, - /** Black */ + /** Black. */ FONT_WEIGHT_900, }; /** - * @brief Enumerates text baselines. + * @brief Enumerates the text baselines. */ enum OH_Drawing_TextBaseline { /** Alphabetic, where the letters in alphabets like English sit on. */ @@ -124,7 +126,7 @@ enum OH_Drawing_TextBaseline { }; /** - * @brief Enumerates text decorations. + * @brief Enumerates the text decorations. */ enum OH_Drawing_TextDecoration { /** No decoration. */ @@ -138,15 +140,153 @@ enum OH_Drawing_TextDecoration { }; /** - * @brief Enumerates font styles. + * @brief Enumerates the font styles. */ enum OH_Drawing_FontStyle { - /** Normal style */ + /** Normal style. */ FONT_STYLE_NORMAL, - /** Italic style */ + /** Italic. */ FONT_STYLE_ITALIC, }; +/** + * @brief Enumerates the vertical alignment modes of placeholders. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Aligned to the baseline. */ + ALIGNMENT_OFFSET_AT_BASELINE, + /** Aligned above the baseline. */ + ALIGNMENT_ABOVE_BASELINE, + /** Aligned below the baseline. */ + ALIGNMENT_BELOW_BASELINE, + /** Aligned to the top of the row box. */ + ALIGNMENT_TOP_OF_ROW_BOX, + /** Aligned to the bottom of the row box. */ + ALIGNMENT_BOTTOM_OF_ROW_BOX, + /** Aligned to the center of the row box. */ + ALIGNMENT_CENTER_OF_ROW_BOX, +} OH_Drawing_PlaceholderVerticalAlignment; + +/** + * @brief Describes a placeholder that acts as a span. + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** Width of the placeholder. */ + double width; + /** Height of the placeholder. */ + double height; + /** Alignment mode of the placeholder. */ + OH_Drawing_PlaceholderVerticalAlignment alignment; + /** Baseline of the placeholder. */ + OH_Drawing_TextBaseline baseline; + /** Baseline offset of the placeholder. */ + double baselineOffset; +} OH_Drawing_PlaceholderSpan; + +/** + * @brief Enumerates the text decoration styles. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Solid style. */ + TEXT_DECORATION_STYLE_SOLID, + /** Double style. */ + TEXT_DECORATION_STYLE_DOUBLE, + /** Dotted style. */ + TEXT_DECORATION_STYLE_DOTTED, + /** Dashed style. */ + TEXT_DECORATION_STYLE_DASHED, + /** Wavy style. */ + TEXT_DECORATION_STYLE_WAVY, +} OH_Drawing_TextDecorationStyle; + +/** + * @brief Enumerates the ellipsis styles. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Places the ellipsis in the text header. */ + ELLIPSIS_MODAL_HEAD = 0, + /** Places the ellipsis in the middle of the text. */ + ELLIPSIS_MODAL_MIDDLE = 1, + /** Places the ellipsis at the end of the text. */ + ELLIPSIS_MODAL_TAIL = 2, +} OH_Drawing_EllipsisModal; + +/** + * @brief Enumerates the text break strategies. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Each line is filled as much as possible during line break. */ + BREAK_STRATEGY_GREEDY = 0, + /** Text continuity is preferentially considered during line break. */ + BREAK_STRATEGY_HIGH_QUALITY = 1, + /** Line breaks are performed at the word boundary. */ + BREAK_STRATEGY_BALANCED = 2, +} OH_Drawing_BreakStrategy; + +/** + * @brief Enumerates the word break types. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Normal mode. */ + WORD_BREAK_TYPE_NORMAL = 0, + /** Breaks the words at any character to prevent overflow. */ + WORD_BREAK_TYPE_BREAK_ALL = 1, + /** Breaks the words at arbitrary points to prevent overflow. */ + WORD_BREAK_TYPE_BREAK_WORD = 2, +} OH_Drawing_WordBreakType; + +/** + * @brief Enumerates the rectangle height styles. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Tight style. */ + RECT_HEIGHT_STYLE_TIGHT, + /** Maximum style. */ + RECT_HEIGHT_STYLE_MAX, + /** Middle style that includes the line spacing. */ + RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, + /** Top style that includes the line spacing. */ + RECT_HEIGHT_STYLE_INCLUDELINESPACETOP, + /** Bottom style that includes the line spacing. */ + RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, + /** Structure style. */ + RECT_HEIGHT_STYLE_STRUCT, +} OH_Drawing_RectHeightStyle; + +/** + * @brief Enumerates the rectangle width styles. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + */Tight style. */ + RECT_WIDTH_STYLE_TIGHT, + */Maximum style. */ + RECT_WIDTH_STYLE_MAX, +} OH_Drawing_RectWidthStyle; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -158,10 +298,11 @@ enum OH_Drawing_FontStyle { OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle(void); /** - * @brief Releases the memory occupied by an OH_Drawing_TypographyStyle object. + * @brief Destroys an OH_Drawing_TypographyStyle object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by + * {@link OH_Drawing_CreateTypographyStyle}. * @since 8 * @version 1.0 */ @@ -171,8 +312,9 @@ void OH_Drawing_DestroyTypographyStyle(OH_Drawing_TypographyStyle*); * @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 OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by + * {@link OH_Drawing_CreateTypographyStyle}. + * @param int Text direction. For details about the available options, see {@link OH_Drawing_TextDirection}. * @since 8 * @version 1.0 */ @@ -182,19 +324,21 @@ void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle*, int /* O * @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 OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by + * {@link OH_Drawing_CreateTypographyStyle}. + * @param int Text alignment mode. For details about the available options, see {@link OH_Drawing_TextAlign}. * @since 8 * @version 1.0 */ void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Drawing_TextAlign */); /** - * @brief Sets the maximum number of lines in a text file. + * @brief Sets the maximum number of lines in the text. * * @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 OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by + * {@link OH_Drawing_CreateTypographyStyle}. + * @param int Maximum number of lines. * @since 8 * @version 1.0 */ @@ -211,10 +355,11 @@ void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle*, int /* ma OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); /** - * @brief Releases the memory occupied by an OH_Drawing_TextStyle object. + * @brief Destroys an OH_Drawing_TextStyle object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. * @since 8 * @version 1.0 */ @@ -224,8 +369,9 @@ void OH_Drawing_DestroyTextStyle(OH_Drawing_TextStyle*); * @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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param uint32_t Color. * @since 8 * @version 1.0 */ @@ -235,8 +381,9 @@ void OH_Drawing_SetTextStyleColor(OH_Drawing_TextStyle*, 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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param double Font size. * @since 8 * @version 1.0 */ @@ -246,8 +393,10 @@ void OH_Drawing_SetTextStyleFontSize(OH_Drawing_TextStyle*, 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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param int Font weight. + * For details about the available options, see {@link OH_Drawing_FontWeight}. * @since 8 * @version 1.0 */ @@ -257,8 +406,9 @@ void OH_Drawing_SetTextStyleFontWeight(OH_Drawing_TextStyle*, int /* OH_Drawing_ * @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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param int Text baseline. For details about the available options, see {@link OH_Drawing_TextBaseline}. * @since 8 * @version 1.0 */ @@ -268,8 +418,9 @@ void OH_Drawing_SetTextStyleBaseLine(OH_Drawing_TextStyle*, int /* OH_Drawing_Te * @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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param int Text decoration. For details about the available options, see {@link OH_Drawing_TextDecoration}. * @since 8 * @version 1.0 */ @@ -279,8 +430,9 @@ void OH_Drawing_SetTextStyleDecoration(OH_Drawing_TextStyle*, int /* OH_Drawing_ * @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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param uint32_t Color. * @since 8 * @version 1.0 */ @@ -290,8 +442,9 @@ void OH_Drawing_SetTextStyleDecorationColor(OH_Drawing_TextStyle*, uint32_t /* c * @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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param double Font height. * @since 8 * @version 1.0 */ @@ -301,9 +454,10 @@ void OH_Drawing_SetTextStyleFontHeight(OH_Drawing_TextStyle*, double /* fontHeig * @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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param int Number of font families. + * @param char Pointer to the font families. * @since 8 * @version 1.0 */ @@ -314,8 +468,9 @@ void OH_Drawing_SetTextStyleFontFamilies(OH_Drawing_TextStyle*, * @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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param int Font style. For details about the available options, see {@link OH_Drawing_FontStyle}. * @since 8 * @version 1.0 */ @@ -325,19 +480,22 @@ void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_F * @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 OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param char Pointer to the locale. * @since 8 * @version 1.0 */ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); /** - * @brief Creates a pointer to an OH_Drawing_TypographyCreate object. + * @brief Creates 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 OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by + * {@link OH_Drawing_CreateTypographyStyle}. + * @param OH_Drawing_FontCollection Pointer to an OH_Drawing_FontCollection object, which is obtained by + * {@link OH_Drawing_CreateFontCollection}. * @return Returns the pointer to the OH_Drawing_TypographyCreate object created. * @since 8 * @version 1.0 @@ -346,10 +504,11 @@ OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler(OH_Drawing_Typog OH_Drawing_FontCollection*); /** - * @brief Releases the memory occupied by an OH_Drawing_TypographyCreate object. + * @brief Destroys an OH_Drawing_TypographyCreate object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained + * by {@link OH_Drawing_CreateTypographyHandler}. * @since 8 * @version 1.0 */ @@ -359,8 +518,10 @@ void OH_Drawing_DestroyTypographyHandler(OH_Drawing_TypographyCreate*); * @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 OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained + * by {@link OH_Drawing_CreateTypographyHandler}. + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. * @since 8 * @version 1.0 */ @@ -370,8 +531,9 @@ void OH_Drawing_TypographyHandlerPushTextStyle(OH_Drawing_TypographyCreate*, OH_ * @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 OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained + * by {@link OH_Drawing_CreateTypographyHandler}. + * @param char Pointer to the text content. * @since 8 * @version 1.0 */ @@ -381,7 +543,8 @@ void OH_Drawing_TypographyHandlerAddText(OH_Drawing_TypographyCreate*, const cha * @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 OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained + * by {@link OH_Drawing_CreateTypographyHandler}. * @since 8 * @version 1.0 */ @@ -391,7 +554,8 @@ void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate*); * @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 OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained + * by {@link OH_Drawing_CreateTypographyHandler}. * @return Returns the pointer to the OH_Drawing_Typography object created. * @since 8 * @version 1.0 @@ -399,10 +563,11 @@ void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate*); OH_Drawing_Typography* OH_Drawing_CreateTypography(OH_Drawing_TypographyCreate*); /** - * @brief Releases the memory occupied by an OH_Drawing_Typography object. + * @brief Destroys an OH_Drawing_Typography object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. * @since 8 * @version 1.0 */ @@ -412,8 +577,9 @@ void OH_Drawing_DestroyTypography(OH_Drawing_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 OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @param double Maximum text width. * @since 8 * @version 1.0 */ @@ -423,10 +589,12 @@ void OH_Drawing_TypographyLayout(OH_Drawing_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 OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object, which is obtained by + * {@link OH_Drawing_CanvasCreate()}. + * @param double X coordinate. + * @param double Y coordinate. * @since 8 * @version 1.0 */ @@ -437,7 +605,8 @@ void OH_Drawing_TypographyPaint(OH_Drawing_Typography*, OH_Drawing_Canvas*, * @brief Obtains the maximum width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. * @return Returns the maximum width. * @since 9 * @version 1.1 @@ -448,7 +617,8 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); * @brief Obtains the height. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. * @return Returns the height. * @since 9 * @version 1.1 @@ -456,10 +626,11 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); /** - * @brief Obtains the longest line. + * @brief Obtains the longest line. You are advised to round up the return value in actual use. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. * @return Returns the longest line. * @since 9 * @version 1.1 @@ -470,7 +641,8 @@ double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography*); * @brief Obtains the minimum intrinsic width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. * @return Returns the minimum intrinsic width. * @since 9 * @version 1.1 @@ -481,7 +653,8 @@ double OH_Drawing_TypographyGetMinIntrinsicWidth(OH_Drawing_Typography*); * @brief Obtains the maximum intrinsic width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. * @return Returns the maximum intrinsic width. * @since 9 * @version 1.1 @@ -492,7 +665,8 @@ double OH_Drawing_TypographyGetMaxIntrinsicWidth(OH_Drawing_Typography*); * @brief Obtains the alphabetic baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. * @return Returns the alphabetic baseline. * @since 9 * @version 1.1 @@ -503,13 +677,402 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); * @brief Obtains the ideographic baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. * @return Returns the ideographic baseline. * @since 9 * @version 1.1 */ double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); +/** + * @brief Adds a placeholder. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained + * by {@link OH_Drawing_CreateTypographyHandler}. + * @param OH_Drawing_PlaceholderSpan Pointer to an OH_Drawing_PlaceholderSpan object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH_Drawing_PlaceholderSpan*); + +/** + * @brief Checks whether the maximum number of lines is exceeded. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @return Returns true if the maximum number of lines is exceeded; returns false otherwise. + * @since 11 + * @version 1.0 + */ +bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); + +/** + * @brief Obtains text boxes in a given range. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @param size_t Start position. + * @param size_t End position. + * @param OH_Drawing_RectHeightStyle Height style. For details about the available options, + * see {@link OH_Drawing_RectHeightStyle}. + * @param OH_Drawing_RectWidthStyle Width style. For details about the available options, + * see {@link OH_Drawing_RectWidthStyle}. + * @return Returns the {@link OH_Drawing_TextBox} struct that holds the text boxes. + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography*, + size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle); + +/** + * @brief Obtains text boxes for placeholders. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @return Returns the {@link OH_Drawing_TextBox} struct that holds the text boxes. + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*); + +/** + * @brief Obtains the left position of a text box. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. + * @param int Index of the text box. + * @return Returns the left position. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Obtains the right position of a text box. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. + * @param int Index of the text box. + * @return Returns the right position. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Obtains the top position of a text box. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. + * @param int Index of the text box. + * @return Returns the top position. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Obtains the bottom position of a text box. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. + * @param int Index of the text box. + * @return Returns the bottom position. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Obtains the text direction of a text box. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. + * @param int Index of the text box. + * @return Returns the text direction. + * @since 11 + * @version 1.0 + */ +int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Obtains the number of text boxes. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. + * @return Returns the number of text boxes. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*); + +/** + * @brief Obtains the position and affinity of the glyph at the given coordinates. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @param double X coordinate. + * @param double Y coordinate. + * @return Returns the {@link OH_Drawing_PositionAndAffinity} struct that holds the position and affinity of the glyph. + * @since 11 + * @version 1.0 + */ +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*, + double, double); + +/** + * @brief Obtains the position and affinity of the glyph cluster to which the glyph at the given coordinates belongs. + * The glyph cluster is a container that holds one or more glyphs. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @param double X coordinate. + * @param double Y coordinate. + * @return Returns the {@link OH_Drawing_PositionAndAffinity} struct that holds the position and affinity + * of the glyph cluster. + * @since 11 + * @version 1.0 + */ +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*, + double, double); + +/** + * @brief Obtains the position attribute of an OH_Drawing_PositionAndAffinity object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PositionAndAffinity Pointer to an OH_Drawing_PositionAndAffinity object, + * which is obtained by {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate} or + * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}. + * @return Returns the position attribute. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); + +/** + * @brief Obtains the affinity attribute of an OH_Drawing_PositionAndAffinity object. + * The affinity determines whether the font is close to the front text or rear text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PositionAndAffinity Pointer to an OH_Drawing_PositionAndAffinity object. + * which is obtained by {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate} or + * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}. + * @return Returns the affinity attribute. + * @since 11 + * @version 1.0 + */ +int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); + +/** + * @brief Obtains the word boundary. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @param size_t Index of the word. + * @return Returns the {@link OH_Drawing_Range} struct that holds the word boundary. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t); + +/** + * @brief Obtains the start position of an OH_Drawing_Range object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Range Pointer to an OH_Drawing_Range object, which is obtained by + * {@link OH_Drawing_TypographyGetWordBoundary}. + * @return Returns the start position. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*); + +/** + * @brief Obtains the end position of an OH_Drawing_Range object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Range Pointer to an OH_Drawing_Range object, which is obtained by + * {@link OH_Drawing_TypographyGetWordBoundary}. + * @return Returns the end position. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*); + +/** + * @brief Obtains the number of lines. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @return Returns the number of lines. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); + +/** + * @brief Sets the text decoration style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param int Text decoration style. For details about the available options, + * see {@link OH_Drawing_TextDecorationStyle}. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); + +/** + * @brief Sets the thickness scale factor of the text decoration line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param double Scale factor. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets the letter spacing for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param double Letter spacing. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets the word spacing for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param double Word spacing. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets half leading for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param bool Whether to enable half leading. The value true means to enable half lading, + * and false means the opposite. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); + +/** + * @brief Sets the ellipsis content for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param char* Pointer to the ellipsis content. The data type is a pointer pointing to char. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*); + +/** + * @brief Sets the ellipsis style for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * {@link OH_Drawing_CreateTextStyle}. + * @param int Ellipsis style. For details about the available options, see {@link OH_Drawing_EllipsisModal}. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); + +/** + * @brief Sets the text break strategy. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by + * {@link OH_Drawing_CreateTypographyStyle}. + * @param int Text break strategy. For details about the available options, see {@link OH_Drawing_BreakStrategy}. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the word break type. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by + * {@link OH_Drawing_CreateTypographyStyle}. + * @param int Word break type. For details about the available options, see {@link OH_Drawing_WordBreakType}. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the ellipsis style for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by + * {@link OH_Drawing_CreateTypographyStyle}. + * @param int Ellipsis style. For details about the available options, see {@link OH_Drawing_EllipsisModal}. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Obtains the height of a line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @param int Target line. + * @return Returns the height. + * @since 11 + * @version 1.0 + */ +double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); + +/** + * @brief Obtains the width of a line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * {@link OH_Drawing_CreateTypography}. + * @param int Target line. + * @return Returns the width. + * @since 11 + * @version 1.0 + */ +double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_typeface.h b/en/native_sdk/graphic/native_drawing/drawing_typeface.h new file mode 100644 index 00000000..f7d9e1a6 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -0,0 +1,74 @@ +/* + * 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 C_INCLUDE_DRAWING_TYPEFACE_H +#define C_INCLUDE_DRAWING_TYPEFACE_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_typeface.h + * + * @brief Declares the functions related to the typeface in the drawing module. + * Different platforms have their own default typefaces. You can also parse the .ttf file to obtain the typefaces + * specified by the third party, such as SimSun and SimHei. + * + * File to include: native_drawing/drawing_typeface.h + * @library libnative_drawing.so + * @since 11 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_Typeface object, which defines the default font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_Typeface object created. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); + +/** + * @brief Destroys an OH_Drawing_Typeface object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typeface Pointer to an OH_Drawing_Typeface object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TypefaceDestroy(OH_Drawing_Typeface*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_types.h b/en/native_sdk/graphic/native_drawing/drawing_types.h index 24280237..178bce33 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_types.h +++ b/en/native_sdk/graphic/native_drawing/drawing_types.h @@ -20,8 +20,8 @@ * @addtogroup Drawing * @{ * - * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. - * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -31,8 +31,10 @@ /** * @file drawing_types.h * - * @brief Declares the data types for drawing 2D graphics, including the canvas, brush, pen, bitmap, and path. + * @brief Declares the data types of the canvas, brush, pen, bitmap, and path used to draw 2D graphics. * + * File to include: native_drawing/drawing_types.h + * @library libnative_drawing.so * @since 8 * @version 1.0 */ @@ -44,8 +46,9 @@ extern "C" { #endif /** - * @brief Defines a rectangular canvas on which various shapes, images, and texts can be drawn by using the brush and pen. - * + * @brief Defines a rectangular canvas on which various shapes, images, and texts can be drawn + * by using the brush and pen. + * * @since 8 * @version 1.0 */ @@ -53,15 +56,15 @@ typedef struct OH_Drawing_Canvas OH_Drawing_Canvas; /** * @brief Defines a pen, which is used to describe the style and color to outline a shape. - * + * * @since 8 * @version 1.0 */ typedef struct OH_Drawing_Pen OH_Drawing_Pen; /** - * @brief Defines as a brush, which is used to describe the style and color to fill in a shape. - * + * @brief Defines a brush, which is used to describe the style and color to fill in a shape. + * * @since 8 * @version 1.0 */ @@ -69,22 +72,119 @@ typedef struct OH_Drawing_Brush OH_Drawing_Brush; /** * @brief Defines a path, which is used to customize various shapes. - * + * * @since 8 * @version 1.0 */ typedef struct OH_Drawing_Path OH_Drawing_Path; /** - * @brief Defines a bitmap, which is a memory that contains the pixel data of a shape. - * + * @brief Defines a bitmap, which is a memory area that contains the pixel data of a shape. + * * @since 8 * @version 1.0 */ typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap; /** - * @brief Enumerates storage formats of bitmap pixels. + * @brief Defines a coordinate point. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Point OH_Drawing_Point; + +/** + * @brief Defines a rectangle. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Rect OH_Drawing_Rect; + +/** + * @brief Defines a rounded rectangle. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_RoundRect OH_Drawing_RoundRect; + +/** + * @brief Defines a matrix, which is used to describe coordinate transformation. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Matrix OH_Drawing_Matrix; + +/** + * @brief Defines a shader effect, which is used to describe the source color of the drawn content. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_ShaderEffect OH_Drawing_ShaderEffect; + +/** + * @brief Defines a filter, which consists of a color filter and mask filter. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Filter OH_Drawing_Filter; + +/** + * @brief Defines a mask filter, which is used to convert a mask into a new one. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_MaskFilter OH_Drawing_MaskFilter; + +/** + * @brief Defines a color filter, which is used to convert a color into a new one. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter; + +/** + * @brief Defines a font. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Font OH_Drawing_Font; + +/** + * @brief Defines a typeface. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Typeface OH_Drawing_Typeface; + +/** + * @brief Defines a text blob, which is an immutable container that holds multiple texts. + * Each text line consists of a glyph and position. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob; + +/** + * @brief Defines a text blob builder, which is used to build a text blob. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder; + +/** + * @brief Enumerates the storage formats of bitmap pixels. * * @since 8 * @version 1.0 @@ -94,19 +194,31 @@ typedef enum { COLOR_FORMAT_UNKNOWN, /** Each pixel is represented by 8 bits, which together indicate alpha. */ COLOR_FORMAT_ALPHA_8, - /** Each pixel is represented by 16 bits. From the most significant bit to the least significant bit, the first 5 bits indicate red, the subsequent 6 bits indicate green, and the last 5 bits indicate blue. */ + /** + * Each pixel is represented by 16 bits. From the most significant bit to the least significant bit, + * the first 5 bits indicate red, the subsequent 6 bits indicate green, and the last 5 bits indicate blue. + */ COLOR_FORMAT_RGB_565, - /** Each pixel is represented by 16 bits. From the most significant bit to the least significant bit, every 4 bits indicate alpha, red, green, and blue, respectively. */ + /** + * Each pixel is represented by 16 bits. From the most significant bit to the least significant bit, + * every 4 bits indicate alpha, red, green, and blue, respectively. + */ COLOR_FORMAT_ARGB_4444, - /** Each pixel is represented by 32 bits. From the most significant bit to the least significant bit, every 8 bits indicate alpha, red, green, and blue, respectively. */ + /** + * Each pixel is represented by 32 bits. From the most significant bit to the least significant bit, + * every 8 bits indicate alpha, red, green, and blue, respectively. + */ COLOR_FORMAT_RGBA_8888, - /** Each pixel is represented by 32 bits. From the most significant bit to the least significant bit, every 8 bits indicate blue, green, red, and alpha, respectively. */ + /** + * Each pixel is represented by 32 bits. From the most significant bit to the least significant bit, + * every 8 bits indicate blue, green, red, and alpha, respectively. + */ COLOR_FORMAT_BGRA_8888 } OH_Drawing_ColorFormat; /** - * @brief Enumerates alpha formats of bitmap pixels. - * + * @brief Enumerates the alpha formats of bitmap pixels. + * * @since 8 * @version 1.0 */ @@ -121,6 +233,100 @@ typedef enum { ALPHA_FORMAT_UNPREMUL } OH_Drawing_AlphaFormat; +/** + * @brief Enumerates the blend modes. In blend mode, each operation generates a new color from two colors + * (source color and target color). + * These operations are the same on the four channels (red, green, blue, and alpha). + * The operations for the alpha channel are used as examples. + * + * For brevity, the following abbreviations are used: + * + * s: source. + * + * d: destination. + * + * sa: source alpha. + * + * da: destination alpha. + * + * The following abbreviations are used in the calculation result: + * + * r: The calculation methods of the four channels are the same. + * + * ra: Only the alpha channel is manipulated. + * + * rc: The other three color channels are manipulated. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Clear mode. r = 0. */ + BLEND_MODE_CLEAR, + /** + * r = s (The four channels of result are equal to the four channels of source, that is, + * the result is equal to the source.) + */ + BLEND_MODE_SRC, + /** + * r = d (The four channels of result are equal to the four channels of destination, that is, + * the result is equal to the destination.) + */ + BLEND_MODE_DST, + /** r = s + (1 - sa) * d. */ + BLEND_MODE_SRC_OVER, + /** r = d + (1 - da) * s. */ + BLEND_MODE_DST_OVER, + /** r = s * da. */ + BLEND_MODE_SRC_IN, + /** r = d * sa. */ + BLEND_MODE_DST_IN, + /** r = s * (1 - da). */ + BLEND_MODE_SRC_OUT, + /** r = d * (1 - sa). */ + BLEND_MODE_DST_OUT, + /** r = s * da + d * (1 - sa). */ + BLEND_MODE_SRC_ATOP, + /** r = d * sa + s * (1 - da). */ + BLEND_MODE_DST_ATOP, + /** r = s * (1 - da) + d * (1 - sa). */ + BLEND_MODE_XOR, + /** r = min(s + d, 1). */ + BLEND_MODE_PLUS, + /** r = s * d. */ + BLEND_MODE_MODULATE, + /** Screen mode. r = s + d - s \* d */ + BLEND_MODE_SCREEN, + /** Overlay mode. */ + BLEND_MODE_OVERLAY, + /** Darken mode. rc = s + d - max(s \* da, d \* sa), ra = s + (1 - sa) \* d */ + BLEND_MODE_DARKEN, + /** Lighten mode. rc = s + d - min(s \* da, d \* sa), ra = s + (1 - sa) \* d */ + BLEND_MODE_LIGHTEN, + /** Color dodge mode. */ + BLEND_MODE_COLOR_DODGE, + /** Color burn mode. */ + BLEND_MODE_COLOR_BURN, + /** Hard light mode. */ + BLEND_MODE_HARD_LIGHT, + /** Soft light mode. */ + BLEND_MODE_SOFT_LIGHT, + /** Difference mode. rc = s + d - 2 \* (min(s \* da, d \* sa)), ra = s + (1 - sa) \* d */ + BLEND_MODE_DIFFERENCE, + /** Exclusion mode. rc = s + d - two(s \* d), ra = s + (1 - sa) \* d */ + BLEND_MODE_EXCLUSION, + /** Multiply mode. r = s \* (1 - da) + d \* (1 - sa) + s \* d */ + BLEND_MODE_MULTIPLY, + /** Hue mode. */ + BLEND_MODE_HUE, + /** Saturation mode. */ + BLEND_MODE_SATURATION, + /** Color mode. */ + BLEND_MODE_COLOR, + /** Luminosity mode. */ + BLEND_MODE_LUMINOSITY, +} OH_Drawing_BlendMode; + #ifdef __cplusplus } #endif -- Gitee From 5cd9f65c444b9128fbb643ff0c98c1869d7d668b Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 4 Feb 2024 11:05:46 +0000 Subject: [PATCH 0245/2135] update zh-cn/native_sdk/media/drm/native_drm_common.h. Signed-off-by: Gezhe --- .../native_sdk/media/drm/native_drm_common.h | 186 +++++++++--------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_drm_common.h b/zh-cn/native_sdk/media/drm/native_drm_common.h index b58aa497..562d59da 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_common.h +++ b/zh-cn/native_sdk/media/drm/native_drm_common.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, @@ -17,7 +17,7 @@ * @addtogroup Drm * @{ * - * @brief Provides APIs of Drm. + * @brief 提供数字版权保护能力的API。 * @kit Drm. * @since 11 * @version 1.0 @@ -26,7 +26,7 @@ /** * @file native_drm_common.h * - * @brief Defines the Drm common struct. + * @brief 定义DRM数据类型 * @library libnative_drm.z.so * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 @@ -44,376 +44,376 @@ extern "C" { #endif /** - * @brief Enumerates event types of listener. + * @brief 监听事件类型。 * @since 11 * @version 1.0 */ typedef enum DRM_EventType { /** - * DRM event base. + * DRM基础事件 */ EVENT_DRM_BASE = 200, /** - * Provision required event. + * 设备证书请求事件 */ EVENT_PROVISION_REQUIRED = 201, /** - * Media key required event. + * 密钥请求事件 */ EVENT_KEY_REQUIRED = 202, /** - * Media key expired event. + * 密钥过期事件 */ EVENT_KEY_EXPIRED = 203, /** - * Vendor defined event. + * 第三方定义事件 */ EVENT_VENDOR_DEFINED = 204, /** - * Expiration update event. + * 密钥过期更新事件 */ EVENT_EXPIRATION_UPDATE = 206, } DRM_EventType; /** - * @brief Content potection level. + * @brief 内容保护级别类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_ContentProtectionLevel { /** - * Content potection level unknown. + * 未知级别 */ CONTENT_PROTECTION_LEVEL_UNKNOWN = 0, /** - * Content potection level software crypto. + * 软件安全级别 */ CONTENT_PROTECTION_LEVEL_SW_CRYPTO, /** - * Content potection level hardware crypto. + * 硬件安全级别 */ CONTENT_PROTECTION_LEVEL_HW_CRYPTO, /** - * Content potection level enhanced hardware crypto. + * 硬件增强级别 */ CONTENT_PROTECTION_LEVEL_ENHANCED_HW_CRYPTO, /** - * Content potection level max stub. + * 最大安全级别 */ CONTENT_PROTECTION_LEVEL_MAX, } DRM_ContentProtectionLevel; /** - * @brief Media key type. + * @brief 许可证类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_MediaKeyType { /** - * Media key type offline. + * 离线 */ MEDIA_KEY_TYPE_OFFLINE = 0, /** - * Media key type online + * 在线 */ MEDIA_KEY_TYPE_ONLINE, } DRM_MediaKeyType; /** - * @brief Media key request type. + * @brief 许可证请求类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_MediaKeyRequestType { /** - * Media key request type unknown. + * 未知请求类型 */ MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, /** - * Media key request type initial. + * 初始化请求 */ MEDIA_KEY_REQUEST_TYPE_INITIAL, /** - * Media key request type renewal. + * 续订请求 */ MEDIA_KEY_REQUEST_TYPE_RENEWAL, /** - * Media key request type release. + * 释放请求 */ MEDIA_KEY_REQUEST_TYPE_RELEASE, /** - * Media key request type none. + * 无请求 */ MEDIA_KEY_REQUEST_TYPE_NONE, /** - * Media key request type update. + * 更新请求 */ MEDIA_KEY_REQUEST_TYPE_UPDATE, } DRM_MediaKeyRequestType; /** - * @brief Offline media key status. + * @brief 离线许可证状态。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_OfflineMediaKeyStatus { /** - * Offline media key status unknown. + * 未知状态 */ OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, /** - * Offline media key status usable. + * 可用状态 */ OFFLINE_MEDIA_KEY_STATUS_USABLE, /** - * Offline media key status inactive. + * 失活状态 */ OFFLINE_MEDIA_KEY_STATUS_INACTIVE, } DRM_OfflineMediaKeyStatus; /** - * @brief Certificate status. + * @brief 设备证书状态类型。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum DRM_CertificateStatus { /** - * Device already provisioned. + * 设备已安装设备证书 */ CERT_STATUS_PROVISIONED = 0, /** - * Device not provisioned. + * 设备未安装设备证书 */ CERT_STATUS_NOT_PROVISIONED, /** - * Cert already expired. + * 设备证书过期 */ CERT_STATUS_EXPIRED, /** - * Certs are invalid. + * 无效设备证书 */ CERT_STATUS_INVALID, /** - * Get certs status failed. + * 设备证书不可用 */ CERT_STATUS_UNAVAILABLE, } DRM_CertificateStatus; /** - * @brief Max count of media key request option. + * @brief 媒体密钥请求选项的最大计数。 * @since 11 * @version 1.0 */ #define MAX_MEDIA_KEY_REQUEST_OPTION_COUNT 16 /** - * @brief Max len of media key request option name. + * @brief 媒体密钥请求选项名称的最大长度。 * @since 11 * @version 1.0 */ #define MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN 64 /** - * @brief Max len of media key request option data. + * @brief 媒体密钥请求选项数据的最大长度。 * @since 11 * @version 1.0 */ #define MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN 128 /** - * @brief Max len of media key request init data. + * @brief 媒体密钥请求初始化数据的最大长度。 * @since 11 * @version 1.0 */ #define MAX_INIT_DATA_LEN 2048 /** - * @brief Max len of media mimetype. + * @brief 媒体mimetype类型的最大长度。 * @since 11 * @version 1.0 */ #define MAX_MIMETYPE_LEN 64 /** - * @brief Media key request info. + * @brief 媒体密钥请求信息。 * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeyRequestInfo { /** - * Offline or online media key type. + * 密钥类型 */ DRM_MediaKeyType type; /** - * Initial data len. + * 初始数据长度。 */ int32_t initDataLen; /** - * Initial data format as PSSH after base64 encoding. + * base64编码后格式为PSSH的初始数据。 */ uint8_t initData[MAX_INIT_DATA_LEN]; /** - * Media content mime type. + * 媒体上下文的mime类型。 */ char mimeType[MAX_MIMETYPE_LEN]; /** - * OptionsData count. + * 选项数据计数。 */ uint32_t optionsCount; /** - * Options name the application set to drm framework. + * 选项将应用程序集命名到drm框架。 */ char optionName[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN]; /** - * Options data the application set to drm framework. + * 选项数据应用程序设置到drm框架。 */ char optionData[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN]; } DRM_MediaKeyRequestInfo; /** - * @brief Max len of media key request. + * @brief 媒体密钥请求的最大长度。 * @since 11 * @version 1.0 */ #define MAX_MEDIA_KEY_REQUEST_DATA_LEN 8192 /** - * @brief Max len of URL. + * @brief URL最大长度。 * @since 11 * @version 1.0 */ #define MAX_DEFAULT_URL_LEN 2048 /** - * @brief Media key request. + * @brief 媒体密钥请求。 * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeyRequest { /** - * Media key request type. + * 媒体密钥请求类型。 */ DRM_MediaKeyRequestType type; /** - * Media key request data len. + * 媒体密钥请求数据长度。 */ int32_t dataLen; /** - * Media key request data sent to media key server. + * 发送到媒体密钥服务器的媒体密钥请求数据。 */ uint8_t data[MAX_MEDIA_KEY_REQUEST_DATA_LEN]; /** - * Media key server URL. + * 媒体密钥服务器URL。 */ char defaultUrl[MAX_DEFAULT_URL_LEN]; } DRM_MediaKeyRequest; /** - * @brief Max count of statistics item. + * @brief 统计项的最大计数。 * @since 11 * @version 1.0 */ #define MAX_STATISTICS_COUNT 10 /** - * @brief Max len of statistics item name. + * @brief 统计项名称的最大长度。 * @since 11 * @version 1.0 */ #define MAX_STATISTICS_NAME_LEN 64 /** - * @brief Max len of statistics item buffer. + * @brief 统计项缓冲区的最大长度。 * @since 11 * @version 1.0 */ #define MAX_STATISTICS_BUFFER_LEN 256 /** - * @brief Statistics of MediaKeySystem. + * @brief MediaKeySystem的度量信息。 * @since 11 * @version 1.0 */ typedef struct DRM_Statistics { - /* Statistics count. */ + /* 度量计数。 */ uint32_t statisticsCount; - /* Statistics name. */ + /* 度量信息名称集合。 */ char statisticsName[MAX_STATISTICS_COUNT][MAX_STATISTICS_NAME_LEN]; - /* Statistics description. */ + /* 度量信息描述集合。 */ char statisticsDescription[MAX_STATISTICS_COUNT][MAX_STATISTICS_BUFFER_LEN]; } DRM_Statistics; /** - * @brief Max count of offline media key id. + * @brief 离线媒体密钥id的最大计数。 * @since 11 * @version 1.0 */ #define MAX_OFFLINE_MEDIA_KEY_ID_COUNT 512 /** - * @brief Max len of offline media key id. + * @brief 离线媒体密钥id的最大长度。 * @since 11 * @version 1.0 */ #define MAX_OFFLINE_MEDIA_KEY_ID_LEN 64 /** - * @brief Offline media key ids array. + * @brief 离线媒体密钥ID数组。 * @since 11 * @version 1.0 */ typedef struct DRM_OfflineMediakeyIdArray { - /* Ids count. */ + /* ID计数 */ uint32_t idsCount; - /* Ids len. */ + /* ID长度集合 */ int32_t idsLen[MAX_OFFLINE_MEDIA_KEY_ID_COUNT]; - /* Ids. */ + /* ID数据集合 */ uint8_t ids[MAX_OFFLINE_MEDIA_KEY_ID_COUNT][MAX_OFFLINE_MEDIA_KEY_ID_LEN]; } DRM_OfflineMediakeyIdArray; /** - * @brief Max count of key info. + * @brief 密钥信息的最大计数。 * @since 11 * @version 1.0 */ #define MAX_KEY_INFO_COUNT 64 /** - * @brief Max len of key id. + * @brief 密钥id的最大长度。 * @since 11 * @version 1.0 */ #define MAX_KEY_ID_LEN 16 /** - * @brief Max len of key status value. + * @brief 密钥状态值的最大长度。 * @since 11 * @version 1.0 */ #define MAX_KEY_STATUS_VALUE_LEN 128 /** - * @brief Media key info. + * @brief 媒体密钥信息。 * @since 11 * @version 1.0 */ typedef struct DRM_KeysInfo { - /* Keys count. */ + /* 钥匙计数。 */ uint32_t keysInfoCount; - /* Key id. */ + /* 密钥ID集合 */ uint8_t keyId[MAX_KEY_INFO_COUNT][MAX_KEY_ID_LEN]; - /* Key status value. */ + /* 关键状态值。 */ char statusValue[MAX_KEY_INFO_COUNT][MAX_KEY_STATUS_VALUE_LEN]; } DRM_KeysInfo; /** - * @brief Max count of media key status. + * @brief 媒体密钥状态的最大计数。 * @since 11 * @version 1.0 */ #define MAX_MEDIA_KEY_STATUS_COUNT 64 /** - * @brief Max len of media key status name. + * @brief 媒体密钥状态名称的最大长度。 * @since 11 * @version 1.0 */ #define MAX_MEDIA_KEY_STATUS_NAME_LEN 64 /** - * @brief Max len of media key status value. + * @brief 媒体密钥状态值的最大长度。 * @since 11 * @version 1.0 */ @@ -425,29 +425,29 @@ typedef struct DRM_KeysInfo { * @version 1.0 */ typedef struct DRM_MediaKeyStatus { - /* Status count. */ + /* 状态计数。*/ uint32_t statusCount; - /* Status name. */ + /* 状态名数组。*/ char statusName[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_NAME_LEN]; - /* Status value. */ + /* 状态值数组。 */ char statusValue[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_VALUE_LEN]; } DRM_MediaKeyStatus; /** - * @brief Drm system uuid len. + * @brief Drm系统 uuid长度。 * @since 11 * @version 1.0 */ #define DRM_UUID_LEN 16 /** - * @brief Max len of PSSH data. + * @brief PSSH数据的最大长度。 * @since 11 * @version 1.0 */ #define MAX_PSSH_DATA_LEN 2048 /** - * @brief PSSH info by uuid. + * @brief uuid的PSSH信息。 * @since 11 * @version 1.0 */ @@ -457,45 +457,45 @@ typedef struct DRM_PsshInfo { */ uint8_t uuid[DRM_UUID_LEN]; /** - * PSSH data len. + * PSSH数据长度。 */ int32_t dataLen; /** - * uint8_t PSSH data. + * uint8_t PSSH数据。 */ uint8_t data[MAX_PSSH_DATA_LEN]; } DRM_PsshInfo; /** - * @brief Max count of PSSH info. + * @brief PSSH信息的最大计数。 * @since 11 * @version 1.0 */ #define MAX_PSSH_INFO_COUNT 8 /** - * @brief MediaKeySystemInfo used for player to get media key system info from media source. + * @brief 用于播放器从媒体源获取媒体密钥系统信息。 * @since 11 * @version 1.0 */ typedef struct DRM_MediaKeySystemInfo { - /* PSSH count. */ + /* PSSH计数。 */ uint32_t psshCount; - /* PSSH info. */ + /* PSSH信息. */ DRM_PsshInfo psshInfo[MAX_PSSH_INFO_COUNT]; } DRM_MediaKeySystemInfo; typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo *mediaKeySystemInfo); /** - * @brief Media key system struct. + * @brief 媒体密钥系统结构。 * @since 11 * @version 1.0 */ typedef struct MediaKeySystem MediaKeySystem; /** - * @brief Media key session struct. + * @brief 媒体密钥会话结构。 * @since 11 * @version 1.0 */ -- Gitee From 3a4919139b84b5f1665b52f37996c055882a5d46 Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 4 Feb 2024 11:15:26 +0000 Subject: [PATCH 0246/2135] update zh-cn/native_sdk/media/drm/native_drm_err.h. Signed-off-by: Gezhe --- zh-cn/native_sdk/media/drm/native_drm_err.h | 35 ++++++++++----------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_drm_err.h b/zh-cn/native_sdk/media/drm/native_drm_err.h index 9ff1adc9..d14abdff 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_err.h +++ b/zh-cn/native_sdk/media/drm/native_drm_err.h @@ -17,15 +17,14 @@ * @addtogroup Drm * @{ * - * @brief Provides APIs of Drm. - * @kit Drm. + * @brief 提供数字版权保护能力的API。 * @since 11 * @version 1.0 */ /** * @file native_drm_err.h - * @brief Defines the Drm errors. + * @brief 定义DRM错误码 * @library libnative_drm.z.so * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 @@ -43,66 +42,66 @@ extern "C" { #endif /** - * @brief DRM error code + * @brief DRM错误码。 * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 * @version 1.0 */ typedef enum Drm_ErrCode { /** - * the operation completed successfully. + * 操作成功完成。 */ DRM_ERR_OK = 0, /** - * DRM_CAPI_ERR_BASE. + * 基础错误。 */ DRM_CAPI_ERR_BASE = 24700500, /** - * no memory. + * 内存不足。 */ DRM_ERR_NO_MEMORY = DRM_CAPI_ERR_BASE + 1, /** - * opertation not be permitted. + * 不支持的操作。 */ DRM_ERR_OPERATION_NOT_PERMITTED = DRM_CAPI_ERR_BASE + 2, /** - * invalid argument. + * 无效参数。 */ DRM_ERR_INVALID_VAL = DRM_CAPI_ERR_BASE + 3, /** - * IO error. + * IO 错误。 */ DRM_ERR_IO = DRM_CAPI_ERR_BASE + 4, /** - * network timeout. + * 网络超时。 */ DRM_ERR_TIMEOUT = DRM_CAPI_ERR_BASE + 5, /** - * unknown error. + * 未知错误。 */ DRM_ERR_UNKNOWN = DRM_CAPI_ERR_BASE + 6, /** - * drm service died. + * drm服务挂死。 */ DRM_ERR_SERVICE_DIED = DRM_CAPI_ERR_BASE + 7, /** - * not support this operation in this state. + * 无效的操作状态。 */ DRM_ERR_INVALID_STATE = DRM_CAPI_ERR_BASE + 8, /** - * unsupport interface. + * 不支持的操作。 */ DRM_ERR_UNSUPPORTED = DRM_CAPI_ERR_BASE + 9, /** - * Meet max MediaKeySystem num limit. + * MediaKeySystem最大实例数。 */ DRM_ERR_MAX_SYSTEM_NUM_REACHED = DRM_CAPI_ERR_BASE + 10, /** - * Meet max MediaKeySession num limit. + * MediaKeySession最大实例数。 */ DRM_ERR_MAX_SESSION_NUM_REACHED = DRM_CAPI_ERR_BASE + 11, /** - * extend err start. + * 扩展错误。 */ DRM_ERR_EXTEND_START = DRM_CAPI_ERR_BASE + 100, } Drm_ErrCode; -- Gitee From b21317a7b71405863e3ac315a2491832933865b4 Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 4 Feb 2024 11:34:33 +0000 Subject: [PATCH 0247/2135] update zh-cn/native_sdk/media/drm/native_mediakeysession.h. Signed-off-by: Gezhe --- .../media/drm/native_mediakeysession.h | 140 +++++++++--------- 1 file changed, 69 insertions(+), 71 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysession.h b/zh-cn/native_sdk/media/drm/native_mediakeysession.h index 999aa04e..b30d2e1a 100644 --- a/zh-cn/native_sdk/media/drm/native_mediakeysession.h +++ b/zh-cn/native_sdk/media/drm/native_mediakeysession.h @@ -17,7 +17,7 @@ * @addtogroup Drm * @{ * - * @brief Provides APIs of Drm. + * @brief 提供数字版权保护能力的API。 * @kit Drm. * @since 11 * @version 1.0 @@ -25,9 +25,9 @@ /** * @file native_mediakeysession.h - * @brief Defines the Drm MediaKeySession APIs. Provide following function: - * generate media key request, process media key response, event listening, - * get content protection level, check media key status, remove media key etc.. + * @brief 定义Drm MediaKeySession API。提供以下功能: + * 生成媒体密钥请求、处理媒体密钥响应、事件侦听、获取内容保护级别、 + * 检查媒体密钥状态、删除媒体密钥等。 * @library libnative_drm.z.so * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 @@ -48,12 +48,12 @@ extern "C" #endif /** - * @brief Call back will be invoked when event triggers. - * @param eventType Event type. - * @param info Event info gotten from media key session. - * @param infoLen Event info len. - * @param extra Extra info gotten from media key session. - * @return Drm_ErrCode. + * @brief 事件触发时将调用的回调。 + * @param eventType 事件类型。 + * @param info 从媒体密钥会话获取的事件信息。 + * @param infoLen 事件信息长度。 + * @param extra 从媒体密钥会话中获得的额外信息。 + * @return Drm_ErrCode 错误码。 * @since 11 * @version 1.0 */ @@ -61,37 +61,37 @@ typedef Drm_ErrCode (*MediaKeySession_EventCallback)(DRM_EventType eventType, u int32_t infoLen, char *extra); /** - * @brief Call back will be invoked when key changes. - * @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. + * @brief 密钥更改时将调用回调。 + * @param keysInfo 从媒体密钥系统获取的密钥信息。 + * @param newKeysAvailable 新密钥是否可用 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ typedef Drm_ErrCode (*MediaKeySession_KeyChangeCallback)(DRM_KeysInfo *keysInfo, bool newKeysAvailable); /** - * @brief MediaKeySession_Callback struct, used to listen event like key expired and key change etc.. + * @brief MediaKeySession_Callback结构体,用于监听密钥过期、密钥更改等事件。 * @since 11 * @version 1.0 */ typedef struct MediaKeySession_Callback { /** - * Normal event callback like key expired etc.. + * 正常事件回调,如密钥过期等。 */ MediaKeySession_EventCallback eventCallback; /** - * Key change callback for keys change event. + * 密钥更改事件的密钥更改回调。 */ MediaKeySession_KeyChangeCallback keyChangeCallback; } MediaKeySession_Callback; /** - * @brief Generate media key request. - * @param mediaKeySession Media key session instance. - * @param info Media key request info. - * @param mediaKeyRequest Media key request. - * @return Drm_ErrCode. + * @brief 生成媒体密钥请求。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param info 媒体密钥请求信息。 + * @param mediaKeyRequest 媒体密钥请求。 + * @return Drm_ErrCode 错误码。 * @since 11 * @version 1.0 */ @@ -99,13 +99,13 @@ Drm_ErrCode OH_MediaKeySession_GenerateMediaKeyRequest(MediaKeySession *mediaKey DRM_MediaKeyRequestInfo *info, DRM_MediaKeyRequest *mediaKeyRequest); /** - * @brief Process media key response. - * @param mediaKeySession Media key session instance. - * @param response Media Key resposne. - * @param responseLen Media Key resposne len. - * @param offlineMediaKeyId Offline media key identifier. - * @param offlineMediaKeyIdLen Offline media key identifier len for in buffer and out data. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 处理媒体密钥响应。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param response 媒体密钥响应。 + * @param responseLen 媒体密钥响应长度。 + * @param offlineMediaKeyId 离线媒体密钥标识符。 + * @param offlineMediaKeyIdLen 缓冲区内和缓冲区外数据的离线媒体密钥标识符的长度。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -113,10 +113,10 @@ Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse(MediaKeySession *mediaKey uint8_t *response, int32_t responseLen, uint8_t *offlineMediaKeyId, int32_t *offlineMediaKeyIdLen); /** - * @brief Check media key status. - * @param mediaKeySession Media key session instance. - * @param mediaKeyStatus Media key status. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 检查媒体密钥状态。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param mediaKeyStatus 媒体密钥状态。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -124,22 +124,20 @@ Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus(MediaKeySession *mediaKeySess DRM_MediaKeyStatus *mediaKeyStatus); /** - * @brief Clear media keys of the current session . - * @param mediaKeySession Media key session instance. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 清除当前会话的媒体密钥。 + * @param mediaKeySession 媒体密钥会话实例。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin); /** - * @brief Generate offline media key release request. - * @param mediaKeySession Media key session instance. - * @param offlineMediaKeyId Offline media key identifier. - * @param offlineMediaKeyIdLen Offline media key identifier len. - * @param releaseRequest Media Key release request. - * @param releaseRequestLen Media Key release request len for in buffer and out data. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 生成离线媒体密钥释放请求。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param offlineMediaKeyId 离线媒体密钥标识符。 + * @param releaseRequestLen 离线媒体密钥标识符长度。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -148,13 +146,13 @@ Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *me int32_t *releaseRequestLen); /** - * @brief Process offline media key release response. - * @param mediaKeySession Media key session instance. - * @param offlineMediaKeyId Offline media key identifier. - * @param offlineMediaKeyIdLen Offline media key identifier len. - * @param releaseReponse Media Key resposne. - * @param releaseReponseLen Media Key resposne len. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 处理离线媒体密钥释放响应。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param offlineMediaKeyId 离线媒体密钥标识符。 + * @param offlineMediaKeyIdLen 离线媒体密钥标识符长度。 + * @param releaseReponse 媒体密钥响应。 + * @param releaseReponseLen 媒体密钥响应长度。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -163,11 +161,11 @@ Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse(MediaKeySession *me int32_t releaseReponseLen); /** - * @brief Restore offline media keys by ID. - * @param mediaKeySession Media key session instance. - * @param offlineMediaKeyId Offline media key identifier. - * @param offlineMediaKeyIdLen Offline media key identifier len. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 按ID还原离线媒体密钥。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param offlineMediaKeyId 离线媒体密钥标识符。 + * @param offlineMediaKeyIdLen 离线媒体密钥标识符长度。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -175,10 +173,10 @@ Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys(MediaKeySession *mediaKey uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); /** - * @brief Get content protection level of the session. - * @param mediaKeySession Media key session instance. - * @param contentProtectionLevel Content protection level. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 获取会话的内容保护级别。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param contentProtectionLevel 内容保护级别。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -186,11 +184,11 @@ Drm_ErrCode OH_MediaKeySession_GetContentProtectionLevel(MediaKeySession *mediaK DRM_ContentProtectionLevel *contentProtectionLevel); /** - * @brief Whether the encrypted content require a secure decoder or not. - * @param mediaKeySession Media key session instance. - * @param mimeType The media type. - * @param status Whether secure decoder is required. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 加密内容是否需要安全解码。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param mimeType 媒体类型。 + * @param status 是否需要安全解码。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -198,10 +196,10 @@ Drm_ErrCode OH_MediaKeySession_RequireSecureDecoderModule(MediaKeySession *media const char *mimeType, bool *status); /** - * @brief Set media key session event callback. - * @param mediaKeySession Media key session instance. - * @param callback Callback to be set to the media key session. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 设置媒体密钥会话事件回调。 + * @param mediaKeySession 媒体密钥会话实例。 + * @param callback 要设置为媒体密钥会话的回调。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -209,9 +207,9 @@ Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *media MediaKeySession_Callback *callback); /** - * @brief Release the resource before the session gonna be unused. - * @param mediaKeySession Media key session instance. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 释放会话资源。 + * @param mediaKeySession 媒体密钥会话实例。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ -- Gitee From 32058d41afbc8600683dbb1a06b536f8005ae62b Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 4 Feb 2024 11:56:22 +0000 Subject: [PATCH 0248/2135] update zh-cn/native_sdk/media/drm/native_mediakeysystem.h. Signed-off-by: Gezhe --- .../media/drm/native_mediakeysystem.h | 191 +++++++++--------- 1 file changed, 95 insertions(+), 96 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h index c1b2a67e..d86a1d8f 100644 --- a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h +++ b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h @@ -17,7 +17,7 @@ * @addtogroup Drm * @{ * - * @brief Provides APIs of Drm. + * @brief 提供数字版权保护能力的API。 * @kit Drm. * @since 11 * @version 1.0 @@ -25,11 +25,10 @@ /** * @file native_mediakeysystem.h - * @brief Defines the Drm MediaKeySystem APIs. Provide following function: - * query if specific drm supported or not, create media key session, - * get and set configurations, get statistics, get content protection level, - * generate provision request, process provision response, event listening, - * get content protection level, manage offline media key etc.. + * @brief 定义Drm MediaKeySystem API。提供以下功能: + * 查询是否支持特定的drm,创建媒体密钥会话,获取和设置配置, + * 获取统计信息,获取内容保护级别,生成提供请求,处理提供响应, + * 事件监听,获取内容防护级别,管理离线媒体密钥等。 * @library libnative_drm.z.so * @syscap SystemCapability.Multimedia.Drm.Core * @since 11 @@ -50,12 +49,12 @@ extern "C" { #endif /** - * @brief Call back will be invoked when event triggers. - * @param eventType Event type. - * @param info Event info gotten from media key system. - * @param infoLen Event info len. - * @param extra Extra info gotten from media key system. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 事件触发时将调用的回调。 + * @param eventType 事件类型。 + * @param info 从媒体密钥系统获取的事件信息。 + * @param infoLen 事件信息长度。 + * @param extra 从媒体密钥系统获得的额外信息。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -63,28 +62,28 @@ typedef Drm_ErrCode (*MediaKeySystem_Callback)(DRM_EventType eventType, uint8_t int32_t infoLen, char *extra); /** - * @brief Query if media key system is supported. - * @param name Used to point a Digital Right Management solution. - * @return Supported or not in boolean. + * @brief 查询是否支持媒体密钥系统。 + * @param name 用于指向数字权限管理解决方案。 + * @return 是否支持。 * @since 11 * @version 1.0 */ bool OH_MediaKeySystem_IsSupported(const char *name); /** - * @brief Query if media key system is supported. - * @param name Used to point a Digital Right Management solution. - * @param mimeType Used to specifies the media type. - * @return Supported or not in boolean. + * @brief 查询是否支持媒体密钥系统。 + * @param name 用于指向数字权限管理解决方案。 + * @param mimeType 用于指定媒体类型。 + * @return 是否支持。 * @since 11 * @version 1.0 */ bool OH_MediaKeySystem_IsSupported2(const char *name, const char *mimeType); /** - * @brief Query if media key system is supported. - * @param name Used to point a Digital Right Management solution. - * @param mimeType Used to specifies the media type. - * @param contentProtectionLevel Used to specifies the ContentProtectionLevel. - * @return Supported or not in boolean. + * @brief 查询是否支持媒体密钥系统。 + * @param name 用于指向数字权限管理解决方案。 + * @param mimeType 用于指定媒体类型。 + * @param contentProtectionLevel 用于指定安全等级。 + * @return 是否支持。 * @since 11 * @version 1.0 */ @@ -92,33 +91,33 @@ bool OH_MediaKeySystem_IsSupported3(const char *name, const char *mimeType, DRM_ContentProtectionLevel contentProtectionLevel); /** - * @brief Creates a media key system instance from the name. - * @param name Secifies which drm system will be created by name. - * @param mediaKeySystem Media key system instance. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully, - * return DRM_ERR_MAX_SYSTEM_NUM_REACHED when max num media key system reached. + * @brief 根据名称创建媒体密钥系统实例。 + * @param name 说明将按名称创建哪个drm系统。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM.ERR_OK, + * 当达到媒体密钥系统的最大数量时,返回DRM_ERR_MAX_SYSTEM_NUM_REACHED。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_Create(const char *name, MediaKeySystem **mediaKeySystem); /** - * @brief Set media key system configuration value by name. - * @param mediaKeySystem Media key system instance. - * @param configName Configuration name string. - * @param value Configuration vaule string to be set. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 按名称设置媒体密钥系统配置值。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param configName 配置名称字符串。 + * @param value 要设置的字符串的配置值。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_SetConfigurationString(MediaKeySystem *mediaKeySystem, const char *configName, const char *value); /** - * @brief Get media key system configuration value by name. - * @param mediaKeySystem Media key system instance. + * @brief 按名称获取媒体密钥系统配置值。 + * @param mediaKeySystem 媒体密钥系统实例。 * @param configName Configuration name string. * @param value Configuration vaule string to be get. * @param valueLen Configuration vaule string len for in buffer. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -126,52 +125,52 @@ Drm_ErrCode OH_MediaKeySystem_GetConfigurationString(MediaKeySystem *mediaKeySys const char *configName, char *value, int32_t valueLen); /** * @brief Set media key system configuration value by name. - * @param mediaKeySystem Media key system instance. + * @param mediaKeySystem 媒体密钥系统实例。 * @param configName Configuration name string. * @param value Configuration vaule in byte array to be set. * @param valueLen Value array len. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_SetConfigurationByteArray(MediaKeySystem *mediaKeySystem, const char *configName, uint8_t *value, int32_t valueLen); /** - * @brief Get media key system configuration value by name. - * @param mediaKeySystem Media key system instance. - * @param configName Configuration name string. - * @param value Configuration vaule in byte array to be get. - * @param valueLen Configuration vaule len for in buffer and out data. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 按名称获取媒体密钥系统配置值。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param configName 配置名称字符串。 + * @param value 要获取数组中的配置值。 + * @param valueLen 数据的配置值长度。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray(MediaKeySystem *mediaKeySystem, const char *configName, uint8_t *value, int32_t *valueLen); /** - * @brief Get media key system statistics info. - * @param mediaKeySystem Media key system instance. - * @param statistics Statistic info gotten. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 获取媒体密钥系统度量信息。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param statistics 已获取度量信息。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetStatistics(MediaKeySystem *mediaKeySystem, DRM_Statistics *statistics); /** - * @brief Get the max content protection level media key system supported. - * @param mediaKeySystem Media key system instance. - * @param contentProtectionLevel Content protection level. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 获取支持的最高内容保护级别的媒体密钥系统。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param contentProtectionLevel 内容保护级别。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetMaxContentProtectionLevel(MediaKeySystem *mediaKeySystem, DRM_ContentProtectionLevel *contentProtectionLevel); /** - * @brief Set media key system event callback. - * @param mediaKeySystem Media key system instance. - * @param callback Callback to be set to the media key system. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 设置媒体密钥系统事件回调。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param callback 将回调设置为媒体密钥系统。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -179,12 +178,12 @@ Drm_ErrCode OH_MediaKeySystem_SetMediaKeySystemCallback(MediaKeySystem *mediaKey MediaKeySystem_Callback callback); /** - * @brief Create a media key session instance. - * @param mediaKeySystem Media key system instance which will create the media key session. - * @param level Specifies the content protection level. - * @param mediaKeySession Media key session instance. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully, - * return DRM_ERR_MAX_SESSION_NUM_REACHED when max num media key system reached. + * @brief 创建媒体密钥会话实例。 + * @param mediaKeySystem 将创建媒体密钥会话的媒体密钥系统实例。 + * @param level 指定内容保护级别。 + * @param mediaKeySession 媒体密钥会话实例。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM.ERR_OK, + *当达到媒体密钥系统的最大数量时,返回DRM_ERR_MAX_SESSION_NUM_REACHED。 * @since 11 * @version 1.0 */ @@ -192,13 +191,13 @@ Drm_ErrCode OH_MediaKeySystem_CreateMediaKeySession(MediaKeySystem *mediaKeySyst DRM_ContentProtectionLevel *level, MediaKeySession **mediaKeySession); /** - * @brief Generate a media key system provision request. - * @param mediaKeySystem Media key system instance. - * @param request Provision request data sent to provision server. - * @param requestLen Provision request data len for in buffer and out data. - * @param defaultUrl Provision server URL. - * @param defaultUrlLen Provision server URL len for in buffer. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 生成媒体密钥系统提供请求。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param request 发送给设备服务器的请求。 + * @param requestLen 设备证书请求的长度。 + * @param defaultUrl 设备证书服务器的网址。 + * @param defaultUrlLen 设备证书服务器的网址长度。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -206,11 +205,11 @@ Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest(MediaKeySystem *mediaKeyS int32_t *requestLen, char *defaultUrl, int32_t defaultUrlLen); /** - * @brief Process a media key system provision response. - * @param mediaKeySystem Media key system instance. - * @param response The provision reponse will be processed. - * @param responseLen The response len. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 处理媒体密钥系统提供响应。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param response 将处理的响应。 + * @param responseLen 响应长度. + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -218,10 +217,10 @@ Drm_ErrCode OH_MediaKeySystem_ProcessKeySystemResponse(MediaKeySystem *mediaKeyS uint8_t *response, int32_t responseLen); /** - * @brief Get offline media key ids . - * @param mediaKeySystem Media key system instance. - * @param offlineMediaKeyIds Media key ids of all offline media keys. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 获取离线媒体密钥ID。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param offlineMediaKeyIds 所有离线媒体密钥的媒体密钥ID。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -230,11 +229,11 @@ Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyIds(MediaKeySystem *mediaKeySyst /** * @brief Get offline media key status. - * @param mediaKeySystem Media key system instance. - * @param offlineMediaKeyId Offline media key identifier. - * @param offlineMediaKeyIdLen Offline media key identifier len. - * @param status The media key status gotten. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @param mediaKeySystem 媒体密钥系统实例。 + * @param offlineMediaKeyId 离线媒体密钥标识符。 + * @param offlineMediaKeyIdLen 离线媒体密钥标识符长度。 + * @param status 已获取媒体密钥状态。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -242,11 +241,11 @@ Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyStatus(MediaKeySystem *mediaKeyS uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, DRM_OfflineMediaKeyStatus *status); /** - * @brief Clear an offline media key by id. - * @param mediaKeySystem Media key system instance. - * @param offlineMediaKeyId Offline media key identifier. - * @param offlineMediaKeyIdLen Offline media key identifier len. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 按id清除离线媒体密钥。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param offlineMediaKeyId 离线媒体密钥标识符。 + * @param offlineMediaKeyIdLen 离线媒体密钥标识符长度。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -254,10 +253,10 @@ Drm_ErrCode OH_MediaKeySystem_ClearOfflineMediaKeys(MediaKeySystem *mediaKeySyst uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); /** - * @brief Get certificate status of media key system. - * @param mediaKeySystem Media key system instance. - * @param certStatus Status will be gotten. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief 获取媒体密钥系统的证书状态。 + * @param mediaKeySystem 媒体密钥系统实例。 + * @param 将获得certStatus状态。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ @@ -265,9 +264,9 @@ Drm_ErrCode OH_MediaKeySystem_GetCertificateStatus(MediaKeySystem *mediaKeySyste DRM_CertificateStatus *certStatus); /** - * @brief Destroy a media key system instance. - * @param mediaKeySystem Secifies which media key system instance will be destroyed. - * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @brief Destroy a 媒体密钥系统实例。 + * @param mediaKeySystem 指定将销毁哪个媒体密钥系统实例。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 */ -- Gitee From e7c2c4b87ecfb7734aea22d45635494486483d41 Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 4 Feb 2024 12:04:23 +0000 Subject: [PATCH 0249/2135] update zh-cn/native_sdk/media/drm/native_mediakeysystem.h. Signed-off-by: Gezhe --- zh-cn/native_sdk/media/drm/native_mediakeysystem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h index d86a1d8f..8a61159d 100644 --- a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h +++ b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h @@ -183,7 +183,7 @@ Drm_ErrCode OH_MediaKeySystem_SetMediaKeySystemCallback(MediaKeySystem *mediaKey * @param level 指定内容保护级别。 * @param mediaKeySession 媒体密钥会话实例。 * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM.ERR_OK, - *当达到媒体密钥系统的最大数量时,返回DRM_ERR_MAX_SESSION_NUM_REACHED。 + * 当达到媒体密钥系统的最大数量时,返回DRM_ERR_MAX_SESSION_NUM_REACHED。 * @since 11 * @version 1.0 */ -- Gitee From 537fb13a8f77e65eedc36ef0abdce58bbba400a7 Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 4 Feb 2024 12:17:13 +0000 Subject: [PATCH 0250/2135] update zh-cn/native_sdk/media/drm/native_drm_common.h. Signed-off-by: Gezhe --- zh-cn/native_sdk/media/drm/native_drm_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_drm_common.h b/zh-cn/native_sdk/media/drm/native_drm_common.h index 562d59da..ae687a8c 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_common.h +++ b/zh-cn/native_sdk/media/drm/native_drm_common.h @@ -425,11 +425,11 @@ typedef struct DRM_KeysInfo { * @version 1.0 */ typedef struct DRM_MediaKeyStatus { - /* 状态计数。*/ + /* 状态计数。*/ uint32_t statusCount; - /* 状态名数组。*/ + /* 状态名数组。*/ char statusName[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_NAME_LEN]; - /* 状态值数组。 */ + /* 状态值数组。 */ char statusValue[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_VALUE_LEN]; } DRM_MediaKeyStatus; -- Gitee From 038164f85b9aab4d6ca45c8f394c5b0f79992081 Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 4 Feb 2024 12:22:44 +0000 Subject: [PATCH 0251/2135] update zh-cn/native_sdk/media/drm/native_drm_common.h. Signed-off-by: Gezhe --- zh-cn/native_sdk/media/drm/native_drm_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_drm_common.h b/zh-cn/native_sdk/media/drm/native_drm_common.h index ae687a8c..562d59da 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_common.h +++ b/zh-cn/native_sdk/media/drm/native_drm_common.h @@ -425,11 +425,11 @@ typedef struct DRM_KeysInfo { * @version 1.0 */ typedef struct DRM_MediaKeyStatus { - /* 状态计数。*/ + /* 状态计数。*/ uint32_t statusCount; - /* 状态名数组。*/ + /* 状态名数组。*/ char statusName[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_NAME_LEN]; - /* 状态值数组。 */ + /* 状态值数组。 */ char statusValue[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_VALUE_LEN]; } DRM_MediaKeyStatus; -- Gitee From 964e27d77f76313cdc3622ee57b350bc13da35f3 Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 4 Feb 2024 12:27:15 +0000 Subject: [PATCH 0252/2135] update zh-cn/native_sdk/media/drm/native_drm_common.h. Signed-off-by: Gezhe --- zh-cn/native_sdk/media/drm/native_drm_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_drm_common.h b/zh-cn/native_sdk/media/drm/native_drm_common.h index 562d59da..a0389d9b 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_common.h +++ b/zh-cn/native_sdk/media/drm/native_drm_common.h @@ -425,9 +425,9 @@ typedef struct DRM_KeysInfo { * @version 1.0 */ typedef struct DRM_MediaKeyStatus { - /* 状态计数。*/ + /* 状态计数。 */ uint32_t statusCount; - /* 状态名数组。*/ + /* 状态名数组。 */ char statusName[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_NAME_LEN]; /* 状态值数组。 */ char statusValue[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_VALUE_LEN]; -- Gitee From ee84190f49562d57ff71b35ae395c0ecbf3a3188 Mon Sep 17 00:00:00 2001 From: guoxing Date: Mon, 5 Feb 2024 03:06:48 +0000 Subject: [PATCH 0253/2135] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoxing --- .../graphic/native_drawing/drawing_text_typography.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index ec0cb841..08e8cbf6 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -596,11 +596,12 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); /** - * @brief 获取最长行,建议实际使用时将返回值向上取整。 + * @brief 获取最长行的宽度,建议实际使用时将返回值向上取整。当文本内容为空时,返回float的最小值, + * 即:-340282346638528859811704183484516925440.000000。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回最长行。 + * @return 返回最长行的宽度。 * @since 9 * @version 1.1 */ -- Gitee From f21c376c0c8213ae99e3162c6f8b838d4e4bb32a Mon Sep 17 00:00:00 2001 From: liuyifei Date: Mon, 5 Feb 2024 11:50:03 +0800 Subject: [PATCH 0254/2135] add hilog OH_LOG_SetCallback interface description in API Signed-off-by: liuyifei --- zh-cn/native_sdk/dfx/log.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/zh-cn/native_sdk/dfx/log.h b/zh-cn/native_sdk/dfx/log.h index a0579bbd..2234e7e3 100644 --- a/zh-cn/native_sdk/dfx/log.h +++ b/zh-cn/native_sdk/dfx/log.h @@ -217,6 +217,30 @@ bool OH_LOG_IsLoggable(unsigned int domain, const char *tag, LogLevel level); */ #define OH_LOG_FATAL(type, ...) ((void)HiLogPrint((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) +/** + * @brief 函数指针,开发者自定义回调函数内容,在回调函数中,可自行对hilog日志进行处理。 + * + * @param type 日志类型,三方应用日志类型为{@link LOG_APP}。 + * @param level 日志级别,日志级别包括LOG_DEBUG、LOG_INFO、LOG_WARN、LOG_ERROR、LOG_FATAL。 + * @param domain 日志业务领域,16进制整数,范围0x0~0xFFFF。 + * @param tag 日志TAG,字符串,标识调用所在的类或者业务。 + * @param msg 日志内容,格式化之后的日志字符串。 + * @since 11 + */ +typedef void (*LogCallback)(const LogType type, const LogLevel level, const unsigned int domain, const char *tag, + const char *msg); + +/** + * @brief 注册函数。 + * + * 调用此函数后,用户实现的回调函数可以接收当前进程的所有hilog日志。 + * 请注意,无论是否调用该接口,它都不会更改当前进程的hilog日志的默认行为。 \n + * + * @param callback 用户实现的回调函数。如果不需要处理hilog日志,可以传输空指针。 + * @since 11 + */ +void OH_LOG_SetCallback(LogCallback callback); + #ifdef __cplusplus } #endif -- Gitee From a265bd4c56893bab18b5839b9d117e095c236fde Mon Sep 17 00:00:00 2001 From: liuyifei Date: Mon, 5 Feb 2024 03:52:31 +0000 Subject: [PATCH 0255/2135] update zh-cn/native_sdk/dfx/log.h. Signed-off-by: liuyifei --- zh-cn/native_sdk/dfx/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/dfx/log.h b/zh-cn/native_sdk/dfx/log.h index 2234e7e3..6f68b333 100644 --- a/zh-cn/native_sdk/dfx/log.h +++ b/zh-cn/native_sdk/dfx/log.h @@ -234,7 +234,7 @@ typedef void (*LogCallback)(const LogType type, const LogLevel level, const unsi * @brief 注册函数。 * * 调用此函数后,用户实现的回调函数可以接收当前进程的所有hilog日志。 - * 请注意,无论是否调用该接口,它都不会更改当前进程的hilog日志的默认行为。 \n + * 请注意,无论是否调用该接口,它都不会更改当前进程的hilog日志的默认行为。 * * @param callback 用户实现的回调函数。如果不需要处理hilog日志,可以传输空指针。 * @since 11 -- Gitee From 4b53eea7f51034c5d0de2b02115138783cd3e9c3 Mon Sep 17 00:00:00 2001 From: Gezhe Date: Mon, 5 Feb 2024 06:12:55 +0000 Subject: [PATCH 0256/2135] update zh-cn/native_sdk/media/drm/native_mediakeysystem.h. Signed-off-by: Gezhe --- zh-cn/native_sdk/media/drm/native_mediakeysystem.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h index 8a61159d..30c8e2fb 100644 --- a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h +++ b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h @@ -114,9 +114,9 @@ Drm_ErrCode OH_MediaKeySystem_SetConfigurationString(MediaKeySystem *mediaKeySys /** * @brief 按名称获取媒体密钥系统配置值。 * @param mediaKeySystem 媒体密钥系统实例。 - * @param configName Configuration name string. - * @param value Configuration vaule string to be get. - * @param valueLen Configuration vaule string len for in buffer. + * @param configName 字符串类型配置名。 + * @param value 字符串形式配置值。 + * @param valueLen 字符串形式配置值长度。 * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 @@ -124,11 +124,11 @@ Drm_ErrCode OH_MediaKeySystem_SetConfigurationString(MediaKeySystem *mediaKeySys Drm_ErrCode OH_MediaKeySystem_GetConfigurationString(MediaKeySystem *mediaKeySystem, const char *configName, char *value, int32_t valueLen); /** - * @brief Set media key system configuration value by name. + * @brief 通过配置名设置MediaKeySystem的配置值。 * @param mediaKeySystem 媒体密钥系统实例。 - * @param configName Configuration name string. - * @param value Configuration vaule in byte array to be set. - * @param valueLen Value array len. + * @param configName 字符串类型配置名。 + * @param value 字节数组形式配置值。 + * @param valueLen 字节数组形式配置值长度。 * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 * @since 11 * @version 1.0 -- Gitee From 6eafe6861f33fc3913d198b796f4478526b0c831 Mon Sep 17 00:00:00 2001 From: Gloria Date: Tue, 6 Feb 2024 15:28:45 +0800 Subject: [PATCH 0257/2135] updated docs Signed-off-by: Gloria --- .../graphic/native_drawing/drawing_text_typography.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_typography.h b/en/native_sdk/graphic/native_drawing/drawing_text_typography.h index 6b0ea042..c5d73a89 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/en/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -626,12 +626,14 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); /** - * @brief Obtains the longest line. You are advised to round up the return value in actual use. + * @brief Obtains the width of the longest line. You are advised to round up the return value in actual use. + * When the text content is empty, the minimum float value, + * 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 * {@link OH_Drawing_CreateTypography}. - * @return Returns the longest line. + * @return Returns the width of the longest row. * @since 9 * @version 1.1 */ -- Gitee From 22c08b2354622a508b2119e131ecb37211fe954c Mon Sep 17 00:00:00 2001 From: guoxing Date: Fri, 2 Feb 2024 07:14:42 +0000 Subject: [PATCH 0258/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoxing --- .../native_drawing/drawing_text_typography.h | 179 ++++++++++-------- 1 file changed, 96 insertions(+), 83 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index ec0cb841..e202e472 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -655,7 +655,7 @@ double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyCreate 指向OH_Drawing_TypographyCreate对象的指针,由{@link OH_Drawing_CreateTypographyHandler}获取。 - * @param OH_Drawing_PlaceholderSpan 指向OH_Drawing_PlaceholderSpan对象的指针 + * @param OH_Drawing_PlaceholderSpan 指向OH_Drawing_PlaceholderSpan对象的指针。 * @since 11 * @version 1.0 */ @@ -666,7 +666,7 @@ void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回文本是否超过最大行,true表示超过,false表示未超过 + * @return 返回文本是否超过最大行,true表示超过,false表示未超过。 * @since 11 * @version 1.0 */ @@ -677,11 +677,11 @@ bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @param size_t 设置开始位置 - * @param size_t 设置结束位置 - * @param OH_Drawing_RectHeightStyle 设置高度样式,支持可选的高度样式具体可见{@link OH_Drawing_RectHeightStyle}枚举 - * @param OH_Drawing_RectWidthStyle 设置宽度样式,支持可选的宽度样式具体可见{@link OH_Drawing_RectWidthStyle}枚举 - * @return 返回指定范围内的文本框,具体可见{@link OH_Drawing_TextBox}结构体 + * @param size_t 设置开始位置。 + * @param size_t 设置结束位置。 + * @param OH_Drawing_RectHeightStyle 设置高度样式,支持可选的高度样式具体可见{@link OH_Drawing_RectHeightStyle}枚举。 + * @param OH_Drawing_RectWidthStyle 设置宽度样式,支持可选的宽度样式具体可见{@link OH_Drawing_RectWidthStyle}枚举。 + * @return 返回指定范围内的文本框,具体可见{@link OH_Drawing_TextBox}结构体。 * @since 11 * @version 1.0 */ @@ -689,101 +689,101 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle); /** - * @brief 获取占位符的文本框 + * @brief 获取占位符的文本框。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回占位符的文本框,返回类型为{@link OH_Drawing_TextBox}结构体 + * @return 返回占位符的文本框,返回类型为{@link OH_Drawing_TextBox}结构体。 * @since 11 * @version 1.0 */ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*); /** - * @brief 获取文本框左侧位置 + * @brief 获取文本框左侧位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 - * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 - * @param int 文本框的索引 - * @return 返回文本框左侧位置 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取。 + * @param int 文本框的索引。 + * @return 返回文本框左侧位置。 * @since 11 * @version 1.0 */ float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int); /** - * @brief 获取文本框右侧位置 + * @brief 获取文本框右侧位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 - * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 - * @param int 文本框的索引 - * @return 返回文本框右侧位置 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取。 + * @param int 文本框的索引。 + * @return 返回文本框右侧位置。 * @since 11 * @version 1.0 */ float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int); /** - * @brief 获取文本框顶部位置 + * @brief 获取文本框顶部位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 - * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 - * @param int 文本框的索引 - * @return 返回文本框顶部位置 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取。 + * @param int 文本框的索引。 + * @return 返回文本框顶部位置。 * @since 11 * @version 1.0 */ float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int); /** - * @brief 获取文本框底部位置 + * @brief 获取文本框底部位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 - * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 - * @param int 文本框的索引 - * @return 返回文本框底部位置 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取。 + * @param int 文本框的索引。 + * @return 返回文本框底部位置。 * @since 11 * @version 1.0 */ float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int); /** - * @brief 获取文本框方向 + * @brief 获取文本框方向。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 - * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 - * @param int 文本框的索引 - * @return 返回文本框方向 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取。 + * @param int 文本框的索引。 + * @return 返回文本框方向。 * @since 11 * @version 1.0 */ int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int); /** - * @brief 获取文本框数量大小 + * @brief 获取文本框数量大小。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextBox 指向OH_Drawing_TextBox对象的指针,由{@link OH_Drawing_TypographyGetRectsForRange}或 - * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取 - * @return 返回文本框数量大小 + * {@link OH_Drawing_TypographyGetRectsForPlaceholders}获取。 + * @return 返回文本框数量大小。 * @since 11 * @version 1.0 */ size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*); /** - * @brief 获取坐标处文本的索引位置和亲和性 + * @brief 获取坐标处文本的索引位置和亲和性。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @param double 光标的x坐标 - * @param double 光标的y坐标 - * @return 返回坐标处字体的索引位置和亲和性,返回类型为{@link OH_Drawing_PositionAndAffinity}结构体 + * @param double 光标的x坐标。 + * @param double 光标的y坐标。 + * @return 返回坐标处字体的索引位置和亲和性,返回类型为{@link OH_Drawing_PositionAndAffinity}结构体。 * @since 11 * @version 1.0 */ @@ -791,13 +791,13 @@ OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinat double, double); /** - * @brief 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体 + * @brief 获取坐标处文本所属字符簇的索引位置和亲和性,字符簇指一个或多个字符组成的整体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @param double 光标的x坐标 - * @param double 光标的y坐标 - * @return 返回坐标处指定类型字体的索引位置和亲和性,返回类型为{@link OH_Drawing_PositionAndAffinity}结构体 + * @param double 光标的x坐标。 + * @param double 光标的y坐标。 + * @return 返回坐标处指定类型字体的索引位置和亲和性,返回类型为{@link OH_Drawing_PositionAndAffinity}结构体。 * @since 11 * @version 1.0 */ @@ -805,210 +805,223 @@ OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinat double, double); /** - * @brief 获取OH_Drawing_PositionAndAffinity对象的位置属性 + * @brief 获取OH_Drawing_PositionAndAffinity对象的位置属性。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_PositionAndAffinity 指向OH_Drawing_PositionAndAffinity对象的指针, * 由{@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate}或 - * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取 - * @return 返回OH_Drawing_PositionAndAffinity对象的位置属性 + * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取。 + * @return 返回OH_Drawing_PositionAndAffinity对象的位置属性。 * @since 11 * @version 1.0 */ size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); /** - * @brief 获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本 + * @brief 获取OH_Drawing_PositionAndAffinity对象的亲和性,根据亲和性可判断字体会靠近前方文本还是后方文本。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_PositionAndAffinity 指向OH_Drawing_PositionAndAffinity对象的指针, * 由{@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate}或 - * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取 - * @return 返回OH_Drawing_PositionAndAffinity对象的亲和性 + * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}获取。 + * @return 返回OH_Drawing_PositionAndAffinity对象的亲和性。 * @since 11 * @version 1.0 */ int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); /** - * @brief 获取单词的边界 + * @brief 获取单词的边界。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @param size_t 单词索引 - * @return 返回单词边界,返回类型为{@link OH_Drawing_Range}结构体 + * @param size_t 单词索引。 + * @return 返回单词边界,返回类型为{@link OH_Drawing_Range}结构体。 * @since 11 * @version 1.0 */ OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t); /** - * @brief 获取OH_Drawing_Range对象开始位置 + * @brief 获取OH_Drawing_Range对象开始位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@link OH_Drawing_TypographyGetWordBoundary}获取 - * @return 返回OH_Drawing_Range对象开始位置 + * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@link OH_Drawing_TypographyGetWordBoundary}获取。 + * @return 返回OH_Drawing_Range对象开始位置。 * @since 11 * @version 1.0 */ size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*); /** - * @brief 获取OH_Drawing_Range对象结束位置 + * @brief 获取OH_Drawing_Range对象结束位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@link OH_Drawing_TypographyGetWordBoundary}获取 - * @return 返回OH_Drawing_Range对象结束位置 + * @param OH_Drawing_Range 指向OH_Drawing_Range对象的指针,由{@link OH_Drawing_TypographyGetWordBoundary}获取。 + * @return 返回OH_Drawing_Range对象结束位置。 * @since 11 * @version 1.0 */ size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*); /** - * @brief 获取文本行数 + * @brief 获取文本行数。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回行数 + * @return 返回行数。 * @since 11 * @version 1.0 */ size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); /** - * @brief 设置文本装饰样式 + * @brief 设置文本装饰样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param int 设置的文本装饰样式,支持可选的装饰样式具体可见{@link OH_Drawing_TextDecorationStyle}枚举 + * @param int 设置的文本装饰样式,支持可选的装饰样式具体可见{@link OH_Drawing_TextDecorationStyle}枚举。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); /** - * @brief 设置文本装饰线的厚度缩放比例 + * @brief 设置文本装饰线的厚度缩放比例。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param double 缩放比例 + * @param double 缩放比例。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, double); /** - * @brief 设置文本的字符间距 + * @brief 设置文本的字符间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param double 间距大小 + * @param double 间距大小。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); /** - * @brief 设置文本的单词间距 + * @brief 设置文本的单词间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param double 间距大小 + * @param double 间距大小。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); /** - * @brief 设置文本为一半行间距 + * @brief 设置文本为一半行间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效 + * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); /** - * @brief 设置文本的省略号内容 + * @brief 设置文本的省略号内容。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param char* 设置省略号内容,数据类型为指向char的指针 + * @param char* 设置省略号内容,数据类型为指向char的指针。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*); /** - * @brief 设置文本的省略号样式 + * @brief 设置文本的省略号样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param int 设置省略号样式,支持可选的省略号样式具体可见{@link OH_Drawing_EllipsisModal}枚举 + * @param int 设置省略号样式,支持可选的省略号样式具体可见{@link OH_Drawing_EllipsisModal}枚举。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); /** - * @brief 设置文本的中断策略 + * @brief 设置文本的中断策略。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 - * @param int 设置中断策略,支持可选的中断策略具体可见{@link OH_Drawing_BreakStrategy}枚举 + * @param int 设置中断策略,支持可选的中断策略具体可见{@link OH_Drawing_BreakStrategy}枚举。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int); /** - * @brief 设置单词的断词方式 + * @brief 设置单词的断词方式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 - * @param int 设置断词方式,支持可选的断词方式样式具体可见{@link OH_Drawing_WordBreakType}枚举 + * @param int 设置断词方式,支持可选的断词方式样式具体可见{@link OH_Drawing_WordBreakType}枚举。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int); /** - * @brief 设置文本的省略号样式 + * @brief 设置文本的省略号样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 - * @param int 设置省略号样式,支持可选的省略号样式样式具体可见{@link OH_Drawing_EllipsisModal}枚举 + * @param int 设置省略号样式,支持可选的省略号样式样式具体可见{@link OH_Drawing_EllipsisModal}枚举。 * @since 11 * @version 1.0 */ void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); /** - * @brief 获取指定行的行高 + * @brief 获取指定行的行高。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @param int 要指定的行数 - * @return 返回指定行的行高 + * @param int 要指定的行数。 + * @return 返回指定行的行高。 * @since 11 * @version 1.0 */ double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); /** - * @brief 获取指定行的行宽 + * @brief 获取指定行的行宽。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @param int 要指定的行数 - * @return 返回指定行的行宽 + * @param int 要指定的行数。 + * @return 返回指定行的行宽。 * @since 11 * @version 1.0 */ double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); +/** + * @brief 获取行的边界。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param int 行索引 + * @param bool 设置返回的边界是否包含空格,true为包含空格,false为不包含空格。 + * @return 返回行边界,返回类型为{@link OH_Drawing_Range}结构体。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, int, bool); + #ifdef __cplusplus } #endif -- Gitee From f21369b88aaf1ffddf5c3f1fef0786421f345e1e Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Wed, 7 Feb 2024 10:44:56 +0800 Subject: [PATCH 0259/2135] Update docs Signed-off-by: ester.zhou --- en/native_sdk/ace/native_event.h | 233 + en/native_sdk/ace/native_interface.h | 129 + .../ace/native_interface_xcomponent.h | 350 +- en/native_sdk/ace/native_node.h | 5588 +++++++++++++++++ en/native_sdk/ace/native_type.h | 1111 ++++ 5 files changed, 7339 insertions(+), 72 deletions(-) create mode 100644 en/native_sdk/ace/native_event.h create mode 100644 en/native_sdk/ace/native_interface.h create mode 100644 en/native_sdk/ace/native_node.h create mode 100644 en/native_sdk/ace/native_type.h diff --git a/en/native_sdk/ace/native_event.h b/en/native_sdk/ace/native_event.h new file mode 100644 index 00000000..923e78f5 --- /dev/null +++ b/en/native_sdk/ace/native_event.h @@ -0,0 +1,233 @@ +/* + * 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 UI capabilities of ArkUI on the native side, such as UI + * component creation and destruction, tree node operations, attribute setting, + * and event listening. + * + * @since 12 + */ + +/** + * @file native_event.h + * + * @brief Provides the event type definitions of ArkUI on the native side. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_EVENT +#define ARKUI_NATIVE_EVENT + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the tool types of the touch event. + * + * @since 12 + */ +typedef enum { + /** Unknown tool type. */ + NODE_TOOL_TYPE_UNKNOWN = -1, + + /** Finger. */ + NODE_TOOL_TYPE_FINGER = 0, + + /** Stylus. */ + NODE_TOOL_TYPE_STYLUS = 1, +} ArkUI_NodeToolType; + +/** + * @brief Enumerates the source types of the touch event. + * + * @since 12 + */ +typedef enum { + /** Unknown source type. */ + NODE_SOURCE_TYPE_UNKNOWN = -1, + /** Touchscreen. */ + NODE_SOURCE_TYPE_TOUCH_SCREEN = 0, + /** Stylus. */ + NODE_SOURCE_TYPE_STYLUS = 1, + /** Touchpad. */ + NODE_SOURCE_TYPE_TOUCHPAD = 2, +} ArkUI_NodeSourceType; + +/** + * @brief Defines the data structure of the touch point information of the + * touch event. + * + * @since 12 + */ +typedef struct { + /** ID of the touch event. */ + int32_t id; + + /** Timestamp when a finger is pressed, in μs. */ + int64_t pressedTime; + + /** X coordinate of the touch point on the screen. */ + int32_t screenX; + + /** Y coordinate of the touch point on the screen. */ + int32_t screenY; + + /** X coordinate of the touch point in the window. */ + int32_t windowX; + + /** Y coordinate of the touch point in the window. */ + int32_t windowY; + + /** X coordinate of the touch point in the component that triggers the event. */ + int32_t nodeX; + + /** Y coordinate of the touch point in the component that triggers the event. */ + int32_t nodeY; + + /** Pressure value. The value range is [0.0, 1.0]. The value 0.0 indicates + that the pressure is not supported. */ + double pressure; + + /** Width of the touch area. */ + int32_t contactAreaWidth; + + /** Height of the touch area. */ + int32_t contactAreaHeight; + + /** Angle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt. */ + double tiltX; + + /** Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt. */ + double tiltY; + + /** X coordinate of the center point of the tool area. */ + int32_t toolX; + + /** Y coordinate of the center point of the tool area. */ + int32_t toolY; + + /** Width of the tool area. */ + int32_t toolWidth; + + /** Height of the tool area. */ + int32_t toolHeight; + + /** X coordinate of the input device. */ + int32_t rawX; + + /** Y coordinate of the input device. */ + int32_t rawY; + + /** Tool type. */ + ArkUI_NodeToolType toolType; +} ArkUI_NodeTouchPoint; + +/** + * @brief Enumerates touch event types. + * + * @since 12 + */ +typedef enum { + /** Cancellation of touch. */ + NODE_ACTION_CANCEL = 0, + /** Pressing of a touch point. */ + NODE_ACTION_DOWN = 1, + /** Moving of a touch point. */ + NODE_ACTION_MOVE = 2, + /** Lifting of a touch point. */ + NODE_ACTION_UP = 3, +} ArkUI_NodeTouchEventAction; + +/** + * @brief Defines the data structure of the historical point information. + * + * @since 12 + */ +typedef struct { + /** Touch event type. */ + ArkUI_NodeTouchEventAction action; + /** Timestamp of the historical touch event, in μs. */ + int64_t timeStamp; + /** Source type of the historical touch event. */ + ArkUI_NodeTouchPoint actionTouch; + /** Source type of the historical touch event. */ + ArkUI_NodeSourceType sourceType; +} ArkUI_NodeHistoricalTouchPoint; + +/** + * @brief Defines the data structure of the touch event. + * + * @since 12 + */ +typedef struct { + /** Touch event type. */ + ArkUI_NodeTouchEventAction action; + + /** Timestamp of the touch event, in μs. */ + int64_t timeStamp; + + /** Touch point information of the touch event. */ + ArkUI_NodeTouchPoint actionTouch; + + /** + * @brief Returns information about all touch points when this event occurs. + * @param points Indicates the pointer to the object that receives data. + * @return Returns the number of elements in the touch point information array. + * @note + * When this function is called, ArkUI creates a heap memory object of the touch point information array and + * returns the pointer to the pointer. You need to call delete[] to manually free the memory when the + * object is not in use. + */ + int32_t (*getTouches)(ArkUI_NodeTouchPoint** points); + + /** + * @brief Returns the historical point information of this event, which covers actions that occur between + * this event and the previous event. + * @param historicalPoints Indicates the pointer to the object that receives data. + * @return Returns the number of elements in the historical touch point information array. + * @note + * When this function is called, ArkUI creates a heap memory object of the historical touch point information array + * and returns the pointer to the pointer. You need to call delete[] to manually free the memory + * when the object is not in use. + */ + int32_t (*getHistoricalPoints)(ArkUI_NodeHistoricalTouchPoint** historicalPoints); + + /** Source type of the touch event. */ + ArkUI_NodeSourceType sourceType; + + /** Whether to prevent propagation of the event to the parent node. */ + bool stopPropagation; + + /** Whether to prevent the default event processing behavior of the current node and allow propagation of the event. */ + bool preventDefault; +} ArkUI_NodeTouchEvent; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_EVENT +/** @} */ diff --git a/en/native_sdk/ace/native_interface.h b/en/native_sdk/ace/native_interface.h new file mode 100644 index 00000000..72982ef8 --- /dev/null +++ b/en/native_sdk/ace/native_interface.h @@ -0,0 +1,129 @@ +/* + * 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 UI capabilities of ArkUI on the native side, such as UI component creation and destruction, + * tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_interface.h + * + * @brief Provides a unified entry for the native module APIs. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_INTERFACE_H +#define ARKUI_NATIVE_INTERFACE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines the native API type of any version. + * + * @since 12 + */ +typedef struct { + /** + * @brief Defines the version information of the native API set. + * + * Unlike the NDK version, the version field of the NativeNode API indicates the version of its own structure. + */ + int32_t version; +} ArkUI_AnyNativeAPI; + +/** + * @brief Defines the native API set type. + * + * @since 12 + */ +typedef enum { + /** API type related to UI components. */ + ARKUI_NATIVE_NODE, +} ArkUI_NativeAPIVariantKind; + +/** + * @brief Defines the version information supported by the ARKUI_NATIVE_NODE type. + * + * @since 12 + */ +typedef enum { + /** The ARKUI_NATIVE_NODE type supports the structure {@link ArkUI_NativeNodeAPI_1} of version 1. */ + ARKUI_NATIVE_NODE_VERSION_1, +} ArkUI_NativeNodeAPIVersion; + +/** + * @brief Obtains the native API set of a specified version. + * + * @param type Indicates the type of the native API set provided by ArkUI, for example, ARKUI_NATIVE_NODE + * (API type related to UI components). + * @param version Indicates the version of the native API structure, which is obtained through the suffix defined in the + * structure. For example, for the ArkUI_NativeNodeAPI_1 structure, the version is 1. + * @return Returns the pointer to the native API abstract object that carries the version. + * @code {.cpp} + * #include + * #include + * + * auto anyNativeAPI = OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1); + * if (anyNativeAPI->version == 1) { + * auto basicNodeApi = reinterpret_cast(anyNativeAPI); + * } + * @endcode + * + * @since 12 + */ +ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32_t version); + +/** + * @brief Obtains the native module API set of a specified version. + * + * @param type Indicates the type of the native API set provided by ArkUI, for example, ARKUI_NATIVE_NODE + * (API type related to UI components). + * @param version Indicates the version of the native API structure, which is obtained through the version enums + * supported by the structure. For example, the available version of ARKUI_NATIVE_NODE is + * {@link ARKUI_NATIVE_NODE_VERSION_1}. + * @return Returns the pointer to the native API abstract object that carries the version. + * @code {.cpp} + * #include + * #include + * + * auto anyNativeAPI = OH_ArkUI_QueryModuleInterface(ARKUI_NATIVE_NODE, ARKUI_NATIVE_NODE_VERSION_1); + * if (anyNativeAPI->version == ARKUI_NATIVE_NODE_VERSION_1) { + * auto nativeNodeApi = reinterpret_cast(anyNativeAPI); + * } + * @endcode + * + * @since 12 + */ +ArkUI_AnyNativeAPI* OH_ArkUI_QueryModuleInterface(ArkUI_NativeAPIVariantKind type, int32_t version); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_INTERFACE_H +/** @} */ diff --git a/en/native_sdk/ace/native_interface_xcomponent.h b/en/native_sdk/ace/native_interface_xcomponent.h index e1fdc8d5..4bc802d0 100644 --- a/en/native_sdk/ace/native_interface_xcomponent.h +++ b/en/native_sdk/ace/native_interface_xcomponent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,7 +17,8 @@ * @addtogroup OH_NativeXComponent Native XComponent * @{ * - * @brief Describes the surface and touch event held by the ArkUI XComponent, which can be used for the EGL/OpenGL ES and media data input and displayed on the ArkUI XComponent. + * @brief Describes the surface and touch event held by the ArkUI XComponent, which can be used for the EGL/OpenGL ES + * and media data input and displayed on the ArkUI XComponent. * * @since 8 * @version 1.0 @@ -26,8 +27,9 @@ /** * @file native_interface_xcomponent.h * - * @brief Declares the APIs used to access the native XComponent. + * @brief Declares the APIs used to access NativeXComponent. * + * @library libace_ndk.z.so * @since 8 * @version 1.0 */ @@ -38,6 +40,10 @@ #include #include +#include "arkui/native_type.h" + +#include "native_xcomponent_key_event.h" + #ifdef __cplusplus extern "C" { #endif @@ -49,7 +55,7 @@ extern "C" { * @version 1.0 */ enum { - /** Success result. */ + /** Success. */ OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0, /** Failure. */ OH_NATIVEXCOMPONENT_RESULT_FAILED = -1, @@ -58,7 +64,7 @@ enum { }; /** - * @brief Enumerates the touch event types. + * @brief Enumerates touch event types. * @since 8 */ typedef enum { @@ -66,16 +72,16 @@ typedef enum { OH_NATIVEXCOMPONENT_DOWN = 0, /** The touch event is triggered when a finger is lifted. */ OH_NATIVEXCOMPONENT_UP, - /** The touch event is triggered when a finger is pressed and moves on the screen. */ + /** The touch event is triggered when a finger is moved on the screen. */ OH_NATIVEXCOMPONENT_MOVE, - /** The event is triggered when a touch event is canceled. */ + /** The touch event is triggered when a touch is canceled. */ OH_NATIVEXCOMPONENT_CANCEL, /** Invalid touch type. */ OH_NATIVEXCOMPONENT_UNKNOWN, } OH_NativeXComponent_TouchEventType; /** - * @brief Enumerates the contact point tool types. + * @brief Enumerates touch point tool types. * * @since 9 * @version 1.0 @@ -87,11 +93,11 @@ typedef enum { OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER, /** Stylus. */ OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN, - /** Eraser. */ + /** Rubber. */ OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER, /** Brush. */ OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH, - /**Pencil. */ + /** Pencil. */ OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL, /** Air brush. */ OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH, @@ -102,7 +108,7 @@ typedef enum { } OH_NativeXComponent_TouchPointToolType; /** - * @brief Enumerates the source types of the touch event. + * @brief Enumerates touch event source types. * * @since 9 * @version 1.0 @@ -110,7 +116,7 @@ typedef enum { typedef enum { /** Unknown source type. */ OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN = 0, - /** Source that generates a mouse multi-touch event. */ + /** Source that generates a mouse multi-click event. */ OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE, /** Source that generates a touchscreen multi-touch event. */ OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN, @@ -118,6 +124,13 @@ typedef enum { OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD, /** Source that generates a joystick multi-touch event. */ OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK, + /** + * @brief Describes the source that generates a key event. + * + * @since 10 + * @version 1.0 + */ + OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD, } OH_NativeXComponent_EventSourceType; /** @@ -129,11 +142,11 @@ typedef enum { typedef enum { /** Invalid mouse event. */ OH_NATIVEXCOMPONENT_MOUSE_NONE = 0, - /** The mouse event is triggered when a mouse button is pressed. */ + /** Mouse button press. */ OH_NATIVEXCOMPONENT_MOUSE_PRESS, - /** The mouse event is triggered when a mouse button is released. */ + /** Mouse button release. */ OH_NATIVEXCOMPONENT_MOUSE_RELEASE, - /** The mouse event is triggered when the mouse moves on the screen. */ + /** Mouse movement. */ OH_NATIVEXCOMPONENT_MOUSE_MOVE, } OH_NativeXComponent_MouseEventAction; @@ -144,17 +157,17 @@ typedef enum { * @version 1.0 */ typedef enum { - /** The mouse event is triggered when no mouse button is pressed. */ + /** No button. */ OH_NATIVEXCOMPONENT_NONE_BUTTON = 0, - /** The mouse event is triggered when the left mouse button is pressed. */ + /** Left mouse button. */ OH_NATIVEXCOMPONENT_LEFT_BUTTON = 0x01, - /** The mouse event is triggered when the right mouse button is pressed. */ + /** Right mouse button. */ OH_NATIVEXCOMPONENT_RIGHT_BUTTON = 0x02, - /** The mouse event is triggered when the middle mouse button is pressed. */ + /** Middle mouse button. */ OH_NATIVEXCOMPONENT_MIDDLE_BUTTON = 0x04, - /** The mouse event is triggered when the back button on the left of the mouse is pressed. */ + /** Back button on the left of the mouse. */ OH_NATIVEXCOMPONENT_BACK_BUTTON = 0x08, - /** The mouse event is triggered when the forward button on the left of the mouse is pressed. */ + /** Forward key on the left of the mouse. */ OH_NATIVEXCOMPONENT_FORWARD_BUTTON = 0x10, } OH_NativeXComponent_MouseEventButton; @@ -165,21 +178,25 @@ const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10; typedef struct { /** Unique identifier of the finger. */ int32_t id = 0; - /** X coordinate of the touch point relative to the upper left corner of the application window where the XComponent is located. */ + /** X coordinate of the touch point relative to the left edge of the application window where the XComponent is + * located. + */ float screenX = 0.0; - /** Y coordinate of the touch point relative to the upper left corner of the application window where the XComponent is located. */ + /** Y coordinate of the touch point relative to the left edge of the application window where the XComponent is + * located. + */ float screenY = 0.0; /** X coordinate of the touch point relative to the left edge of the XComponent. */ float x = 0.0; /** Y coordinate of the touch point relative to the upper edge of the XComponent. */ float y = 0.0; - /** Touch type of the touch event. */ + /** Touch type of the touch point. */ OH_NativeXComponent_TouchEventType type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN; /** Contact area between the finger pad and the screen. */ double size = 0.0; - /** Pressure of the current touch event. */ + /** Pressure of the touch event. */ float force = 0.0; - /** Timestamp of the current touch event. */ + /** Timestamp of the touch point. */ long long timeStamp = 0; /** Whether the current point is pressed. */ bool isPressed = false; @@ -202,17 +219,17 @@ typedef struct { float x = 0.0; /** Y coordinate of the touch point relative to the upper edge of the XComponent. */ float y = 0.0; - /** Touch type of the touch event. */ + /** Touch type of the touch point. */ OH_NativeXComponent_TouchEventType type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN; /** Contact area between the finger pad and the screen. */ double size = 0.0; - /** Pressure of the current touch event. */ + /** Pressure of the touch event. */ float force = 0.0; /** ID of the device where the current touch event is triggered. */ int64_t deviceId = 0; - /** Timestamp of the current touch event. */ + /** Timestamp of the touch point. */ long long timeStamp = 0; - /** Array of the current touch points. */ + /** Array of the touch points. */ OH_NativeXComponent_TouchPoint touchPoints[OH_MAX_TOUCH_POINTS_NUMBER]; /** Number of current touch points. */ uint32_t numPoints = 0; @@ -233,16 +250,16 @@ typedef struct { float screenX; /** Y coordinate of the clicked point relative to the upper left corner of the screen. */ float screenY; - /** Timestamp of the current mouse event. */ + /** Timestamp of the mouse event. */ int64_t timestamp; - /** Current mouse event action. */ + /** Action of the mouse event. */ OH_NativeXComponent_MouseEventAction action; - /** Mouse event button */ + /** Mouse event buttons. */ OH_NativeXComponent_MouseEventButton button; } OH_NativeXComponent_MouseEvent; /** - * @brief Provides an encapsulated OH_NativeXComponent instance. + * @brief Provides an encapsulated OH_NativeXComponent instance. * * @since 8 * @version 1.0 @@ -250,7 +267,7 @@ typedef struct { typedef struct OH_NativeXComponent OH_NativeXComponent; /** - * @brief Registers a callback for the surface lifecycle and touch event. + * @brief Registers callbacks for the surface lifecycle and touch event. * * @since 8 * @version 1.0 @@ -267,7 +284,7 @@ typedef struct OH_NativeXComponent_Callback { } OH_NativeXComponent_Callback; /** - * @brief Registers a callback for the mouse event. + * @brief Registers callbacks for the mouse event. * * @since 9 * @version 1.0 @@ -279,15 +296,39 @@ typedef struct OH_NativeXComponent_MouseEvent_Callback { void (*DispatchHoverEvent)(OH_NativeXComponent* component, bool isHover); } OH_NativeXComponent_MouseEvent_Callback; +struct OH_NativeXComponent_KeyEvent; +/** + * @brief Provides an encapsulated OH_NativeXComponent_KeyEvent instance. + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent; + +/** + * @brief Defines the expected frame rate range. + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** Minimum value of the expected frame rate range. */ + int32_t min; + /** Maximum value of the expected frame rate range. */ + int32_t max; + /** Expected frame rate range. */ + int32_t expected; +} OH_NativeXComponent_ExpectedRateRange; + /** * @brief Obtains the ID of the ArkUI XComponent. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param id Indicates the pointer to the character buffer used to hold the ID of the OH_NativeXComponent instance. - * Note that the null terminator is attached to the character buffer, so the size of the character buffer should be at least one unit greater than the length of the real ID. - * The recommended size of the character buffer is [OH_XCOMPONENT_ID_LEN_MAX + 1]. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param id Indicates the pointer to the character buffer for storing the ID of the OH_NativeXComponent instance. + * Note that null terminators will be attached to the character buffer, so the size of the character buffer should be at least one unit greater than the length of the real ID. + * The recommended size is [OH_XCOMPONENT_ID_LEN_MAX + 1]. * @param size Indicates the pointer to the length of the ID. - * @return Returns the status code of the operation. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ @@ -296,11 +337,11 @@ int32_t OH_NativeXComponent_GetXComponentId(OH_NativeXComponent* component, char /** * @brief Obtains the size of the surface held by the ArkUI XComponent. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param window Indicates the pointer to a NativeWindow handle. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param window Indicates the handle to the NativeWindow instance. * @param width Indicates the pointer to the width of the current surface. * @param height Indicates the pointer to the height of the current surface. - * @return Returns the status code of the operation. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ @@ -310,11 +351,11 @@ int32_t OH_NativeXComponent_GetXComponentSize( /** * @brief Obtains the offset of the ArkUI XComponent relative to the upper left vertex of the screen. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param window Indicates the pointer to a NativeWindow handle. - * @param x Indicates the pointer to the x coordinate of the current surface. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param window Indicates the handle to the NativeWindow instance. + * @param x Indicates the pointer to the x coordinate of the current surface. * @param y Indicates the pointer to the y coordinate of the current surface. - * @return Returns the status code of the operation. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ @@ -324,10 +365,10 @@ int32_t OH_NativeXComponent_GetXComponentOffset( /** * @brief Obtains the touch event scheduled by the ArkUI XComponent. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param window Indicates the pointer to a NativeWindow handle. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param window Indicates the handle to the NativeWindow instance. * @param touchEvent Indicates the pointer to the current touch event. - * @return Returns the status code of the operation. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ @@ -336,10 +377,10 @@ int32_t OH_NativeXComponent_GetTouchEvent( /** * @brief Obtains the ArkUI XComponent touch point tool type. - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param pointIndex Indicates the index of the pointer to a touch point. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param pointIndex Indicates the pointer to the index of the touch point. * @param toolType Indicates the pointer to the tool type. - * @return Returns the status code of the operation. + * @return Returns the status code of the execution. * @since 9 * @version 1.0 */ @@ -347,24 +388,24 @@ int32_t OH_NativeXComponent_GetTouchPointToolType(OH_NativeXComponent* component OH_NativeXComponent_TouchPointToolType* toolType); /** - * @brief Obtains the angle between the tilt of the ArkUI XComponent touch point and the x-axis. + * @brief Obtains the angle between the ArkUI XComponent touch point and the x-axis. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param pointIndex Indicates the index of the pointer to a touch point. - * @param tiltX Indicates the pointer to the tilt along the x-axis. - * @return Returns the status code of the operation. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param pointIndex Indicates the pointer to the index of the touch point. + * @param tiltX Indicates the pointer to the angle between the touch point and the x-axis. + * @return Returns the status code of the execution. * @since 9 * @version 1.0 */ int32_t OH_NativeXComponent_GetTouchPointTiltX(OH_NativeXComponent* component, uint32_t pointIndex, float* tiltX); /** - * @brief Obtains the angle between the tilt of the ArkUI XComponent touch point and the y-axis. + * @brief Obtains the angle between the ArkUI XComponent touch point and the y-axis. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param pointIndex Indicates the index of the pointer to a touch point. - * @param tiltY Indicates the pointer to the tilt along the y-axis. - * @return Returns the status code of the operation. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param pointIndex Indicates the pointer to the index of the touch point. + * @param tiltY Indicates the pointer to the angle between the touch point and the y-axis. + * @return Returns the status code of the execution. * @since 9 * @version 1.0 */ @@ -373,10 +414,10 @@ int32_t OH_NativeXComponent_GetTouchPointTiltY(OH_NativeXComponent* component, u /** * @brief Obtains the mouse event scheduled by ArkUI XComponent. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param window Indicates the pointer to a NativeWindow handle. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param window Indicates the handle to the NativeWindow instance. * @param mouseEvent Indicates the pointer to the current mouse event. - * @return Returns the status code of the operation. + * @return Returns the status code of the execution. * @since 9 * @version 1.0 */ @@ -386,9 +427,9 @@ int32_t OH_NativeXComponent_GetMouseEvent( /** * @brief Registers a callback for this OH_NativeXComponent instance. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. - * @param callback Indicates the pointer to the surface lifecycle and touch event callback. - * @return Returns the status code of the operation. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param callback Indicates the pointe to the surface lifecycle and touch event callback. + * @return Returns the status code of the execution. * @since 8 * @version 1.0 */ @@ -397,14 +438,179 @@ int32_t OH_NativeXComponent_RegisterCallback(OH_NativeXComponent* component, OH_ /** * @brief Registers a mouse event callback for this OH_NativeXComponent instance. * - * @param component Indicates the pointer to an OH_NativeXComponent instance. + * @param component Indicates the pointer to the OH_NativeXComponent instance. * @param callback Indicates the pointer to the mouse event callback. - * @return Returns the status code of the operation. + * @return Returns the status code of the execution. * @since 9 * @version 1.0 */ int32_t OH_NativeXComponent_RegisterMouseEventCallback( OH_NativeXComponent* component, OH_NativeXComponent_MouseEvent_Callback* callback); + +/** + * @brief Registers a focus event callback for this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param callback Indicates the pointer to the focus event callback. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterFocusEventCallback( + OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); + +/** + * @brief Registers a key event callback for this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param callback Indicates the pointer to the key event callback. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterKeyEventCallback( + OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); + +/** + * @brief Registers a blur event callback for this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param callback Indicates the pointer to the blur event callback. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterBlurEventCallback( + OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); + +/** + * @brief Obtains the key event scheduled by the ArkUI XComponent. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param keyEvent Indicates the pointer to the current key event. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_GetKeyEvent(OH_NativeXComponent* component, OH_NativeXComponent_KeyEvent** keyEvent); + +/** + * @brief Obtains the action of a key event. + * + * @param keyEvent Indicates the pointer to the OH_NativeXComponent_KeyEvent instance. + * @param action Indicates the pointer to the key event action. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_GetKeyEventAction( + OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_KeyAction* action); + +/** + * @brief Obtains the key code of a key event. + * + * @param keyEvent Indicates the pointer to the OH_NativeXComponent_KeyEvent instance. + * @param code Indicates the pointer to the key code of the key event. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_GetKeyEventCode(OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_KeyCode* code); + +/** + * @brief Obtains the source type of a key event. + * + * @param keyEvent Indicates the pointer to the OH_NativeXComponent_KeyEvent instance. + * @param sourceType Indicates the pointer to the key event source type. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_GetKeyEventSourceType( + OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_EventSourceType* sourceType); + +/** + * @brief Obtains the device ID of a key event. + * + * @param keyEvent Indicates the pointer to the OH_NativeXComponent_KeyEvent instance. + * @param deviceId Indicates the pointer to the key event device ID. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_GetKeyEventDeviceId(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* deviceId); + +/** + * @brief Obtains the timestamp of a key event. + * + * @param keyEvent Indicates the pointer to the OH_NativeXComponent_KeyEvent instance. + * @param timeStamp Indicates the pointer to the timestamp of the key event. + * @return Returns the status code of the execution. + * @since 10 + * @version 1.0 + */ +int32_t OH_NativeXComponent_GetKeyEventTimeStamp(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* timeStamp); + +/** + * @brief Sets the expected frame rate range. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param range Indicates the pointer to the expected frame rate range. + * @return Returns the status code of the execution. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_SetExpectedFrameRateRange( + OH_NativeXComponent* component, OH_NativeXComponent_ExpectedRateRange* range); + +/** + * @brief Registers a display update callback for this OH_NativeXComponent instance and enables the callback + * for each frame. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param callback Indicates the pointer to the display update callback. + * @return Returns the status code of the execution. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* component, + void (*callback)(OH_NativeXComponent* component, uint64_t timestamp, uint64_t targetTimestamp)); + +/** + * @brief Deregisters the display update callback for this OH_NativeXComponent instance and disables the callback + * for each frame. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @return Returns the status code of the execution. + * @since 11 + * @version 1.0 + */ +int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* component); + +/** + * @brief Attaches the UI component created through the native API of ArkUI to this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param root Indicates the pointer to the component instance created by the native API. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * + * @since 12 + */ +int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); + +/** + * @brief Detaches the native component of ArkUI from this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param root Indicates the pointer to the component instance created by the native API. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * + * @since 12 + */ +int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); + #ifdef __cplusplus }; #endif diff --git a/en/native_sdk/ace/native_node.h b/en/native_sdk/ace/native_node.h new file mode 100644 index 00000000..6259bc2a --- /dev/null +++ b/en/native_sdk/ace/native_node.h @@ -0,0 +1,5588 @@ +/* + * 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 UI capabilities of ArkUI on the native side, such as UI component creation and destruction, + * tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_node.h + * + * @brief Provides type definitions for NativeNode APIs. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_NODE_H +#define ARKUI_NATIVE_NODE_H + +#include "native_event.h" +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_NODE_SCOPE_NUM 1000 + +/** + * @brief Enumerates ArkUI component types that can be created on the native side. + * + * @since 12 + */ +typedef enum { + /** Custom node. */ + ARKUI_NODE_CUSTOM = 0, + /** Text. */ + ARKUI_NODE_TEXT = 1, + /** Text span. */ + ARKUI_NODE_SPAN = 2, + /** Image span. */ + ARKUI_NODE_IMAGE_SPAN = 3, + /** Image. */ + ARKUI_NODE_IMAGE = 4, + /** Toggle. */ + ARKUI_NODE_TOGGLE = 5, + /** Loading icon. */ + ARKUI_NODE_LOADING_PROGRESS = 6, + /** Single-line text input. */ + ARKUI_NODE_TEXT_INPUT = 7, + /** Multi-line text input. */ + ARKUI_NODE_TEXT_AREA = 8, + /** Button. */ + ARKUI_NODE_BUTTON = 9, + /** Progress indicator. */ + ARKUI_NODE_PROGRESS = 10, + /** Check box. */ + ARKUI_NODE_CHECKBOX = 11, + /** XComponent. */ + ARKUI_NODE_XCOMPONENT = 12, + /** Date picker. */ + ARKUI_NODE_DATE_PICKER = 13, + /** Time picker. */ + ARKUI_NODE_TIME_PICKER = 14, + /** Text picker. */ + ARKUI_NODE_TEXT_PICKER = 15, + /** Calendar picker. */ + ARKUI_NODE_CALENDAR_PICKER = 16, + /** Slider. */ + ARKUI_NODE_SLIDER = 17, + /** Stack container. */ + ARKUI_NODE_STACK = MAX_NODE_SCOPE_NUM, + /** Swiper. */ + ARKUI_NODE_SWIPER, + /** Scrolling container. */ + ARKUI_NODE_SCROLL, + /** List. */ + ARKUI_NODE_LIST, + /** List item. */ + ARKUI_NODE_LIST_ITEM, + /** List item group. */ + ARKUI_NODE_LIST_ITEM_GROUP, + /** Column container. */ + ARKUI_NODE_COLUMN, + /** Row container. */ + ARKUI_NODE_ROW, + /** Flex container. */ + ARKUI_NODE_FLEX, + /** Refresh component. */ + ARKUI_NODE_REFRESH, +} ArkUI_NodeType; + +/** + * @brief Defines the general input parameter structure of the {@link setAttribute} function. + * + * @since 12 + */ +typedef struct { + /** Numeric array. */ + const ArkUI_NumberValue* value; + /** Size of the numeric array. */ + int32_t size; + /** String type. */ + const char* string; + /** Object type. */ + void* object; +} ArkUI_AttributeItem; + +/** + * @brief Defines the ArkUI style attributes that can be set on the native side. + * + * @since 12 + */ +typedef enum { + /** + * @brief Defines the width 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, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: width, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 1.2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_WIDTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_WIDTH); + * auto nodeWidth = item->value[0].f32; + * @endcode + * + */ + NODE_WIDTH = 0, + /** + * @brief Defines the height 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: height, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: height, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 1.2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_HEIGHT, &item);clang-tid + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_HEIGHT); + * auto nodeHeight = item->value[0].f32; + * @endcode + * + */ + NODE_HEIGHT, + /** + * @brief Defines the background color 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].u32: background color. The value is in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].u32: background color. The value is in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); + * auto nodeBackgroundColor = item->value[0].u32; + * @endcode + * + */ + NODE_BACKGROUND_COLOR, + /** + * @brief Defines the background image attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + *.string: image address;\n + *.value[0]? .i32: whether to repeat the image. Optional. The parameter type is {@link ArkUI_ImageRepeat}. + * The default value is ARKUI_IMAGE_REPEAT_NONE.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.string: image address;\n + *.value[0].i32: whether to repeat the image. The parameter type is {@link ArkUI_ImageRepeat}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_IMAGE_REPEAT_NONE} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); + * auto nodeBackgroundImageUrl = item->string; + * auto nodeBackgroundImageRepeat = item->value[0].i32; + * @endcode + * + */ + NODE_BACKGROUND_IMAGE, + /** + * @brief Defines the padding attribute, which can be set, reset, and obtained as required through APIs. + * + * There are two formats of {@link ArkUI_AttributeItem} for setting the attribute value:\n + * 1: Specify the same padding for the four directions. \n + *.value[0].f32: padding, in vp.\n + * 2: Specify different paddings for different directions. \n + *.value[0].f32: top padding, in vp.\n + *.value[1].f32: right padding, in vp.\n + *.value[2].f32: bottom padding, in vp.\n + *.value[3].f32: left padding, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: top padding, in vp.\n + *.value[1].f32: right padding, in vp.\n + *.value[2].f32: bottom padding, in vp.\n + *.value[3].f32: left padding, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value1[] = { 1, 2, 3, 4}; + * ArkUI_AttributeItem item1 = { value1, sizeof(value1)/sizeof(ArkUI_NumberValue) }; + * ArkUI_NumberValue value2[] = { 10 }; + * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item1); + * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item2); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PADDING); + * auto nodePaddingTop = item->value[0].f32; + * @endcode + * + */ + NODE_PADDING, + /** + * @brief Defines the component ID attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + *.string: component ID.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.string: component ID.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "test" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ID, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ID); + * auto nodeId = item->string; + * @endcode + * + */ + NODE_ID, + /** + * @brief Defines the interactivity 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].i32: The value true means that the component can interact with users, and false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].i32: The value 1 means that the component can interact with users, and 0 means the opposite. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = false} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ENABLED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ENABLED); + * auto nodeEnabled = item->value[0].i32; + * @endcode + */ + NODE_ENABLED, + /** + * @brief Defines the margin attribute, which can be set, reset, and obtained as required through APIs. + * + * There are two formats of {@link ArkUI_AttributeItem} for setting the attribute value:\n + * 1: Specify the same margin for the four directions. \n + *.value[0].f32: margin, in vp.\n + * 2: Specify different margins for different directions. \n + *.value[0].f32: top margin, in vp.\n + *.value[1].f32: right margin, in vp.\n + *.value[2].f32: bottom margin, in vp.\n + *.value[3].f32: left margin, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: top margin, in vp.\n + *.value[1].f32: right margin, in vp.\n + *.value[2].f32: bottom margin, in vp.\n + *.value[3].f32: left margin, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value1[] = { 1, 2, 3, 4}; + * ArkUI_AttributeItem item1 = { value1, sizeof(value1)/sizeof(ArkUI_NumberValue) }; + * ArkUI_NumberValue value2[] = { 10 }; + * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item1); + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item2); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_MARGIN); + * auto nodeMarginTop = item->value[0].f32; + * @endcode + * + */ + NODE_MARGIN, + /** + * @brief Defines the translate 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: distance to translate along the x-axis, in vp. The default value is 0.\n + *.value[1].f32: distance to translate along the y-axis, in vp. The default value is 0.\n + *.value[2].f32: distance to translate along the z-axis, in vp. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: distance to translate along the x-axis, in vp.\n + *.value[1].f32: distance to translate along the y-axis, in vp.\n + *.value[2].f32: distance to translate along the z-axis, in vp. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 100, 20, 0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE); + * auto nodeTranslate = item->value[0].f32; + * @endcode + * + */ + NODE_TRANSLATE, + /** + * @brief Defines the 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: scale factor along the x-axis. The default value is 1.\n + *.value[1].f32: scale factor along the y-axis. The default value is 1. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: scale factor along the x-axis.\n + *.value[1].f32: scale factor along the y-axis. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 1.0, 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE); + * auto nodeScale = item->value[0].f32; + * @endcode + * + */ + NODE_SCALE, + /** + * @brief Defines the rotate 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: X coordinate of the rotation axis vector. The default value is 0.\n + *.value[1].f32: Y coordinate of the rotation axis vector. The default value is 0.\n + *.value[2].f32: Z coordinate of the rotation axis vector. The default value is 0.\n + *.value[3].f32: rotation angle. The default value is 0.\n + *.value[4].f32: line of sight, that is, the distance from the viewpoint to the z=0 plane, in vp. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: X coordinate of the rotation axis vector.\n + *.value[1].f32: Y coordinate of the rotation axis vector.\n + *.value[2].f32: Z coordinate of the rotation axis vector.\n + *.value[3].f32: rotation angle.\n + *.value[4].f32: line of sight, that is, the distance from the viewpoint to the z=0 plane, in vp. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 0, 0, 1, 300, 0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE); + * auto nodeRotate = item->value[0].f32; + * @endcode + * + */ + NODE_ROTATE, + /** + * @brief Sets the brightness 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: brightness value. The default value is 1.0, and the recommended value range is [0, 2]. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: brightness value. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 1.2 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BRIGHTNESS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BRIGHTNESS); + * auto nodeBrightness = item->value[0].f32; + * @endcode + * + */ + NODE_BRIGHTNESS, + /** + * @brief Sets the saturation 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: saturation value. The default value is 1.0, and the recommended value range is [0, FLT_MAX]. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: saturation value. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 1.0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SATURATION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SATURATION); + * auto nodeSaturate = item->value[0].f32; + * @endcode + * + */ + NODE_SATURATION, + /** + * @brief Sets the 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: blur radius. A larger value indicates a higher blur degree. If the value is 0, + * the component is not blurred. The unit is vp. The default value is 0.0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: blur radius. The larger the fuzzy radius, the more blurred the image. + * When the value is 0, the image is not blurred. The unit is vp. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 1.0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BLUR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLUR); + * auto nodeBlur = item->value[0].f32; + * @endcode + * + */ + NODE_BLUR, + /** + * @brief Sets the gradient attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: array of four parameters of the string type, separated by semicolons (;).\n + * Parameter 1: array of color stops, each of which consists of a color and its stop position. + * Invalid colors are automatically skipped. The color stops, set in vp, are separated by commas (,).\n + * Parameter 2: start angle of the linear gradient. A positive value indicates a clockwise rotation from + * the origin, (0, 0). The default value is 180.\n + * Parameter 3: + * direction of the linear gradient. It does not take effect when angle is set. + * Value: ("left","top","right","bottom","left-top","left-bottom","right-top",\n + * "right-bottom","none",default value "bottom";\n + * Parameter 4: whether the colors are repeated. The default value is false.\n + * Example: "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * * .string: array of four parameters of the string type, separated by semicolons (;).\n + * Parameter 1: array of color stops, each of which consists of a color and its stop position. + * Invalid colors are automatically skipped. The color stops, set in vp, are separated by commas (,).\n + * Parameter 2: start angle of the linear gradient. + * A positive value indicates a clockwise rotation from the origin, (0, 0).\n + * Parameter 3: direction of the linear gradient. It does not take effect when angle is set. + * Parameter 4: whether the colors are repeated.\n \n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LINEAR_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LINEAR_GRADIENT); + * auto nodeLinearGradient = item->string; + * @endcode + * + */ + NODE_LINEAR_GRADIENT, + /** + * @brief Sets the alignment 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].i32: alignment mode. The data type is {@link ArkUI_Alignment}. + * The default value is ARKUI_ALIGNMENT_CENTER. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: alignment mode. The data type is {@link ArkUI_Alignment}. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGNMENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT); + * auto nodeAlign = item->value[0].i32; + * @endcode + * + */ + NODE_ALIGNMENT, + /** + * @brief Defines the opacity 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: opacity value. The value ranges from 0 to 1. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: opacity value. The value ranges from 0 to 1. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY); + * auto nodeOpacity = item->value[0].f32; + * @endcode + * + */ + NODE_OPACITY, + /** + * @brief Defines the border width attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * 1: .value[0].f32: width of the four borders. \n + * 2: .value[0].f32: width of the top border. \n + * .value[1].f32: width of the right border. \n + * .value[2].f32: width of the bottom border. \n + * .value[3].f32: width of the left border. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: width of the top border. \n + * .value[1].f32: width of the right border. \n + * .value[2].f32: width of the bottom border. \n + * .value[3].f32: width of the left border. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); + * ArkUI_NumberValue value[] = { 5, 5, 10, 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_WIDTH); + * auto nodeBorderWitdh = item->value[0].f32; + * @endcode + * + */ + NODE_BORDER_WIDTH, + /** + * @brief Defines the border corner radius attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * 1: .value[0].f32: radius of the four corners. \n + * 2: .value[0].f32: radius of the upper left corner. \n + *.value[1].f32: radius of the upper right corner. \n + *.value[2].f32: radius of the lower left corner. \n + *.value[3].f32: radius of the lower right corner. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: radius of the upper left corner. \n + *.value[1].f32: radius of the upper right corner. \n + *.value[2].f32: radius of the lower left corner. \n + *.value[3].f32: radius of the lower right corner. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); + * ArkUI_NumberValue value[] = { 5, 5, 10, 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_RADIUS); + * auto nodeBorderRadius = item->value[0].f32; + * @endcode + * + */ + NODE_BORDER_RADIUS, + /** + * @brief Defines the border color attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * 1: .value[0].u32: color of the four borders, in 0xARGB format, for example, 0xFFFF11FF. \n + * 2: .value[0].u32: color of the top border, in 0xARGB format, for example, 0xFFFF11FF. \n + * .value[1].u32: color of the right border, in 0xARGB format, for example, 0xFFFF11FF. \n + * .value[2].u32: color of the lower border, in 0xARGB format, for example, 0xFFFF11FF. \n + * .value[3].u32: color of the left border, in 0xARGB format, for example, 0xFFFF11FF. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color of the top border, in 0xARGB format, for example, 0xFFFF11FF. \n + * .value[1].u32: color of the right border, in 0xARGB format, for example, 0xFFFF11FF. \n + * .value[2].u32: color of the lower border, in 0xARGB format, for example, 0xFFFF11FF. \n + * .value[3].u32: color of the left border, in 0xARGB format, for example, 0xFFFF11FF. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32 = 0xFFFF11FF} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); + * ArkUI_NumberValue value[] = { {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFFFFFF}, {.u32 = 0x000000} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_COLOR); + * auto nodeBorderColor = item->value[0].u32; + * @endcode + * + */ + NODE_BORDER_COLOR, + /** + * @brief Defines the border line style attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * 1: .value[0].i32: line style of the four borders. The parameter type is {@link ArkUI_BorderStyle}. + * The default value is ARKUI_BORDER_STYLE_SOLID. \n + * 2: .value[0].i32: line style of the top border. The parameter type is {@link ArkUI_BorderStyle}. + * The default value is ARKUI_BORDER_STYLE_SOLID. \n + * .value[1].i32: line style of the right border. The parameter type is {@link ArkUI_BorderStyle}. + * The default value is ARKUI_BORDER_STYLE_SOLID. \n + * .value[2].i32: line style of the bottom border. The parameter type is {@link ArkUI_BorderStyle}. + * The default value is ARKUI_BORDER_STYLE_SOLID. \n + * .value[3].i32: line style of the left border. The parameter type is {@link ArkUI_BorderStyle}. + * The default value is ARKUI_BORDER_STYLE_SOLID. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: line style of the top border. \n + * .value[1].i32: line style of the right border. \n + * .value[2].i32: line style of the bottom border. \n + * .value[3].i32: line style of the left border. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_BORDER_STYLE_DOTTED} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_BORDER_STYLE_DOTTED}, {.i32 = ARKUI_BORDER_STYLE_SOLID}, + * {.i32 = ARKUI_BORDER_STYLE_SOLID}, {.i32 = ARKUI_BORDER_STYLE_DOTTED} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_STYLE); + * auto nodeBorderStyle = item->value[0].i32; + * @endcode + * + */ + NODE_BORDER_STYLE, + /** + * @brief Defines the z-index attribute for stacking. + * 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 + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: z-index value. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_Z_INDEX, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_Z_INDEX); + * auto nodeZIndex = item->value[0].f32; + * @endcode + * + */ + NODE_Z_INDEX, + /** + * @brief Defines the visibility 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].i32: whether to show or hide the component. The parameter type is {@link ArkUI_Visibility}. + * The default value is ARKUI_VISIBILITY_VISIBLE. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to show or hide the component. The parameter type is {@link ArkUI_Visibility}. + * The default value is ARKUI_VISIBILITY_VISIBLE. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_VISIBILITY_NONE} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_VISIBILITY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_VISIBILITY); + * auto nodeVisibility = item->value[0].i32; + * @endcode + * + */ + NODE_VISIBILITY, + /** + * @brief Defines the clip 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].i32: whether to clip the component based on the parent container bounds. + * The value 0 means to clip the component, and 1 means the opposite. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to clip the component based on the parent container bounds. + * The value 0 means to clip the component, and 1 means the opposite. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 0} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); + * auto nodeClip = item->value[0].i32; + * @endcode + * + */ + NODE_CLIP, + /** + * @brief Defines the clip shape attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: shape. Optional.\n + * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, + * and radius height, respectively.\n + * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n + * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n + * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and commands, + * respectively.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: shape.\n + * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, and + * radius height, respectively.\n + * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n + * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n + * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and commands, + * respectively.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "rect(10,10,10,10)" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP_SHAPE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); + * auto nodeClipShape = item->string; + * @endcode + * + */ + NODE_CLIP_SHAPE, + /** + * @brief Defines the transform attribute, which can be used to translate, rotate, and scale images. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .data[0...15].f32: 16 floating-point numbers. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .data[0...15].f32: 16 floating-point numbers. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + * {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM); + * auto nodeTransform = item[0].value; + * @endcode + * + */ + NODE_TRANSFORM, + /** + * @brief Defines the hit test behavior 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].i32: hit test mode. The parameter type is {@link ArkUI_HitTestMode}. + * The default value is ARKUI_HIT_TEST_MODE_DEFAULT. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: hit test mode. The parameter type is {@link ArkUI_HitTestMode}. + * The default value is ARKUI_HIT_TEST_MODE_DEFAULT. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_HIT_TEST_MODE_BLOCK} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR); + * auto nodeHitTestBehavior = item->value[0].i32; + * @endcode + * + */ + NODE_HIT_TEST_BEHAVIOR, + /** + * @brief Defines the offset attribute, which specifies the offset of the component's upper left corner relative to + * the parent container's. 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: X coordinate. \n + * .value[1].f32: Y coordinate. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: X coordinate. \n + * .value[1].f32: Y coordinate. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 50, 50 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_POSITION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_POSITION); + * auto nodePositionX = item->value[0].f32; + * auto nodePositionY = item->value[1].f32; + * @endcode + * + */ + NODE_POSITION, + /** + * @brief Defines the shadow 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].i32: shadow effect. The parameter type is {@link ArkUI_ShadowStyle}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].i32: shadow effect. The parameter type is {@link ArkUI_ShadowStyle}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SHADOW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SHADOW); + * auto nodePositionX = item->value[0].i32; + * @endcode + * + */ + NODE_SHADOW, + /** + * @brief Defines the custom shadow effect. 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: array of six parameters of the string type, separated by semicolons (;).\n + * Parameter 1: shadow blur radius. \n + * Parameter 2: offset of the shadow along the x-axis. \n + * Parameter 3: offset of the shadow along the y-axis. \n + * Parameter 4: shadow type. \n + * Parameter 5: shadow color. \n + * Parameter 6: whether to fill the shadow. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of six parameters of the string type, separated by semicolons (;).\n + * Parameter 1: shadow blur radius. \n + * Parameter 2: offset of the shadow along the x-axis. \n + * Parameter 3: offset of the shadow along the y-axis. \n + * Parameter 4: shadow type. \n + * Parameter 5: shadow color. \n + * Parameter 6: whether to fill the shadow. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "5; 10; 10; COLOR; #FFF00FFF; true" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); + * auto nodeCustomShadow = item->string; + * @endcode + * + */ + NODE_CUSTOM_SHADOW, + /** + * @brief Defines the background image width and height. + * 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: width of the image. The value range is [0, +∞), and the unit is vp. \n + * .value[1].f32: height of the image. The value range is [0, +∞), and the unit is vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: width of the image, in vp. \n + * .value[1].f32: height of the image, in vp. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue sizeArray[] = { 20, 0 } + * ArkUI_AttributeItem item = { .value = sizeArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); + * auto width = item->value[0].f32; + * @endcode + * + */ + NODE_BACKGROUND_IMAGE_SIZE, + /** + * @brief Defines the background image size. + * 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: size of the background image. + * The value is an enum of {@link ArkUI_ImageSize}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: size of the background image. + * The value is an enum of {@link ArkUI_ImageSize}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue imageSizeStyle[] = { {.i32 = static_cast(ARKUI_IMAGE_SIZE_COVER) } } + * ArkUI_AttributeItem item = { .value = imageSizeStyle, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); + * auto blurStyle = item->value[0].i32 + * @endcode + */ + NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, + /** + * @brief Defines the background blur attribute. + * 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: blue type. The value is an enum of {@link ArkUI_BlurStyle}. \n + * .value[1]? .i32: color mode. The value is an enum of {@link ArkUI_ColorMode}. \n + * .value[2]? .i32: adaptive color mode. The value is an enum of {@link ArkUI_AdaptiveColor}. \n + * .value[3]? .f32: blur degree. The value range is [0.0, 1.0]. \n + * .value[4]? .f32: start boundary of grayscale blur. \n + * .value[5]? .f32: end boundary of grayscale blur. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: blue type. The value is an enum of {@link ArkUI_BlurStyle}. \n + * .value[1]? .i32: color mode. The value is an enum of {@link ArkUI_ColorMode}. \n + * .value[2]? .i32: adaptive color mode. The value is an enum of {@link ArkUI_AdaptiveColor}. \n + * .value[3]? .f32: blur degree. The value range is [0.0, 1.0]. \n + * .value[4]? .f32: start boundary of grayscale blur. \n + * .value[5]? .f32: end boundary of grayscale blur. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue blurStyle[] = { { .i32 = static_cast(ARKUI_BLUR_STYLE_THICK)}} + * ArkUI_AttributeItem item = { .value = blurStyle, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); + * auto blurStyle = item->value[0].i32 + * @endcode + * + */ + NODE_BACKGROUND_BLUR_STYLE, + /** + * @brief Defines the transform center 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: X coordinate of the center point, in vp.\n + * .value[1]? .f32: Y coordinate of the center point, in vp.\n + * .value[2]? .f32: Z coordinate of the center point, in vp.\n + * .value[3]? .f32 : X coordinate of the center point, expressed in a number that represents a percentage. + * For example, 0.2 indicates 20%. This attribute overwrites value[0].f32. The default value is 0.5f. \n + * .value[4]? .f32 : Y coordinate of the center point, expressed in a number that represents a percentage. + * For example, 0.2 indicates 20%. This attribute overwrites value[1].f32. The default value is 0.5f. \n + * .value[5]? .f32 : Z coordinate of the center point, expressed in a number that represents a percentage. + * For example, 0.2 indicates 20%. This attribute overwrites value[2].f32. The default value is 0.0f. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0]? .f32: X coordinate of the center point, in vp.\n + * .value[1]? .f32: Y coordinate of the center point, in vp.\n + * .value[2]? .f32: Z coordinate of the center point, in vp.\n + * Note: If the coordinate is expressed in a number that represents a percentage, + * the attribute obtaining API returns the calculated value in vp. + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue centerPointArray[] = { 20 }; + * ArkUI_AttributeItem item = { .value = centerPointArray, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM_CENTER , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM_CENTER); + * auto centerX = item->value[0].f32; + * @endcode + */ + NODE_TRANSFORM_CENTER, + /** + * @brief Defines the transition opacity 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: opacity values of the start and end points.\n + * .value[1].i32: animation duration, in milliseconds.\n + * .value[2].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n + * .value[3]? .i32: animation delay duration, in milliseconds.\n + * .value[4]? .i32: number of times that the animation is played.\n + * .value[5]? .i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}.\n + * .value[6]? .f32: animation playback speed.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: opacity values of the start and end points.\n + * .value[1].i32: animation duration, in milliseconds.\n + * .value[2].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n + * .value[3]? .i32: animation delay duration, in milliseconds.\n + * .value[4]? .i32: number of times that the animation is played.\n + * .value[5]? .i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}.\n + * .value[6]? .f32: animation playback speed.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue opacityTransition[] = { 20, { .i32 = 3000}, + * { .i32 = static_cast(ARKUI_CURVE_EASE_IN_OUT)}}; + * ArkUI_AttributeItem item = { .value = opacityTransition, .size = 3}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY_TRANSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); + * auto opacity = item->value[0].f32; + * @endcode + */ + NODE_OPACITY_TRANSITION, + /** + * @brief Defines the transition rotation 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: X-component of the rotation vector. \n + * .value[1].f32: Y-component of the rotation vector. \n + * .value[2].f32: Z-component of the rotation vector \n + * .value[3].f32: angle. \n + * .value[4].f32: line of sight. The default value is 0.0f. \n + * .value[5].i32: animation duration, in milliseconds. \n + * .value[6].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n + * .value[7]? .i32: animation delay duration, in milliseconds. \n + * .value[8]? .i32: number of times that the animation is played. \n + * .value[9]? .i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * .value[10]? .f32: animation playback speed. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: X-component of the rotation vector. \n + * .value[1].f32: Y-component of the rotation vector. \n + * .value[2].f32: Z-component of the rotation vector \n + * .value[3].f32: angle. \n + * .value[4].f32: line of sight. \n + * .value[5].i32: animation duration, in milliseconds. \n + * .value[6].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n + * .value[7]? .i32: animation delay duration, in milliseconds. \n + * .value[8]? .i32: number of times that the animation is played. \n + * .value[9]? .i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * .value[10]? .f32: animation playback speed. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue rotateTransition[] = { 0.0f, 0.0f, 1.0f, 180, 0, { .i32 = 3000}, + * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; + * ArkUI_AttributeItem item = { .value = rotateTransition, .size = 7}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE_TRANSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); + * auto rotateX = item->value[0].f32; + * @endcode + */ + NODE_ROTATE_TRANSITION, + /** + * @brief Defines the transition scaling 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: scale factor along the x-axis. \n + * .value[1].f32: scale factor along the y-axis. \n + * .value[2].f32: scale factor along the z-axis. \n + * .value[3].i32: animation duration, in milliseconds. \n + * .value[4].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n + * .value[5]?.i32: animation delay duration, in milliseconds. \n + * .value[6]?.i32: number of times that the animation is played. \n + * .value[7]?.i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * .value[8]?.f32: animation playback speed. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: scale factor along the x-axis. \n + * .value[1].f32: scale factor along the y-axis. \n + * .value[2].f32: scale factor along the z-axis. \n + * .value[3].i32: animation duration, in milliseconds. \n + * .value[4].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n + * .value[5]?.i32: animation delay duration, in milliseconds. \n + * .value[6]?.i32: number of times that the animation is played. \n + * .value[7]?.i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * .value[8]?.f32: animation playback speed. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue scaleTransition[] = { 0.0f, 0.0f, 0.0f, { .i32 = 3000}, + * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; + * ArkUI_AttributeItem item = { .value = scaleTransition, .size = 5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE_TRANSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); + * auto scaleX = item->value[0].f32; + * @endcode + */ + NODE_SCALE_TRANSITION, + /** + * @brief Defines the transition translation attribute. + * 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: translation distance along the x-axis, in vp.\n + * value[1].f32: translation distance along the y-axis, in vp.\n + * value[2].f32: translation distance along the z-axis, in vp.\n + * value[3].i32: animation duration, in milliseconds. \n + * value[4].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n + * value[5]?.i32: animation delay duration, in milliseconds. \n + * value[6]?.i32: number of times that the animation is played. \n + * value[7]?.i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * value[8]?.f32: animation playback speed. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].f32: translation distance along the x-axis, in vp.\n + * value[1].f32: translation distance along the y-axis, in vp.\n + * value[2].f32: translation distance along the z-axis, in vp.\n + * value[3].i32: animation duration, in milliseconds. \n + * value[4].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n + * value[5]?.i32: animation delay duration, in milliseconds. \n + * value[6]?.i32: number of times that the animation is played. \n + * value[7]?.i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * value[8]?.f32: animation playback speed. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue translateTransition[] = { 0.0f, 0.0f, 0.0f, + * { .i32 = 3000}, { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; + * ArkUI_AttributeItem item = { .value = translateTransition, .size = 5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); + * auto translateX = item->value[0].f32; + * @endcode + */ + NODE_TRANSLATE_TRANSITION, + + /** + * @brief Defines the focus 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].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. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUSABLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUSABLE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_FOCUSABLE, + + /** + * @brief Defines the default focus 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].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. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DEFAULT_FOCUS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DEFAULT_FOCUS); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_DEFAULT_FOCUS, + + /** + * @brief Defines the touch target attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .data[0].f32: X coordinate of the touch point relative to the upper left corner of the component, in vp. \n + * .data[1].f32: Y coordinate of the touch point relative to the upper left corner of the component, in vp. \n + * .data[2].f32: width of the touch target, in %. \n + * .data[3].f32: height of the touch target, in %. \n + * .data[4...].f32: Multiple touch targets can be set. The sequence of the parameters is the same as the preceding. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .data[0].f32: X coordinate of the touch point relative to the upper left corner of the component, in vp. \n + * .data[1].f32: Y coordinate of the touch point relative to the upper left corner of the component, in vp. \n + * .data[2].f32: width of the touch target, in %. \n + * .data[3].f32: height of the touch target, in %. \n + * .data[4...].f32: Multiple touch targets can be set. The sequence of the parameters is the same as the preceding. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0, 0, 100, 100 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); + * + * ArkUI_NumberValue value[] = { 0, 0, 100, 100, 0, 0, 100, 100 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RESPONSE_REGION); + * auto x = item->value[0].f32; + * auto y = item->value[1].f32; + * auto width = item->value[2].f32; + * auto height = item->value[3].f32; + * @endcode + * + */ + NODE_RESPONSE_REGION, + + /** + * @brief Defines the overlay attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: mask text.\n + * .value[0]?.i32: position of the overlay relative to the component. Optional. + * The value is an enum of {@link ArkUI_Alignment}. + * The default value is ARKUI_ALIGNMENT_TOP_START. \n + * .value[1]? .f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. Optional. \n + * .value[2]? .f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. Optional. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: mask text.\n + * .value[0]?.i32: position of the overlay relative to the component. Optional. + * The value is an enum of {@link ArkUI_Alignment}. + * The default value is ARKUI_ALIGNMENT_TOP_START. \n + * .value[1]? .f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. Optional. \n + * .value[2]? .f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. Optional. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_TOP_START }, 1.2, 0.3 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OVERLAY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OVERLAY); + * auto text = item->string; + * @endcode + * + */ + NODE_OVERLAY, + /** + * @brief Defines the sweep gradient effect. 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: array of seven parameters of the string type, separated by semicolons (;).\n + * Parameter 1: array of color stops, each of which consists of a color and its stop position. + * Invalid colors are automatically skipped. \n + * Parameter 2: X-coordinate of the sweep gradient center relative to the upper left corner of the component. \n + * Parameter 3: Y-coordinate of the sweep gradient center relative to the upper left corner of the component. \n + * Parameter 4: start point of the sweep gradient. The default value is 0. \n + * Parameter 5: end point of the sweep gradient. The default value is 0. \n + * Parameter 6: rotation angle of the sweep gradient. The default value is 0. \n + * Parameter 7: whether the colors are repeated. The default value is false. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.string: array of parameters of the string type.\n + * Parameter 1: array of color stops, each of which consists of a color and its stop position. + * Invalid colors are automatically skipped. \n + * Parameter 2: X-coordinate of the sweep gradient center relative to the upper left corner of the component. \n + * Parameter 3: Y-coordinate of the sweep gradient center relative to the upper left corner of the component. \n + * Parameter 4: start point of the sweep gradient. The default value is 0. \n + * Parameter 5: end point of the sweep gradient. The default value is 0. \n + * Parameter 6: rotation angle of the sweep gradient. The default value is 0. \n + * Parameter 7: whether the colors are repeated. The default value is false. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;5;10;60;180;60;true" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); + * auto nodeSweepGradient = item->string; + * @endcode + * + */ + NODE_SWEEP_GRADIENT, + /** + * @brief Defines the radial gradient effect. + * 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: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: array of color stops, each of which consists of a color and its stop position. + * Invalid colors are automatically skipped. \n + * Parameter 2: X-coordinate of the radial gradient center relative to the upper left corner of the component. \n + * Parameter 3: Y-coordinate of the radial gradient center relative to the upper left corner of the component. \n + * Parameter 4: radius of the radial gradient. The default value is 0. \n + * Parameter 5: whether the colors are repeated. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.string: array of parameters of the string type.\n + * Parameter 1: array of color stops, each of which consists of a color and its stop position. + * Invalid colors are automatically skipped. \n + * Parameter 2: X-coordinate of the radial gradient center relative to the upper left corner of the component. \n + * Parameter 3: Y-coordinate of the radial gradient center relative to the upper left corner of the component. \n + * Parameter 4: radius of the radial gradient. The default value is 0. \n + * Parameter 5: whether the colors are repeated. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;5;10;50;true" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RADIAL_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RADIAL_GRADIENT); + * auto nodeRadialGradient = item->string; + * @endcode + * + */ + NODE_RADIAL_GRADIENT, + /** + * @brief Adds a mask of the specified shape to 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]?.u32: fill color, in 0xARGB format. Optional.\n + * .value[1]?.u32: stroke color, in 0xARGB format. Optional.\n + * .value[2]?.f32: stroke width, in vp. Optional.\n + * .string: shape. Optional.\n + * In "progressMask(10,10,#ff0000ff)", the values in parentheses indicate the current value, maximum value, + * and color of the progress mask, respectively.\n + * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, + * and radius height, respectively.\n + * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n + * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n + * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and + * commands, respectively.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32 fill color, in 0xARGB format.\n + * .value[1].u32: stroke color, in 0xARGB format.\n + * .value[2].f32: stroke width, in vp.\n + * .string: shape.\n + * In "progressMask(10,10,#ff0000ff)", the values in parentheses indicate the current value, maximum value, + * and color of the progress mask, respectively.\n + * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, + * and radius height, respectively.\n + * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n + * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n + * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and + * commands, respectively.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "rect(10,10,10,10)" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MASK, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MASK); + * auto nodeMaskFill = item->value[0].u32; + * auto nodeMaskStrokeColor = item->value[1].u32; + * auto nodeMaskStrokeWidth = item->value[1].f32; + * auto nodeMaskShape = item->string; + * @endcode + * + */ + NODE_MASK, + /** + * @brief Blends the component's background with the content of the component's child node. + * 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: blend mode. The parameter type is {@link ArkUI_BlendMode}. + * The default value is ARKUI_BLEND_MODE_NONE. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: blend mode. The parameter type is {@link ArkUI_BlendMode}. + * The default value is ARKUI_BLEND_MODE_NONE. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_BLEND_MODE_NONE} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BLEND_MODE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLEND_MODE); + * auto nodeBlendMode = item->value[0].i32; + * @endcode + * + */ + NODE_BLEND_MODE, + /** + * @brief Sets the direction of the main axis. + * 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: direction of the main axis.\n + * The parameter type is {@link ArkUI_Direction}. The default value is ARKUI_DIRECTION_AUTO. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: direction of the main axis.\n + * The parameter type is {@link ArkUI_Direction}. The default value is ARKUI_DIRECTION_AUTO. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_DIRECTION_RTL} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DIRECTION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DIRECTION); + * auto nodeDirection = item->value[0].i32; + * @endcode + * + */ + NODE_DIRECTION, + /** + * @brief Defines the size constraints. 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 width, in vp.\n + * .value[1].f32: maximum width, in vp.\n + * .value[2].f32: minimum height, in vp.\n + * .value[3].f32: maximum height, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: minimum width, in vp.\n + * .value[1].f32: maximum width, in vp.\n + * .value[2].f32: minimum height, in vp.\n + * .value[3].f32: maximum height, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0, 5, 0, 5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CONSTRAINT_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); + * auto nodeMinWidth = item->value[0].f32; + * auto nodeMaxWidth = item->value[1].f32; + * auto nodeMinHeight = item->value[2].f32; + * auto nodeMaxHeight = item->value[3].f32; + * @endcode + * + */ + NODE_CONSTRAINT_SIZE, + /** + * @brief Defines the grayscale effect. 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: grayscale conversion ratio. + * The value ranges from 0 to 1. For example, 0.5 indicates a 50% grayscale conversion ratio.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: grayscale conversion ratio. The value ranges from 0 to 1.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_GRAY_SCALE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_GRAY_SCALE); + * auto nodeGrayScale = item->value[0].f32; + * @endcode + */ + NODE_GRAY_SCALE, + /** + * @brief Inverts the image. 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: image inversion ratio. The value ranges from 0 to 1. + * For example, 0.5 indicates a 50% image inversion ratio.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: image inversion ratio. The value ranges from 0 to 1.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_INVERT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_INVERT); + * auto nodeInvert = item->value[0].f32; + * @endcode + */ + NODE_INVERT, + /** + * @brief Defines the sepia conversion ratio. 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: sepia conversion ratio. The value ranges from 0 to 1. + * For example, 0.5 indicates that a 50% sepia conversion ratio.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: sepia conversion ratio. The value ranges from 0 to 1.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0.5 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SEPIA, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SEPIA); + * auto nodeSepia = item->value[0].f32; + * @endcode + */ + NODE_SEPIA, + /** + * @brief Defines the contrast 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: contrast. If the value is 1, the source image is displayed. + * A larger value indicates a higher contrast and a clearer image. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: contrast.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CONTRAST, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONTRAST); + * auto nodeContrast = item->value[0].f32; + * @endcode + */ + NODE_CONTRAST, + /** + * @brief Defines the foreground color attribute, which can be set, reset, and obtained as required through APIs. + * + * There are two formats of {@link ArkUI_AttributeItem} for setting the attribute value:\n + * 1: .value[0].u32: color value, in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * 2: .value[0].i32: color enum {@link ArkUI_ColoringStrategy}.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color value, in 0xARGB format.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { {.u32=0xFFFF0000} }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FOREGROUND_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); + * auto nodeForegroundColor = item->value[0].u32; + * @endcode + */ + NODE_FOREGROUND_COLOR, + + /** + * @brief Defines the offset of the component's child relative to 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].f32 : offset along the x-axis, in vp. \n + * .value[1].f32 : offset along the y-axis, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32 : offset along the x-axis, in vp. \n + * .value[1].f32 : offset along the y-axis, in vp. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue offsetArray[] = { 20, 0 }; + * ArkUI_AttributeItem item = { .value = offsetArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OFFSET , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); + * auto offsetX = item->value[0].f32; + * @endcode + * + */ + NODE_OFFSET, + /** + * @brief Sets the anchor for locating the component's child. + * 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: X coordinate of the anchor, in vp.\n + * .value[1].f32: Y coordinate of the anchor, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: X coordinate of the anchor, in vp.\n + * .value[1].f32: Y coordinate of the anchor, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue pointArray[] = { 20, 0 }; + * ArkUI_AttributeItem item = { .value = pointArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARK_ANCHOR , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); + * auto pointX = item->value[0].f32; + * @endcode + * + */ + NODE_MARK_ANCHOR, + /** + * @brief Defines the position of the background image in the component, that is, the coordinates relative to the + * upper left corner 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].f32: position along the x-axis, in vp. \n + * .value[1].f32: position along the y-axis, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: position along the x-axis, in vp. \n + * .value[1].f32: position along the y-axis, in vp. \n + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue possitionArray[] = { 20, 0 }; + * ArkUI_AttributeItem item = { .value = possitionArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_POSITION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_POSITION); + * auto offsetX = item->value[0].f32; + * @endcode + */ + NODE_BACKGROUND_IMAGE_POSITION, + /** + * @brief Sets the alignment rules in the relative container. + * 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: ID of the component that functions as the anchor point for left alignment. \n + * .value[1]?.i32: alignment mode relative to the anchor component for left alignment. + * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n + * .value[2]?.i32: ID of the component that functions as the anchor point for center alignment. \n + * .value[3]?.i32: alignment mode relative to the anchor component for center alignment. + * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n + * .value[4]?.i32: ID of the component that functions as the anchor point for right alignment. \n + * .value[5]?.i32: alignment mode relative to the anchor component for right alignment. + * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n + * .value[6]?.i32: ID of the component that functions as the anchor point for top alignment. \n + * .value[7]?.i32: alignment mode relative to the anchor component for top alignment. + * The value is an enum of {@link ArkUI_VerticalAlignment}. \n + * .value[8]?.i32: ID of the component that functions as the anchor point for center alignment in the vertical direction. \n + * .value[9]?.i32: alignment mode relative to the anchor component forcenter alignment in the vertical direction. + * The value is an enum of {@link ArkUI_VerticalAlignment}. \n + * .value[10]?.i32: ID of the component that functions as the anchor point for bottom alignment. \n + * .value[11]?.i32: alignment mode relative to the anchor component for bottom alignment. + * The value is an enum of {@link ArkUI_VerticalAlignment}. \n + * .value[12]?.f32: bias value in the horizontal direction. \n + * .value[13]?.f32: bias value in the vertical direction. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0]?.i32: ID of the component that functions as the anchor point for left alignment. \n + * .value[1]?.i32: alignment mode relative to the anchor component for left alignment. + * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n + * .value[2]?.i32: ID of the component that functions as the anchor point for center alignment. \n + * .value[3]?.i32: alignment mode relative to the anchor component for center alignment. + * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n + * .value[4]?.i32: ID of the component that functions as the anchor point for right alignment. \n + * .value[5]?.i32: alignment mode relative to the anchor component for right alignment. + * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n + * .value[6]?.i32: ID of the component that functions as the anchor point for top alignment. \n + * .value[7]?.i32: alignment mode relative to the anchor component for top alignment. + * The value is an enum of {@link ArkUI_VerticalAlignment}. \n + * .value[8]?.i32: ID of the component that functions as the anchor point for center alignment in the vertical direction. \n + * .value[9]?.i32: alignment mode relative to the anchor component forcenter alignment in the vertical direction. + * The value is an enum of {@link ArkUI_VerticalAlignment}. \n + * .value[10]?.i32: ID of the component that functions as the anchor point for bottom alignment. \n + * .value[11]?.i32: alignment mode relative to the anchor component for bottom alignment. + * The value is an enum of {@link ArkUI_VerticalAlignment}. \n + * .value[12]?.f32: bias value in the horizontal direction. \n + * .value[13]?.f32: bias value in the vertical direction. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue alignRulesArray[] = { { .i32 = 2000}, { .i32 = + * static_cast(ARKUI_HORIZONTAL_ALIGNMENT_START)}}; + * ArkUI_AttributeItem item = { .value = alignRulesArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGN_RULES , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT_RULES); + * auto id = item->value[0].i32; + * @endcode + * + */ + NODE_ALIGN_RULES, + /** + * @brief Sets the alignment mode of the child components along the cross axis of the parent container. + * 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: alignment mode of the child components along the cross axis of the parent container.\n + * The parameter type is {@link ArkUI_ItemAlign}. The default value is ARKUI_ITEM_ALIGN_AUTO. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: alignment mode of the child components along the cross axis of the parent container.\n + * The parameter type is {@link ArkUI_ItemAlign}. The default value is ARKUI_ITEM_ALIGN_AUTO. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_ITEM_ALIGN_STRETCH} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGN_SELF, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGN_SELF); + * auto nodeHitTestBehavior = item->value[0].f32; + * @endcode + * + */ + NODE_ALIGN_SELF, + /** + * @brief Sets the percentage of the parent container's remaining space that is allocated to 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].f32: percentage of the parent container's remaining space that is allocated to the component. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: percentage of the parent container's remaining space that is allocated to the component. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_GROW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_GROW); + * auto nodeFlexGrow = item->value[0].f32; + * @endcode + * + */ + NODE_FLEX_GROW, + /** + * @brief Sets the percentage of the parent container's shrink size that is allocated to 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].f32: percentage of the parent container's shrink size that is allocated to the component. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: percentage of the parent container's shrink size that is allocated to the component. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_SHRINK, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_SHRINK); + * auto nodeFlexShrink = item->value[0].f32; + * @endcode + * + */ + NODE_FLEX_SHRINK, + /** + * @brief Sets the base size 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].f32: base size of the component. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: base size of the component. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_BASIS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_BASIS); + * auto nodeFlexBasis = item->value[0].f32; + * @endcode + * + */ + NODE_FLEX_BASIS, + /** + * @brief Sets the accessibility group. 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: Accessibility group. The value 1 means that the component and + * all its child components form an entire selectable component. + * In this case, the accessibility service will no longer be available for the content of its child components. + * The value is 1 or 0. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: Accessibility group. The value 1 means that the component and all its child components + * form an entire selectable component. + * In this case, the accessibility service will no longer be available for the content of its child components. + * The value is 1 or 0. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_GROUP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_GROUP); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_ACCESSIBILITY_GROUP, + + /** + * @brief Sets the accessibility text. 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: accessibility text. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: accessibility text. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "test"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_TEXT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_TEXT); + * auto value = item->string; + * @endcode + * + */ + NODE_ACCESSIBILITY_TEXT, + + /** + * @brief Sets the accessibility level. 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: accessibility level. The parameter type is {@link ArkUI_AccessibilityLevel}. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: accessibility level. The parameter type is {@link ArkUI_AccessibilityLevel}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ACCESSIBILITY_LEVEL_AUTO } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_LEVEL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_LEVEL); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_ACCESSIBILITY_LEVEL, + + /** + * @brief Sets the accessibility description. + * 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: accessibility description. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: accessibility description. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "test" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_DESCRIPTION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_DESCRIPTION); + * auto value = item->string; + * @endcode + * + */ + NODE_ACCESSIBILITY_DESCRIPTION, + + /** + * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: text content.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: text content.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CONTENT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); + * auto content = item->string + * @endcode + */ + NODE_TEXT_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT, + /** + * @brief Defines the font color 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].u32: font color, in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].u32: font color value, in 0xARGB format.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_COLOR); + * auto nodeFontColor = item->value[0].u32; + * @endcode + * + */ + NODE_FONT_COLOR, + /** + * @brief Defines the font size 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: font size, in fp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: font size, in fp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_SIZE); + * auto nodeFontSize = item->value[0].f32; + * @endcode + * + */ + NODE_FONT_SIZE, + /** + * @brief Defines the font style 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].i32: font style {@link ArkUI_FontStyle}. The default value is ARKUI_FONT_STYLE_NORMAL.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: font style {@link ArkUI_FontStyle}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_STYLE_NORMAL} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_STYLE); + * auto nodeFontStyle = item->value[0].i32; + * @endcode + * + */ + NODE_FONT_STYLE, + /** + * @brief Defines the font weight 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].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 + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_WEIGHT_NORMAL} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_WEIGHT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_WEIGHT); + * auto nodeFontWeight = item->value[0].i32; + * @endcode + * + */ + NODE_FONT_WEIGHT, + /** + * @brief Defines the text line height 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: line height, in fp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: line height, in fp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue lineHeight[] = { 20 }; + * ArkUI_AttributeItem item = { .value = lineHeight, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); + * auto pointX = item->value[0].f32; + * @endcode + */ + NODE_TEXT_LINE_HEIGHT, + /** + * @brief Defines the text decoration style and color. + * 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: text decoration style {@link ArkUI_TextDecorationType}. + * The default value is ARKUI_TEXT_DECORATION_TYPE_NONE.\n + * .value[1]? .u32: text decoration color, in 0xARGB format. For example, 0xFFFF0000 indicates red. Optional.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: text decoration style {@link ArkUI_TextDecorationType}.\n + * .value[1].u32: text decoration color, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); + * auto nodeDecorationStyle = item->value[0].i32; + * auto nodeDecorationColor = item->value[1].u32; + * @endcode + * + */ + NODE_TEXT_DECORATION, + /** + * @brief Defines the text case 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].i32: text case.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: text case.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textCase[] = { {.i32 = static_cast(ARKUI_TEXT_CASE_LOWER) } }; + * ArkUI_AttributeItem item = { .value = textCase, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CASE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); + * auto textCase = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_CASE, + /** + * @brief Defines the letter spacing 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: letter spacing, in fp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: letter spacing, in fp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue letterSpacing[] = { 20 }; + * ArkUI_AttributeItem item = { .value = letterSpacing, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); + * auto letterSpacing = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_LETTER_SPACING, + /** + * @brief Sets the maximum number of lines in the text. + * 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: maximum number of lines in the text.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: maximum number of lines in the text.\n + + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue maxLine[] = { { .i32 = 2 } }; + * ArkUI_AttributeItem item = { .value = maxLine, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_LINES , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); + * auto maxLines = item->value[0].i32; + * @endcode + */ + NODE_TEXT_MAX_LINES, + /** + * @brief Horizontal alignment mode of the text. + * 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: horizontal alignment mode of the text. The value is an enum of {@link ArkUI_TextAlignment}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: horizontal alignment mode of the text. The value is an enum of {@link ArkUI_TextAlignment}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue alignMent[] = {{.i32 = static_cast(ARKUI_TEXT_ALIGNMENT_CENTER)}}; + * ArkUI_AttributeItem item = { .value = alignMent, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_ALIGN , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); + * auto alignMent = item->value[0].i32; + * @endcode + */ + NODE_TEXT_ALIGN, + /** + * @brief Defines the text overflow 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].i32: display mode when the text is too long. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: display mode when the text is too long. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textOverFlow[] = { { .i32 = static_cast(ARKUI_TEXT_OVERFLOW_CLIP) } }; + * ArkUI_AttributeItem item = { .value = textOverFlow, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle,NODE_TEXT_OVERFLOW , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); + * auto textOverFlow = item->value[0].i32; + * @endcode + */ + NODE_TEXT_OVERFLOW, + /** + * @brief Defines the font family attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: fonts, separated by commas (,). + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: fonts, separated by commas (,). + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "HarmonyOS Sans"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_FAMILY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_FAMILY); + * auto font = item->string; + * @endcode + * + */ + NODE_FONT_FAMILY, + /** + * @brief Defines the copy option 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].i32: copy option {@link ArkUI_CopyOptions}. The default value is ARKUI_COPY_OPTIONS_NONE.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: copy option {@link ArkUI_CopyOptions. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_COPY_OPTIONS_NONE} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_COPY_OPTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); + * auto nodeTextCopyOption = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_COPY_OPTION, + /** + * @brief Defines the text baseline offset attribute. + * 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: baseline offset, in fp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: baseline offset, in fp. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); + * auto nodeTextBaselineOffset = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_BASELINE_OFFSET, + /** + * @brief Defines the text shadow 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: blur radius of the shadow, in vp.\n + * .value[1].i32: shadow type {@link ArkUI_ShadowType}. The default value is ARKUI_SHADOW_TYPE_COLOR.\n + * .value[2].u32: shadow color, in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * .value[3].f32: offset of the shadow along the x-axis, in vp.\n + * .value[4].f32: offset of the shadow along the y-axis, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: blur radius of the shadow, in vp.\n + * .value[1].i32: shadow type {@link ArkUI_ShadowType}.\n + * .value[2].u32: shadow color, in 0xARGB format.\n + * .value[3].f32: offset of the shadow along the x-axis, in vp.\n + * .value[4].f32: offset of the shadow along the y-axis, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, 10, 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); + * auto nodeTextShadowRadius = item->value[0].f32; + * auto nodeTextShadowType = item->value[1].i32; + * auto nodeTextShadowColor = item->value[2].u32; + * auto nodeTextShadowOffsetX = item->value[3].f32; + * auto nodeTextShadowOffsetY = item->value[4].f32; + * @endcode + * + */ + NODE_TEXT_TEXT_SHADOW, + /** + * @brief Defines the minimum font size 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 size, in fp. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: minimum font size, in fp. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 20 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_MIN_FONT_SIZE, + + /** + * @brief Defines the maximum font size 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 size, in fp. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: maximum font size, in fp. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 20 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_MAX_FONT_SIZE, + + /** + * @brief Defines the text style attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string?: font family. Optional. Use commas (,) to separate multiple fonts. \n + * .value[0].f32: font size, in fp. \n + * .value[1]? .i32: font weight. Optional. The parameter type is {@link ArkUI_FontWeight}. + * The default value is ARKUI_FONT_WEIGHT_NORMAL. \n + * .value[2]? .i32: font style. Optional. The parameter type is {@link ArkUI_FontStyle}. + * The default value is ARKUI_FONT_STYLE_NORMAL. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string?: font family. Optional. Use commas (,) to separate multiple fonts. \n + * .value[0].f32: font size, in fp. \n + * .value[1]? .i32: font weight. Optional. The parameter type is {@link ArkUI_FontWeight}. + * The default value is ARKUI_FONT_WEIGHT_NORMAL. \n + * .value[2]? .i32: font style. Optional. The parameter type is {@link ArkUI_FontStyle}. + * The default value is ARKUI_FONT_STYLE_NORMAL. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 16, { .i32 = ARKUI_FONT_STYLE_NORMAL }, + * { .i32 = ARKUI_FONT_STYLE_NORMAL } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_FONT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_FONT); + * auto size = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_FONT, + + /** + * @brief Defines how the adaptive height is determined for the text. + * 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: how the adaptive height is determined for the text. + * The parameter type is {@link ArkUI_TextHeightAdaptivePolicy}. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: how the adaptive height is determined for the text. + * The parameter type is {@link ArkUI_TextHeightAdaptivePolicy} + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY); + * auto size = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, + /** + * @brief Defines the indentation of the first line. + * 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: indentation of the first line. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: indentation of the first line. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textIndent[] = { 20 }; + * ArkUI_AttributeItem item = { .value = textIndent, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INDENT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); + * auto indentValue = item->value[0].f32; + * @endcode + */ + NODE_TEXT_INDENT, + /** + * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: content of the text span. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: content of the text span. \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SPAN_CONTENT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SPAN_CONTENT); + * auto spanContent = item->string; + * @endcode + */ + NODE_SPAN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SPAN, + /** + * @brief Defines the image source of the image span. + * 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: image address of the image span.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: image address of the image span.\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC); + * auto spanScr = item->string; + * @endcode + */ + NODE_IMAGE_SPAN_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE_SPAN, + /** + * @brief Defines the alignment mode of the image with the text. + * 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: alignment mode of the image with the text. + * The value is an enum of {@link ArkUI_ImageSpanAlignment}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: alignment mode of the image with the text. + * The value is an enum of {@link ArkUI_ImageSpanAlignment}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue alignValue[] = { {.i32 = static_cast(ARKUI_IMAGE_SPAN_ALIGNMENT_TOP) } }; + * ArkUI_AttributeItem item = {.value = alignValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN); + * auto verticalAlign = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_SPAN_VERTICAL_ALIGN, + /** + * @brief Defines the image source 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 + * .string: image source.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: image source.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SRC , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); + * auto imageSrc = item->string; + * @endcode + */ + NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, + /** + * @brief Defines how the image is resized to fit its container. + * 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: how the image is resized to fit its container. The value is an enum of {@link ArkUI_ObjectFit}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: how the image is resized to fit its container. The value is an enum of {@link ArkUI_ObjectFit}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue objectFitValue[] = { { .i32 = static_cast(ARKUI_OBJECT_FIT_FILL) } }; + * ArkUI_AttributeItem item = { .value = objectFitValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); + * auto objectFit = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_OBJECT_FIT, + /** + * @brief Defines the interpolation effect of the image. + * 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: interpolation effect of the image. The value is an enum of {@link ArkUI_ImageInterpolation}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: interpolation effect of the image. The value is an enum of {@link ArkUI_ImageInterpolation}. \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue interpolationValue[] = { { .i32 = ARKUI_INTERPOLATION_LOW } }; + * ArkUI_AttributeItem item = { .value = interpolationValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); + * auto interpolation = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_INTERPOLATION, + /** + * @brief Defines how the image is repeated. 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: how the image is repeated. The value is an enum of {@link ArkUI_ImageRepeat}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: how the image is repeated. The value is an enum of {@link ArkUI_ImageRepeat}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue repeatValue[] = { { .i32 = static_cast(ARKUI_IMAGE_REPEAT_X) } }; + * ArkUI_AttributeItem item = { .value = repeatValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); + * auto repeat = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_OBJECT_REPEAT, + /** + * @brief Defines the color filter of the image. + * 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 to .value[19].i32: filter matrix array. \n + * .size: 5 x 4 filter array size. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32 to .value[19].i32: filter matrix array. \n + * .size: 5 x 4 filter array size. \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue filterValue[] = { {.i32 = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 + * = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = + * 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0} }; + * ArkUI_AttributeItem item = { .value = filterValue, .size = sizeof(filterValue)/ sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); + * auto colorFilter = item->value + * @endcode + */ + NODE_IMAGE_COLOR_FILTER, + /** + * @brief Defines the auto resize 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].i32 : whether to resize the image source. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32 : whether to resize the image source. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue resizeValue[] = { {.i32 = true} }; + * ArkUI_AttributeItem item = { .value = resizeValue, .size = 1}}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); + * auto autoResize = item->value[0].i32; + * @endcode + */ + NODE_IMAGE_AUTO_RESIZE, + /** + * @brief Defines the placeholder image source. + * 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: placeholder image source. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: placeholder image source. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "/pages/loading.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_ALT , &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); + * auto altStr = item->string; + * @endcode + */ + NODE_IMAGE_ALT, + /** + * @brief Defines the color of the component 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: background color, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: background color, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR); + * auto nodeToggleSelectedColor = item->value[0].u32; + * @endcode + * + */ + NODE_TOGGLE_SELECTED_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, + /** + * @brief Defines the color of the circular slider for the component of the switch type. + * 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 circular slider, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color of the circular slider, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); + * auto nodeSwitchPointColor = item->value[0].u32; + * @endcode + * + */ + NODE_TOGGLE_SWITCH_POINT_COLOR, + + /** + * @brief Defines the foreground color of the loading progress bar. + * 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: foreground color, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: foreground color, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0x99666666 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR); + * auto nodeLoadingProgressColor = item->value[0].u32; + * @endcode + * + */ + NODE_LOADING_PROGRESS_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LOADING_PROGRESS, + /** + * @brief Defines whether to show the loading animation for 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: whether to show the loading animation. + * The value true means to show the loading animation, and false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: The value 1 means to show the loading animation, and 0 means the opposite. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING); + * auto nodeLoadingProgressEnableLoading = item->value[0].i32; + * @endcode + */ + NODE_LOADING_PROGRESS_ENABLE_LOADING, + + /** + * @brief Defines the default placeholder text of the single-line text box. + * 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: default placeholder text. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: default placeholder text. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="input" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER); + * auto nodeTextInputPlaceholder = item->string; + * @endcode + * + */ + NODE_TEXT_INPUT_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, + /** + * @brief Defines the default text content of the single-line text box. + * 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: default text content. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: default text content. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="input" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT); + * auto nodeTextInputText = item->string; + * @endcode + * + */ + NODE_TEXT_INPUT_TEXT, + /** + * @brief Defines the caret color attribute. + * 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: caret color, in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: caret color, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR); + * auto nodeTextInputCaretColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_INPUT_CARET_COLOR, + /** + * @brief Defines the caret style attribute. + * 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: caret width, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: caret width, in vp. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE); + * auto nodeTextInputCaretStyle = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_INPUT_CARET_STYLE, + /** + * @brief Defines the underline attribute of the single-line text box. + * 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 an underline. + * The value true means to show an underline, and false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: The value 1 means to show an underline, and 0 means the opposite. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = true} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE); + * auto nodeTextInputUnderline = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_SHOW_UNDERLINE, + /** + * @brief Defines the maximum number of characters in the text input. + * 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: maximum number of characters in the text input, without a unit. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: maximum number of characters in the text input. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 50 } }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH); + * auto nodeTextInputMaxlength = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_MAX_LENGTH, + /** + * @brief Defines the type of the Enter key. + * 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: type of the Enter key{@link ArkUI_EnterKeyType}. The default value is ARKUI_ENTER_KEY_TYPE_DONE. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: type of the Enter key{@link ArkUI_EnterKeyType}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_ENTER_KEY_TYPE_DONE} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE); + * auto nodeTextInputMaxlength = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_ENTER_KEY_TYPE, + /** + * @brief Defines the placeholder text color. + * 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 value, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color value, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR); + * auto nodeTextInputPlaceholderColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_INPUT_PLACEHOLDER_COLOR, + /** + * @brief Defines the placeholder text font. + * 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: font size, in fp. Optional. The default value is 16.0.\n + * .value[1]? .i32: font style {@link ArkUI_FontStyle}. Optional. + * The default value is ARKUI_FONT_STYLE_NORMAL.\n + * .value[2]?.i32: font weight {@link ArkUI_FontWeight}. Optional. + * The default value is ARKUI_FONT_WEIGHT_NORMAL.\n + * ?.string: font family. Multiple font families are separated by commas (,). + * For example, "font weight; font family 1, font family 2". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: font size, in fp.\n + * .value[1].i32: font style {@link ArkUI_FontStyle}.\n + * .value[2].i32: font weight {@link ArkUI_FontWeight}.\n + * .string: font family. Multiple font families are separated by commas (,). \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT); + * auto nodeTextInputPlaceholderFontSize = item->value[0].f32; + * auto nodeTextInputPlaceholderFontStyle = item->value[1].i32; + * auto nodeTextInputPlaceholderFontWeight = item->value[2].i32; + * auto nodeTextInputPlaceholderFontFamily = item->string; + * @endcode + * + */ + NODE_TEXT_INPUT_PLACEHOLDER_FONT, + /** + * @brief Defines whether to enable the input method when the component obtains focus. + * 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 the input method when the component obtains focus. + * The value true means to enable the input method, and false means the opposite.\n \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].i32: The value 1 means to enable the input method when the component obtains focus, + * and 0 means the opposite. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = true} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS); + * auto nodeTextInputFocusKeyboard = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, + /** + * @brief Defines the text box type. 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: text box type {@link ArkUI_TextInputType}. + * The default value is ARKUI_TEXTINPUT_TYPE_NORMAL. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: text box type {@link ArkUI_TextInputType}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXTINPUT_TYPE_NORMAL} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE); + * auto nodeTextInputType = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_TYPE, + /** + * @brief Defines the background color of the selected text. + * 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 value, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color value, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR); + * auto nodeTextInputSelectedColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, + /** + * @brief Defines whether to display the password icon at the end of the password text box. + * 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 display the password icon at the end of the password text box. + * The value true means to display the password icon, and false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: The value 1 means to display the password icon at the end of the + * password text box, and 0 means the opposite. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = true} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON); + * auto nodeTextInputPasswordIcon = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, + /** + * @brief Defines the editable state for the single-line text box. This attribute can be set as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to remain in the editable state. + * The value true means to remain in the editable state, and false means to exit the editable state.\n \n + * \n + * Format of the {@link ArkUI_AttributeItem} parameter for obtaining the attribute: + * .value[0].i32: whether to remain in the editable state. + * The value true means to remain in the editable state, and false means to exit the editable state.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = false} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_EDITING, &item); + * @endcode + * + */ + NODE_TEXT_INPUT_EDITING, + /** + * @brief Defines the style of the cancel button on the right of the single-line text box. + * 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: button style {@link ArkUI_CancelButtonStyle}. + * The default value is ARKUI_CANCELBUTTON_STYLE_INPUT.\n + * .value[1]? .f32: button icon size, in vp.\n + * .value[2]? .u32: button icon color, in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * ?.string: button icon image source. The value is the local address of the image, for example, /pages/icon.png. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: button style {@link ArkUI_CancelButtonStyle}.\n + * .value[1].f32: icon size, in vp.\n + * .value[2].u32: button icon color, in 0xARGB format.\n + * .string: button icon image source. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_CANCELBUTTON_STYLE_INPUT}, 10.0, {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON); + * auto nodeCancelButtonStyle = item->value[0].i32; + * auto nodeCancelButtonSize = item->value[1].f32; + * auto nodeCancelButtonColor = item->value[2].u32; + * auto nodeCancelButtonImage = item->string; + * @endcode + * + */ + NODE_TEXT_INPUT_CANCEL_BUTTON, + + /** + * @brief Defines the default placeholder text for the multi-line text box. + * The attribute setting, attribute resetting, and attribute obtaining interfaces are supported. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: default placeholder text. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: default placeholder text. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="input" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER); + * auto nodeTextAreaPlaceholder = item->string; + * @endcode + * + */ + NODE_TEXT_AREA_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, + /** + * @brief Defines the default text content for the multi-line text box. + * The attribute setting, attribute resetting, and attribute obtaining interfaces are supported. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: default text content. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: default text content. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="input" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_TEXT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_TEXT); + * auto nodeTextAreaText = item->string; + * @endcode + * + */ + NODE_TEXT_AREA_TEXT, + /** + * @brief Defines the maximum number of characters in the text input. + * 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: maximum number of characters in the text input. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: maximum number of characters in the text input. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 50 } }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH); + * auto nodeTextAreaMaxlength = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_AREA_MAX_LENGTH, + /** + * @brief Defines the placeholder text color. + * 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 value, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color value, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR); + * auto nodeTextAreaPlaceholderColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_AREA_PLACEHOLDER_COLOR, + /** + * @brief Defines the placeholder text font. + * 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: font size, in fp. Optional. The default value is 16.0.\n + * .value[1]? .i32: font style {@link ArkUI_FontStyle}. Optional. The default value is ARKUI_FONT_STYLE_NORMAL.\n + * .value[2]?.i32: font weight {@link ArkUI_FontWeight}. Optional. The default value is ARKUI_FONT_WEIGHT_NORMAL.\n + * ?.string: font family. Multiple font families are separated by commas (,). For example, "font weight; font family 1, font family 2". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: font size, in fp.\n + * .value[1].i32: font style {@link ArkUI_FontStyle}.\n + * .value[2].i32: font weight {@link ArkUI_FontWeight}.\n + * .string: font family. Multiple font families are separated by commas (,). \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT); + * auto nodeTextAreaPlaceholderFontSize = item->value[0].f32; + * auto nodeTextAreaPlaceholderFontStyle = item->value[1].i32; + * auto nodeTextAreaPlaceholderFontWeight = item->value[2].i32; + * auto nodeTextAreaPlaceholderFontFamily = item->string; + * @endcode + * + */ + NODE_TEXT_AREA_PLACEHOLDER_FONT, + /** + * @brief Defines the caret color attribute. + * 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: background color, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: background color, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR); + * auto nodeTextAreaCaretColor = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_AREA_CARET_COLOR, + /** + * @brief Defines the editable state for the multi-line text box. This attribute can be set as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to remain in the editable state. + * The value true means to remain in the editable state, and false means to exit the editable state.\n \n + * \n + * Format of the {@link ArkUI_AttributeItem} parameter for obtaining the attribute: + * .value[0].i32: whether to remain in the editable state. + * The value true means to remain in the editable state, and false means to exit the editable state.\n \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = false} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_EDITING, &item); + * @endcode + * + */ + NODE_TEXT_AREA_EDITING, + + /** + * @brief Defines the button text content. 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: default text content. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: default text content. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string="click" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BUTTON_LABEL); + * auto nodeButtonLabelr = item->string; + * @endcode + * + */ + NODE_BUTTON_LABEL = MAX_NODE_SCOPE_NUM * ARKUI_NODE_BUTTON, + + /** + * @brief Defines the current value of the progress 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].f32: current value of the progress indicator. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: current value of the progress indicator. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_VALUE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_VALUE); + * auto nodeProgressValue = item->value[0].f32; + * @endcode + * + */ + NODE_PROGRESS_VALUE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_PROGRESS, + /** + * @brief Defines the total value of the progress 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].f32: total value of the progress indicator. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: total value of the progress indicator. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TOTAL, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_TOTAL); + * auto nodeProgressTotal = item->value[0].f32; + * @endcode + * + */ + NODE_PROGRESS_TOTAL, + /** + * @brief Defines the color for the progress value on the progress 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].u32: color value, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color value, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_COLOR); + * auto nodeProgressColor = item->value[0].u32; + * @endcode + * + */ + NODE_PROGRESS_COLOR, + /** + * @brief Defines the type of the progress 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: type of the progress indicator {@link ArkUI_ProgressType}. + * The default value is ARKUI_PROGRESS_LINEAR. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: type of the progress indicator {@link ArkUI_ProgressType}. \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_PROGRESS_LINEAR} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TYPE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_TYPE); + * auto nodeProgressType = item->value[0].i32; + * @endcode + */ + NODE_PROGRESS_TYPE, + + /** + * @brief Defines whether the check box 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 check box is selected. The value 1 means that the check box 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 check box is selected, and 0 means the opposite.\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 0 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SELECT); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_CHECKBOX_SELECT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, + + /** + * @brief Defines the color of the check box 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 check box 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 check box when it is selected, in 0xARGB format, for example, 0xFF1122FF. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_CHECKBOX_SELECT_COLOR, + + /** + * @brief Defines the border color of the check box 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. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_CHECKBOX_UNSELECT_COLOR, + + /** + * @brief Defines the internal icon style of the check box. + * 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: 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. Optional.\n + * .value[2]? .f32: stroke width of the internal mark, in vp. Optional. The default value is 2. \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 0xFF1122FF }, 20.0f, 2.0f }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_MARK, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_MARK); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_CHECKBOX_MARK, + + /** + * @brief Defines the shape of the check box. + * 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}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ArkUI_CHECKBOX_SHAPE_CIRCLE } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SHAPE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SHAPE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_CHECKBOX_SHAPE, + + /** + * @brief Defines the ID of 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 + * .string: component ID. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: component ID. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "test" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_ID, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_ID); + * auto nodeXcomponentId = item->string; + * @endcode + * + */ + NODE_XCOMPONENT_ID = MAX_NODE_SCOPE_NUM * ARKUI_NODE_XCOMPONENT, + /** + * @brief Defines the type 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: type {@link ArkUI_XComponentType}. The default value is ARKUI_XCOMPONENT_TYPE_SURFACE.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: type {@link ArkUI_XComponentType}. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_XCOMPONENT_TYPE_SURFACE} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_TYPE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_TYPE); + * auto nodeXcomponentType = item->value[0].i32; + * @endcode + * + */ + NODE_XCOMPONENT_TYPE, + /** + * @brief Defines the width and height of 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].u32: width, in vp.\n + * .value[1].u32: height, in vp.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: width, in vp.\n + * .value[1].u32: height, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32=300}, {.u32=50} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * auto nodeXcomponentSurfaceWidth = item->value[0].u32; + * auto nodeXcomponentSurfaceHeight = item->value[1].u32; + * @endcode + * + */ + NODE_XCOMPONENT_SURFACE_SIZE, + + /** + * @brief Defines whether to display the lunar calendar in 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: whether to display the lunar calendar in the date picker. The default value is false. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to display the lunar calendar in the date picker. + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR); + * auto nodeDatePickerLunar = item->value[0].i32; + * @endcode + */ + NODE_DATE_PICKER_LUNAR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_DATE_PICKER, + /** + * @brief Defines the start date 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 + * .string: date. The default value is "1970-1-1". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: date. \n + * + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "1970-1-1" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_START, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_START); + * auto nodeDatePickerStart = item->string; + * @endcode + */ + NODE_DATE_PICKER_START, + /** + * @brief Defines the end date 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 + *.string: date. The default value is "2100-12-31". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: date. \n + * + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "2100-12-31" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_END, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_END); + * auto nodeDatePickerEnd = item->string; + * @endcode + */ + NODE_DATE_PICKER_END, + /** + * @brief Defines the selected date 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 + * .string: date. The default value is "2024-01-22". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: date. + * + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "2024-01-22" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED); + * auto nodeDatePickerSelected = item->string; + * @endcode + */ + NODE_DATE_PICKER_SELECTED, + /** + * @brief Defines the font color, font size, and font weight for the top and bottom items in 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 + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); + * auto nodeDatePickerDisappearTextStyle = item->string; + * @endcode + */ + NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, + /** + * @brief Defines the font color, font size, and font weight of all items except the top, bottom, and selected items + * in 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 + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE); + * auto nodeDatePickerTextStyle = item->string; + * @endcode + */ + NODE_DATE_PICKER_TEXT_STYLE, + /** + * @brief Defines the font color, font size, and font weight of the selected item in 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 + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE); + * auto nodeDatePickerSelectedTextStyle = item->string; + * @endcode + */ + NODE_DATE_PICKER_SELECTED_TEXT_STYLE, + /** + * @brief Defines the time of the selected item. in the timer 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 the current system time. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: time. + * + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "17-11" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED); + * auto nodeTimePickerSelected = item->string; + * @endcode + */ + + NODE_TIME_PICKER_SELECTED = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TIME_PICKER, + /** + * @brief Defines whether the display time is in 24-hour format. + * 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 display time is in 24-hour format. The default value is false. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].i32: whether the display time is in 24-hour format. + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME); + * auto nodeTimePickerUseMilitaryTime = item->value[0].i32; + * @endcode + */ + NODE_TIME_PICKER_USE_MILITARY_TIME, + /** + * @brief Defines the font color, font size, and font weight for the top and bottom items in 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: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); + * auto nodeDatePickerDisappearTextStyle = item->string; + * @endcode + */ + NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, + /** + * @brief Defines the font color, font size, and font weight of all items except the top, bottom, and selected items + * in 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: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.cpp} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE); + * auto nodeTimePickerTextStyle = item->string; + * @endcode + */ + NODE_TIME_PICKER_TEXT_STYLE, + /** + * @brief Defines the font color, font size, and font weight of the selected item in 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: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.c} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE); + * auto nodeDatePickerSelectedTextStyle = item->string; + * @endcode + */ + NODE_TIME_PICKER_SELECTED_TEXT_STYLE, + + /** + * @brief Defines the data selection range 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].i32: type of the text picker {@link ArkUI_TextPickerRangeType}. + * The default value is ARKUI_TEXTPICKER_RANGETYPE_SINGLE.\n + * ?.string: string input, whose format varies by picker type.\n + * 1: single-column picker. The input format is a group of strings separated by semicolons (;).\n + * 2: multi-column picker. Multiple pairs of plain text strings are supported. + * The pairs are separated by semicolons (;), and strings within each pair are separated by commas (,).\n + * ?.object: Object input, whose format varies by picker type.\n + * 1: single-column picker with image support. The input structure is {@link ARKUI_TextPickerRangeContent}.\n + * 2: multi-column interconnected picker. The input structure is {@link ARKUI_TextPickerCascadeRangeContent}.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: type of the text picker {@link ArkUI_TextPickerRangeType}.\n + * ?.string: string output, whose format varies by picker type.\n + * 1: single-column picker. The output format is a group of strings separated by semicolons (;).\n + * 2: multi-column picker. Multiple pairs of plain text strings are supported. + * The pairs are separated by semicolons (;), and strings within each pair are separated by commas (,).\n + * ?.string: Object output, whose format varies by picker type.\n + * 1: single-column picker with image support. The output structure is {@link ARKUI_TextPickerRangeContent}.\n + * 2: multi-column interconnected picker. The output structure is {@link ARKUI_TextPickerCascadeRangeContent}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=ARKUI_TEXTPICKER_RANGETYPE_MULTI} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "1,2,3;A,B,C" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE); + * auto nodeTextPickerRangeType = item->value[0].i32; + * auto nodeTextPickerMultiRange = item->string; + * @endcode + * + */ + NODE_TEXT_PICKER_OPTION_RANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, + /** + * @brief Defines the index of the default selected item in the data selection range 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].u32: index. If there are multiple index values, add them one by one. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: index. If there are multiple index values, add them one by one.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.u32 = 1}, {.u32 = 2} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED); + * auto nodeTextPickerSelected = item->value[0].u32; + * @endcode + * + */ + NODE_TEXT_PICKER_OPTION_SELECTED, + /** + * @brief Defines the value of the default selected item in 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 + * .string: value of the selected item. If there are multiple values, add them one by one and + * separate them with semicolons (;). \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: value of the selected item. If there are multiple values, add them one by one and + * separate them with semicolons (;).\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = { .string = "A;B" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE); + * auto nodeTextPickerValue = item->string; + * @endcode + * + */ + NODE_TEXT_PICKER_OPTION_VALUE, + /** + * @brief Defines the font color, font size, and font weight for the top and bottom items in 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 + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.c} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE); + * auto nodeDatePickerDisappearTextStyle = item->string; + * @endcode + */ + NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, + /** + * @brief Defines the font color, font size, and font weight for all items except the top, bottom, and + * selected items in 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 + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.c} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE); + * auto nodeDatePickerTextStyle = item->string; + * @endcode + */ + NODE_TEXT_PICKER_TEXT_STYLE, + /** + * @brief Defines the font color, font size, and font weight for the selected item in 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 + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * @code {.c} + * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE); + * auto nodeTextPickerSelectedTextStyle = item->string; + * @endcode + */ + NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, + /** + * @brief Defines the index of the default item in the data selection range 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...].i32: index of the default item in the data selection range. + * + * @code {.c} + * ArkUI_NumberValue value[] = { { .i32 = 0 }, { .i32 = 1 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_INDEX, &item); + * @endcode + */ + NODE_TEXT_PICKER_SELECTED_INDEX, + /** + * @brief Defines whether to support scroll looping for 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].i32: whether to support scroll looping. + * The value true means to support scroll looping, and false means the opposite.\n \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: The value 1 means to support scroll looping, and 0 means the opposite. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32=true} }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP); + * auto nodePickerCanLoop = item->value[0].i32; + * @endcode + */ + NODE_TEXT_PICKER_CAN_LOOP, + /** + * @brief Defines the height of each item in the 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: item height, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].f32: item height, in vp. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = { value, 1 }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT); + * auto nodePickerItemHeight = item->value[0].f32; + * @endcode + */ + NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, + + /** + * @brief Defines the color of the slider. 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 slider, in 0xARGB format, for example, 0xFF1122FF. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].u32: color of the slider, in 0xARGB format, for example, 0xFF1122FF. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_SLIDER_BLOCK_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, + + /** + * @brief Defines the background color of the slider. + * 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: background color, in 0xARGB format, for example, 0xFF1122FF. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: background color, in 0xARGB format, for example, 0xFF1122FF. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_TRACK_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_TRACK_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_SLIDER_TRACK_COLOR, + + /** + * @brief Defines the color of the selected part of the slider track. + * 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 selected part of the slider track, in 0xARGB format, for example, 0xFF1122FF. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color of the selected part of the slider track, in 0xARGB format, for example, 0xFF1122FF. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR); + * auto value = item->value[0].u32; + * @endcode + * + */ + NODE_SLIDER_SELECTED_COLOR, + + /** + * @brief Defines whether to display a tooltip when the user drags the slider. + * 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 display a tooltip when the user drags the slider. + * The value 1 means to display a tooltip, and 0 means the opposite. The default value is 0.\n \n + * .string?: text content of the tooltip. Optional. The default value is the current percentage. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to display a tooltip when the user drags the slider. + * The value 1 means to display a tooltip, and 0 means the opposite. The default value is 0.\n \n + * .string?: text content of the tooltip. Optional. The default value is the current percentage. \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SHOW_TIPS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_SHOW_TIPS, + + /** + * @brief Defines the slider shape, 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].i32: shape. The parameter type is {@link ArkUI_SliderBlockStyle}. \n + * .string?: depending on the shape. Optional. \n + * ARKUI_SLIDER_BLOCK_STYLE_IMAGE: image resource of the slider. Example: /pages/common/icon.png. \n + * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: custom shape of the slider. \n + * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, and + * radius height, respectively.\n + * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n + * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n + * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and commands, respectively.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: shape. The parameter type is {@link ArkUI_SliderBlockStyle}. \n + * .string? depending on the shape. Optional. \n + * ARKUI_SLIDER_BLOCK_STYLE_IMAGE: image resource of the slider. Example: /pages/common/icon.png. \n + * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: custom shape of the slider. \n + * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, + * and radius height, respectively.\n + * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n + * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n + * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and + * commands, respectively.\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_DEFAULT}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_BLOCK_STYLE, + + /** + * @brief Defines the current value of the slider. + * 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: current value. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: current value. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_VALUE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_VALUE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_SLIDER_VALUE, + + /** + * @brief Defines the minimum value of the slider. + * 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 value. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: minimum value. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 0 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_SLIDER_MIN_VALUE, + + /** + * @brief Defines the maximum value of the slider. + * 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 value. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: maximum value. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_SLIDER_MAX_VALUE, + + /** + * @brief Defines the step of the slider. 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: step. The value range is [0.01, 100]. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: step. The value range is [0.01, 100]. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 100 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_STEP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_STEP); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_SLIDER_STEP, + + /** + * @brief Defines whether the slider moves horizontally or vertically. + * 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 slider moves horizontally or vertically. + * The parameter type is {@link ArkUI_SliderDirection}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether the slider moves horizontally or vertically. + * The parameter type is {@link ArkUI_SliderDirection}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SLIDER_DIRECTION_VERTICAL } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_DIRECTION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_DIRECTION); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_DIRECTION, + + /** + * @brief Defines whether the slider values are reversed. + * 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 slider values are reversed. + * The value 1 means that the slider values are reversed, and 0 means the opposite. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether the slider values are reversed. + * The value 1 means that the slider values are reversed, and 0 means the opposite. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 0} }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_REVERSE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_REVERSE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_REVERSE, + + /** + * @brief Defines the style of the slider thumb and track. + * 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: style of the slider thumb and track. The parameter type is {@link ArkUI_SliderStyle}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: style of the slider thumb and track. The parameter type is {@link ArkUI_SliderStyle}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SLIDER_STYLE_OUT_SET } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_STYLE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SLIDER_STYLE, + + /** + * @brief Defines the alignment mode of the child components in the container. + * 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: alignment mode. The parameter type is {@link ArkUI_Alignment}. + * The default value is ARKUI_ALIGNMENT_CENTER. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: alignment mode. The parameter type is {@link ArkUI_Alignment}. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); + * auto nodeStackAlignContent = item->value[0].i32; + * @endcode + */ + NODE_STACK_ALIGN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_STACK, + + /** + * @brief Defines the scrollbar status. 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: scrollbar status. The parameter type is {@link ArkUI_ScrollBarDisplayMode}. + * The default value is ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: scrollbar status. The parameter type is {@link ArkUI_ScrollBarDisplayMode}. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); + * auto nodeScrollBarDisplayMode = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_BAR_DISPLAY_MODE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, + /** + * @brief Defines the width of the scrollbar. + * 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: width of the scrollbar, in vp. The default value is 4. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].f32: width of the scrollbar, in vp. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 20 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); + * auto nodeScrollBarWidth = item->value[0].f32; + * @endcode + * + */ + NODE_SCROLL_BAR_WIDTH, + /** + * @brief Defines the color of the scrollbar. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .data[0].u32: color of the scrollbar, in 0xARGB format. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .data[0].u32: color of the scrollbar, in 0xARGB format. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); + * auto nodeScrollBarColor = item->value[0].u32; + * @endcode + * + */ + NODE_SCROLL_BAR_COLOR, + /** + * @brief Defines the scroll direction. 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: scroll direction. The parameter type is {@link ArkUI_Axis}. + * The default value is ARKUI_AXIS_VERTICAL. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: scroll direction. The parameter type is {@link ArkUI_Axis}. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); + * auto nodeScrollBarDirection = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_SCROLL_DIRECTION, + /** + * @brief Defines the effect used at the edges of the component when the boundary of the scrollable content is + * reached. 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: effect used at the edges of the component when the boundary of the scrollable content is reached. + * The parameter type is {@link ArkUI_EdgeEffect}. The default value is ARKUI_EDGE_EFFECT_NONE.\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. The default value is 1. \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 + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_EDGE_EFFECT_NONE }, { .i32 = 1 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); + * auto nodeScrollEdgeEffect = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_EDGE_EFFECT, + /** + * @brief Defines whether to support scroll gestures. When this attribute is set to false, scrolling by + * finger or mouse is not supported, but the scroll controller API is not affected. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to support scroll gestures. The default value is true. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to support scroll gestures. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); + * auto nodeScrollEnableScroll = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_ENABLE_SCROLL_INTERACTION, + /** + * @brief Defines the friction coefficient. It applies only to gestures in the scrolling area, and + * it affects only indirectly the scroll chaining during the inertial scrolling process. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: friction coefficient. + * The default value is 0.6 for non-wearable devices and 0.9 for wearable devices. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: friction coefficient. + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 0.6 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_FRICTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_FRICTION); + * auto nodeScrollFriction = item->value[0].f32; + * @endcode + * + */ + NODE_SCROLL_FRICTION, + /** + * @brief Defines the scroll snapping 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: alignment mode for the scroll snap position. The parameter type is {@link ArkUI_ScrollSnapAlign}. + * The default value is ARKUI_SCROLL_SNAP_ALIGN_NONE.\n + * .value[1].i32: whether to enable the snap to start feature. When scroll snapping is defined for the + * component, setting this attribute to false enables the component to scroll between the + * start edge and the first snap point. The default value is true. + * t is valid only when there are multiple snap points.\n + * .value[2].i32: Whether to enable the snap to end feature. When scroll snapping is defined for the + * component, setting this attribute to false enables the component to scroll between the + * end edge and the last snap point. The default value is true. + * It is valid only when there are multiple snap points.\n + * .value[3...].f32: snap points for the component. + * Each snap point defines the offset from an edge to which the component can scroll. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].i32: alignment mode for the scroll snap position. The parameter type is {@link ArkUI_ScrollSnapAlign}.\n + * .value[1].i32: whether to enable the snap to start feature. When scroll snapping is defined for the + * component, setting this attribute to false enables the component to scroll between the + * start edge and the first snap point.\n + * .value[2].i32: Whether to enable the snap to end feature. When scroll snapping is defined for the + * component, setting this attribute to false enables the component to scroll between the + * end edge and the last snap point.\n + * .value[3...].f32: snap points for the component. Each snap point defines the offset from + * an edge to which the component can scroll. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { + * { .i32=ARKUI_SCROLL_SNAP_ALIGN_NONE }, { .i32=true }, { .i32=true }, + * { .f32=0 }, { .f32=500 }, { .f32=1000 }, { .f32=1500 } + * }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SNAP, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SNAP); + * auto nodeScrollSnap = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_SNAP, + + /** + * @brief Defines the nested scrolling options. + * 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: nested scrolling option when the component scrolls forward. + * The parameter type is {@link ArkUI_ScrollNestedMode}. \n + * .value[1]? .i32: nested scrolling option when the component scrolls backward. + * The parameter type is {@link ArkUI_ScrollNestedMode}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0]? .i32: nested scrolling option when the component scrolls forward. + * The parameter type is {@link ArkUI_ScrollNestedMode}. \n + * .value[1]? .i32: nested scrolling option when the component scrolls backward. + * The parameter type is {@link ArkUI_ScrollNestedMode}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY }, + * { .i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL); + * auto first = item->value[0].i32; + * auto second = item->value[1].i32; + * @endcode + * + */ + NODE_SCROLL_NESTED_SCROLL, + /** + * @brief Defines the specified position to scroll to. + * 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: horizontal scrolling offset, in vp. \n + * .value[1].f32: vertical scrolling offset, in vp. \n + * .value[2]? .i32: scrolling duration, in milliseconds. Optional. \n + *.value[3]? .i32: scrolling curve. Optional. The parameter type is {@link ArkUI_AnimationCurve}. + * The default value is ARKUI_CURVE_EASE. \n + * .value[4]? .i32: whether to enable the default spring animation. Optional. + * The default value 0 means not to enable the default spring animation. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: horizontal scrolling offset, in vp. \n + * .value[1].f32: vertical scrolling offset, in vp. \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10, 100, { .i32 = 1000 }, { .i32 = ARKUI_CURVE_EASE }, { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_OFFSET, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_OFFSET); + * auto x = item->value[0].f32; + * auto y = item->value[1].f32; + * @endcode + * + */ + NODE_SCROLL_OFFSET, + + /** + * @brief Defines the edge position to scroll to. + * 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: edge position to scroll to. The parameter type is {@link ArkUI_ScrollEdge}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: edge position to scroll to. The parameter type is {@link ArkUI_ScrollEdge}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_EDGE_TOP } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_EDGE, + + /** + * @brief Defines whether to enable the swipe-to-turn-pages feature. + * This attribute can be set, reset, and obtained as required through APIs. + * + * If both enablePaging and scrollSnap are set, scrollSnap takes effect, + * but enablePaging does not. \n + * \n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to enable the swipe-to-turn-pages feature. The default value is false. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable the swipe-to-turn-pages feature. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = true } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); + * auto nodeScrollEnablePaging = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_ENABLE_PAGING, + + /** + * @brief Defines the direction in which the list items are arranged. + * 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: direction in which the list items are arranged. The parameter type is {@link ArkUI_Axis}. + * The default value is ARKUI_AXIS_VERTICAL. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: direction in which the list items are arranged. The parameter type is {@link ArkUI_Axis}. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_DIRECTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_DIRECTION); + * auto nodeListDirection = item->value[0].i32; + * @endcode + * + */ + NODE_LIST_DIRECTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST, + /** + * @brief Defines whether to pin the header to the top or the footer to the bottom in 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: whether to pin the header to the top or the footer to the bottom in the + * component. It is used together with the component. The parameter type is + * {@link ArkUI_StickyStyle}. The default value is ARKUI_STICKY_STYLE_NONE. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to pin the header to the top or the footer to the bottom in the + * component. It is used together with the component. The parameter type is + * {@link ArkUI_StickyStyle}. + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_STICKY_STYLE_NONE } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_STICKY, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_STICKY); + * auto nodeListSticky = item->value[0].i32; + * @endcode + * + */ + NODE_LIST_STICKY, + /** + * @brief Defines the spacing between list items. + * 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: spacing between list items along the main axis. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: spacing between list items along the main axis. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_SPACE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_SPACE); + * auto nodeListSpace = item->value[0].f32; + * @endcode + * + */ + NODE_LIST_SPACE, + + /** + * @brief Defines whether to enable loop playback for the swiper. + * 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 loop playback. The value 1 means to enable loop playback, + * and 0 means the opposite. The default value is 1/b>. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable loop playback. The value 1 means to enable loop playback, and + * 0 means the opposite. The default value is 1. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { {.i32 = 0} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_LOOP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_LOOP); + * auto nodeSwiperLoop = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_LOOP = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SWIPER, + /** + * @brief Defines whether to enable automatic playback for child component switching in the swiper. + * 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 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 + * 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 + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY); + * auto nodeSwiperAutoPlay = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_AUTO_PLAY, + /** + * @brief Defines whether to enable the navigation point indicator for the swiper. + * 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 the navigation point indicator. The value 1 means to + * enable the navigation point indicator, and 0 means the opposite. The default value is 1. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable the navigation point indicator. The value 1 means to + * enable the navigation point indicator, and 0 means the opposite. The default value is 1. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 0} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR); + * auto nodeSwiperShowIndicator = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_SHOW_INDICATOR, + /** + * @brief Defines the interval for automatic playback. + * 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: interval for automatic playback, in milliseconds. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: interval for automatic playback, in milliseconds. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 3000 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INTERVAL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_INTERVAL); + * auto nodeSwiperInterval = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_INTERVAL, + /** + * @brief Defines whether vertical swiping is used for the swiper. + * 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 vertical swiping is used. The value 1 means that vertical swiping is used, + * and 0 means the opposite. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether vertical swiping is used. The value 1 means that vertical swiping is used, + * and 0 means the opposite. The default value is 0. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_VERTICAL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_VERTICAL); + * auto nodeSwiperVertical = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_VERTICAL, + + /** + * @brief Defines the duration of the animation for switching child components. + * 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: duration of the animation for switching child components, in milliseconds. + * The default value is 400. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: duration of the animation for switching child components, in milliseconds. + * The default value is 400. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10000 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DURATION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DURATION); + * auto nodeSwiperDuration = item->value[0].f32; + * @endcode + * + */ + NODE_SWIPER_DURATION, + + /** + * @brief Defines the animation curve for the swiper. + * 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: animation curve. The parameter type is {@link ArkUI_AnimationCurve}. + * The default value is ARKUI_CURVE_LINEAR. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: animation curve. The parameter type is {@link ArkUI_AnimationCurve}. + * The default value is ARKUI_CURVE_LINEAR. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_CURVE_SHARP} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_CURVE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_CURVE); + * auto nodeSwiperCurve = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_CURVE, + + /** + * @brief Defines the spacing between child components in the swiper. + * 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: spacing between child components. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: spacing between child components. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { 10 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperItemSpace = item->value[0].f32; + * @endcode + * + */ + NODE_SWIPER_ITEM_SPACE, + + /** + * @brief Defines the index of the child component currently displayed in the swiper. + * 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 + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {i32 = 3} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INDEX, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperIndex = item->value[0].i32; + * @endcode + * + */ + 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: number of elements to display per page. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: number of elements to display per page. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {i32 = 3} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISPLAY_COUNT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperDisplayCount = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_DISPLAY_COUNT, + + /** + * @brief Defines whether to disable the swipe feature. + * 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 disable the swipe feature. The value 1 means to disable the swipe feature, + * and 0 means the opposite. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to disable the swipe feature. The value 1 means to disable the swipe feature, + * and 0 means the opposite. The default value is 0. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE); + * auto nodeSwiperDisableSwipe = item->value[0].i32; + * @endcode + * + */ + 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 + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SWIPER_ARROW_SHOW_ON_HOVER} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW); + * auto nodeSwiperShowDisplayArrow = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_SHOW_DISPLAY_ARROW, + + /** + * @brief Defines the header of the list item group. + * 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_NodeHandle} object to be used as the header of the list item group. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object: {@link ArkUI_NodeHandle} object to be used as the header of the list item group. \n + * + * @code {.cpp} + * auto header = nodeAPI->createNode(ARKUI_NODE_TEXT); + * ArkUI_AttributeItem item = { .object = header }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); + * auto nodeListItemGroupSetHeader = item->object; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_HEADER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST_ITEM_GROUP, + /** + * @brief Defines the footer of the list item group. + * 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_NodeHandle} object to be used as the footer of the list item group. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object: {@link ArkUI_NodeHandle} object to be used as the footer of the list item group. \n + * + * @code {.cpp} + * auto footer = nodeAPI->createNode(ARKUI_NODE_TEXT); + * ArkUI_AttributeItem item = { .object = footer }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); + * auto nodeListItemGroupSetFooter = item->value[0].object; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_FOOTER, + /** + * @brief Defines the style of the divider for the list items. + * 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 divider, in 0xARGB format.\n + * .value[1].f32: stroke width of the divider, in vp.\n + * .value[2].f32: distance between the divider and the start of the list, in vp.\n + * .value[3].f32: distance between the divider and the end of the list, in vp.\n \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color of the divider, in 0xARGB format.\n + * .value[1].f32: stroke width of the divider, in vp.\n + * .value[2].f32: distance between the divider and the start of the list, in vp.\n + * .value[3].f32: distance between the divider and the end of the list, in vp.\n \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF }, 1, 0, 0 }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * auto nodeListItemDividerColor = item->value[0].u32; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_DIVIDER, + /** + * @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, +∞). 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 + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 16.0f }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); + * auto borderRadius = item->value[0].f32; + * @endcode + */ + NODE_CALENDAR_PICKER_HINT_RADIUS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + /** + * @brief Defines the date of the selected item in 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[1].u32: selected year. \n + * .value[2].u32: selected month. \n + * .value[3].u32: selected day. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[1].u32: selected year. \n + * .value[2].u32: selected month. \n + * .value[3].u32: selected day. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED); + * auto selectYear = item->value[0].u32; + * @endcode + */ + NODE_CALENDAR_PICKER_SELECTED, + /** + * @brief Defines how the calendar picker is aligned with the entry 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: alignment mode. The parameter type is {@link ArkUI_CalendarAlignment}. \n + * .value[1]? .f32: offset of the picker relative to the entry component along the x-axis after alignment + * based on the specified alignment mode. \n + * .value[2]? .f32: offset of the picker relative to the entry component along the y-axis after alignment + * based on the specified alignment mode. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: alignment mode. The parameter type is {@link ArkUI_CalendarAlignment}. \n + * .value[1]? .f32: offset of the picker relative to the entry component along the x-axis after alignment + * based on the specified alignment mode. \n + * .value[2]? .f32: offset of the picker relative to the entry component along the y-axis after alignment + * based on the specified alignment mode. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGN_END) }, 10.0f, 0.0f }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGN, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGN); + * auto alignType = item->value[0].i32; + * @endcode + */ + NODE_CALENDAR_PICKER_EDGE_ALIGN, + /** + * @brief Defines the font color, font size, and font weight in the entry area of the calendar picker. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0]? .u32: font color of the entry area. \n + * .value[1]? .f32: font size of the entry area, in fp. \n + * .value[2]? .i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0]? .u32: font color of the entry area. \n + * .value[1]? .f32: font size of the entry area, in fp. \n + * .value[2]? .i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = + * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); + * auto textColor = item->value[0].u32; + * @endcode + */ + NODE_CALENDAR_PICKER_TEXT_STYLE, +} ArkUI_NodeAttributeType; + +#define MAX_COMPONENT_EVENT_ARG_NUM 12 +/** + * @brief Defines the parameter type of the component callback event. + * + * @since 12 + */ +typedef struct { + /** Data array object. */ + ArkUI_NumberValue data[MAX_COMPONENT_EVENT_ARG_NUM]; +} ArkUI_NodeComponentEvent; + +/** + * @brief Defines the string type parameter used by the component callback event. + * + * @since 12 + */ +typedef struct { + /** String. */ + const char* pStr; +} ArkUI_StringAsyncEvent; + +/** + * @brief Enumerates the event types supported by the NativeNode component. + * + * @since 12 + */ +typedef enum { + /** + * @brief Defines the gesture event type. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_TouchEvent}. + */ + NODE_TOUCH_EVENT = 0, + + /** + * @brief Defines the mount event. + * + * This event is triggered when the component is mounted and displayed. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. + */ + NODE_EVENT_ON_APPEAR, + + /** + * @brief Defines the area change event. + * + * The area change event is triggered when the component's size, position, or any other attribute that may affect + * its display area changes. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object + * is {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains 12 parameters:\n + * ArkUI_NodeComponentEvent.data[0].f32: original width of the target element, in vp. + * The value type is number. \n + * ArkUI_NodeComponentEvent.data[1].f32: original height of the target element, in vp. + * The value type is number. \n + * ArkUI_NodeComponentEvent.data[2].f32: original X coordinate of the target element's upper left corner + * relative to the parent element's, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[3].f32: original Y coordinate of the target element's upper left corner + * relative to the parent element's, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[4].f32: original X coordinate of the target element's upper left corner + * relative to the page's, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[5].f32: original Y coordinate of the target element's upper left corner + * relative to the page's, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[6].f32: new width of the target element, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[7].f32: new height of the target element, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[8].f32: new X coordinate of the target element's upper left corner + * relative to the parent element's, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[9].f32: new Y coordinate of the target element's upper left corner + * relative to the parent element's, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[10].f32: new X coordinate of the target element's upper left corner + * relative to the page's, in vp. The value type is number.\n + * ArkUI_NodeComponentEvent.data[11].f32: new Y coordinate of the target element's upper left corner + * relative to the page's, in vp. The value type is number.\n + */ + NODE_EVENT_ON_AREA_CHANGE, + /** + * @brief Defines the focus event. + * + * This event is triggered when the component obtains the focus. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. + */ + NODE_ON_FOCUS, + /** + * @brief Defines the blur event. + * + * This event is triggered when the component loses the focus. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. + */ + NODE_ON_BLUR, + /** + * @brief Defines the click event. + * + * This event is triggered when the component is clicked. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains 12 parameters:\n + * ArkUI_NodeComponentEvent.data[0].f32: X coordinate of the click relative to the upper left corner of the + * clicked component's original area, in vp. \n + * ArkUI_NodeComponentEvent.data[1].f32: Y coordinate of the click relative to the upper left corner of the + * clicked component's original area, in vp. \n + * ArkUI_NodeComponentEvent.data[2].f32: event timestamp. It is the interval between the time when the event + * is triggered and the time when the system starts, in microseconds. \n + * ArkUI_NodeComponentEvent.data[3].i32: event input device. The value 1 indicates the mouse, 2 + * indicates the touchscreen, and 4 indicates the key. \n + * ArkUI_NodeComponentEvent.data[4].f32: X coordinate of the click relative to the upper left corner of the + * application window, in vp. \n + * ArkUI_NodeComponentEvent.data[5].f32: Y coordinate of the click relative to the upper left corner of the + * application window, in vp. \n + * ArkUI_NodeComponentEvent.data[6].f32: X coordinate of the click relative to the upper left corner of the + * application screen, in vp. \n + * ArkUI_NodeComponentEvent.data[7].f32: Y coordinate of the click relative to the upper left corner of the + * application screen, in vp. \n + */ + NODE_ON_CLICK, + /** + * @brief Defines the image loading success event. + * + * This event is triggered when an image is successfully loaded or decoded. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains nine parameters:\n + * ArkUI_NodeComponentEvent.data[0].i32: loading status. The value 0 indicates that the image is + * loaded successfully, and the value 1 indicates that the image is decoded successfully. \n + * ArkUI_NodeComponentEvent.data[1].f32: width of the image, in px. \n + * ArkUI_NodeComponentEvent.data[2].f32: height of the image, in px. \n + * ArkUI_NodeComponentEvent.data[3].f32: width of the component, in px. \n + * ArkUI_NodeComponentEvent.data[4].f32: height of the component, in px. \n + * ArkUI_NodeComponentEvent.data[5].f32: offset of the rendered content relative to the component on + * the x-axis, in px. \n + * ArkUI_NodeComponentEvent.data[6].f32: offset of the rendered content relative to the component on + * the y-axis, in px. \n + * ArkUI_NodeComponentEvent.data[7].f32: actual rendered width of the image, in px. \n + * ArkUI_NodeComponentEvent.data[8].f32: actual rendered height of the image, in px. \n + */ + NODE_IMAGE_ON_COMPLETE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, + /** + * @brief Defines the image loading failure event. + * + * This event is triggered when an error occurs during image loading.\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].i32error code:\n + * 401: The image could not be obtained because the image path is invalid.\n + * 103101: The image format is not supported. \n + */ + NODE_IMAGE_ON_ERROR, + /** + * @brief Defines the SVG animation playback completion event. + * + * This event is triggered when the animation playback in the loaded SVG image is complete.\n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}.\n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. + */ + NODE_IMAGE_ON_SVG_PLAY_FINISH, + /** + * @brief Defines the event triggered when the toggle status changes.\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: toggle status. 1: on; 0: off. + * + */ + NODE_TOGGLE_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, + + NODE_TEXT_INPUT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, + NODE_TEXT_INPUT_ON_SUBMIT, + NODE_TEXT_INPUT_ON_CUT, + NODE_TEXT_INPUT_ON_PASTE, + + NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, + + NODE_REFRESH_STATE_CHANGE = 1000 * ARKUI_NODE_REFRESH + 1, + NODE_REFRESH_ON_REFRESH, + + /** + * @brief Defines the event triggered when a date is selected in the ARKUI_NODE_DATE_PICKER 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: year of the selected date. \n + * ArkUI_NodeComponentEvent.data[1].i32: month of the selected date. Value range: [0-11].\n + * ArkUI_NodeComponentEvent.data[2].i32: day of the selected date. \n + */ + NODE_DATE_PICKER_EVENT_ON_DATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_DATE_PICKER, + + /** + * @brief Defines the event triggered when a time is selected in the ARKUI_NODE_TIME_PICKER 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 two parameters:\n + * ArkUI_NodeComponentEvent.data[0].i32: hour of the selected time. Value range: [0-23]. \n + * ArkUI_NodeComponentEvent.data[1].i32: minute of the selected time. Value range: [0-59]. \n + */ + NODE_TIME_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TIME_PICKER, + + /** + * @brief Defines the event triggered when an item is selected in the ARKUI_NODE_TEXT_PICKER 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 one parameter:\n + * ArkUI_NodeComponentEvent.data[0...11].i32: value of the selected item. \n + */ + NODE_TEXT_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, + + /** + * @brief Defines the event triggered when the selected status of the ARKUI_NODE_CHECKBOX component changes. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * ArkUI_NodeComponentEvent.data[0].i321: selected; 0: not selected.\n + */ + NODE_CHECKBOX_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, + /** + * @brief Defines the event triggered when the ARKUI_NODE_SLIDER component is dragged or clicked. + * + * 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].f32: current slider value. \n + * ArkUI_NodeComponentEvent.data[1].i32: state triggered by the event.\n + */ + NODE_SLIDER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, + + /** + * @brief Defines the event triggered when the ARKUI_NODE_SCROLL component scrolls. + * + * Notes for triggering the event:\n + * 1. This event is triggered when scrolling is started by the ARKUI_NODE_SCROLL component or other input + * settings, such as keyboard and mouse operations. \n + * 2. Scrolling can be initiated by calling the controller API. \n + * 3. The out-of-bounds bounce effect is supported. \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].f32: horizontal scrolling offset. \n + * ArkUI_NodeComponentEvent.data[1].f32: vertical scrolling offset. \n + */ + NODE_SCROLL_EVENT_ON_SCROLL = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, + /** + * @brief Defines the event triggered when each frame scrolling starts in the ARKUI_NODE_SCROLL component. + * + * Notes for triggering the event:\n + * 1. This event is triggered when scrolling is started by the ARKUI_NODE_SCROLL component or other input + * settings, such as keyboard and mouse operations. \n + * 2. This event is not triggered when the controller API is called. \n + * 3. This event does not support the out-of-bounds bounce effect. \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].f32: amount to scroll by. \n + * ArkUI_NodeComponentEvent.data[1].i32: current scrolling state. \n + * ::ArkUI_NodeComponentEvent contains one return value:\n + * ArkUI_NodeComponentEvent.data[0].f32: The event handler can work out the amount by which the component + * needs to scroll based on the real-world situation and return the result in this parameter. \n + */ + NODE_SCROLL_EVENT_ON_SCROLL_FRAME_BEGIN, + /** + * @brief Defines the event triggered when scrolling starts in the ARKUI_NODE_SCROLL component. + * + * Notes for triggering the event:\n + * 1. This event is triggered when scrolling is started, with support for other input settings, such as keyboard + * and mouse operations. \n + * 2. This event is triggered when the controller API is called, accompanied by a transition animation. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. \n + */ + NODE_SCROLL_EVENT_ON_SCROLL_START, + /** + * @brief Defines the event triggered when scrolling of the ARKUI_NODE_SCROLL component stops. + * + * Notes for triggering the event:\n + * 1. This event is triggered when scrolling is stopped by the ARKUI_NODE_SCROLL component or other input + * settings, such as keyboard and mouse operations. \n + * 2. This event is triggered when the controller API is called, accompanied by a transition animation. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. \n + */ + NODE_SCROLL_EVENT_ON_SCROLL_STOP, + /** + * @brief Defines the event triggered when scrolling of the ARKUI_NODE_SCROLL component + * reaches one of the edges. + * + * Notes for triggering the event:\n + * 1. This event is triggered when scrolling reaches the edge after being started by the ARKUI_NODE_SCROLL + * component or other input settings, such as keyboard and mouse operations. \n + * 2. Scrolling can be initiated by calling the controller API. \n + * 3. The out-of-bounds bounce effect is supported. \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: edge (top, bottom, left, or right) that the scrolling reaches. \n + */ + NODE_SCROLL_EVENT_ON_SCROLL_EDGE, + /** + * @brief Defines the event triggered when a date is selected in the NODE_CALENDAR_PICKER. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * ArkUI_NodeComponent.data[0].u32: year of the selected date. \n + * ArkUI_NodeComponent.data[1].u32: month of the selected date. \n + * ArkUI_NodeComponent.data[2].u32: day of the selected date. \n + */ + NODE_CALENDAR_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, +} ArkUI_NodeEventType; + +/** + * @brief Defines the common structure type of a component event. + * + * @since 12 + */ +typedef struct { + /** + * @brief Enumerates the event types. + * + * @see ArkUI_NodeEventType + */ + int32_t kind; + + /** + * @brief Defines the custom ID of the event. + * + * The event ID is passed as a parameter in {@link registerNodeEvent} and can be applied to the dispatch logic + * of the same event entry function {@link registerNodeEventReceiver}. + */ + int32_t eventId; + + /** Component object that triggers the event. */ + ArkUI_NodeHandle node; + union { + /** Callback parameter of the touch event type. */ + ArkUI_NodeTouchEvent touchEvent; + /** The universal component event uses callback parameters of the number type. */ + ArkUI_NodeComponentEvent componentEvent; + /** The universal component event uses callback parameters of the string type. */ + ArkUI_StringAsyncEvent stringEvent; + }; +} ArkUI_NodeEvent; + +/** + * @brief Defines the dirty area flag passed in the ::markDirty API. + * + * @since 12 + */ +typedef enum { + /** + * @brief Remeasure. + * + * When this type of flag is specified, re-layout is triggered by default. + */ + NODE_NEED_MEASURE = 1, + + /** Re-layout. */ + NODE_NEED_LAYOUT, + /** Re-rendering. */ + NODE_NEED_RENDER, +} ArkUI_NodeDirtyFlag; + +/** + * @brief Declares a collection of native node APIs provided by ArkUI. + * + * @version 1 + * @since 12 + */ +typedef struct { + /** Struct version. */ + int32_t version; + + /** + * @brief Creates a component based on {@link ArkUI_NodeType} and returns the pointer to the created component. + * + * @param type Indicates the type of component to create. + * @return Returns the pointer to the created component. If the component fails to be created, NULL is returned. + */ + ArkUI_NodeHandle (*createNode)(ArkUI_NodeType type); + + /** + * @brief Destroys the component to which the specified pointer points. + * + * @param node Indicates the pointer. + */ + void (*disposeNode)(ArkUI_NodeHandle node); + + /** + * @brief Adds a component to a parent node. + * + * @param parent Indicates the pointer to the parent node. + * @param child Indicates the pointer to the child node. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*addChild)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child); + + /** + * @brief Removes a component from its parent node. + * + * @param parent Indicates the pointer to the parent node. + * @param child Indicates the pointer to the child node. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*removeChild)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child); + + /** + * @brief Inserts a component to a parent node after the specified sibling node. + * + * @param parent Indicates the pointer to the parent node. + * @param child Indicates the pointer to the child node. + * @param sibling Indicates the pointer to the sibling node after which the target node is to be inserted. + * If the value is null, the node is inserted at the start of the parent node. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*insertChildAfter)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, ArkUI_NodeHandle sibling); + + /** + * @brief Inserts a component to a parent node before the specified sibling node. + * + * @param parent Indicates the pointer to the parent node. + * @param child Indicates the pointer to the child node. + * @param sibling Indicates the pointer to the sibling node before which the target node is to be inserted. + * If the value is null, the node is inserted at the end of the parent node. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*insertChildBefore)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, ArkUI_NodeHandle sibling); + + /** + * @brief Inserts a component to the specified position in a parent node. + * + * @param parent Indicates the pointer to the parent node. + * @param child Indicates the pointer to the child node. + * @param position Indicates the position to which the target child node is to be inserted. + * If the value is a negative number or invalid, the node is inserted at the end of the parent node. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*insertChildAt)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, int32_t position); + + /** + * @brief Sets the attribute of a node. + * + * @param node Indicates the node whose attribute needs to be set. + * @param attribute Indicates the type of attribute to set. + * @param value Indicates the attribute value. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * Returns 106102 if the dynamic implementation library of the native API was not found. + */ + int32_t (*setAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute, const ArkUI_AttributeItem* item); + + /** + * @brief Obtains an attribute. + * + * The pointer returned by this API is an internal buffer pointer of the ArkUI framework. + * As such, you do not need to call delete to release the memory. However, the pointer must be used before + * this API is called next time. Otherwise, the pointer may be overwritten by other values. + * + * @param node Indicates the node whose attribute needs to be obtained. + * @param attribute Indicates the type of attribute to obtain. + * @return Returns the attribute value. If the operation fails, a null pointer is returned. + */ + const ArkUI_AttributeItem* (*getAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute); + + /** + * @brief Resets an attribute. + * + * @param node Indicates the node whose attribute needs to be reset. + * @param attribute Indicates the type of attribute to reset. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * Returns 106102 if the dynamic implementation library of the native API was not found. + */ + int32_t (*resetAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute); + + /** + * @brief Registers an event for the specified node. + * + * @param node Indicates the target node. + * @param eventType Indicates the type of event to register. + * @param eventId Indicates the custom event ID, which is passed in the callback of <@link ArkUI_NodeEvent> + * when the event is triggered. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * Returns 106102 if the dynamic implementation library of the native API was not found. + */ + int32_t (*registerNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, int32_t eventId); + + /** + * @brief Unregisters an event for the specified node. + * + * @param node Indicates the target node. + * @param eventType Indicates the type of event to unregister. + */ + void (*unregisterNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType); + + /** + * @brief Registers an event receiver. + * + * The ArkUI framework collects component events generated during the process and calls back the events through + * the registered event receiver. \n + * A new call to this API will overwrite the previously registered event receiver. + * + * @param eventReceiver Indicates the event receiver to register. + */ + void (*registerNodeEventReceiver)(void (*eventReceiver)(ArkUI_NodeEvent* event)); + + /** + * @brief Unregisters the event receiver. + * + */ + void (*unregisterNodeEventReceiver)(); + + /** + * @brief Forcibly marks the current node that needs to be measured, laid out, or rendered again. + * + * Regarding updates to system attributes, the ArkUI framework automatically marks the dirty area and performs + * measuring, layout, or rendering again. In this case, you do not need to call this API. + * + * @param node Indicates the node for which you want to mark as dirty area. + * @param dirtyFlag Indicates type of dirty area. + */ + void (*markDirty)(ArkUI_NodeHandle node, ArkUI_NodeDirtyFlag dirtyFlag); +} ArkUI_NativeNodeAPI_1; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_NODE_H +/** @}*/ diff --git a/en/native_sdk/ace/native_type.h b/en/native_sdk/ace/native_type.h new file mode 100644 index 00000000..752f0b75 --- /dev/null +++ b/en/native_sdk/ace/native_type.h @@ -0,0 +1,1111 @@ +/* + * 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 UI capabilities of ArkUI on the native side, such as UI component creation and destruction, + * tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_type.h + * + * @brief Defines the common types for the native module. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_TYPE_H +#define ARKUI_NATIVE_TYPE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines the ArkUI native component object. + * + * @since 12 + */ +struct ArkUI_Node; + +/** + * @brief Defines the pointer to the ArkUI native component object. + * + * @since 12 + */ +typedef struct ArkUI_Node* ArkUI_NodeHandle; + +/** + * @brief Provides the number types of ArkUI in the native code. + * + * @since 12 + */ +typedef union { + /** Floating-point type. */ + float f32; + /** Signed integer. */ + int32_t i32; + /** Unsigned integer. */ + uint32_t u32; +} ArkUI_NumberValue; + +/** + * @brief Enumerates the alignment modes. + * + * @since 12 + */ +typedef enum { + /** Top start. */ + ARKUI_ALIGNMENT_TOP_START = 0, + /** Top center. */ + ARKUI_ALIGNMENT_TOP, + /** Top end. */ + ARKUI_ALIGNMENT_TOP_END, + /** Vertically centered start. */ + ARKUI_ALIGNMENT_START, + /** Horizontally and vertically centered. */ + ARKUI_ALIGNMENT_CENTER, + /** Vertically centered end. */ + ARKUI_ALIGNMENT_END, + /** Bottom start. */ + ARKUI_ALIGNMENT_BOTTOM_START, + /** Horizontally centered on the bottom. */ + ARKUI_ALIGNMENT_BOTTOM, + /** Bottom end. */ + ARKUI_ALIGNMENT_BOTTOM_END, +} ArkUI_Alignment; + +/** + * @brief Enumerates the image repeat patterns. + * + * @since 12 + */ +typedef enum { + /** The image is not repeatedly drawn. */ + ARKUI_IMAGE_REPEAT_NONE = 0, + /** The image is repeatedly drawn only along the horizontal axis. */ + ARKUI_IMAGE_REPEAT_X, + /** The image is repeatedly drawn only along the vertical axis. */ + ARKUI_IMAGE_REPEAT_Y, + /** The image is repeatedly drawn along both axes. */ + ARKUI_IMAGE_REPEAT_XY, +} ArkUI_ImageRepeat; + +/** + * @brief Enumerates the font styles. + * + * @since 12 + */ +typedef enum { + /** Standard font style. */ + ARKUI_FONT_STYLE_NORMAL = 0, + /** Italic font style. */ + ARKUI_FONT_STYLE_ITALIC +} ArkUI_FontStyle; + +/** + * @brief Enumerates the font weights. + * + * @since 12 + */ +typedef enum { + /** 100 */ + ARKUI_FONT_WEIGHT_W100 = 0, + /** 200 */ + ARKUI_FONT_WEIGHT_W200, + /** 300 */ + ARKUI_FONT_WEIGHT_W300, + /** 400 */ + ARKUI_FONT_WEIGHT_W400, + /** 500 */ + ARKUI_FONT_WEIGHT_W500, + /** 600 */ + ARKUI_FONT_WEIGHT_W600, + /** 700 */ + ARKUI_FONT_WEIGHT_W700, + /** 800 */ + ARKUI_FONT_WEIGHT_W800, + /** 900 */ + ARKUI_FONT_WEIGHT_W900, + /** The font weight is bold. */ + ARKUI_FONT_WEIGHT_BOLD, + /** The font weight is normal. */ + ARKUI_FONT_WEIGHT_NORMAL, + /** The font weight is bolder. */ + ARKUI_FONT_WEIGHT_BOLDER, + /** The font weight is lighter. */ + ARKUI_FONT_WEIGHT_LIGHTER, + /** The font weight is medium. */ + ARKUI_FONT_WEIGHT_MEDIUM, + /** The font weight is normal. */ + ARKUI_FONT_WEIGHT_REGULAR, +} ArkUI_FontWeight; + +/** + * @brief Enumerates the text alignment mode. + * + * @since 12 + */ +typedef enum { + /** Aligned with the start. */ + ARKUI_TEXT_ALIGNMENT_START = 0, + /** Horizontally centered. */ + ARKUI_TEXT_ALIGNMENT_CENTER, + /** Aligned with the end. */ + ARKUI_TEXT_ALIGNMENT_END, + /** Aligned with both margins. */ + ARKUI_TEXT_ALIGNMENT_JUSTIFY, +} ArkUI_TextAlignment; + +/** + * @brief Enumerates the types of the Enter key for a single-line text box. + * + * @since 12 + */ +typedef enum { + /** The Enter key is labeled "Go." */ + ARKUI_ENTER_KEY_TYPE_GO = 2, + /** The Enter key is labeled "Search." */ + ARKUI_ENTER_KEY_TYPE_SEARCH = 3, + /** The Enter key is labeled "Send." */ + ARKUI_ENTER_KEY_TYPE_SEND, + /** The Enter key is labeled "Next." */ + ARKUI_ENTER_KEY_TYPE_NEXT, + /** The Enter key is labeled "Done." */ + ARKUI_ENTER_KEY_TYPE_DONE, + /** The Enter key is labeled "Previous." */ + ARKUI_ENTER_KEY_TYPE_PREVIOUS, + /** The Enter key is labeled "New Line." */ + ARKUI_ENTER_KEY_TYPE_NEW_LINE, +} ArkUI_EnterKeyType; + +/** + * @brief Enumerates the text input types. + * + * @since 12 + */ +typedef enum { + /** Normal input mode. */ + ARKUI_TEXTINPUT_TYPE_NORMAL = 0, + /** Number input mode. */ + ARKUI_TEXTINPUT_TYPE_NUMBER = 2, + /** Phone number input mode. */ + ARKUI_TEXTINPUT_TYPE_PHONE_NUMBER = 3, + /** Email address input mode. */ + ARKUI_TEXTINPUT_TYPE_EMAIL = 5, + /** Password input mode. */ + ARKUI_TEXTINPUT_TYPE_PASSWORD = 7, + /** Numeric password input mode. */ + ARKUI_TEXTINPUT_TYPE_NUMBER_PASSWORD = 8, + /** Lock screen password input mode. */ + ARKUI_TEXTINPUT_TYPE_SCREEN_LOCK_PASSWORD = 9, + /** Username input mode. */ + ARKUI_TEXTINPUT_TYPE_USER_NAME = 10, + /** New password input mode. */ + ARKUI_TEXTINPUT_TYPE_NEW_PASSWORD = 11, + /** Number input mode with a decimal point. */ + ARKUI_TEXTINPUT_TYPE_NUMBER_DECIMAL = 12, +} ArkUI_TextInputType; + +/** + * @brief Enumerates the styles of the Cancel button. + * + * @since 12 + */ +typedef enum { + /** The Cancel button is always displayed. */ + ARKUI_CANCELBUTTON_STYLE_CONSTANT = 0, + /** The Cancel button is always hidden. */ + ARKUI_CANCELBUTTON_STYLE_INVISIBLE, + /** The Cancel button is displayed when there is text input. */ + ARKUI_CANCELBUTTON_STYLE_INPUT, +} ArkUI_CancelButtonStyle; + +/** + * @brief Enumerates the types of the component. + * + * @since 12 + */ +typedef enum { + /** The custom content of EGL/OpenGL ES and media data is displayed individually on the screen. */ + ARKUI_XCOMPONENT_TYPE_SURFACE = 0, + /** The custom content of EGL/OpenGL ES and media data is grouped and displayed together with content + * of the component. + */ + ARKUI_XCOMPONENT_TYPE_TEXTURE = 2, +} ArkUI_XComponentType; + +/** + * @brief Enumerates the styles of the progress indicator. + * + * @since 12 + */ +typedef enum { + /** Linear style. */ + ARKUI_PROGRESS_LINEAR = 0, + /** Indeterminate ring style. */ + ARKUI_PROGRESS_RING, + /** Eclipse style. */ + ARKUI_PROGRESS_ECLIPSE, + /** Determinate ring style. */ + ARKUI_PROGRESS_SCALERING, + /** Capsule style. */ + ARKUI_PROGRESS_CAPSULE, +}ArkUI_ProgressType; + +typedef enum { + /** No text decoration. */ + ARKUI_TEXT_DECORATION_TYPE_NONE = 0, + /** Line under the text. */ + ARKUI_TEXT_DECORATION_TYPE_UNDERLINE, + /** Line over the text. */ + ARKUI_TEXT_DECORATION_TYPE_OVERLINE, + /** Line through the text. */ + ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH, +} ArkUI_TextDecorationType; + +typedef enum { + /** The original case of the text is retained. */ + ARKUI_TEXT_CASE_NORMAL = 0, + /** All letters in the text are in lowercase. */ + ARKUI_TEXT_CASE_LOWER, + /** All letters in the text are in uppercase. */ + ARKUI_TEXT_CASE_UPPER, +} ArkUI_TextCase; + +typedef enum { + /** Copy is not allowed. */ + ARKUI_COPY_OPTIONS_NONE = 0, + /** Intra-application copy is allowed. */ + ARKUI_COPY_OPTIONS_IN_APP, + /** Intra-device copy is allowed. */ + ARKUI_COPY_OPTIONS_LOCAL_DEVICE, + /** Cross-device copy is allowed. */ + ARKUI_COPY_OPTIONS_CROSS_DEVICE, +} ArkUI_CopyOptions; + +typedef enum { + /** Color. */ + ARKUI_SHADOW_TYPE_COLOR = 0, + /** Blur. */ + ARKUI_SHADOW_TYPE_BLUR +} ArkUI_ShadowType; + +/** + * @brief Enumerates the types of the text picker. + * + * @since 12 + */ +typedef enum { + /** Single-column text picker. */ + ARKUI_TEXTPICKER_RANGETYPE_SINGLE = 0, + /** Multi-column text picker. */ + ARKUI_TEXTPICKER_RANGETYPE_MULTI, + /** Single-column text picker with image resources. */ + ARKUI_TEXTPICKER_RANGETYPE_RANGE_C0NTENT, + /** Interconnected multi-column text picker. */ + ARKUI_TEXTPICKER_RANGETYPE_CASCADE_RANGE_CONTENT, +} ArkUI_TextPickerRangeType; + +/** + * @brief Defines the input structure of the single-column text picker with image resources. + * + * @since 12 + */ +typedef struct { + /** Image resource. */ + const char* icon; + /** Text information. */ + const char* text; +} ARKUI_TextPickerRangeContent; + +/** + * @brief Defines the input structure of the interconnected multi-column text picker. + * + * @since 12 + */ +typedef struct { + /** Text information. */ + const char* text; + /** Interconnected data. */ + const ARKUI_TextPickerRangeContent* children; + /** Size of the interconnected data array. */ + int32_t size; +} ARKUI_TextPickerCascadeRangeContent; + +/** + * @brief Enumerates the effects used at the edges of the component when the boundary of the + * scrollable content is reached. + * + * @since 12 + */ +typedef enum { + /** Spring effect. When at one of the edges, the component can move beyond the bounds based on the + * initial speed or through touches, and produces a bounce effect when the user releases their finger. + */ + ARKUI_EDGE_EFFECT_SPRING = 0, + /** Fade effect. When at one of the edges, the component produces a fade effect. */ + ARKUI_EDGE_EFFECT_FADE, + /** No effect after the scrollbar is moved to the edge. */ + ARKUI_EDGE_EFFECT_NONE, +} ArkUI_EdgeEffect; + +/** + * @brief Enumerates the alignment modes of list items when scrolling ends. + * + * @since 12 + */ +typedef enum { + /** No alignment. This is the default value. */ + ARKUI_SCROLL_SNAP_ALIGN_NONE = 0, + /** The first item in the view is aligned at the start of the list. */ + ARKUI_SCROLL_SNAP_ALIGN_START, + /** The middle items in the view are aligned in the center of the list. */ + ARKUI_SCROLL_SNAP_ALIGN_CENTER, + /** The last item in the view is aligned at the end of the list. */ + ARKUI_SCROLL_SNAP_ALIGN_END, +} ArkUI_ScrollSnapAlign; + +/** + * @brief Enumerates the scrollbar display modes. + * + * @since 12 + */ +typedef enum { + /** Hide. */ + ARKUI_SCROLL_BAR_DISPLAY_MODE_OFF = 0, + /** Display on demand (displays when the screen is touched and disappears after 2s). */ + ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO, + /** Always display. */ + ARKUI_SCROLL_BAR_DISPLAY_MODE_ON, +} ArkUI_ScrollBarDisplayMode; + +/** + * @brief Enumerates the scroll directions. + * + * @since 12 + */ +typedef enum { + /** Only vertical scrolling is supported. */ + ARKUI_AXIS_VERTICAL = 0, + /** Only horizontal scrolling is supported. */ + ARKUI_AXIS_HORIZONTAL, +} ArkUI_Axis; + +/** + * @brief Enumerates the modes for pinning the header to the top or the footer to the bottom. + * + * @since 12 + */ +typedef enum { + /** In the list item group, the header is not pinned to the top, and the footer is not pinned to the bottom. */ + ARKUI_STICKY_STYLE_NONE = 0, + /** In the list item group, the header is pinned to the top, and the footer is not pinned to the bottom. */ + ARKUI_STICKY_STYLE_HEADER = 1, + /** In the list item group, the footer is pinned to the bottom, and the header is not pinned to the top. */ + ARKUI_STICKY_STYLE_FOOTER = 2, + /** In the list item group, the footer is pinned to the bottom, and the header is pinned to the top. */ + ARKUI_STICKY_STYLE_BOTH = 3, +} ArkUI_StickyStyle; + + +/** + * @brief Enumerates the border styles. + * + * @since 12 + */ +typedef enum { + /** Solid border. */ + ARKUI_BORDER_STYLE_SOLID = 0, + /** Dashed border. */ + ARKUI_BORDER_STYLE_DASHED, + /** Dotted border. */ + ARKUI_BORDER_STYLE_DOTTED, +} ArkUI_BorderStyle; + +/** + * @brief Enumerates the hit test modes. + * + * @since 12 + */ +typedef enum { + /** Both the node and its child node respond to the hit test of a touch event, + * but its sibling node is blocked from the hit test. + */ + ARKUI_HIT_TEST_MODE_DEFAULT = 0, + /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from + * the hit test. + */ + ARKUI_HIT_TEST_MODE_BLOCK, + /** Both the node and its child node respond to the hit test of a touch event, and its sibling node is also + * considered during the hit test. + */ + ARKUI_HIT_TEST_MODE_TRANSPARENT, + /** The node does not respond to the hit test of a touch event. */ + ARKUI_HIT_TEST_MODE_NONE +} ArkUI_HitTestMode; + +/** + * @brief Enumerates the shadow styles. + * + * @since 12 + */ +typedef enum { + /** Mini shadow. */ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS = 0, + /** Little shadow. */ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM, + /** Medium shadow. */ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD, + /** Large shadow. */ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG, + /** Floating small shadow. */ + ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM, + /** Floating medium shadow. */ + ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD, +} ArkUI_ShadowStyle; + +/** + * @brief Enumerates the animation curves. + * + * @since 12 + */ +typedef enum { + /** The animation speed keeps unchanged. */ + ARKUI_CURVE_LINEAR = 0, + /** The animation starts slowly, accelerates, and then slows down towards the end. */ + ARKUI_CURVE_EASE, + /** The animation starts at a low speed and then picks up speed until the end. */ + ARKUI_CURVE_EASE_IN, + /** The animation ends at a low speed. */ + ARKUI_CURVE_EASE_OUT, + /** The animation starts and ends at a low speed. */ + ARKUI_CURVE_EASE_IN_OUT, + /** The animation uses the standard curve */ + ARKUI_CURVE_FAST_OUT_SLOW_IN, + /** The animation uses the deceleration curve. */ + ARKUI_CURVE_LINEAR_OUT_SLOW_IN, + /** The animation uses the acceleration curve. */ + ARKUI_CURVE_FAST_OUT_LINEAR_IN, + /** The animation uses the extreme deceleration curve. */ + ARKUI_CURVE_EXTREME_DECELERATION, + /** The animation uses the sharp curve. */ + ARKUI_CURVE_SHARP, + /** The animation uses the rhythm curve. */ + ARKUI_CURVE_RHYTHM, + /** The animation uses the smooth curve. */ + ARKUI_CURVE_SMOOTH, + /** The animation uses the friction curve */ + ARKUI_CURVE_FRICTION, +} ArkUI_AnimationCurve; + +/** + * @brief Enumerates arrow styles of the navigation point indicator. + * + * @since 12 + */ +typedef enum { + /** The arrow is not displayed for the navigation point indicator. */ + ARKUI_SWIPER_ARROW_HIDE = 0, + /** The arrow is displayed for the navigation point indicator. */ + ARKUI_SWIPER_ARROW_SHOW, + /** The arrow is displayed only when the mouse pointer hovers over the navigation point indicator. */ + ARKUI_SWIPER_ARROW_SHOW_ON_HOVER, +} ArkUI_SwiperArrow; + + +/** + * @brief Defines the accessibility level. + * + * @since 12 + */ +typedef enum { + /** The value can be changed to yes or no based on the component. */ + ARKUI_ACCESSIBILITY_LEVEL_AUTO = 0, + /** The component can be identified by the accessibility service. */ + ARKUI_ACCESSIBILITY_LEVEL_YES, + /** The component cannot be identified by the accessibility service. */ + ARKUI_ACCESSIBILITY_LEVEL_NO, + /** The component and all its child components cannot be identified by the accessibility service. */ + ARKUI_ACCESSIBILITY_LEVEL_NO_HIDE_DESCENDANTS, +} ArkUI_AccessibilityLevel; + +/** + * @brief Defines whether copy and paste is allowed for text content. + * + * @since 12 + */ +typedef enum { + /** Copy is not allowed. */ + ARKUI_TEXT_COPY_OPTIONS_NONE = 0, + /** Intra-application copy is allowed. */ + ARKUI_TEXT_COPY_OPTIONS_IN_APP, + /** Intra-device copy is allowed. */ + ARKUI_TEXT_COPY_OPTIONS_LOCAL_DEVICE, + /** Cross-device copy is allowed. */ + ARKUI_TEXT_COPY_OPTIONS_CROSS_DEVICE, +} ArkUI_TextCopyOptions; + + +/** + * @brief Defines how the adaptive height is determined for the text. + * + * @since 12 + */ +typedef enum { + /** Prioritize the maxLines settings. */ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST = 0, + /** Prioritize the minFontSize settings. */ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MIN_FONT_SIZE_FIRST, + /** Prioritize the layout constraint settings in terms of height. */ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_LAYOUT_CONSTRAINT_FIRST, +} ArkUI_TextHeightAdaptivePolicy; + + +/** + * @brief Defines nested scrolling options. + * + * @since 12 + */ +typedef enum { + /** The scrolling is contained within the component, and no scroll chaining occurs, that is, the parent component + * does not scroll when the component scrolling reaches the boundary. */ + ARKUI_SCROLL_NESTED_MODE_SELF_ONLY = 0, + /** The component scrolls first, and when it hits the boundary, the parent component scrolls. + * When the parent component hits the boundary, its edge effect is displayed. If no edge effect is specified for + * the parent component, the edge effect of the child component is displayed instead. + */ + ARKUI_SCROLL_NESTED_MODE_SELF_FIRST, + /** The parent component scrolls first, and when it hits the boundary, the component scrolls. + * When the component hits the boundary, its edge effect is displayed. If no edge effect is specified for the + * component, the edge effect of the parent component is displayed instead. + */ + ARKUI_SCROLL_NESTED_MODE_PARENT_FIRST, + /** The component and its parent component scroll at the same time. When both the component and its parent component + * hit the boundary, the edge effect of the component is displayed. If no edge effect is specified for the + * component, the edge effect of the parent component is displayed instead. + */ + ARKUI_SCROLL_NESTED_MODE_PARALLEL, +} ArkUI_ScrollNestedMode; + + +/** + * @brief Defines the edge to which the component scrolls. + * + * @since 12 + */ +typedef enum { + /** Top edge in the vertical direction. */ + ARKUI_SCROLL_EDGE_TOP = 0, + /** Center position in the vertical direction. */ + ARKUI_SCROLL_EDGE_CENTER, + /** Bottom edge in the vertical direction. */ + ARKUI_SCROLL_EDGE_BOTTOM, + /** Text baseline position in the cross axis direction. */ + ARKUI_SCROLL_EDGE_BASELINE, + /** Start position in the horizontal direction. */ + ARKUI_SCROLL_EDGE_START, + /** Center position in the horizontal direction. */ + ARKUI_SCROLL_EDGE_MIDDLE, + /** End position in the horizontal direction. */ + ARKUI_SCROLL_EDGE_END, +} ArkUI_ScrollEdge; + +/** + * @brief Enumerates the types of the slider in the block direction. + * + * @since 12 + */ +typedef enum { + /** Round slider. */ + ARKUI_SLIDER_BLOCK_STYLE_DEFAULT = 0, + /** Slider with an image background. */ + ARKUI_SLIDER_BLOCK_STYLE_IMAGE, + /** Slider in a custom shape. */ + ARKUI_SLIDER_BLOCK_STYLE_SHAPE, +} ArkUI_SliderBlockStyle; + +/** + * @brief Enumerates the scroll directions of the slider. + * + * @since 12 + */ +typedef enum { + /** Vertical direction. */ + ARKUI_SLIDER_DIRECTION_VERTICAL = 0, + /** Horizontal direction. */ + ARKUI_SLIDER_DIRECTION_HORIZONTAL, +} ArkUI_SliderDirection; + +/** + * @brief Enumerates the slider styles. + * + * @since 12 + */ +typedef enum { + /** The slider is on the slider track. */ + ARKUI_SLIDER_STYLE_OUT_SET = 0, + /** The slider is in the slider track. */ + ARKUI_SLIDER_STYLE_IN_SET, +} ArkUI_SliderStyle; + +/** + * @brief Enumerates the shapes of the check box + * + * @since 12 + */ +typedef enum { + /** Circle. */ + ArkUI_CHECKBOX_SHAPE_CIRCLE = 0, + /** Rounded square. */ + ArkUI_CHECKBOX_SHAPE_ROUNDED_SQUARE, +} ArkUI_CheckboxShape; + +/** + * @brief Enumerates the animation playback modes. + * + * @since 12 + */ +typedef enum { + /** The animation is played forwards. */ + ARKUI_ANIMATION_PLAY_MODE_NORMAL = 0, + /** The animation is played reversely. */ + ARKUI_ANIMATION_PLAY_MODE_REVERSE, + /** The animation is played normally for an odd number of times (1, 3, 5...) and reversely for an even number of + * times (2, 4, 6...). + */ + ARKUI_ANIMATION_PLAY_MODE_ALTERNATE, + /** The animation is played reversely for an odd number of times (1, 3, 5...) and normally for an even number of + * times (2, 4, 6...). + */ + ARKUI_ANIMATION_PLAY_MODE_ALTERNATE_REVERSE, +} ArkUI_AnimationPlayMode; + +/** + * @brief Defines the image size. + * + * @since 12 + */ +typedef enum { + /** The original image aspect ratio is retained. */ + ARKUI_IMAGE_SIZE_AUTO = 0, + /** Default value. The image is scaled with its aspect ratio retained for both sides to be greater than or equal to + * the display boundaries. */ + ARKUI_IMAGE_SIZE_COVER, + /** The image is scaled with its aspect ratio retained for the content to be completely displayed within the + * display boundaries. */ + ARKUI_IMAGE_SIZE_CONTAIN, +} ArkUI_ImageSize; + +/** + * @brief Enumerates the adaptive color modes. + * + * @since 12 + */ +typedef enum { + /** Adaptive color mode is not used. */ + ARKUI_ADAPTIVE_COLOR_DEFAULT = 0, + /** Adaptive color mode is used. */ + ARKUI_ADAPTIVE_COLOR_AVERAGE, +} ArkUI_AdaptiveColor; + +/** + * @brief Enumerates the color modes. + * + * @since 12 + */ +typedef enum { + /** Following the system color mode. */ + ARKUI_COLOR_MODE_SYSTEM = 0, + /** Light color mode. */ + ARKUI_COLOR_MODE_LIGHT, + /** Dark color mode. */ + ARKUI_COLOR_MODE_DARK, +} ArkUI_ColorMode; + +/** + * @brief Enumerates the blur styles. + * + * @since 12 + */ +typedef enum { + /** Thin material. */ + ARKUI_BLUR_STYLE_THIN = 0, + /** Regular material. */ + ARKUI_BLUR_STYLE_REGULAR, + /** Thick material. */ + ARKUI_BLUR_STYLE_THICK, + /** Material that creates the minimum depth of field effect. */ + ARKUI_BLUR_STYLE_BACKGROUND_THIN, + /** Material that creates a medium shallow depth of field effect. */ + ARKUI_BLUR_STYLE_BACKGROUND_REGULAR, + /** Material that creates a high shallow depth of field effect. */ + ARKUI_BLUR_STYLE_BACKGROUND_THICK, + /** Material that creates the maximum depth of field effect. */ + ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK, + /** No blur. */ + ARKUI_BLUR_STYLE_NONE, + /** Component ultra-thin material. */ + ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN, + /** Component thin material. */ + ARKUI_BLUR_STYLE_COMPONENT_THIN, + /** Component regular material. */ + ARKUI_BLUR_STYLE_COMPONENT_REGULAR, + /** Component thick material. */ + ARKUI_BLUR_STYLE_COMPONENT_THICK, + /** Component ultra-thick material. */ + ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK, +} ArkUI_BlurStyle; + +/** + * @brief Enumerates the vertical alignment modes. + * + * @since 12 + */ +typedef enum { + /** Top aligned. */ + ARKUI_VERTICAL_ALIGNMENT_TOP = 0, + /** Center aligned. This is the default alignment mode. */ + ARKUI_VERTICAL_ALIGNMENT_CENTER, + /** Bottom aligned. */ + ARKUI_VERTICAL_ALIGNMENT_BOTTOM, +} ArkUI_VerticalAlignment; + +/** + * @brief Enumerates the alignment mode in the horizontal direction. + * + * @since 12 + */ +typedef enum { + /** Aligned with the start edge in the same direction as the language in use. */ + ARKUI_HORIZONTAL_ALIGNMENT_START = 0, + /** Center aligned. This is the default alignment mode. */ + ARKUI_HORIZONTAL_ALIGNMENT_CENTER, + /** Aligned with the end edge in the same direction as the language in use. */ + ARKUI_HORIZONTAL_ALIGNMENT_END, +} ArkUI_HorizontalAlignment; + +/** + * @brief Enumerates the display modes when the text is too long. + * + * @since 12 + */ +typedef enum { + /** Extra-long text is not clipped. */ + ARKUI_TEXT_OVERFLOW_NONE = 0, + /** Extra-long text is clipped. */ + ARKUI_TEXT_OVERFLOW_CLIP, + /** An ellipsis (...) is used to represent text overflow. */ + ARKUI_TEXT_OVERFLOW_ELLIPSIS, + /** Text continuously scrolls when text overflow occurs. */ + ARKUI_TEXT_OVERFLOW_MARQUEE, +} ArkUI_TextOverflow; + +/** + * @brief Enumerates the alignment mode of the image with the text. + * + * @since 12 + */ +typedef enum { + /** The image is bottom aligned with the text baseline. */ + ARKUI_IMAGE_SPAN_ALIGNMENT_BASELINE = 0, + /** The image is bottom aligned with the text. */ + ARKUI_IMAGE_SPAN_ALIGNMENT_BOTTOM, + /** The image is centered aligned with the text. */ + ARKUI_IMAGE_SPAN_ALIGNMENT_CENTER, + /** The image is top aligned with the text. */ + ARKUI_IMAGE_SPAN_ALIGNMENT_TOP, +} ArkUI_ImageSpanAlignment; + +/** + * @brief Defines how the image is resized to fit its container. + *ImageSpanAlignment + * @since 12 + */ +typedef enum { + /** The image is scaled with its aspect ratio retained for the content to be completely displayed within the + * display boundaries. + */ + ARKUI_OBJECT_FIT_CONTAIN = 0, + /** The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the + * display boundaries. + */ + ARKUI_OBJECT_FIT_COVER, + /** The image is scaled automatically to fit the display area. */ + ARKUI_OBJECT_FIT_AUTO, + /** The image is scaled to fill the display area, and its aspect ratio is not retained. */ + ARKUI_OBJECT_FIT_FILL, + /** The image content is displayed with its aspect ratio retained. The size is smaller than or equal to the + * original size. + */ + ARKUI_OBJECT_FIT_SCALE_DOWN, + /** The original size is retained. */ + ARKUI_OBJECT_FIT_NONE, +} ArkUI_ObjectFit; + +/** + * @brief Enumerates the image interpolation effect. + * + * @since 12 + */ +typedef enum { + /** No image interpolation. */ + ARKUI_IMAGE_INTERPOLATION_NONE = 0, + /** Low quality interpolation. */ + ARKUI_IMAGE_INTERPOLATION_LOW, + /** Medium quality interpolation. */ + ARKUI_IMAGE_INTERPOLATION_MEDIUM, + /** High quality interpolation. This mode produces scaled images of the highest possible quality. */ + ARKUI_IMAGE_INTERPOLATION_HIGH, +} ArkUI_ImageInterpolation; + + +/** + * @brief Enumerates the blend modes. + * + * @since 12 + */ +typedef enum { + /** The top image is superimposed on the bottom image without any blending. */ + ARKUI_BLEND_MODE_NONE = 0, + /** The target pixels covered by the source pixels are erased by being turned to completely transparent. */ + ARKUI_BLEND_MODE_CLEAR, + /** r = s: Only the source pixels are displayed. */ + ARKUI_BLEND_MODE_SRC, + /** r = d: Only the target pixels are displayed. */ + ARKUI_BLEND_MODE_DST, + /** r = s + (1 - sa) * d: The source pixels are blended based on opacity and cover the target pixels. */ + ARKUI_BLEND_MODE_SRC_OVER, + /** r = d + (1 - da) * s: The target pixels are blended based on opacity and cover on the source pixels. */ + ARKUI_BLEND_MODE_DST_OVER, + /** r = s * da: Only the part of the source pixels that overlap with the target pixels is displayed. */ + ARKUI_BLEND_MODE_SRC_IN, + /** r = d * sa: Only the part of the target pixels that overlap with the source pixels is displayed. */ + ARKUI_BLEND_MODE_DST_IN, + /** r = s * (1 - da): Only the part of the source pixels that do not overlap with the target pixels is displayed. */ + ARKUI_BLEND_MODE_SRC_OUT, + /** r = d * (1 - sa): Only the part of the target pixels that do not overlap with the source pixels is displayed. */ + ARKUI_BLEND_MODE_DST_OUT, + /** r = s * da + d * (1 - sa): The part of the source pixels that overlap with the target pixels is displayed and + * the part of the target pixels that do not overlap with the source pixels are displayed. + */ + ARKUI_BLEND_MODE_SRC_ATOP, + /** r = d * sa + s * (1 - da): The part of the target pixels that overlap with the source pixels and the part of + * the source pixels that do not overlap with the target pixels are displayed. + */ + ARKUI_BLEND_MODE_DST_ATOP, + /** r = s * (1 - da) + d * (1 - sa): Only the non-overlapping part between the source pixels and the target pixels + * is displayed. */ + ARKUI_BLEND_MODE_XOR, + /** r = min(s + d, 1): New pixels resulting from adding the source pixels to the target pixels are displayed. */ + ARKUI_BLEND_MODE_PLUS, + /** r = s * d: New pixels resulting from multiplying the source pixels with the target pixels are displayed. */ + ARKUI_BLEND_MODE_MODULATE, + /** r = s + d - s * d: Pixels are blended by adding the source pixels to the target pixels and subtracting the + * product of their multiplication. */ + ARKUI_BLEND_MODE_SCREEN, + /** The MULTIPLY or SCREEN mode is used based on the target pixels. */ + ARKUI_BLEND_MODE_OVERLAY, + /** rc = s + d - max(s * da, d * sa), ra = kSrcOver: When two colors overlap, whichever is darker is used. */ + ARKUI_BLEND_MODE_DARKEN, + /** rc = s + d - min(s * da, d * sa), ra = + kSrcOver: The final pixels are composed of the lightest values of pixels. */ + ARKUI_BLEND_MODE_LIGHTEN, + /** The colors of the target pixels are lightened to reflect the source pixels. */ + ARKUI_BLEND_MODE_COLOR_DODGE, + /** The colors of the target pixels are darkened to reflect the source pixels. */ + ARKUI_BLEND_MODE_COLOR_BURN, + /** The MULTIPLY or SCREEN mode is used, depending on the source pixels. */ + ARKUI_BLEND_MODE_HARD_LIGHT, + /** The LIGHTEN or DARKEN mode is used, depending on the source pixels. */ + ARKUI_BLEND_MODE_SOFT_LIGHT, + /** rc = s + d - 2 * (min(s * da, d * sa)), ra = kSrcOver: The final pixel is the result of subtracting the darker + * of the two pixels (source and target) from the lighter one. + */ + ARKUI_BLEND_MODE_DIFFERENCE, + /** rc = s + d - two(s * d), ra = kSrcOver: The final pixel is similar to DIFFERENCE, but with less contrast. + */ + ARKUI_BLEND_MODE_EXCLUSION, + /** r = s * (1 - da) + d * (1 - sa) + s * d: The final pixel is the result of multiplying the source pixel by + * the target pixel. + */ + ARKUI_BLEND_MODE_MULTIPLY, + /** The resultant image is created with the luminance and saturation of the source image and the hue of the + * target image. + */ + ARKUI_BLEND_MODE_HUE, + /** The resultant image is created with the luminance and hue of the target image and the saturation of the + * source image. + */ + ARKUI_BLEND_MODE_SATURATION, + /** The resultant image is created with the saturation and hue of the source image and the luminance of the + * target image. + */ + ARKUI_BLEND_MODE_COLOR, + /** The resultant image is created with the saturation and hue of the target image and the luminance of the + * source image. + */ + ARKUI_BLEND_MODE_LUMINOSITY, +} ArkUI_BlendMode; + +/** + * @brief Enumerates the modes in which components are laid out along the main axis of the container. + * + * @since 12 + */ +typedef enum { + /** Components are arranged from left to right. */ + ARKUI_DIRECTION_LTR = 0, + /** Components are arranged from right to left. */ + ARKUI_DIRECTION_RTL, + /** The default layout direction is used. */ + ARKUI_DIRECTION_AUTO = 3, +} ArkUI_Direction; + +/** + * @brief Enumerates the modes in which components are laid out along the cross axis of the container. + * + * @since 12 + */ +typedef enum { + /** The default configuration in the container is used. */ + ARKUI_ITEM_ALIGN_AUTO = 0, + /** The items in the container are aligned with the cross-start edge. */ + ARKUI_ITEM_ALIGN_START, + /** The items in the container are centered along the cross axis. */ + ARKUI_ITEM_ALIGN_CENTER, + /** The items in the container are aligned with the cross-end edge. */ + ARKUI_ITEM_ALIGN_END, + /** The items in the container are stretched and padded along the cross axis. */ + ARKUI_ITEM_ALIGN_STRETCH, + /** The items in the container are aligned in such a manner that their text baselines are aligned along the + * cross axis. */ + ARKUI_ITEM_ALIGN_BASELINE, +} ArkUI_ItemAlign; + +/** + * @brief Enumerates the foreground colors. + * + * @since 12 + */ +typedef enum { + /** The foreground colors are the inverse of the component background colors. */ + ARKUI_COLOR_STRATEGY_INVERT = 0, + /** The shadow colors of the component are the average color obtained from the component background shadow area. */ + ARKUI_COLOR_STRATEGY_AVERAGE, + /** The shadow colors of the component are the primary color obtained from the component background shadow area. */ + ARKUI_COLOR_STRATEGY_PRIMARY, +} ArkUI_ColorStrategy; + +/** + * @brief Enumerates the vertical alignment modes. + * + * @since 12 + */ +typedef enum { + /** The child components are aligned with the start edge of the main axis. */ + ARKUI_FLEX_ALIGN_START = 1, + /** The child components are aligned in the center of the main axis. */ + ARKUI_FLEX_ALIGN_CENTER = 2, + /** The child components are aligned with the end edge of the main axis. */ + ARKUI_FLEX_ALIGN_END = 3, + /** The child components are evenly distributed along the main axis. The space between any two adjacent components + * is the same. The first component is aligned with the main-start, and the last component is aligned with the + * main-end. + */ + ARKUI_FLEX_ALIGN_SPACE_BETWEEN = 6, + /** The child components are evenly distributed along the main axis. The space between any two adjacent components + * is the same. The space between the first component and main-start, and that between the last component and + * cross-main are both half the size of the space between two adjacent components. */ + ARKUI_FLEX_ALIGN_SPACE_AROUND = 7, + /** The child components are evenly distributed along the main axis. The space between the first component and + * main-start, the space between the last component and main-end, and the space between any two adjacent components + * are the same. */ + ARKUI_FLEX_ALIGN_SPACE_EVENLY = 8, +} ArkUI_FlexAlign; + +/** + * @brief Enumerates the directions of the main axis in the flex container. + * + * @since 12 + */ +typedef enum { + /** The child components are arranged in the same direction as the main axis runs along the rows. */ + ARKUI_FLEX_DIRECTION_ROW = 0, + /** The child components are arranged in the same direction as the main axis runs down the columns. */ + ARKUI_FLEX_DIRECTION_COLUMN, + /** The child components are arranged opposite to the ROW direction. */ + ARKUI_FLEX_DIRECTION_ROW_REVERSE, + /** The child components are arranged opposite to the COLUMN direction. */ + ARKUI_FLEX_DIRECTION_COLUMN_REVERSE, +} ArkUI_FlexDirection; + +/** + * @brief Defines whether the flex container has a single line or multiple lines. + * + * @since 12 + */ +typedef enum { + /** The child components in the flex container are arranged in a single line, and they cannot overflow. */ + ARKUI_FLEX_WRAP_NO_WRAP = 0, + /** The child components in the flex container are arranged in multiple lines, and they may overflow. */ + ARKUI_FLEX_WRAP_WRAP, + /** The child components in the flex container are reversely arranged in multiple lines, and they may overflow. */ + ARKUI_FLEX_WRAP_WRAP_REVERSE, +} ArkUI_FlexWrap; + +/** + * @brief Enumerates the visibility values. + * + * @since 12 + */ +typedef enum { + /** The component is visible. */ + ARKUI_VISIBILITY_VISIBLE = 0, + /** The component is hidden, and a placeholder is used for it in the layout. */ + ARKUI_VISIBILITY_HIDDEN, + /** The component is hidden. It is not involved in the layout, and no placeholder is used for it. */ + ARKUI_VISIBILITY_NONE, +} ArkUI_Visibility; + +/** + * @brief Enumerates the alignment modes between the calendar picker and the entry component. + * + * @since 12 + */ +typedef enum { + /** Left aligned. */ + ARKUI_CALENDAR_ALIGNMENT_START = 0, + /** Center aligned. */ + ARKUI_CALENDAR_ALIGNMENT_CENTER, + /** Right aligned. */ + ARKUI_CALENDAR_ALIGNMENT_END, +} ArkUI_CalendarAlignment; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_TYPE_H +/** @} */ -- Gitee From e3c2ae1db0fdc2fb250d6775e10500c13a63c15e Mon Sep 17 00:00:00 2001 From: liu-binjun Date: Wed, 7 Feb 2024 15:56:05 +0800 Subject: [PATCH 0260/2135] bugfix Signed-off-by: liu-binjun --- .../hdi/location/agnss/v1_0/AGnssTypes.idl | 216 +++++++++++ .../location/agnss/v1_0/IAGnssCallback.idl | 78 ++++ .../location/agnss/v1_0/IAGnssInterface.idl | 92 +++++ .../location/geofence/v1_0/GeofenceTypes.idl | 123 ++++++ .../geofence/v1_0/IGeofenceCallback.idl | 89 +++++ .../geofence/v1_0/IGeofenceInterface.idl | 83 ++++ .../hdi/location/gnss/v1_0/GnssTypes.idl | 365 ++++++++++++++++++ .../hdi/location/gnss/v1_0/IGnssCallback.idl | 141 +++++++ .../hdi/location/gnss/v1_0/IGnssInterface.idl | 162 ++++++++ 9 files changed, 1349 insertions(+) create mode 100644 zh-cn/device_api/hdi/location/agnss/v1_0/AGnssTypes.idl create mode 100644 zh-cn/device_api/hdi/location/agnss/v1_0/IAGnssCallback.idl create mode 100644 zh-cn/device_api/hdi/location/agnss/v1_0/IAGnssInterface.idl create mode 100644 zh-cn/device_api/hdi/location/geofence/v1_0/GeofenceTypes.idl create mode 100644 zh-cn/device_api/hdi/location/geofence/v1_0/IGeofenceCallback.idl create mode 100644 zh-cn/device_api/hdi/location/geofence/v1_0/IGeofenceInterface.idl create mode 100644 zh-cn/device_api/hdi/location/gnss/v1_0/GnssTypes.idl create mode 100644 zh-cn/device_api/hdi/location/gnss/v1_0/IGnssCallback.idl create mode 100644 zh-cn/device_api/hdi/location/gnss/v1_0/IGnssInterface.idl diff --git a/zh-cn/device_api/hdi/location/agnss/v1_0/AGnssTypes.idl b/zh-cn/device_api/hdi/location/agnss/v1_0/AGnssTypes.idl new file mode 100644 index 00000000..9a48b5b1 --- /dev/null +++ b/zh-cn/device_api/hdi/location/agnss/v1_0/AGnssTypes.idl @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiAGnss + * @{ + * + * @brief AGNSS模块接口定义 + * + * 上层可以使用该模块提供的接口设置AGNSS回调、AGNSS服务器地址、AGNSS参考信息、setId等。 + * + * @since 3.2 + */ + +/* + * @file AGnssTypes.idl + * + * @brief 定义AGNSS模块接口中使用到的数据结构。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.agnss.v1_0; + +/* + * @brief 定义AGNSS参考信息类型。 + * + * @since 3.2 + */ +enum AGnssRefInfoType { + /* 小区ID */ + ANSS_REF_INFO_TYPE_CELLID = 1, + + /* MAC地址 */ + ANSS_REF_INFO_TYPE_MAC = 2, +}; + +/* + * @brief 定义AGNSS用户面的协议类型。 + * + * @since 3.2 + */ +enum AGnssUserPlaneProtocol { + /* SUPL类型 */ + AGNSS_TYPE_SUPL = 1, + + /* C2K类型 */ + AGNSS_TYPE_C2K = 2, + + /* IMS类型 */ + AGNSS_TYPE_SUPL_IMS = 3, + + /* EIMS类型 */ + AGNSS_TYPE_SUPL_EIMS = 4 +}; + +/* + * @brief 定义数据链路的操作类型。 + * + * @since 3.2 + */ +enum DataLinkSetUpType { + /* 请求建立数据业务连接。 */ + ESTABLISH_DATA_CONNECTION = 1, + + /* 请求释放数据业务连接。 */ + RELEASE_DATA_CONNECTION = 2 +}; + +/* + * @brief 定义cell id类型。 + * + * @since 3.2 + */ +enum CellIdType { + /* GSM小区 */ + CELLID_TYPE_GSM = 1, + + /* UMTS小区 */ + CELLID_TYPE_UMTS = 2, + + /* LTE小区 */ + CELLID_TYPE_LTE = 3, + + /* NR小区 */ + CELLID_TYPE_NR = 4, +}; + +/* + * @brief 定义setid类型。 + * + * @since 3.2 + */ +enum SubscriberSetIdType { + /* 未知类型 */ + SETID_TYPE_NONE = 0, + + /* IMSI类型 */ + SETID_TYPE_IMSI = 1, + + /* MSISDM类型 */ + SETID_TYPE_MSISDM = 2 +}; + +/* + * @brief 定义AGNSS参考信息中cellId的结构体。 + * + * @since 3.2 + */ +struct AGnssRefCellId { + /* 小区ID类型 */ + enum CellIdType type; + + /* 移动设备国家码 */ + unsigned short mcc; + + /* 移动设备网络码 */ + unsigned short mnc; + + /* 位置区域码 */ + unsigned short lac; + + /* 小区ID */ + unsigned int cid; + + /* 跟踪区域码 */ + unsigned short tac; + + /* 物理小区ID */ + unsigned short pcid; + + /* NR的小区ID */ + unsigned int nci; +}; + +/* + * @brief 定义AGNSS服务器信息结构体。 + * + * @since 3.2 + */ +struct AGnssServerInfo { + /* AGNSS用户面协议类型 */ + enum AGnssUserPlaneProtocol type; + + /* AGNSS服务器地址 */ + String server; + + /* AGNSS服务器端口 */ + int port; +}; + +/* + * @brief 定义setId结构体。 + * + * @since 3.2 + */ +struct SubscriberSetId { + /* setId类型 */ + enum SubscriberSetIdType type; + + /* setId字符串 */ + String id; +}; + +/* + * @brief 定义AGNSS参考信息中MAC的结构体。 + * + * @since 3.2 + */ +struct AGnssRefMac { + /* MAC地址 */ + unsigned char[] mac; +}; + +/* + * @brief 定义AGNSS参考信息结构体。 + * + * @since 3.2 + */ +struct AGnssRefInfo { + /* 参考信息类型 */ + enum AGnssRefInfoType type; + + /* 小区ID */ + struct AGnssRefCellId cellId; + + /* MAC地址 */ + struct AGnssRefMac mac; +}; + +/* + * @brief 定义操作数据业务连接请求的结构体。 + * + * @since 3.2 + */ +struct AGnssDataLinkRequest { + /* AGNSS用户面协议类型 */ + enum AGnssUserPlaneProtocol agnssType; + + /* 数据业务操作类型 */ + enum DataLinkSetUpType setUpType; +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/location/agnss/v1_0/IAGnssCallback.idl b/zh-cn/device_api/hdi/location/agnss/v1_0/IAGnssCallback.idl new file mode 100644 index 00000000..32e4f170 --- /dev/null +++ b/zh-cn/device_api/hdi/location/agnss/v1_0/IAGnssCallback.idl @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiAGnss + * @{ + * + * @brief 定义AGNSS模块的接口。 + * + * 上层可以使用该模块提供的接口设置AGNSS回调、AGNSS服务器地址、AGNSS参考信息、setId等。 + * + * @since 3.2 + */ + +/* + * @file IAGnssCallback.idl + * + * @brief 定义AGNSS回调,用于请求上层建立或释放数据业务连接、请求上层下发setId、请求上层下发AGNSS参考信息。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.agnss.v1_0; + +import ohos.hdi.location.agnss.v1_0.AGnssTypes; + +/* + * @brief 定义AGNSS回调,用于请求上层建立或释放数据业务连接、请求上层下发setId、请求上层下发AGNSS参考信息。 + * + * @since 3.2 + */ +[callback] interface IAGnssCallback { + /* + * @brief 该接口用于请求上层建立或者释放数据业务连接。 + * + * @param request 表示请求参数信息,详情参考{@link AGnssDataLinkRequest}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + RequestSetUpAgnssDataLink([in] struct AGnssDataLinkRequest request); + + /* + * @brief 请求上层注入setId。 + * + * @param type 表示setId类型,详情参考{@link SubscriberSetIdType}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + RequestSubscriberSetId([in] enum SubscriberSetIdType type); + + /* + * @brief 请求上层注入AGNSS参考信息。 + * + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + RequestAgnssRefInfo(); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/location/agnss/v1_0/IAGnssInterface.idl b/zh-cn/device_api/hdi/location/agnss/v1_0/IAGnssInterface.idl new file mode 100644 index 00000000..b07d9248 --- /dev/null +++ b/zh-cn/device_api/hdi/location/agnss/v1_0/IAGnssInterface.idl @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiAGnss + * @{ + * + * @brief 定义AGNSS模块接口。 + * + * 上层可以使用该模块提供的接口设置AGNSS回调、AGNSS服务器地址、AGNSS参考信息、setId等。 + * + * @since 3.2 + */ + +/* + * @file IAGnssInterface.idl + * + * @brief 定义AGNSS接口,用于设置AGNSS回调、AGNSS服务器地址、AGNSS参考信息和setId。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.agnss.v1_0; + +import ohos.hdi.location.agnss.v1_0.IAGnssCallback; +import ohos.hdi.location.agnss.v1_0.AGnssTypes; + +/* + * @brief 定义AGNSS接口,用于设置AGNSS回调、AGNSS服务器地址、AGNSS参考信息和setId。 + * + * @since 3.2 + */ +interface IAGnssInterface { + /* + * @brief 设置回调函数 + * + * @param callback 表示上层传入的回调函数,包含请求上层建立或释放数据业务连接,请求上层下发setId, + * 请求上层下发AGNSS参考信息等回调,详情参考{@link IAGnssCallback}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + SetAgnssCallback([in] IAGnssCallback callbackObj); + + /* + * @brief 设置AGNSS服务器信息。 + * + * @param server 表示AGNSS服务器信息。详情参考{@link AGnssServerInfo}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + SetAgnssServer([in] struct AGnssServerInfo server); + + /* + * @brief 注入参考信息。 + * + * @param refInfo 表示AGNSS参考信息。详情参考{@link AGnssRefInfo}. + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + SetAgnssRefInfo([in] struct AGnssRefInfo refInfo); + + /* + * @brief 设置setId。 + * + * @param id 表示setId,详情参考{@link SubscriberSetId}. + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + SetSubscriberSetId([in] struct SubscriberSetId id); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/location/geofence/v1_0/GeofenceTypes.idl b/zh-cn/device_api/hdi/location/geofence/v1_0/GeofenceTypes.idl new file mode 100644 index 00000000..4999b254 --- /dev/null +++ b/zh-cn/device_api/hdi/location/geofence/v1_0/GeofenceTypes.idl @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiGeofence + * @{ + * + * @brief 定义GNSS围栏接口。 + * + * GNSS上层服务可以使用本模块的接口来添加地理围栏,删除地理围栏,以及监视地理围栏状态的变化。 + * + * @since 3.2 + */ + +/* + * @file GeofenceTypes.idl + * + * @brief 定义地理围栏模块接口使用到的数据结构。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.geofence.v1_0; + +/* + * @brief 定义监控的地理围栏事件类型。 + * + * @since 3.2 + */ +enum GeofenceEvent { + /* 状态不确定 */ + GEOFENCE_EVENT_UNCERTAIN = 1, + + /* 进入围栏 */ + GEOFENCE_EVENT_ENTERED = 2, + + /* 退出围栏 */ + GEOFENCE_EVENT_EXITED = 4, +}; + +/* + * @brief 定义地理围栏操作的错误码。 + * + * @since 3.2 + */ +enum GeofenceOperateResult { + /* 操作成功 */ + OPERATION_SUCCESS = 0, + /* 未知错误 */ + OPERATION_ERROR_UNKNOWN = -100, + /* 围栏个数超过限制 */ + OPERATION_ERROR_TOO_MANY_GEOFENCES = -101, + /* 围栏ID重复 */ + OPERATION_ERROR_GEOFENCE_INDEX_EXISTS = -102, + /* 入参错误 */ + OPERATION_ERROR_PARAMS_INVALID = -103, +}; + +/* + * @brief 定义地理围栏的操作类型。 + * + * @since 3.2 + */ +enum GeofenceOperateType { + /* 添加围栏 */ + TYPE_ADD = 1, + /* 删除围栏 */ + TYPE_DELETE = 2, +}; + +/* + * @brief 定义地理围栏的参数。 + * + * @since 3.2 + */ +struct GeofenceInfo { + /* 围栏编号 */ + int fenceIndex; + /* 圆心纬度 */ + double latitude; + /* 圆心经度 */ + double longitude; + /* 半径 */ + double radius; +}; + +/* + * @brief 定义位置信息结构体。 + * + * @since 3.2 + */ +struct LocationInfo { + /* 纬度 */ + double latitude; + /* 经度 */ + double longitude; + /* 海拔 */ + double altitude; + /* 精确度 */ + float accuracy; + /* 速度 */ + float speed; + /* 方向 */ + double direction; + /* UTC时间戳 */ + long timeStamp; + /* 自开机起经过的时长 */ + long timeSinceBoot; +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/location/geofence/v1_0/IGeofenceCallback.idl b/zh-cn/device_api/hdi/location/geofence/v1_0/IGeofenceCallback.idl new file mode 100644 index 00000000..31222101 --- /dev/null +++ b/zh-cn/device_api/hdi/location/geofence/v1_0/IGeofenceCallback.idl @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiGeofence + * @{ + * + * @brief 定义地理围栏的接口。 + * + * 上层GNSS服务模块可以使用这个模块的接口来添加地理围栏,删除地理围栏,以及监视地理围栏状态的变化。 + * + * @since 3.2 + */ + +/* + * @file IGeofenceCallback.idl + * + * @brief 定义回调函数用于上报地理围栏服务是否可用、地理围栏事件、地理围栏操作结果等。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.geofence.v1_0; + +import ohos.hdi.location.geofence.v1_0.GeofenceTypes; + +/* + * @brief 定义回调函数用于上报地理围栏服务是否可用、地理围栏事件、地理围栏操作结果等。 + * + * @since 3.2 + */ +[callback] interface IGeofenceCallback { + /* + * @brief 上报地理围栏服务是否可用。 + * + * @param isAvailable 表示地理围栏是否可用。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportGeofenceAvailability([in] boolean isAvailable); + + /* + * @brief 用于上报地理围栏事件。 + * + * @param fenceIndex 表示地理围栏编号。 + * @param location 表示当前的位置,详情参考{@link Location}. + * @param event 表示当前发生的地理围栏事件,详情参考{@link GeofenceEvent}. + * @param timestamp 表示地理围栏事件发生的时刻。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportGeofenceEvent([in] int fenceIndex, + [in] struct LocationInfo location, + [in] enum GeofenceEvent event, + [in] long timestamp); + + /* + * @brief 上报围栏操作结果。 + * + * @param fenceIndex 表示地理围栏编号。 + * @param type 表示地理围栏操作类型。详情参考{@link GeofenceOperateType}。 + * @param result 表示地理围栏操作结果,详情参考{@link GeofenceOperateResult}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportGeofenceOperateResult([in] int fenceIndex, + [in] enum GeofenceOperateType type, + [in] enum GeofenceOperateResult result); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/location/geofence/v1_0/IGeofenceInterface.idl b/zh-cn/device_api/hdi/location/geofence/v1_0/IGeofenceInterface.idl new file mode 100644 index 00000000..5624a0e6 --- /dev/null +++ b/zh-cn/device_api/hdi/location/geofence/v1_0/IGeofenceInterface.idl @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiGeofence + * @{ + * + * @brief 定义GNSS地理围栏接口。 + * + * 上层GNSS服务模块可以使用这个模块的接口来添加地理围栏,删除地理围栏,以及监视地理围栏状态的变化。 + * + * @since 3.2 + */ + +/* + * @file IGeofenceInterface.idl + * + * @brief 定义接口用于添加围栏,删除围栏,设置围栏回调函数等。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.geofence.v1_0; + +import ohos.hdi.location.geofence.v1_0.IGeofenceCallback; +import ohos.hdi.location.geofence.v1_0.GeofenceTypes; + +/* + * @brief 定义接口用于添加围栏,删除围栏,设置围栏回调函数等。 + * + * @since 3.2 + */ +interface IGeofenceInterface { + /* + * @brief 设置地理围栏回调函数。 + * + * @param callback 表示地理围栏的回调函数,GNSS驱动使用此回调上报地理围栏服务可用性, + * 上报地理围栏事件,上报地理围栏操作结果。详情参考{@link IGeofenceCallback}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + SetGeofenceCallback([in] IGeofenceCallback callbackObj); + + /* + * @brief 添加一个地理围栏。 + * + * @param fence 表示地理围栏的参数。详情参考{@link GeofenceInfo}。 + * @param monitorEvent 表示APP想要监控的地理围栏事件。详情参考{@link GeofenceEvent}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + AddGnssGeofence([in] struct GeofenceInfo fence, + [in] enum GeofenceEvent monitorEvent); + + /* + * @brief 删除一个地理围栏。 + * + * @param fenceIndex 表示地理围栏的编号。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + DeleteGnssGeofence([in] int fenceIndex); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/location/gnss/v1_0/GnssTypes.idl b/zh-cn/device_api/hdi/location/gnss/v1_0/GnssTypes.idl new file mode 100644 index 00000000..4698d5c6 --- /dev/null +++ b/zh-cn/device_api/hdi/location/gnss/v1_0/GnssTypes.idl @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiGnss + * @{ + * + * @brief 定义GNSS模块的接口。 + * + * 上层GNSS服务可以获取一个GNSS驱动对象或代理,然后调用该对象或代理提供的api来访问GNSS设备, + * 从而实现启动GNSS芯片,启动导航,设置GNSS工作模式,注入参考信息,获取定位结果,获取nmea, + * 获取卫星状态信息,批量获取缓存位置信息等。 + * + * @since 3.2 + */ + +/* + * @file GnssTypes.idl + * + * @brief 定义GNSS模块接口中使用到的数据结构。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.gnss.v1_0; + +/* + * @brief 定义GNSS工作模式。 + * + * 定义GNSS工作模式的枚举值。 + * + * @since 3.2 + */ +enum GnssWorkingMode +{ + /* GNSS独立模式(无辅助) */ + GNSS_WORKING_MODE_STANDALONE = 1, + + /* 在移动设备端进行定位计算的模式 */ + GNSS_WORKING_MODE_MS_BASED = 2, + + /* 移动设备辅助模式,在网络侧完成定位计算 */ + GNSS_WORKING_MODE_MS_ASSISTED = 3 +}; + +/* + * @brief 定义GNSS启动方式。 + * + * 定义GNSS启动类型的枚举值,用于区分普通GNSS定位和GNSS缓存上报功能 + * (不立刻上报底层位置,仅当上层请求全部上报或者底层FIFO满后才上报位置)。 + * + * @since 3.2 + */ +enum GnssStartType { + /* 普通的GNSS功能 */ + GNSS_START_TYPE_NORMAL = 1, + /* GNSS缓存位置功能 */ + GNSS_START_TYPE_GNSS_CACHE = 2, +}; + +/* + * @brief 定义GNSS参考信息类型。 + * + * 参考信息包含参考时间、参考位置等。 + * + * @since 3.2 + */ +enum GnssRefInfoType { + /* 参考时间 */ + GNSS_REF_INFO_TIME = 1, + /* 参考位置 */ + GNSS_REF_INFO_LOCATION = 2, + /* 参考融合位置 */ + GNSS_REF_INFO_BEST_LOCATION = 3, +}; + +/* + * @brief 定义辅助数据类型。 + * + * @since 3.2 + */ +enum GnssAuxiliaryData { + /* 星历 */ + GNSS_AUXILIARY_DATA_EPHEMERIS = 1, + /* 历书 */ + GNSS_AUXILIARY_DATA_ALMANAC = 2, + /* 位置 */ + GNSS_AUXILIARY_DATA_POSITION = 4, + /* 时间 */ + GNSS_AUXILIARY_DATA_TIME = 8, + /* 电离层 */ + GNSS_AUXILIARY_DATA_IONO = 16, + /* UTC时间 */ + GNSS_AUXILIARY_DATA_UTC = 32, + /* 健康度 */ + GNSS_AUXILIARY_DATA_HEALTH = 64, + /* 方向 */ + GNSS_AUXILIARY_DATA_SVDIR = 128, + /* 方向角 */ + GNSS_AUXILIARY_DATA_SVSTEER = 256, + /* 辅助数据 */ + GNSS_AUXILIARY_DATA_SADATA = 512, + /* 差分数据 */ + GNSS_AUXILIARY_DATA_RTI = 1024, + /* cell数据库 */ + GNSS_AUXILIARY_DATA_CELLDB_INFO = 32768, + /* 所有辅助数据 */ + GNSS_AUXILIARY_DATA_ALL = 65535 +}; + +/* + * @brief 定义GNSS的工作状态。 + * + * @since 3.2 + */ +enum GnssWorkingStatus { + /* 未知状态 */ + GNSS_STATUS_NONE = 0, + + /* 导航启动 */ + GNSS_STATUS_SESSION_BEGIN = 1, + + /* 导航停止 */ + GNSS_STATUS_SESSION_END = 2, + + /* 芯片上电 */ + GNSS_STATUS_ENGINE_ON = 3, + + /* 芯片下电 */ + GNSS_STATUS_ENGINE_OFF = 4 +}; + +/* + * @brief 定义GNSS能力 + * + * @since 3.2 + */ +enum GnssCapabilities { + /* 支持MS-Based模式 */ + GNSS_CAP_SUPPORT_MSB = 1, + + /* 支持MS-Assisted模式 */ + GNSS_CAP_SUPPORT_MSA = 2, + + /* 支持地理围栏功能 */ + GNSS_CAP_SUPPORT_GEOFENCING = 4, + + /* 支持GNSS测量信息上报 */ + GNSS_CAP_SUPPORT_MEASUREMENTS = 8, + + /* 支持GNSS导航电文上报 */ + GNSS_CAP_SUPPORT_NAV_MESSAGES = 16, + + /* 支持GNSS缓存位置功能 */ + GNSS_CAP_SUPPORT_GNSS_CACHE = 32, +}; + +/* + * @brief 定义星座类型 + * + * @since 3.2 + */ +enum GnssConstellationType { + /* 未知 */ + GNSS_CONSTELLATION_UNKNOWN = 0, + + /* GPS */ + GNSS_CONSTELLATION_GPS = 1, + + /* SBAS */ + GNSS_CONSTELLATION_SBAS = 2, + + /* GLONASS */ + GNSS_CONSTELLATION_GLONASS = 3, + + /* QZSS */ + GNSS_CONSTELLATION_QZSS = 4, + + /* 北斗 */ + GNSS_CONSTELLATION_BEIDOU = 5, + + /* GALILEO */ + GNSS_CONSTELLATION_GALILEO = 6, + + /* IRNSS */ + GNSS_CONSTELLATION_IRNSS = 7, +}; + +/* + * @brief 定义卫星状态中的附加信息。 + * + * @since 3.2 + */ +enum SatellitesStatusFlag { + /* 默认值 */ + SATELLITES_STATUS_NONE = 0, + /* 有星历表数据 */ + SATELLITES_STATUS_HAS_EPHEMERIS_DATA = 1, + /* 有历书数据 */ + SATELLITES_STATUS_HAS_ALMANAC_DATA = 2, + /* 定位中有使用到 */ + SATELLITES_STATUS_USED_IN_FIX = 4, + /* 有载波频率 */ + SATELLITES_STATUS_HAS_CARRIER_FREQUENCY = 8 +}; + +/* + * @brief 定义卫星状态信息结构体。 + * + * @since 3.2 + */ +struct SatelliteStatusInfo { + /* 卫星个数 */ + unsigned int satellitesNumber; + + /* 卫星编号 */ + short[] satelliteIds; + + /* 星座类型 */ + enum GnssConstellationType[] constellation; + + /* 信噪比 */ + float[] carrierToNoiseDensitys; + + /* 卫星仰角 */ + float[] elevation; + + /* 方位角 */ + float[] azimuths; + + /* 跟踪信号的载波频率 */ + float[] carrierFrequencies; + + /* 卫星状态中的附加信息 */ + enum SatellitesStatusFlag flags; +}; + +/* + * @brief 定义基础的GNSS配置参数。 + * + * @since 3.2 + */ +struct GnssBasicConfig { + /* 位置上报间隔 */ + unsigned int minInterval; + + /* 期望的定位精度 */ + unsigned int accuracy; + + /* 期望的首定位耗时 */ + unsigned int firstFixTime; + + /* 是否周期性定位 */ + boolean isPeriodicPositioning; + + /* GNSS工作模式 */ + enum GnssWorkingMode gnssMode; +}; + +/* + * @brief 定义GNSS缓存功能的配置参数。 + * + * @since 3.2 + */ +struct GnssCachingConfig { + /* 缓存位置之间的时间间隔 */ + unsigned int interval; + + /* 如果为true,在FIFO满后唤醒AP并报告缓存的位置 */ + boolean fifoFullNotify; +}; + +/* + * @brief 定义GNSS配置参数结构体。 + * + * @since 3.2 + */ +struct GnssConfigPara { + /* GNSS基础配置参数 */ + struct GnssBasicConfig gnssBasic; + /* GNSS cache功能配置参数 */ + struct GnssCachingConfig gnssCaching; +}; + +/* + * @brief 定义GNSS参考时间结构体。 + * + * @since 3.2 + */ +struct GnssRefTime { + /* UTC时间 */ + long timeMs; + /* 自系统启动后经过的时间 */ + long timeReferenceMs; + /* 时间不确定度 */ + int uncertainty; +}; + +/* + * @brief 定义GNSS参考位置结构体。 + * + * @since 3.2 + */ +struct GnssRefLocation { + /* 纬度 */ + double latitude; + /* 经度 */ + double longitude; + /* 精确度 */ + float accuracy; +}; + +/* + * @brief 定义GNSS定位结果结构体。 + * + * @since 3.2 + */ +struct LocationInfo { + /* 纬度 */ + double latitude; + /* 经度 */ + double longitude; + /* 海拔 */ + double altitude; + /* 精确度 */ + float accuracy; + /* 速度 */ + float speed; + /* 方向 */ + double direction; + /* UTC时间戳 */ + long timeStamp; + /* 自系统启动后经过的时间 */ + long timeSinceBoot; +}; + +/* + * @brief 定义GNSS参考信息结构体。 + * + * @since 3.2 + */ +struct GnssRefInfo { + /* 参考信息类型 */ + enum GnssRefInfoType type; + /* 参考时间 */ + struct GnssRefTime time; + /* 参考位置 */ + struct GnssRefLocation location; + /* 参考融合位置 */ + struct LocationInfo best_location; +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/location/gnss/v1_0/IGnssCallback.idl b/zh-cn/device_api/hdi/location/gnss/v1_0/IGnssCallback.idl new file mode 100644 index 00000000..3cb5f57c --- /dev/null +++ b/zh-cn/device_api/hdi/location/gnss/v1_0/IGnssCallback.idl @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiGnss + * @{ + * + * @brief 定义GNSS模块的接口。 + * + * 上层GNSS服务可以获取GNSS驱动对象或代理,然后调用该对象或代理提供的API来访问GNSS设备, + * 从而实现启动GNSS芯片,启动导航,设置GNSS工作模式,注入参考信息,获取定位结果,获取nmea, + * 获取卫星状态信息,批量获取缓存位置信息等。 + * + * @since 3.2 + */ + +/* + * @file IGnssCallback.idl + * + * @brief 声明获取定位结果回调、获取GNSS模块工作状态回调、获取nmea回调、获取GNSS能力回调、 + * 获取卫星状态信息回调、批量获取缓存位置回调、请求上层注入参考信息回调、 + * 请求上层注入PGNSS数据回调。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.gnss.v1_0; + +import ohos.hdi.location.gnss.v1_0.GnssTypes; + +/* + * @brief 声明获取定位结果回调、获取GNSS模块工作状态回调、获取nmea回调、获取GNSS能力回调、 + * 获取卫星状态信息回调、批量获取缓存位置回调、请求上层注入参考信息回调、 + * 请求上层注入PGNSS数据回调。 + * + * @since 3.2 + */ +[callback] interface IGnssCallback { + /* + * @brief 位置上报的回调函数。 + * + * @param location 表示GNSS定位结果,详情参考{@link Location}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportLocation([in] struct LocationInfo location); + + /* + * @brief 上报GNSS工作状态的回调函数。 + * + * @param status 表示GNSS芯片的工作状态,详情参考{@link GnssWorkingStatus}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportGnssWorkingStatus([in] enum GnssWorkingStatus status); + + /* + * @brief 上报NMEA数据的回调函数。 + * + * @param timestamp 表示NMEA上报的时刻。 + * @param nmea 表示NMEA字符串。格式是NMEA 0183。 + * @param length 表示NMEA字符串的长度。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportNmea([in] long timestamp, [in] String nmea, [in] int length); + + /* + * @brief 上报GNSS能力的回调函数。 + * + * @param capabilities 表示GNSS的能力。详情参考{@link GnssCapabilities}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportGnssCapabilities([in] enum GnssCapabilities capabilities); + + /* + * @brief 上报卫星状态信息的回调函数。 + * + * @param info 表示卫星状态信息,详情参考{@link SatelliteStatusInfo}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportSatelliteStatusInfo([in] struct SatelliteStatusInfo info); + + /* + * @brief 请求上层注入GNSS参考信息。 + * + * @param type 表示GNSS参考信息类型,详情参考{@link GnssRefInfoType}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + RequestGnssReferenceInfo([in] enum GnssRefInfoType type); + + /* + * @brief 请求上层注入PGNSS数据。 + * + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + RequestPredictGnssData(); + + /* + * @brief 批量上报所有的缓存GNSS位置信息。 + * + * @param gnssLocations 表示GNSS芯片缓存的所有位置信息。详情参考{@link Location}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + ReportCachedLocation([in] struct LocationInfo[] gnssLocations); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/location/gnss/v1_0/IGnssInterface.idl b/zh-cn/device_api/hdi/location/gnss/v1_0/IGnssInterface.idl new file mode 100644 index 00000000..9e01db92 --- /dev/null +++ b/zh-cn/device_api/hdi/location/gnss/v1_0/IGnssInterface.idl @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @addtogroup HdiGnss + * @{ + * + * @brief 定义GNSS模块的接口。 + * + * 上层GNSS服务可以获取GNSS驱动对象或代理,然后调用该对象或代理提供的API来访问GNSS设备, + * 从而实现启动GNSS芯片,启动导航,设置GNSS工作模式,注入参考信息,获取定位结果,获取nmea, + * 获取卫星状态信息,批量获取缓存位置信息等。 + * + * @since 3.2 + */ + +/* + * @file IGnssInterface.idl + * + * @brief 声明GNSS模块提供的接口函数,包括启动GNSS芯片、启动导航、设置GNSS工作模式、注入参考信息、 + * 删除辅助数据、注入PGNSS数据、获取GNSS缓存位置个数、获取所有缓存位置。 + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.location.gnss.v1_0; + +import ohos.hdi.location.gnss.v1_0.IGnssCallback; +import ohos.hdi.location.gnss.v1_0.GnssTypes; + +/* + * @brief 声明GNSS模块提供的接口函数,包括启动GNSS芯片、启动导航、设置GNSS工作模式、注入参考信息、 + * 删除辅助数据、注入PGNSS数据、获取GNSS缓存位置个数、获取所有缓存位置。 + * + * @since 3.2 + */ +interface IGnssInterface { + /* + * @brief 设置GNSS配置参数。 + * + * @param para 表示GNSS配置参数。包含基础的GNSS配置和GNSS缓存位置功能配置参数。详情参考{@link GnssConfigPara}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + SetGnssConfigPara([in] struct GnssConfigPara para); + + /* + * @brief 使能GNSS功能,并设置回调函数。 + * + * @param callback 表示GNSS回调函数。GNSS驱动通过此回调函数上报定位结果和卫星状态信息等。 + * 详情参考{@link IGnssCallback}. + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + EnableGnss([in] IGnssCallback callbackObj); + + /* + * @brief 去使能GNSS功能。 + * + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + DisableGnss(); + + /* + * @brief 启动导航功能。 + * + * @param type 表示GNSS启动类型,该参数是为了区分正常的GNSS定位功能和GNSS缓存功能。 + * 详情参考{@link GnssStartType}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + StartGnss([in] enum GnssStartType type); + + /* + * @brief 停止导航功能。 + * + * @param type 表示GNSS启动类型,该参数为了区分正常的GNSS定位功能和GNSS缓存功能。 + * 详情参考{@link GnssStartType}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + StopGnss([in] enum GnssStartType type); + + /* + * @brief 注入GNSS参考信息。 + * + * @param refInfo 表示GNSS参考信息,包含参考时间和参考位置。详情参考{@link GnssRefInfo}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + SetGnssReferenceInfo([in] struct GnssRefInfo refInfo); + + /* + * @brief 删除指定的辅助数据。 + * + * @param data 表示辅助数据类型。详情参考{@link GnssAuxiliaryData}。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + DeleteAuxiliaryData([in] enum GnssAuxiliaryData data); + + /* + * @brief 注入PGNSS数据。 + * + * @param data 表示PGNSS数据。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + SetPredictGnssData([in] String data); + + /* + * @brief 获取GNSS缓存位置个数。 + * + * @param size 表示GNSS缓存位置个数。 + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + GetCachedGnssLocationsSize([out] int size); + + /* + * @brief 请求一次性获取GNSS缓存中的所有位置信息,并清空缓存buffer,缓存位置通过回调上报。 + * + * @return 返回0表示成功,返回负数表示失败。 + * + * @since 3.2 + * @version 1.0 + */ + GetCachedGnssLocations(); +} +/** @} */ \ No newline at end of file -- Gitee From 869c4d3fa976c7561c85249f72eeb4bd063c3fb1 Mon Sep 17 00:00:00 2001 From: Wuhongbo Date: Thu, 8 Feb 2024 11:01:43 +0800 Subject: [PATCH 0261/2135] =?UTF-8?q?hdi=E6=8E=A5=E5=8F=A3=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Wuhongbo --- zh-cn/device_api/hdi/wlan/bundle.json | 136 ++ .../device_api/hdi/wlan/hostapd/v1_0/BUILD.gn | 34 + .../hdi/wlan/hostapd/v1_0/HostapdTypes.idl | 59 + .../wlan/hostapd/v1_0/IHostapdCallback.idl | 88 ++ .../wlan/hostapd/v1_0/IHostapdInterface.idl | 311 +++++ zh-cn/device_api/hdi/wlan/v1_0/BUILD.gn | 34 + zh-cn/device_api/hdi/wlan/v1_1/BUILD.gn | 34 + .../hdi/wlan/v1_1/IWlanCallback.idl | 103 ++ .../hdi/wlan/v1_1/IWlanInterface.idl | 520 ++++++++ zh-cn/device_api/hdi/wlan/v1_1/WlanTypes.idl | 367 ++++++ zh-cn/device_api/hdi/wlan/v1_2/BUILD.gn | 30 + .../hdi/wlan/v1_2/IWlanInterface.idl | 116 ++ zh-cn/device_api/hdi/wlan/wpa/v1_0/BUILD.gn | 34 + .../hdi/wlan/wpa/v1_0/IWpaCallback.idl | 352 +++++ .../hdi/wlan/wpa/v1_0/IWpaInterface.idl | 1173 +++++++++++++++++ .../device_api/hdi/wlan/wpa/v1_0/WpaTypes.idl | 464 +++++++ 16 files changed, 3855 insertions(+) create mode 100644 zh-cn/device_api/hdi/wlan/bundle.json create mode 100644 zh-cn/device_api/hdi/wlan/hostapd/v1_0/BUILD.gn create mode 100644 zh-cn/device_api/hdi/wlan/hostapd/v1_0/HostapdTypes.idl create mode 100644 zh-cn/device_api/hdi/wlan/hostapd/v1_0/IHostapdCallback.idl create mode 100644 zh-cn/device_api/hdi/wlan/hostapd/v1_0/IHostapdInterface.idl create mode 100644 zh-cn/device_api/hdi/wlan/v1_0/BUILD.gn create mode 100644 zh-cn/device_api/hdi/wlan/v1_1/BUILD.gn create mode 100644 zh-cn/device_api/hdi/wlan/v1_1/IWlanCallback.idl create mode 100644 zh-cn/device_api/hdi/wlan/v1_1/IWlanInterface.idl create mode 100644 zh-cn/device_api/hdi/wlan/v1_1/WlanTypes.idl create mode 100644 zh-cn/device_api/hdi/wlan/v1_2/BUILD.gn create mode 100644 zh-cn/device_api/hdi/wlan/v1_2/IWlanInterface.idl create mode 100644 zh-cn/device_api/hdi/wlan/wpa/v1_0/BUILD.gn create mode 100644 zh-cn/device_api/hdi/wlan/wpa/v1_0/IWpaCallback.idl create mode 100644 zh-cn/device_api/hdi/wlan/wpa/v1_0/IWpaInterface.idl create mode 100644 zh-cn/device_api/hdi/wlan/wpa/v1_0/WpaTypes.idl diff --git a/zh-cn/device_api/hdi/wlan/bundle.json b/zh-cn/device_api/hdi/wlan/bundle.json new file mode 100644 index 00000000..668b5f47 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/bundle.json @@ -0,0 +1,136 @@ +{ + "name": "@ohos/drivers_interface_wlan", + "description": "wlan device driver interface", + "version": "4.0", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath": "drivers/interface/wlan" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "drivers_interface_wlan", + "subsystem": "hdf", + "adapted_system_type": ["standard"], + "rom": "675KB", + "ram": "1024KB", + "deps": { + "components": [ + "hdf_core", + "hilog", + "c_utils", + "ipc" + ], + "third_party": [] + }, + "build": { + "sub_component": [ + "//drivers/interface/wlan/v1_1:wlan_idl_target", + "//drivers/interface/wlan/v1_2:wlan_idl_target", + "//drivers/interface/wlan/wpa/v1_0:wpa_idl_target", + "//drivers/interface/wlan/hostapd/v1_0:hostapd_idl_target" + ], + "test": [ + ], + "inner_kits": [ + { + "name": "//drivers/interface/wlan/v1_1:libwlan_proxy_1.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, + { + "name": "//drivers/interface/wlan/v1_1:wlan_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, + { + "name": "//drivers/interface/wlan/v1_1:libwlan_stub_1.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, + { + "name": "//drivers/interface/wlan/v1_2:libwlan_proxy_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, + { + "name": "//drivers/interface/wlan/v1_2:wlan_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, + { + "name": "//drivers/interface/wlan/v1_2:libwlan_stub_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, + { + "name": "//drivers/interface/wlan/wpa/v1_0:libwpa_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/wpa" + } + }, + { + "name": "//drivers/interface/wlan/wpa/v1_0:wpa_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/wpa" + } + }, + { + "name": "//drivers/interface/wlan/wpa/v1_0:libwpa_stub_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/wpa" + } + }, + { + "name": "//drivers/interface/wlan/hostapd/v1_0:libhostapd_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/hostapd" + } + }, + { + "name": "//drivers/interface/wlan/hostapd/v1_0:hostapd_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/hostapd" + } + }, + { + "name": "//drivers/interface/wlan/hostapd/v1_0:libhostapd_stub_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/hostapd" + } + } + ] + } + } + } diff --git a/zh-cn/device_api/hdi/wlan/hostapd/v1_0/BUILD.gn b/zh-cn/device_api/hdi/wlan/hostapd/v1_0/BUILD.gn new file mode 100644 index 00000000..418ee2aa --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/hostapd/v1_0/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libhostapd_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("hostapd") { + module_name = "hostapd_service" + + sources = [ + "HostapdTypes.idl", + "IHostapdCallback.idl", + "IHostapdInterface.idl", + ] + + language = "c" + subsystem_name = "hdf" + part_name = "drivers_interface_wlan" + } +} diff --git a/zh-cn/device_api/hdi/wlan/hostapd/v1_0/HostapdTypes.idl b/zh-cn/device_api/hdi/wlan/hostapd/v1_0/HostapdTypes.idl new file mode 100644 index 00000000..951f33ca --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/hostapd/v1_0/HostapdTypes.idl @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Hostapd + * @{ + * + * @brief WLAN模块为上层WLAN业务提供API接口. + * + * 上层WLAN服务开发人员可根据WLAN模块提供的向上统一接口获取如下能力:建立/关闭WLAN热点,扫描/关联WLAN热点,WLAN平台芯片管理,网络数据缓冲的申请、释放、移动等操作,网络设备管理,电源管理等. + * + * @since 4.1 + * @version 1.0 + */ + + /** + * @file HostapdTypes.idl + * + * @brief 定义与WLAN模块相关的数据类型. + * + * WLAN模块数据包括{@code Feature}对象信息、站点(STA)信息等,扫描信息和网络设备信息 + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 定义WLAN模块接口的包路径. + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.wlan.hostapd.v1_0; + +/** + * @brief 定义{@code Feature}对象信息. + * + * @since 4.1 + * @version 1.0 + */ + +struct HdiApCbParm { + /** Wi-Fi Hal回调STA加入和AP状态. */ + String content; + /** ap id. */ + int id; +}; diff --git a/zh-cn/device_api/hdi/wlan/hostapd/v1_0/IHostapdCallback.idl b/zh-cn/device_api/hdi/wlan/hostapd/v1_0/IHostapdCallback.idl new file mode 100644 index 00000000..55f8e371 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/hostapd/v1_0/IHostapdCallback.idl @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Hostapd + * @{ + * + * @brief 定义上层WLAN服务的API接口. + * + * 上层WLAN服务开发人员可根据WLAN模块提供的向上统一接口获取如下能力:建立/关闭WLAN热点,扫描/关联WLAN热点,WLAN平台芯片管理,网络数据缓冲的申请、释放、移动等操作,网络设备管理,电源管理等. + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IHostapdCallback.idl + * + * @brief 提供在重新启动hostapd时调用的回调,返回扫描结果,接收Netlink消息. + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 定义WLAN模块接口的包路径. + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.wlan.hostapd.v1_0; + +import ohos.hdi.wlan.hostapd.v1_0.HostapdTypes; + +/** + * @brief hostapd回调的接口. + * + * 当hostapd启动、热点扫描结束,收到Netlink消息时,调用该回调,继续后续处理. + * + * @since 4.1 + * @version 1.0 + */ +[callback] interface IHostapdCallback { + /** + * @brief Wi-Fi Hal回调STA加入AP. + * + * @param staJoinParm 表示sta加入内容. + * @param ifName 表示网卡名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventStaJoin([in] struct HdiApCbParm apCbParm, [in] String ifName); + + /** + * @brief Wi-Fi Hal回调AP状态. + * + * @param apStateParm 表示ap状态内容. + * @param ifName 表示网卡名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventApState([in] struct HdiApCbParm apCbParm, [in] String ifName); + + /** + * 用于处理Hostapd回调参数 + * + * @param notifyParam 表示Hostapd的参数. + * @param ifName 表示网卡名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventHostApdNotify([in] String notifyParam, [in] String ifName); +} diff --git a/zh-cn/device_api/hdi/wlan/hostapd/v1_0/IHostapdInterface.idl b/zh-cn/device_api/hdi/wlan/hostapd/v1_0/IHostapdInterface.idl new file mode 100644 index 00000000..fd672966 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/hostapd/v1_0/IHostapdInterface.idl @@ -0,0 +1,311 @@ +/* + * 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. + */ + +/** + * @添加到组 Hostapd + * @{ + * + * @brief WLAN模块为上层WLAN业务提供API接口. + * + * 上层WLAN服务开发人员可根据WLAN模块提供的向上统一接口获取如下能力:建立/关闭WLAN热点,扫描/关联WLAN热点,WLAN平台芯片管理,网络数据缓冲的申请、释放、移动等操作,网络设备管理,电源管理等. + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @file IHostapdInterface.idl + * + * @brief 提供API接口,实现WLAN热点的开启、关闭、扫描、连接、断开等功能,设置国家代码.管理网络设备. + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 定义Hostapd模块接口的包路径. + * + * @since 4.1 + * @version 1.0 + */ + +package ohos.hdi.wlan.hostapd.v1_0; + +import ohos.hdi.wlan.hostapd.v1_0.HostapdTypes; +import ohos.hdi.wlan.hostapd.v1_0.IHostapdCallback; + +/** + * @brief 定义上层WLAN服务的接口. + * + * @since 4.1 + * @version 1.0 + */ + +interface IHostapdInterface { + /** + * @brief 打开 ap. + * + * @param ifName 表示网卡名称. + * @param id 表示热点id. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + StartAp(); + + /** + * @brief 关闭 ap. + * + * @param ifName 表示网卡名称. + * @param id 表示热点id. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + StopAp(); + + /** + * @brief 启用 AP. + * + * @param ifName Indicates the NIC name. + * @param id - ap id. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + EnableAp([in] String ifName, [in] int id); + + /** + * @brief 禁用 AP. + * + * @param ifName 表示NIC名称. + * @param id 表示热点id. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + DisableAp([in] String ifName, [in] int id); + + /** + * @brief 设置个人热点密码. + * + * @param pass 密码. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetApPasswd([in] String ifName, [in] String pass, [in]int id); + + /** + * @brief 设置个人热点名称. + * + * @param name - The SAP SSID. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetApName([in] String ifName, [in] String name, [in] int id); + + /** + * @brief 设置AP安全类型. + * + * @param securityType - SAP安全类型,例如:wpa/wpa_psk等. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetApWpaValue([in] String ifName, [in] int securityType, [in] int id); + + /** + * @brief 设置AP带宽. + * + * @param band - SAP带宽. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetApBand([in] String ifName, [in] int band, [in] int id); + + /** + * @brief 设置AP需要支持的协议类型. + * + * @param value - Hostapd配置值. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetAp80211n([in] String ifName, [in] int value, [in] int id); + + /** + * @brief 设置AP WMM模式. + * + * @param value - 启用或禁用Wmm. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetApWmm([in] String ifName, [in] int value, [in] int id); + + /** + * @brief 设置AP通道. + * + * @param channel - SAP通道. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetApChannel([in] String ifName, [in] int channel, [in] int id); + + /** + * @brief 设置AP最大连接. + * + * @param maxConn - 设置连接设备的最大数量. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetApMaxConn([in] String ifName, [in] int maxConn, [in] int id); + + /** + * @brief 设置AP模式下的黑名单设置为禁止MAC地址连接 + * + * @param mac - 被阻止的MAC地址. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetMacFilter([in] String ifName, [in] String mac, [in] int id); + + /** + * @brief 在AP模式下设置的黑名单过滤,并删除来自黑名单中指定的MAC地址. + * + * @param mac - 黑名单中的MAC地址. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + DelMacFilter([in] String ifName, [in] String mac, [in] int id); + + /** + * @brief 获取有关所有连接的STA的信息. + * + * @param infos - 已连接STA数组信息. + * @param size - 获取已连接STA数组中,数组信息的大小. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetStaInfos([in] String ifName, [out] String buf, [in] int size, [in] int id); + + /** + * @brief 断开指定的STA连接. + * + * @param mac - 断开指定的mac. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + DisassociateSta([in] String ifName, [in] String mac, [in] int id); + + /** + * @brief 注册回调以侦听异步事件. + * + * @param cbFunc 表示要注册的回调. + * @param ifName 表示NIC名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + RegisterEventCallback([in] IHostapdCallback cbFunc, [in] String ifName); + + /** + * @brief 注销回调. + * + * @param cbFunc 表示要注销的回调. + * @param ifName 表示NIC名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + UnregisterEventCallback([in] IHostapdCallback cbFunc, [in] String ifName); + + /** + * @brief 用于处理Hostapd的cmd命令 + * + * @param ifName 表示NIC名称. + * @param cmd 表示来自WifiHal的HostApd命令 + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + HostApdShellCmd([in] String ifName, [in] String cmd); + } diff --git a/zh-cn/device_api/hdi/wlan/v1_0/BUILD.gn b/zh-cn/device_api/hdi/wlan/v1_0/BUILD.gn new file mode 100644 index 00000000..1d5e6370 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/v1_0/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libwlan_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("wlan") { + module_name = "wlan_service" + + sources = [ + "IWlanCallback.idl", + "IWlanInterface.idl", + "WlanTypes.idl", + ] + + language = "c" + subsystem_name = "hdf" + part_name = "drivers_interface_wlan" + } +} diff --git a/zh-cn/device_api/hdi/wlan/v1_1/BUILD.gn b/zh-cn/device_api/hdi/wlan/v1_1/BUILD.gn new file mode 100644 index 00000000..58145e5d --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/v1_1/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libwlan_proxy_1.1") { + deps = [] + public_configs = [] + } +} else { + hdi("wlan") { + module_name = "wlan_service" + + sources = [ + "IWlanCallback.idl", + "IWlanInterface.idl", + "WlanTypes.idl", + ] + + language = "c" + subsystem_name = "hdf" + part_name = "drivers_interface_wlan" + } +} diff --git a/zh-cn/device_api/hdi/wlan/v1_1/IWlanCallback.idl b/zh-cn/device_api/hdi/wlan/v1_1/IWlanCallback.idl new file mode 100644 index 00000000..34bbf903 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/v1_1/IWlanCallback.idl @@ -0,0 +1,103 @@ +/* + * 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. + */ + +/** + * @添加到组 WLAN + * @{ + * + * @brief 定义上层WLAN服务的API接口. + * + * 上层WLAN服务开发人员可根据WLAN模块提供的向上统一接口获取如下能力:建立/关闭WLAN热点,扫描/关联WLAN热点 + * WLAN平台芯片管理,网络数据缓冲的申请、释放、移动等操作,网络设备管理,电源管理等。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file IWlanCallback.idl + * + * @brief 提供回调函数,当WLAN驱动重启、扫描结果返回时调用,接收到Netlink消息. + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @brief 定义WLAN模块接口的包路径. + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.wlan.v1_1; + +import ohos.hdi.wlan.v1_1.WlanTypes; + +/** + * @brief 定义WLAN模块的回调. + * + * 当WLAN模块重新启动、热点扫描结束,收到Netlink消息等情况下,调用该回调,继续后续处理, + * + * @since 3.2 + * @version 1.1 + */ +[callback] interface IWlanCallback { + /** + * @brief 调用此方法,处理WLAN驱动重启时,返回的结果. + * + * @param event 表示驱动重启事件ID. + * @param code 表示重启驱动时的返回结果. + * @param ifName 表示网卡(NIC)名称. + * + * @since 3.2 + * @version 1.1 + */ + ResetDriverResult([in] unsigned int event, [in] int code, [in] String ifName); + + /** + * @brief 调用此方法,处理扫描结束时,返回的扫描结果. + * + * @param event 表示扫描结果事件的ID. + * @param scanResult 表示扫描结果. + * @param ifName 表示网卡(NIC)名称. + * + * @since 3.2 + * @version 1.1 + */ + ScanResult([in] unsigned int event, [in] struct HdfWifiScanResult scanResult, [in] String ifName); + + /** + * @brief 调用此方法以处理收到的Netlink消息. + * + * @param recvMsg 表示收到的Netlink消息. + * + * @since 3.2 + * @version 1.1 + */ + WifiNetlinkMessage([in] unsigned char[] recvMsg); + + /** + * @brief 调用此方法,以处理扫描完成时,返回的扫描结果. + * + * @param event 表示扫描结果事件的ID. + * @param scanResults 表示扫描结果(多个). + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.0 + * @version 1.1 + */ + ScanResults([in] unsigned int event, [in] struct HdfWifiScanResults scanResults, [in] String ifName); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/wlan/v1_1/IWlanInterface.idl b/zh-cn/device_api/hdi/wlan/v1_1/IWlanInterface.idl new file mode 100644 index 00000000..8fdb3114 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/v1_1/IWlanInterface.idl @@ -0,0 +1,520 @@ +/* + * 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. + */ + +/** + * @添加到组 WLAN + * @{ + * + * @brief 定义上层WLAN服务的API接口. + * + * 上层WLAN服务开发人员可根据WLAN模块提供的向上统一接口获取如下能力:建立/关闭WLAN热点,扫描/关联WLAN热点 + * WLAN平台芯片管理,网络数据缓冲的申请、释放、移动等操作,网络设备管理,电源管理等。 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @file IWlanInterface.idl + * + * @brief 提供API以启用或禁用WLAN热点、扫描热点、连接到WLAN热点或断开与WLAN热点的连接,设置国家代码,并管理网络设备. + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @brief 定义WLAN模块接口的包路径. + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.wlan.v1_1; + +import ohos.hdi.wlan.v1_1.WlanTypes; +import ohos.hdi.wlan.v1_1.IWlanCallback; + +/** + * @brief 定义上层WLAN服务的接口. + * + * @since 3.2 + * @version 1.1 + */ + +interface IWlanInterface { + /** + * @brief 在HAL和WLAN驱动程序之间创建一个通道,并获取驱动程序网络接口卡(NIC)信息,此函数必须在创建IWiFi实例后调用 + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + Start(); + + /** + * @brief 销毁HAL和WLAN驱动程序之间的通道。此函数必须在IWiFi实例被销毁之前调用. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + Stop(); + + /** + * @brief 基于指定的类型创建Feature对象. + * + * @param type 表示要创建的Feature对象的类型, 2:Station, 3:AP. + * @param ifeature 表示创建feature对象. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + CreateFeature([in] int type, [out] struct HdfFeatureInfo ifeature); + + /** + * @brief 销毁Feature对象. + * + * @param ifeature 表示要销毁的Feature对象. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + DestroyFeature([in] struct HdfFeatureInfo ifeature); + + /** + * @brief 获取连接到此AP的所有STA的信息。目前,STA信息仅包含MAC地址。 + * + * @param ifeature 表示Feature对象. + * @param staInfo 表示所有连接到AP的STA的基本信息. + * @param num 表示连接的STA的数量. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetAssociatedStas([in] struct HdfFeatureInfo ifeature, [out] struct HdfStaInfo[] staInfo, [out] unsigned int num); + + /** + * @brief 获取当前驱动程序的芯片ID. + * + * @param ifeature 表示Feature对象. + * @param chipId 表示获得的芯片ID. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetChipId([in] struct HdfFeatureInfo ifeature, [out] unsigned char chipId); + + /** + * @brief 获取设备MAC地址. + * + * @param ifeature 表示Feature对象. + * @param mac 表示获得的MAC地址. + * @param len 表示MAC地址的长度,该值固定为6. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetDeviceMacAddress([in] struct HdfFeatureInfo ifeature, [out] unsigned char[] mac, [in] unsigned char len); + + /** + * @brief 基于指定的NIC名称获取Feature对象. + * + * @param ifName 表示网卡(NIC)名称. + * @param ifeature 表示获得的Feature对象. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetFeatureByIfName([in] String ifName, [out] struct HdfFeatureInfo ifeature); + + /** + * @brief 获取Feature对象的类型. + * + * @param ifeature 表示Feature对象. + * @param featureType 表示获取的Feature对象的类型. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetFeatureType([in] struct HdfFeatureInfo ifeature, [out] int featureType); + + /** + * @brief 获得指定频段支持的频率. + * + * @param ifeature 表示Feature对象. + * @param wifiInfo 表示频率信息,wifiInfo.band, 0:2.4 GHz; 1:5 GHz, wifiInfo.size,最小为14。 + * @param freq Indicates the supported frequencies obtained. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetFreqsWithBand([in] struct HdfFeatureInfo ifeature, [in] struct HdfWifiInfo wifiInfo, [out] int[] freq); + + /** + * @brief 获取芯片的所有NIC名称. + * + * @param chipId 表示目标芯片的ID. + * @param ifNames 表示获得的NIC名称. + * @param num 表示NIC的数量. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetIfNamesByChipId([in] unsigned char chipId, [out] String ifName, [out] unsigned int num); + + /** + * @brief 获取基于Feature对象的NIC名称. + * + * @param ifeature 表示Feature对象. + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetNetworkIfaceName([in] struct HdfFeatureInfo ifeature, [out] String ifName); + + /** + * @brief 获取多个NIC共存的信息. + * + * @param combo 表示获得的信息,例如,AP、STA和P2P的不同组合. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetSupportCombo([out] unsigned long combo); + + /** + * @brief 获得设备支持的WLAN功能,无论设备状态如何. + * + * @param supType 表示获得的功能. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetSupportFeature([out] unsigned char[] supType); + + /** + * @brief 注册回调以侦听异步事件. + * + * @param cbFunc 表示要注册的回调. + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + RegisterEventCallback([in] IWlanCallback cbFunc, [in] String ifName); + + /** + * @brief 注销回调. + * + * @param cbFunc 表示要注销的回调. + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + UnregisterEventCallback([in] IWlanCallback cbFunc, [in] String ifName); + + /** + * @brief 根据指定的芯片ID重新启动WLAN驱动程序. + * + * @param chipId 表示要重新启动其驱动程序的芯片的ID. + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + ResetDriver([in] unsigned char chipId, [in] String ifName); + + /** + * @brief 设置国家码. + * + * 国家/地区代码表示AP射频所在的国家/地区。描述AP射频特性, + * 包括AP的发射功率和支持的信道,确保AP的射频属性符合当地法律法规 + * + * @param ifeature 表示Feature对象. + * @param code 表示设置的国家码. + * @param len 表示国家码的长度. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + SetCountryCode([in] struct HdfFeatureInfo ifeature, [in] String code, [in] unsigned int len); + + /** + * @brief 设置NIC的MAC地址. + * + * @param ifeature 表示Feature对象. + * @param mac 表示要设置的MAC地址. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + SetMacAddress([in] struct HdfFeatureInfo ifeature, [in] unsigned char[] mac); + + /** + * @brief 扫描单个MAC地址. + * + * @param ifeature 表示Feature对象. + * @param scanMac 表示STA要扫描的MAC地址. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + SetScanningMacAddress([in] struct HdfFeatureInfo ifeature, [in] unsigned char[] scanMac); + + /** + * @brief 设置发射功率. + * + * @param ifeature 表示Feature对象. + * @param power 表示要设置的发射功率. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + SetTxPower([in] struct HdfFeatureInfo ifeature, [in] int power); + + /** + * @brief 获取网络设备信息,如设备索引、NIC名称和MAC地址. + * + * @param netDeviceInfoResult 表示获得的网络设备信息. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetNetDevInfo([out] struct HdfNetDeviceInfoResult netDeviceInfoResult); + + /** + * @brief 开始扫描. + * + * @param ifeature 表示Feature对象. + * @param scan 表示扫描参数. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + StartScan([in] struct HdfFeatureInfo ifeature, [in] struct HdfWifiScan scan); + + /** + * @brief 获得使用中的电源模式. + * + * @param ifeature 表示Feature对象. + * @param mode 表示获得的电源模式。电源模式可以是睡眠(在待机模式下运行),一般(以正常额定功率运行), + * 和穿墙(以最大功率运行以提高信号强度和覆盖范围)。 + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetPowerMode([in] struct HdfFeatureInfo ifeature, [out] unsigned char mode); + + /** + * @brief 设置电源模式. + * + * @param ifeature 表示Feature对象. + * @param mode 表示设置电源模式。电源模式可以是睡眠(在待机模式下运行),一般(以正常额定功率运行), + * 和穿墙(以最大功率运行以提高信号强度和覆盖范围)。 + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + SetPowerMode([in] struct HdfFeatureInfo ifeature, [in] unsigned char mode); + + /** + * @brief 开始通道测量. + * + * @param ifName 表示网卡(NIC)名称. + * @param measChannelParam 表示通道测量参数(通道ID和测量时间). + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + [oneway] StartChannelMeas([in] String ifName, [in] struct MeasChannelParam measChannelParam); + + /** + * @brief 获得通道测量结果. + * + * @param ifName 表示网卡(NIC)名称. + * @param measChannelResult 指示通道测量结果(包括通道ID、负载和噪声) + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetChannelMeasResult([in] String ifName, [out] struct MeasChannelResult measChannelResult); + + /** + * @brief 设置投影参数. + * + * @param ifName 表示网卡(NIC)名称. + * @param param 表示要设置的投影参数. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + SetProjectionScreenParam([in] String ifName, [in] struct ProjectionScreenCmdParam param); + + /** + * @brief 向驱动程序发送I/O控制命令. + * + * @param ifName 表示网卡(NIC)名称. + * @param cmdId 表示要发送的命令的ID. + * @param paramBuf 表示命令内容. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + WifiSendCmdIoctl([in] String ifName, [in] int cmdId, [in] byte[] paramBuf); + + /** + * @brief 获取指定NIC的STA信息. + * + * @param ifName 表示网卡(NIC)名称. + * @param info 表示所获得的STA信息。有关详细信息,请参阅{@link WifiStationInfo}. + * @param mac 表示STA的MAC地址. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 3.2 + * @version 1.1 + */ + GetStaInfo([in] String ifName, [out] struct WifiStationInfo info, [in] unsigned char[] mac); + + /** + * @brief 启动Pno扫描. + * + * @param interfaceName 表示网卡(NIC)名称. + * @param pnoSettings 表示pno扫描参数. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.0 + * @version 1.1 + */ + StartPnoScan([in] String interfaceName, [in] struct PnoSettings pnoSettings); + + /** + * @brief 关闭Pno扫描. + * + * @param interfaceName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.0 + * @version 1.1 + */ + StopPnoScan([in] String interfaceName); + + /** + * @brief 获取相关链路的信号信息。此函数必须在STA模式下调用. + * + * @param ifName 表示网卡(NIC)名称. + * @param signalResult 表示信号信息. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.0 + * @version 1.1 + */ + GetSignalPollInfo([in] String ifName, [out] struct SignalPollResult signalResult); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/wlan/v1_1/WlanTypes.idl b/zh-cn/device_api/hdi/wlan/v1_1/WlanTypes.idl new file mode 100644 index 00000000..b2b4db30 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/v1_1/WlanTypes.idl @@ -0,0 +1,367 @@ +/* + * 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. + */ + +/** + * @添加到组 WLAN + * @{ + * + * @brief 定义上层WLAN服务的API接口. + * + * 上层WLAN服务开发人员可根据WLAN模块提供的向上统一接口获取如下能力:建立/关闭WLAN热点,扫描/关联WLAN热点 + * WLAN平台芯片管理,网络数据缓冲的申请、释放、移动等操作,网络设备管理,电源管理等。 + * + * @since 3.2 + * @version 1.1 + */ + + /** + * @file WlanTypes.idl + * + * @brief 定义与WLAN模块相关的数据类型. + * + * WLAN模块数据包括{@code-Feature}对象信息、站(STA)信息等,扫描信息和网络设备信息 + * + * @since 3.2 + * @version 1.1 + */ + +/** + * @brief 定义WLAN模块接口的包路径. + * + * @since 3.2 + * @version 1.1 + */ +package ohos.hdi.wlan.v1_1; + +/** + * @brief 定义{@code Feature}对象信息. + * + * @since 3.2 + * @version 1.1 + */ +struct HdfFeatureInfo { + /** NIC name of the {@code Feature} object. */ + String ifName; + /** {@code Feature} object. */ + int type; +}; + +/** + * @brief 定义STA信息. + * + * @since 3.2 + * @version 1.1 + */ +struct HdfStaInfo { + /** MAC address of an STA. */ + unsigned char[] mac; +}; + +/** + * @brief 定义Wi-Fi扫描的服务集标识符(SSID)信息. + * + * @since 3.2 + * @version 1.1 + */ +struct HdfWifiDriverScanSsid { + /** SSID to scan. */ + String ssid; + /** Length of the SSID. */ + int ssidLen; +}; + +/** + * @brief 定义Wi-Fi扫描参数. + * + * @since 3.2 + * @version 1.1 + */ +struct HdfWifiScan{ + /** SSIDs to scan. */ + struct HdfWifiDriverScanSsid[] ssids; + /** Frequencies to scan. */ + int[] freqs; + /** Extended information element (IE) carried in a Wi-Fi scan request. */ + unsigned char[] extraIes; + /** Basic service set identifier (BSSID) to scan. */ + unsigned char[] bssid; + /** Whether the SSID to be scanned has a prefix. */ + unsigned char prefixSsidScanFlag; + /** Fast connect flag. */ + unsigned char fastConnectFlag; +}; + +/** + * @brief 定义网络设备信息. + * + * @since 3.2 + * @version 1.1 + */ +struct HdfNetDeviceInfo { + /** Index of the network device. */ + unsigned int index; + /** Network interface card (NIC) name. */ + String ifName; + /** Length of the NIC name. */ + unsigned int ifNameLen; + /** NIC type. */ + unsigned char iftype; + /** MAC address of the network device. */ + unsigned char[] mac; +}; + +/** + * @brief 定义网络设备信息集. + * + * @since 3.2 + * @version 1.1 + */ +struct HdfNetDeviceInfoResult { + /** A sef of network device information. */ + struct HdfNetDeviceInfo[] deviceInfos; +}; + +/** + * @brief 定义Wi-Fi扫描结果. + * + * @since 3.2 + * @version 1.1 + */ +struct HdfWifiScanResult { + /** Flag of the basic service set (BSS)/independent basic service set (IBSS). */ + unsigned int flags; + /** BSSID information. */ + unsigned char[] bssid; + /** Capability information fields (in host byte order). */ + unsigned short caps; + /** Channel frequency. */ + unsigned int freq; + /** Beacon interval. */ + unsigned short beaconInt; + /** Signal quality. */ + int qual; + /** Signal strength. */ + int level; + /** Time for receiving the latest beacon or probe response frame, in milliseconds. */ + unsigned int age; + /** Variable value in the scan result. */ + unsigned char[] variable; + /** IE in the following Probe Response message. */ + unsigned char[] ie; + /** IE in the following beacon. */ + unsigned char[] beaconIe; +}; + +/** + * @brief 定义Wi-Fi扫描结果. + * + * @since 4.0 + * @version 1.1 + */ +struct HdfWifiScanResultExt { + /** Flag of the basic service set (BSS)/independent basic service set (IBSS). */ + unsigned int flags; + /** BSSID information. */ + unsigned char[] bssid; + /** Capability information fields (in host byte order). */ + unsigned short caps; + /** Channel frequency. */ + unsigned int freq; + /** Beacon interval. */ + unsigned short beaconInt; + /** Signal quality. */ + int qual; + /** Signal strength. */ + int level; + /** Time for receiving the latest beacon or probe response frame, in milliseconds. */ + unsigned int age; + /** Timestamp **/ + unsigned long tsf; + /** Variable value in the scan result. */ + unsigned char[] variable; + /** IE in the following Probe Response message. */ + unsigned char[] ie; + /** IE in the following beacon. */ + unsigned char[] beaconIe; +}; + +/** + * @brief 定义Wi-Fi扫描结果. + * + * @since 4.0 + * @version 1.1 + */ +struct HdfWifiScanResults { + struct HdfWifiScanResultExt[] res; +}; + +/** + * @brief 定义Wi-Fi频带信息. + * + * @since 3.2 + * @version 1.1 + */ +struct HdfWifiInfo { + /** Wi-Fi frequency band. */ + int band; + /** Number of frequencies supported in the Wi-Fi frequency band. */ + unsigned int size; +}; + +/** + * @brief 定义通道测量参数. + * + * @since 3.2 + * @version 1.1 + */ +struct MeasChannelParam { + /** Channel ID. */ + int channelId; + /** Measure time. */ + int measTime; +}; + +/** + * @brief 定义通道测量结果. + * + * @since 3.2 + * @version 1.1 + */ +struct MeasChannelResult { + /** Channel ID. */ + int channelId; + /** Channel load. */ + int chload; + /** Channel noise. */ + int noise; +}; + +/** + * @brief 定义投影参数. + * + * @since 3.2 + * @version 1.1 + */ +struct ProjectionScreenCmdParam { + /** ID of the projection command. */ + int cmdId; + /** Content of the projection command. */ + byte[] buf; +}; + +/** + * @brief 定义STA信息. + * + * @since 3.2 + * @version 1.1 + */ +struct WifiStationInfo { + /** Receive (RX) rate. */ + unsigned int rxRate; + /** Transmit (TX) rate. */ + unsigned int txRate; + /** Transmission type. */ + unsigned int flags; + /** RX Very High Throughput Modulation and Coding Scheme (VHT-MCS) configuration. */ + unsigned char rxVhtmcs; + /** TX VHT-MCS configuration. */ + unsigned char txVhtmcs; + /** RX Modulation and Coding Scheme (MCS) index. */ + unsigned char rxMcs; + /** TX MCS index. */ + unsigned char txMcs; + /** RX Very High Throughput Number of Spatial Streams (VHT-NSS) configuration. */ + unsigned char rxVhtNss; + /** TX VHT-NSS configuration. */ + unsigned char txVhtNss; +}; + +struct AdjustChannelInfo { + int msgId; + unsigned char chanNumber; + unsigned char bandwidth; + unsigned char switchType; + unsigned char statusCode; +}; + +/** + * @brief 定义Pno扫描网络信息. + * + * @since 4.0 + * @version 1.1 + */ +struct PnoNetwork { + /** whether to scan hidden network. */ + boolean isHidden; + /** Frequencies to scan. */ + int[] freqs; + /** Ssid to scan. */ + struct HdfWifiDriverScanSsid ssid; +}; + +/** + * @brief 定义Pno扫描参数. + * + * @since 4.0 + * @version 1.1 + */ +struct PnoSettings { + /** Minimum 2G Rssi to scan. */ + int min2gRssi; + /** Minimum 5G Rssi to scan. */ + int min5gRssi; + /** Scan interval. */ + int scanIntervalMs; + /** Scan iteration. */ + int scanIterations; + /** Scan network list. */ + struct PnoNetwork[] pnoNetworks; +}; + +/** + * @brief 定义信号轮询信息. + * + * @since 4.0 + * @version 1.1 + */ +struct SignalPollResult { + /** Rssi value in dBM. */ + int currentRssi; + /** Association frequency in MHz. */ + int associatedFreq; + /** Transmission bit rate in Mbps. */ + int txBitrate; + /** Received bit rate in Mbps. */ + int rxBitrate; + /** Noise value in dBM. */ + int currentNoise; + /** Snr value in dB. */ + int currentSnr; + /** Current channel load. */ + int currentChload; + /** Uldelay value in ms. */ + int currentUlDelay; + /** TxBytes value. */ + int currentTxBytes; + /** RxBytes value. */ + int currentRxBytes; + /** TxFailed value. */ + int currentTxFailed; + /** TxPackets value. */ + int currentTxPackets; + /** RxPackets value. */ + int currentRxPackets; +}; +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/wlan/v1_2/BUILD.gn b/zh-cn/device_api/hdi/wlan/v1_2/BUILD.gn new file mode 100644 index 00000000..32e7f0bc --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/v1_2/BUILD.gn @@ -0,0 +1,30 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libwlan_proxy_1.2") { + deps = [] + public_configs = [] + } +} else { + hdi("wlan") { + module_name = "wlan_service" + + sources = [ "IWlanInterface.idl" ] + + language = "c" + subsystem_name = "hdf" + part_name = "drivers_interface_wlan" + } +} diff --git a/zh-cn/device_api/hdi/wlan/v1_2/IWlanInterface.idl b/zh-cn/device_api/hdi/wlan/v1_2/IWlanInterface.idl new file mode 100644 index 00000000..146881e8 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/v1_2/IWlanInterface.idl @@ -0,0 +1,116 @@ +/* + * 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. + */ + +/** + * @file IWlanInterface.idl + * + * @brief 提供API以启用或禁用WLAN热点、扫描热点、连接到WLAN热点或断开与WLAN热点的连接,设置国家代码,并管理网络设备. + * + * @since 4.1 + * @version 1.2 + */ + +package ohos.hdi.wlan.v1_2; + +import ohos.hdi.wlan.v1_1.IWlanInterface; + +interface IWlanInterface extends ohos.hdi.wlan.v1_1.IWlanInterface { + /** + * @brief 获取ap当前带宽. + * + * @param ifName 表示网卡(NIC)名称. + * @param bandwidth ap电流带宽, 1(20M), 2(40M), 4(80M), 8(160M). + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.2 + */ + GetApBandwidth([in] String ifName, [out] unsigned char bandwidth); + + /** + * @brief 重置为出厂mac地址(永久硬件地址). + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.2 + */ + ResetToFactoryMacAddress([in] String ifName); + + /** + * @brief 向驱动程序发送动作帧. + * + * @param ifName 表示网卡(NIC)名称. + * @param freq 表示发送通道频率. + * @param ifName 表示动作帧数据. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.2 + */ + SendActionFrame([in] String ifName, [in] unsigned int freq, [in] unsigned char[] frameData); + + /** + * @brief 寄存器动作帧接收机. + * + * @param ifName 表示网卡(NIC)名称. + * @param txChannel 表示数据匹配操作框架. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.2 + */ + RegisterActionFrameReceiver([in] String ifName, [in] unsigned char[] match); + + /** + * @brief 设置节能管理器模式. + * + * @param ifName 表示网卡(NIC)名称. + * @param frequency 表示连接的ap频率. + * @param mode 表示省电模式,3(启用省电),4(禁用省电). + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.2 + */ + SetPowerSaveMode([in] String ifName, [in] int frequency, [in] int mode); + + /** + * @brief 设置数据包标识标记规则. + * + * @param uid 表示目标应用程序uid. + * @param protocol 表示目标协议类型,tcp/udp. + * @param enable 指示启用/禁用dpi标记规则. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.2 + */ + SetDpiMarkRule([in] int uid, [in] int protocol, [in] int enable); +} +/** @} */ diff --git a/zh-cn/device_api/hdi/wlan/wpa/v1_0/BUILD.gn b/zh-cn/device_api/hdi/wlan/wpa/v1_0/BUILD.gn new file mode 100644 index 00000000..2e583e37 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/wpa/v1_0/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libwpa_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("wpa") { + module_name = "wpa_service" + + sources = [ + "IWpaCallback.idl", + "IWpaInterface.idl", + "WpaTypes.idl", + ] + + language = "c" + subsystem_name = "hdf" + part_name = "drivers_interface_wlan" + } +} diff --git a/zh-cn/device_api/hdi/wlan/wpa/v1_0/IWpaCallback.idl b/zh-cn/device_api/hdi/wlan/wpa/v1_0/IWpaCallback.idl new file mode 100644 index 00000000..02ed37a9 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/wpa/v1_0/IWpaCallback.idl @@ -0,0 +1,352 @@ +/* + * 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. + */ + +/** + * @添加到组 Wpa + * @{ + * + * @brief 定义上层WLAN服务的API接口. + * + * 上层WLAN服务开发人员可根据WLAN模块提供的向上统一接口获取如下能力:建立/关闭WLAN热点,扫描/关联WLAN热点 + * WLAN平台芯片管理,网络数据缓冲的申请、释放、移动等操作,网络设备管理,电源管理等。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IWpaCallback.idl + * + * @brief 提供在wpa请求程序重启时调用的回调,返回扫描结果,并且接收到Netlink消息. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief 定义WLAN模块接口的包路径. + * + * @since 3.2 + * @version 1.0 + */ +package ohos.hdi.wlan.wpa.v1_0; + +import ohos.hdi.wlan.wpa.v1_0.WpaTypes; + +/** + * @brief 定义Wpa模块的回调. + * + * 当wpa客户端重启、热点扫描结束时,或者收到Netlink消息,调用回调以继续后续处理. + * + * @since 4.1 + * @version 1.0 + */ +[callback] interface IWpaCallback { + /** + * 用于表示与此接口上当前连接的断开连接. + * + * @param disconnectParam 表示Disconnect的参数 + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventDisconnected([in] struct HdiWpaDisconnectParam disconnectParam, [in] String ifName); + + /** + * 用于表示来自此接口上当前连接的网络的连接. + * + * @param disconnectParam 表示Connect的参数 + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventConnected([in] struct HdiWpaConnectParam connectParam, [in] String ifName); + + /** + * 用于表示来自此接口上当前BssidChanged网络的BssidChanged. + * + * @param disconnectParam 表示BsidChanged的参数 + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventBssidChanged([in] struct HdiWpaBssidChangedParam bssidChangedParam, [in] String ifName); + + /** + * 用于表示来自此接口上来自当前状态已更改网络的Wpa状态已更改. + * + * @param disconnectParam 表示BsidChanged的参数 + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventStateChanged([in] struct HdiWpaStateChangedParam statechangedParam, [in] String ifName); + + /** + * 用于表示来自此接口上当前Wifi TempDisabled网络的TempDisabled. + * + * @param disconnectParam 表示TempDisabled的参数 + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventTempDisabled([in] struct HdiWpaTempDisabledParam tempDisabledParam, [in] String ifName); + + /** + * 用于表示来自此接口上当前Wifi AssociateReject网络的AssociateReject. + * + * @param disconnectParam 表示AssociateReject的参数 + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventAssociateReject([in] struct HdiWpaAssociateRejectParam associateRejectParam, [in] String ifName); + + /** + * 用于表示来自此接口上当前wifi网络的WPS PBC连接尝试在此接口上重叠. + * + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventWpsOverlap([in] String ifName); + + /** + * 用于表示来自此接口上当前wifi网络尝试进行PBC连接的超时. + * + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventWpsTimeout([in] String ifName); + + /** + * 用于表示来自此接口上当前wifi网络尝试进行PBC连接的超时. + * + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventScanResult([in] HdiWpaRecvScanResultParam recvScanResultParam, [in] String ifName); + /** + * 用于表示示已找到P2P设备. + * + * @param deviceInfoParam 表示找到的设备的参数 + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventDeviceFound([in] struct HdiP2pDeviceInfoParam deviceInfoParam, [in] String ifName); + + /** + * 用于表示P2P设备已丢失. + * + * @param deviceLostParam 表示丢失设备的参数 + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventDeviceLost([in] struct HdiP2pDeviceLostParam deviceLostParam, [in] String ifName); + + /** + * 用于表示接收到P2P Group Owner协商请求. + * + * @param goNegotiationRequestParam 启动GO的设备的MAC地址协商请求. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventGoNegotiationRequest([in] struct HdiP2pGoNegotiationRequestParam goNegotiationRequestParam, + [in] String ifName); + + /** + * 用于表示P2P Group Owner协商请求完成. + * + * @param goNegotiationCompletedParam GO协商状态. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventGoNegotiationCompleted([in] struct HdiP2pGoNegotiationCompletedParam goNegotiationCompletedParam, + [in] String ifName); + + /** + * 用于表示接收到P2P邀请. + * + * @param invitationReceivedParam 表示邀请ReceivedParam的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventInvitationReceived([in] struct HdiP2pInvitationReceivedParam invitationReceivedParam, + [in] String ifName); + + /** + * 用于表示P2P邀请请求的结果. + * + * @param invitationResultParam 表示邀请结果的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventInvitationResult([in] struct HdiP2pInvitationResultParam invitationResultParam, + [in] String ifName); + + /** + * 用于表示成功组建P2P组. + * + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventGroupFormationSuccess([in] String ifName); + + /** + * 用于表示组建P2P组失败. + * + * @param reason 表示建组失败的原因. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventGroupFormationFailure([in] String reason, [in] String ifName); + + /** + * 用于表示P2P建组开始. + * + * @param groupStartedParam 表示已启动组的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventGroupStarted([in] struct HdiP2pGroupStartedParam groupStartedParam, [in] String ifName); + + /** + * 用于表示删除P2P组. + * + * @param groupRemovedParam 表示已删除组的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventGroupRemoved([in] struct HdiP2pGroupRemovedParam groupRemovedParam, [in] String ifName); + + /** + * 用于表示P2P提供发现请求完成. + * + * @param provisionDiscoveryCompletedParam 表示配置发现已完成的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventProvisionDiscoveryCompleted([in] struct HdiP2pProvisionDiscoveryCompletedParam + provisionDiscoveryCompletedParam, [in] String ifName); + + /** + * 用于表示P2P查找操作的终止. + * + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventFindStopped([in] String ifName); + + /** + * 用于表示P2P服务发现的请求. + * + * @param servDiscReqInfoParam 表示服务发现请求的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventServDiscReq([in] struct HdiP2pServDiscReqInfoParam servDiscReqInfoParam, [in] String ifName); + + /** + * 用于表示接收到P2P服务发现响应. + * + * @param servDiscRespParam 表示服务发现响应的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventServDiscResp([in] struct HdiP2pServDiscRespParam servDiscRespParam, [in] String ifName); + + /** + * 用于表示STA设备何时连接或断开与该设备的连接. + * + * @param staConnectStateParam 表示Sta连接状态的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventStaConnectState([in] struct HdiP2pStaConnectStateParam staConnectStateParam, [in] String ifName); + + /** + * 用于表示创建Iface的时间. + * + * @param ifaceCreatedParam 表示Iface创建的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventIfaceCreated([in] struct HdiP2pIfaceCreatedParam ifaceCreatedParam, [in] String ifName); + + /** + * 用于表示STA认证拒绝 + * + * @param authRejectParam 表示身份验证拒绝的参数. + * @param ifName 表示网卡(NIC)名称. + * + * @since 4.1 + * @version 1.0 + */ + OnEventAuthReject([in] struct HdiWpaAuthRejectParam authRejectParam, [in] String ifName); + + /** + * 用于处理STA回调参数 + * + * @param notifyParam 表示Sta的参数. + * @param cmd 表示WifiHal对Sta的命令. + * + * @since 4.1 + * @version 1.0 + */ + OnEventStaNotify([in] String notifyParam, [in] String ifName); +} \ No newline at end of file diff --git a/zh-cn/device_api/hdi/wlan/wpa/v1_0/IWpaInterface.idl b/zh-cn/device_api/hdi/wlan/wpa/v1_0/IWpaInterface.idl new file mode 100644 index 00000000..e05f595a --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/wpa/v1_0/IWpaInterface.idl @@ -0,0 +1,1173 @@ +/* + * 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. + */ + +/** + * @添加到组 Wpa + * @{ + * + * @brief 定义上层WLAN服务的API接口. + * + * 您可以使用API启用或禁用WLAN热点、扫描热点、连接到WLAN热点,管理WLAN芯片、网络设备和电源,并申请、释放和移动网络数据缓冲区. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IWpaInterface.idl + * + * @brief 提供API以启用或禁用WLAN热点、扫描热点、连接到WLAN热点或断开与WLAN热点的连接,设置国家代码,并管理网络设备. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief 定义Wpa模块接口的包路径. + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.wlan.wpa.v1_0; + +import ohos.hdi.wlan.wpa.v1_0.WpaTypes; +import ohos.hdi.wlan.wpa.v1_0.IWpaCallback; + +/** + * @brief 定义上层WLAN服务的接口. + * + * @since 4.1 + * @version 1.0 + */ + + interface IWpaInterface { + /** + * @brief 在HAL和wpa请求端之间创建一个通道,并获取驱动程序网络接口卡(NIC)信息,此函数必须在创建IWiFi实例之后调用. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + Start(); + + /** + * @brief 销毁HAL和wpa请求者之间的通道。此函数必须在IWiFi实例销毁之前调用. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + Stop(); + + /** + * @brief 在wpa请求方中添加接口. + * + * @param ifName 表示需要添加的接口(如:wlan0或wlan2). + * @param confName 表示配置文件(例如:/data/service/el1/public/wifi/wpa_ppliet/wpa_pplicant.conf). + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + AddWpaIface([in] String ifName, [in] String confName); + + /** + * @brief 删除wpa请求方中的接口. + * + * @param ifName 表示需要删除的接口(例如:wlan0或wlan2). + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + RemoveWpaIface([in] String ifName); + + /** + * @brief 在wpa请求方中扫描. + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + Scan([in] String ifName); + + /** + * @brief wpa请求方中的扫描结果. + * + * @param ifName 表示网卡(NIC)名称. + * @param resultBuf 表示已获得扫描结果. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + ScanResult([in] String ifName, [out] unsigned char[] resultBuf); + + /** + * @brief 在wpa请求方中添加网络. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示添加的网络ID. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + AddNetwork([in] String ifName, [out] int networkId); + + /** + * @brief 删除wpa请求方中的网络. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示要删除的网络ID. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + RemoveNetwork([in] String ifName, [in] int networkId); + + /** + * @brief 禁用wpa请求方中的网络. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示要禁用的网络ID. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + DisableNetwork([in] String ifName, [in] int networkId); + + /** + * @brief 在wpa请求方中设置网络. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示要设置的网络ID + * @param name 表示要设置的名称 + * @param value 表示要设置的值 + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetNetwork([in] String ifName, [in] int networkId, [in] String name, [in] String value); + + /** + * @brief wpa请求方中的网络列表. + * + * @param ifName 表示网卡(NIC)名称. + * @param mode 表示已获取wifi网络信息. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + ListNetworks([in] String ifName, [out] struct HdiWifiWpaNetworkInfo[] networkInfo); + + /** + * @brief 在wpa请求方中选择网络. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示网络ID选择. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SelectNetwork([in] String ifName, [in] int networkId); + + /** + * @brief 在wpa请求方中启用网络. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示待启动的网络ID. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + EnableNetwork([in] String ifName, [in] int networkId); + + /** + * @brief wpa请求方重新连接网络. + * + * @param ifName 表示网卡(NIC)名称. + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + Reconnect([in] String ifName); + + /** + * @brief wpa请求方中断开连接. + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + Disconnect([in] String ifName); + + /** + * @brief 保存wpa请求方配置. + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SaveConfig([in] String ifName); + + /** + * @brief 在wpa请求方中设置PowerSave. + * + * @param ifName 表示网卡(NIC)名称. + * @param enable 表示是否设置powerSave . + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetPowerSave([in] String ifName, [in] int enable); + + /** + * @brief wpa请求方中的自动连接. + * + * @param ifName 表示网卡(NIC)名称. + * @param enable 表示是否自动连接 . + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + AutoConnect([in] String ifName, [in] int enable); + + /** + * @brief 获取wpa请求方Wifi状态. + * + * @param ifName 表示网卡(NIC)名称. + * @param mode 表示已获得wifi状态. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + WifiStatus([in] String ifName, [out] struct HdiWpaCmdStatus wifiStatus); + + /** + * @brief 设置wpa请求方WpsPbcMode. + * + * @param ifName 表示网卡(NIC)名称. + * @param wpsParam 表示已获得wifi状态. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + WpsPbcMode([in] String ifName, [in] struct HdiWifiWpsParam wpsParam); + + /** + * @brief 设置wpa请求方Wifi状态. + * + * @param ifName 表示网卡(NIC)名称. + * @param wpsParam 表示已获得wifi状态. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + WpsPinMode([in] String ifName, [in] struct HdiWifiWpsParam wpsParam, [out] int pinCode); + + /** + * @brief 取消wpa请求程序中的Wps. + * + * @param ifName 表示网卡(NIC)名称. + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + WpsCancel([in] String ifName); + + /** + * @brief 获取wpa请求方国家码. + * + * @param ifName 表示网卡(NIC)名称. + * @param countrycode 表示获得的国家码. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetCountryCode([in] String ifName, [out] String countrycode); + + /** + * @brief 获取wpa请求方网络. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示参数的网络ID + * @param param 表示参数 + * @param value 表示获得的值. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetNetwork([in] String ifName, [in] int networkId, [in] String param, [out] String value); + + /** + * @brief 清除wpa请求方的黑名单. + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + BlocklistClear([in] String ifName); + + /** + * @brief 设置wpa请求方的SuspendMode. + * + * @param ifName 表示网卡(NIC)名称. + * @param mode 表示设置挂起 . + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetSuspendMode([in] String ifName, [in] int mode); + + /** + * @brief 注册回调以侦听异步事件. + * + * @param cbFunc 表示要注册的回调. + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + RegisterEventCallback([in] IWpaCallback cbFunc, [in] String ifName); + + /** + * @brief 销毁注回调. + * + * @param cbFunc 表示要注销的回调. + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + UnregisterEventCallback([in] IWpaCallback cbFunc, [in] String ifName); + + /** + * @brief 获取wpa请求方中的连接能力. + * + * @param ifName 表示网卡(NIC)名称. + * @param connectionCap 表示获取到的connectionCap. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetConnectionCapabilities([in] String ifName, [out] struct ConnectionCapabilities connectionCap); + + /** + * @brief 获取是否为此网络发送探测请求(隐藏). + * + * @param ifName 表示网卡(NIC)名称. + * @param enabled 如果设置,则为true,否则为false. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetScanSsid([in] String ifName, [out] int enable); + + /** + * @brief Get passphrase in wpa supplicant. + * + * @param ifName 表示网卡(NIC)名称. + * @param psk 表示设置psk的值. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetPskPassphrase([in] String ifName, [out] String psk); + + /** + * @brief 获取wpa请求方的原始psk. + * + * @param ifName 表示网卡(NIC)名称. + * @param psk 表示psk值集. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetPsk([in] String ifName, [out] unsigned char[] psk); + + /** + * @brief 获取wpa请求方WEP密钥. + * + * @param ifName 表示网卡(NIC)名称. + * @param keyIdx 要提取的wep密钥的索引 + * @param wepKey wep键值集. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetWepKey([in] String ifName, [in] int keyIdx, [out] unsigned char[] wepKey); + + /** + * @brief 获取wpa请求方的默认Tx密钥索引. + * + * @param ifName 表示网卡(NIC)名称. + * @param keyIdx 表示keyIdx的值集. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetWepTxKeyIdx([in] String ifName, [out] int keyIdx); + + /** + * @brief 获取是否为此网络启用RequirePmf. + * + * @param ifName 表示网卡(NIC)名称. + * @param enabled 如果设置,则为true,否则为false. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + GetRequirePmf([in] String ifName, [out] int enable); + + /** + * @brief 设置wpa请求方国家码. + * + * @param ifName 表示网卡(NIC)名称. + * @param countrycode 表示要设置的国家码 + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + SetCountryCode([in] String ifName,[in] String countrycode); + + /** + * 设置要用于P2P SSID的后缀. + * + * @param ifName 表示网卡(NIC)名称. + * @param name 表示要挂到SSID的字符串. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + */ + P2pSetSsidPostfixName([in] String ifName, [in] String name); + + /** + * @brief 为p2p设置Wps设备类型. + * + * @param ifName 表示网卡(NIC)名称. + * @param type 表示wpa设备类型. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetWpsDeviceType([in] String ifName, [in] String type); + + /** + * @brief set Wps config methods for p2p. + * + * @param ifName 表示网卡(NIC)名称. + * @param methods 表示参数的Wps配置方法. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetWpsConfigMethods([in] String ifName, [in] String methods); + + /** + * @brief P2P组的最大空闲时间(以秒为单位). + * + * @param ifName 表示网卡(NIC)名称. + * @param time 表示参数的最大空闲时间. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetGroupMaxIdle([in] String ifName, [in] int time); + + /** + * @brief 启用/禁用对等网络的Wifi显示. + * + * @param ifName 表示网卡(NIC)名称. + * @param enable 1启用,0禁用. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetWfdEnable([in] String ifName, [in] int enable); + + /** + * @brief 为p2p设置永久重新连接. + * + * @param ifName 表示网卡(NIC)名称. + * @param status 表示参数的“永久重新连接”状态. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetPersistentReconnect([in] String ifName, [in] int status); + + /** + * @brief 为p2p设置Wps辅助设备类型. + * + * @param ifName 表示网卡(NIC)名称. + * @param type 表示参数的wpa辅助设备类型. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetWpsSecondaryDeviceType([in] String ifName, [in] String type); + + /** + * @brief 为p2p设置Wps-pbc. + * + * @param ifName 表示网卡(NIC)名称. + * @param address 表示参数的AP的BSSID. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetupWpsPbc([in] String ifName, [in] String address); + + /** + * @brief 为p2p设置Wps引脚. + * + * @param ifName 表示网卡(NIC)名称. + * @param address 表示参数的AP的BSSID. + * @param pin 要使用的8位引脚. + * @param result 表示操作的状态. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetupWpsPin([in] String ifName, [in] String address, [in] String pin, [out] String result); + + /** + * @brief 打开/关闭接口的省电模式. + * + * @param ifName 表示网卡(NIC)名称. + * @param enable 表示是否要打开/关闭节能. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + */ + P2pSetPowerSave([in] String ifName, [in] int enable); + + /** + * @brief Set Device Name for p2p. + * + * @param ifName 表示网卡(NIC)名称. + * @param name 表示参数的设备名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetDeviceName([in] String ifName, [in] String name); + + /** + * @brief 为p2p设置Wifi显示设备配置. + * + * @param ifName 表示网卡(NIC)名称. + * @param config 表示参数的设备配置. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetWfdDeviceConfig([in] String ifName, [in] String config); + + /** + * @brief 为p2p设置随机MAC. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示网络ID启用. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetRandomMac([in] String ifName, [in] int networkId); + + /** + * @brief 启动p2p查找. + * + * @param ifName 表示网卡(NIC)名称. + * @param timeout 表示执行查找所用的最长时间. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pStartFind([in] String ifName, [in] int timeout); + + /** + * @brief 为p2p配置扩展监听定时. + * + * @param ifName 表示网卡(NIC)名称. + * @param enable 表示是否启用. + * @param period 表示周期(以毫秒为单位). + * @param enable 表示间隔(以毫秒为单位). + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetExtListen([in] String ifName, [in] int enable, [in] int period, [in] int interval); + + /** + * @brief 设置P2P监听通道. + * + * @param ifName 表示网卡(NIC)名称. + * @param channel 表示Wifi信道. + * @param regClass 表示此BSSID指示的AP的信道集. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetListenChannel([in] String ifName, [in] int channel, [in] int regClass); + + /** + * @brief 向指定的对等方发送P2P供应发现请求. + * + * @param ifName 表示网卡(NIC)名称. + * @param peerBssid 表示要发送发现的设备的MAC地址. + * @param mode 指示参数的设置模式. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pProvisionDiscovery([in] String ifName, [in] String peerBssid, [in] int mode); + + /** + * @brief 手动设置P2P组所有者. + * + * @param ifName 表示网卡(NIC)名称. + * @param isPersistent 表示用于请求组成持久组. + * @param networkId 表示网络ID启用. + * @param freq 表示p2p组的频率. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pAddGroup([in] String ifName, [in] int isPersistent, [in] int networkId, [in] int freq); + + /** + * @brief 为p2p添加服务. + * + * @param ifName 表示网卡(NIC)名称. + * @param info 表示P2p服务信息. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pAddService([in] String ifName, [in] struct HdiP2pServiceInfo info); + + /** + * @brief 删除p2p服务. + * + * @param ifName 表示网卡(NIC)名称. + * @param info 表示P2p服务信息. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pRemoveService([in] String ifName, [in] struct HdiP2pServiceInfo info); + + /** + * @brief 停止正在进行的P2P服务发现. + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pStopFind([in] String ifName); + + /** + * @brief 刷新P2P设备表和状态. + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pFlush([in] String ifName); + + /** + * @brief 此命令可用于从设备中清除所有服务. + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pFlushService([in] String ifName); + + /** + * @brief 删除p2p网络. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示网络ID启用. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pRemoveNetwork([in] String ifName, [in] int networkId); + + /** + * @brief 为p2p设置组配置. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示网络ID启用. + * @param name 表示参数的组配置名称. + * @param value 表示参数的组配置值. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetGroupConfig([in] String ifName, [in] int networkId, [in] String name, [in] String value); + + /** + * @brief 为p2p设置组配置. + * + * @param ifName 表示网卡(NIC)名称. + * @param peerAddress 要邀请的设备的MAC地址. + * @param goBssid 组所有者设备的MAC地址. + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pInvite([in] String ifName, [in] String peerBssid, [in] String goBssid); + + /** + * @brief 重新为p2p设置组配置. + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示网络ID启用. + * @param bssid 要重新配置的设备的MAC地址. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pReinvoke([in] String ifName, [in] int networkId,[in] String bssid); + + /** + * @brief 获取设备地址. + * + * @param ifName 表示网卡(NIC)名称. + * @param deviceAddress 表示设备地址信息. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pGetDeviceAddress([in] String ifName, [out] String deviceAddress); + + /** + * @brief 安排P2P服务发现请求. + * + * @param ifName 表示网卡(NIC)名称. + * @param reqService 表示对等设备的设备mac地址. + * @param replyDisc 表示服务发现序列. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pReqServiceDiscovery([in] String ifName, [in] struct HdiP2pReqService reqService,[out] String replyDisc); + + /** + * @brief 取消以前的服务发现请求. + * + * @param ifName 表示网卡(NIC)名称. + * @param id 取消请求的ID. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pCancelServiceDiscovery([in] String ifName, [in] String id); + + /** + * @brief p2p服务器发现的resp + * + * @param ifName 表示网卡(NIC)名称. + * @param info 表示服务器发现的响应信息. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pRespServerDiscovery([in] String ifName, [in] struct HdiP2pServDiscReqInfo info); + + /** + * @brief 使用已发现的P2P队,开始P2P建连. + * + * @param ifName 表示网卡(NIC)名称. + * @param info 表示要连接的设备的所有消息. + * @param replyPin 生成Pin,如果|provisionMethod|使用生成的|Pin*|方法之一. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pConnect([in] String ifName, [in] struct HdiP2pConnectInfo info, [out] String replyPin); + + /** + * @brief 使用已发现的P2P队,开始P2P建连. + * + * @param ifName 表示网卡(NIC)名称. + * @param info 表示要连接的设备的所有消息. + * @param replyPin 生成Pin,如果|provisionMethod|使用生成的|Pin*|方法之一. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pHid2dConnect([in] String ifName, [in] struct HdiHid2dConnectInfo info); + + /** + * @brief 为p2p设置服务发现模式 + * + * @param ifName 表示网卡(NIC)名称. + * @param mode 指示参数的服务发现模式. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSetServDiscExternal([in] String ifName, [in] int mode); + + /** + * @brief 为p2p删除组 + * + * @param ifName 表示网卡(NIC)名称. + * @param groupName 表示p2p的组名. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pRemoveGroup([in] String ifName, [in] String groupName); + + /** + * @brief 取消p2p连接 + * + * @param ifName 表示网卡(NIC)名称. + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pCancelConnect([in] String ifName); + + /** + * @brief 获取p2p的组配置 + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示网络ID启用. + * @param param 表示组配置名称. + * @param value 表示组配置值. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pGetGroupConfig([in] String ifName, [in] int networkId, [in] String param, [out] String value); + + /** + * @brief 为p2p添加网络 + * + * @param ifName 表示网卡(NIC)名称. + * @param networkId 表示网络ID启用. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pAddNetwork([in] String ifName, [out] int networkId); + + /** + * @brief 获取设备所属组的功能. + * + * @param ifName 表示网卡(NIC)名称. + * @param bssid 表示对等方的MAC地址. + * @param info 表示用于保存设备信息的结构体. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pGetPeer([in] String ifName, [in] String bssid, [out] struct HdiP2pDeviceInfo info); + + /** + * @brief 获取设备所属组的功能. + * + * @param ifName 表示网卡(NIC)名称. + * @param bssid 表示对等方的MAC地址. + * @param cap 表示功能掩码|P2pGroupCapabilityMmask|值的组合. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pGetGroupCapability([in] String ifName, [in] String bssid, [out] int cap); + + /** + * @brief 列出所有网络信息. + * + * @param ifName 表示网卡(NIC)名称. + * @param infoList 表示用于保存网络信息的结构体. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pListNetworks([in] String ifName, [out] struct HdiP2pNetworkList infoList); + + /** + * @brief 为p2p保存配置. + * + * @param ifName 表示网卡(NIC)名称. + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + P2pSaveConfig([in] String ifName); + + /** + * @brief 重新关联wpa请求者. + * + * @param ifName 表示网卡(NIC)名称. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + Reassociate([in] String ifName); + + /** + * @brief Wpa请求者STA CMD. + * + * @param ifName 表示网卡(NIC)名称. + * @param cmd 表示WifiHal对Sta的命令 + * 示例:如果CMD为“SET external_sim 1”,则最终结果是“externalsim=1”. + * + * @return 返回值 如果操作成功,则返回0. + * @return 返回值 如果操作失败,则为负值. + * + * @since 4.1 + * @version 1.0 + */ + StaShellCmd([in] String ifName, [in] String cmd); + } \ No newline at end of file diff --git a/zh-cn/device_api/hdi/wlan/wpa/v1_0/WpaTypes.idl b/zh-cn/device_api/hdi/wlan/wpa/v1_0/WpaTypes.idl new file mode 100644 index 00000000..b8381ad4 --- /dev/null +++ b/zh-cn/device_api/hdi/wlan/wpa/v1_0/WpaTypes.idl @@ -0,0 +1,464 @@ +/* + * 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. + */ + +/** + * @添加到组 Wpa + * @{ + * + * @brief 定义上层WLAN服务的API接口. + * + * 您可以使用API启用或禁用WLAN热点、扫描热点、连接到WLAN热点,管理WLAN芯片、网络设备和电源,并申请、释放和移动网络数据缓冲区. + * + * @since 4.1 + * @version 1.0 + */ + + /** + * @file WpaTypes.idl + * + * @brief 定义与WLAN模块相关的数据类型. + * + * WLAN模块数据包括{@code-Feature}对象信息、站(STA)信息等,扫描信息和网络设备信息. + * + * @since 4.1 + * @version 1.0 + */ + +/** + * @brief 定义WLAN模块接口的包路径. + * + * @since 4.1 + * @version 1.0 + */ +package ohos.hdi.wlan.wpa.v1_0; + +/** + * @brief 定义{@code Feature}对象信息. + * + * @since 4.1 + * @version 1.0 + */ +struct HdiFeatureInfo { + /** NIC name of the {@code Feature} object. */ + String ifName; + /** {@code Feature} object. */ + int type; +}; + +/** + * @brief 定义Wi-Fi的Wifi状态信息. + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWifiStatus { + /** 要扫描的基本服务集标识符(BSSID). */ + unsigned char[] bssid; + int freq; + /** SSID to scan. */ + String ssid; + /** Length of the SSID. */ + int ssidLen; + String keyMgmt; + int keyMgmtLen; + unsigned char[] address; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWifiWpaNetworkInfo { + int id; + unsigned char[] ssid; + unsigned char[] bssid; + unsigned char[] flags; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWifiWpsParam { + int anyFlag; + int multiAp; + unsigned char[] bssid; + unsigned char[] pinCode; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaCmdStatus { + unsigned char[] bssid; + int freq; + unsigned char[] ssid; + int id; + unsigned char[] keyMgmt; + unsigned char[] address; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaDisconnectParam { + unsigned char[] bssid; + int reasonCode; + int locallyGenerated; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaConnectParam { + unsigned char[] bssid; + int networkId; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaBssidChangedParam { + unsigned char[] bssid; + unsigned char[] reason; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaStateChangedParam { + int status; + unsigned char[] bssid; + int networkId; + unsigned char[] ssid; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaTempDisabledParam { + int networkId; + unsigned char[] ssid; + int authFailures; + int duration; + unsigned char[] reason; +}; + +/** + * @brief 定义Wi-Fi的Wpa状态信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaAssociateRejectParam { + unsigned char[] bssid; + int statusCode; + int timeOut; +}; + +/** + * @brief 定义Wi-Fi的接收扫描结构信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaRecvScanResultParam { + unsigned int scanId; +}; + +/** + * @brief 枚举Wifi技术 + */ +enum WifiTechnology { + UNKNOWN_TECHNOLOGY = 0, + /** + * For 802.11a/b/g + */ + LEGACY = 1, + /** + * For 802.11n + */ + HT = 2, + /** + * For 802.11ac + */ + VHT = 3, + /** + * For 802.11ax + */ + HE = 4, +}; + +/** + * @brief 枚举通道工作宽度(以Mhz为单位). + */ +enum WifiChannelWidthInMhz { + WIDTH_20 = 0, + WIDTH_40 = 1, + WIDTH_80 = 2, + WIDTH_160 = 3, + WIDTH_80P80 = 4, + WIDTH_5 = 5, + WIDTH_10 = 6, + WIDTH_INVALID = -1 +}; + +/** + *@brief 枚举传统网络的详细网络模式 + */ +enum LegacyMode { + UNKNOWN_MODE = 0, + /** + * For 802.11a + */ + A_MODE = 1, + /** + * For 802.11b + */ + B_MODE = 2, + /** + * For 802.11g + */ + G_MODE = 3, +}; + +/** + * 当前网络和设备支持的连接功能 + */ +struct ConnectionCapabilities { + /** + * Wifi技术 + */ + WifiTechnology technology; + /** + * 信道带宽 + */ + WifiChannelWidthInMhz channelBandwidth; + /** + * Tx空间流的最大数量 + */ + int maxNumberTxSpatialStreams; + /** + * Rx空间流的最大数量 + */ + int maxNumberRxSpatialStreams; + /** + * 遗留网络的详细网络模式 + */ + LegacyMode legacyMode; +}; + +/** + * @brief 定义Wi-Fi的p2p网络信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiP2pNetworkInfo { + int id; + unsigned char[] ssid; + unsigned char[] bssid; + unsigned char[] flags; +}; + +/** + * @brief 定义Wi-Fi的p2p网络列表 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiP2pNetworkList { + int infoNum; + struct HdiP2pNetworkInfo[] infos; +}; + +/** + * @brief 定义Wi-Fi的P2p设备信息 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiP2pDeviceInfo { + unsigned char[] srcAddress; + unsigned char[] p2pDeviceAddress; + unsigned char[] primaryDeviceType; + unsigned char[] deviceName; + int configMethods; + int deviceCapabilities; + int groupCapabilities; + unsigned char[] wfdDeviceInfo; + unsigned int wfdLength; + unsigned char[] operSsid; +}; + +struct HdiP2pServiceInfo { + int mode; /* 0/1, upnp/bonjour */ + int version; + unsigned char[] name; + unsigned char[] query; + unsigned char[] resp; +}; + +struct HdiP2pReqService { + unsigned char[] bssid; + unsigned char[] msg; +}; + +struct HdiP2pServDiscReqInfo { + int freq; + int dialogToken; + int updateIndic; + unsigned char[] mac; + unsigned char[] tlvs; +}; + +struct HdiHid2dConnectInfo { + unsigned char[] ssid; + unsigned char[] bssid; + unsigned char[] passphrase; + int frequency; +}; +struct HdiP2pConnectInfo { + int persistent; /* |persistent=] */ + int mode; /* [join|auth] */ + int goIntent; /* [go_intent=<0..15>] */ + int provdisc; /* [provdisc] */ + unsigned char[] peerDevAddr; + unsigned char[] pin; /* */ +}; + +struct HdiP2pDeviceInfoParam { + unsigned char[] srcAddress; + unsigned char[] p2pDeviceAddress; + unsigned char[] primaryDeviceType; + unsigned char[] deviceName; + int configMethods; + int deviceCapabilities; + int groupCapabilities; + unsigned char[] wfdDeviceInfo; + unsigned int wfdLength; + unsigned char[] operSsid; +}; + +struct HdiP2pDeviceLostParam { + unsigned char[] p2pDeviceAddress; + int networkId; +}; + +struct HdiP2pGoNegotiationRequestParam { + unsigned char[] srcAddress; + int passwordId; +}; + +struct HdiP2pGoNegotiationCompletedParam { + int status; +}; + +struct HdiP2pInvitationReceivedParam { + int type; /* 0:Received, 1:Accepted */ + int persistentNetworkId; + int operatingFrequency; + unsigned char[] srcAddress; + unsigned char[] goDeviceAddress; + unsigned char[] bssid; +}; + +struct HdiP2pInvitationResultParam { + int status; + unsigned char[] bssid; +}; + +struct HdiP2pGroupStartedParam { + int isGo; + int isPersistent; + int frequency; + unsigned char[] groupIfName; + unsigned char[] ssid; + unsigned char[] psk; + unsigned char[] passphrase; + unsigned char[] goDeviceAddress; +}; + +struct HdiP2pGroupRemovedParam { + int isGo; + unsigned char[] groupIfName; +}; + +struct HdiP2pProvisionDiscoveryCompletedParam { + int isRequest; + int provDiscStatusCode; + int configMethods; + unsigned char[] p2pDeviceAddress; + unsigned char[] generatedPin; +}; + +struct HdiP2pServDiscReqInfoParam { + int freq; + int dialogToken; + int updateIndic; + unsigned char[] mac; + unsigned char[] tlvs; +}; + +struct HdiP2pServDiscRespParam { + int updateIndicator; + unsigned char[] srcAddress; + unsigned char[] tlvs; +}; + +struct HdiP2pStaConnectStateParam { + int state; + unsigned char[] srcAddress; + unsigned char[] p2pDeviceAddress; +}; + +struct HdiP2pIfaceCreatedParam { + int isGo; +}; + +/** + * @brief STA认证拒绝参数 + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaAuthRejectParam { + unsigned char[] bssid; + unsigned short authType; + unsigned short authTransaction; + unsigned short statusCode; +}; \ No newline at end of file -- Gitee From 8065286600b9b3b87e59475d2b2c17b801a336b4 Mon Sep 17 00:00:00 2001 From: yan-shuifeng Date: Thu, 8 Feb 2024 15:12:34 +0800 Subject: [PATCH 0262/2135] update arkui native interface defines Signed-off-by: yan-shuifeng --- zh-cn/native_sdk/ace/native_node.h | 831 +++++++++++++++++++---------- zh-cn/native_sdk/ace/native_type.h | 89 ++- 2 files changed, 619 insertions(+), 301 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 4a9fd523..03e98696 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -447,27 +447,38 @@ typedef enum { /** * @brief 设置组件颜色渐变效果,支持属性设置,属性重置和属性获取接口。 * - * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .string: 字符串组合参数,入参4个,以分号分割:\n - * 入参1: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。颜色和位置(单位vp)数组类型,以逗号分割;\n - * 入参2: 线性渐变的起始角度。0点方向顺时针旋转为正向角度,默认值:180;\n - * 入参3: - * 线性渐变的方向,设置angle后不生效。取值("left","top","right","bottom","left-top","left-bottom","right-top",\n - * "right-bottom","none", 默认值 "bottom");\n - * 入参4: 为渐变的颜色重复着色,默认值 false;\n - * 如 "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" 。 - * \n - * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * * .string: 字符串组合参数,入参4个,以分号分割:\n - * 入参1: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。颜色和位置(单位vp)数组类型,以逗号分割;\n - * 入参2: 线性渐变的起始角度。0点方向顺时针旋转为正向角度;\n - * 入参3: 线性渐变的方向,设置angle后不生效;\n - * 入参4: 为渐变的颜色重复着色。\n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" }; + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32: 线性渐变的起始角度。0点方向顺时针旋转为正向角度,默认值:180; \n + * .value[1].i32:线性渐变的方向,设置angle后不生效。取值("left","top","right","bottom","left-top","left-bottom","right-top", \n + * "right-bottom","none", 默认值 "bottom"); \n + * .value[2].u32: 为渐变的颜色重复着色,默认值 false;如 "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" 。 \n + * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n + * colors:渐变色颜色颜色。 \n + * stops:渐变位置。 \n + * size:颜色个数。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 线性渐变的起始角度。0点方向顺时针旋转为正向角度,默认值:180;\n + * .value[1].i32:线性渐变的方向,设置angle后不生效。\n + * .value[0].u32: 为渐变的颜色重复着色,默认值 false;\n + * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n + * colors:渐变色颜色颜色。 \n + * stops:渐变位置。 \n + * size:颜色个数。 \n + * @code {.cpp} + * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; + * float stops[] = { 0.0, 0.5 }; + * ArkUIColorStop colorStop = { colors, stops, 2 }; + * ArkUI_ColorStop* ptr = &colorStop; + * ArkUI_NumberValue value[] = {{ .f32 = 60 } , { .i32 = left } , { .i32 = true }}; + * ArkUI_AttributeItem item = + * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LINEAR_GRADIENT, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LINEAR_GRADIENT); - * auto nodeLinearGradient = item->string; + * auto nodeLinearGradientStartAngel = item->value[0]; + * auto nodeLinearGradientDirection = item->value[1]; + * auto nodeLinearGradientFill = item->value[2]; + * auto nodeLinearGradientColorStop = item->object; * @endcode * */ @@ -701,29 +712,62 @@ typedef enum { */ NODE_CLIP, /** - * @brief 组件进行裁剪、遮罩处理属性,支持属性设置,属性重置和属性获取接口。 - * - * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n - * .string:形状描述,可选: \n - * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n - * "circle(10,10)"括号内分别为width、height; \n - * "ellipse(10,10)"括号内分别为width、height; \n - * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n - * \n - * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .string:形状描述: \n - * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n - * "circle(10,10)"括号内分别为width、height; \n - * "ellipse(10,10)"括号内分别为width、height; \n - * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * @brief 组件上指定形状的裁剪,支持属性设置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式,共有5种类型: \n + * 1.rect类型: \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_RECT; \n + * .value[1].f32:矩形宽度; \n + * .value[2].f32:矩形高度; \n + * .value[3].f32:矩形圆角宽度; \n + * .value[4].f32:矩形圆角高度; \n + * 2.circle类型: \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_CIRCLE; \n + * .value[1].f32:圆形宽度; \n + * .value[2].f32:圆形高度; \n + * 3.ellipse类型: \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_ELLIPSE; \n + * .value[1].f32:椭圆形宽度; \n + * .value[2].f32:椭圆形高度; \n + * 4.path类型: \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_PATH; \n + * .value[1].f32:路径宽度; \n + * .value[2].f32:路径高度; \n + * .string:路径绘制的命令字符串; \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式,共有5种类型: \n + * 1.rect类型: \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_RECT; \n + * .value[1].f32:矩形宽度; \n + * .value[2].f32:矩形高度; \n + * .value[3].f32:矩形圆角宽度; \n + * .value[4].f32:矩形圆角高度; \n + * 2.circle类型: \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_CIRCLE; \n + * .value[1].f32:圆形宽度; \n + * .value[2].f32:圆形高度; \n + * 3.ellipse类型:: \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_ELLIPSE; \n + * .value[1].f32:椭圆形宽度; \n + * .value[2].f32:椭圆形高度; \n + * 4.path类型: \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_PATH; \n + * .value[1].f32:路径宽度; \n + * .value[2].f32:路径高度; \n + * .string:路径绘制的命令字符串; \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "rect(10,10,10,10)" }; + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = + * { {.i32 = ARKUI_CLIP_TYPE_RECT}, 100, 100, 15, 15, { .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP_SHAPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); - * auto nodeClipShape = item->string; + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP_SHAPE); + * auto nodeClipType = item->value[0].i32; + * auto nodeClipWidth = item->value[1].f32; + * auto nodeClipHeight = item->value[2].f32; + * auto nodeClipRadiusWidth = item->value[3].f32; + * auto nodeClipRadiusHeight = item->value[4].f32; * @endcode * */ @@ -819,31 +863,37 @@ typedef enum { /** * @brief 自定义阴影效果,支持属性设置,属性重置和属性获取接口。 * - * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n - * .string: 字符串组合参数,入参6个,以分号分割: \n - * 入参1:阴影模糊半径。 \n - * 入参2:阴影的X轴偏移量。 \n - * 入参3:阴影的Y轴偏移量。 \n - * 入参4:阴影类型。 \n - * 入参5:阴影的颜色。 \n - * 入参6:阴影是否内部填充。 \n + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.f32:阴影模糊半径,单位为vp;\n + * .value[1]?.i32:是否开启智能取色,0代表不开启,1代表开启,默认不开启;\n + * .value[2]?.f32:阴影X轴偏移量,单位为vp;\n + * .value[3]?.f32:阴影Y轴偏移量,单位为vp;\n + * .value[4]?.i32:阴影类型{@link ArkUI_ShadowType},默认值为ARKUI_SHADOW_TYPE_COLOR;\n + * .value[5]?.u32:阴影颜色,0xargb格式,形如 0xFFFF0000 表示红色;\n + * .value[6]?.u32:阴影是否内部填充,,0表示不填充,1表示填充;\n + * * \n - * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .string: 字符串组合参数,入参6个,以分号分割: \n - * 入参1:阴影模糊半径。 \n - * 入参2:阴影的X轴偏移量。 \n - * 入参3:阴影的Y轴偏移量。 \n - * 入参4:阴影类型。 \n - * 入参5:阴影的颜色。 \n - * 入参6:阴影是否内部填充。 \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32:阴影模糊半径,单位为vp;\n + * .value[1]?.i32:是否开启智能取色;\n + * .value[2].f32:阴影X轴偏移量,单位为vp;\n + * .value[3].f32:阴影Y轴偏移量,单位为vp;\n + * .value[4].i32:阴影类型{@link ArkUI_ShadowType},默认值为ARKUI_SHADOW_TYPE_COLOR;\n + * .value[5].u32:阴影颜色,0xargb格式,形如 0xFFFF0000 表示红色;\n + * .value[6].u32:阴影是否内部填充,,0表示不填充,1表示填充;\n * * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "5; 10; 10; COLOR; #FFF00FFF; true" }; + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = + * { 10, {.i32 = 1},10, 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, {.i32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); - * auto nodeCustomShadow = item->string; + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); + * auto nodeCustomShadowRadius = item->value[0].f32; + * auto nodeCustomShadowOffsetX = item->value[1].f32; + * auto nodeCustomShadowOffsetY = item->value[2].f32; + * auto nodeCustomShadowType = item->value[3].i32; + * auto nodeCustomShadowColor = item->value[4].u32; * @endcode * */ @@ -862,11 +912,11 @@ typedef enum { * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue sizeArray[] = { 20, 0 } + * ArkUI_NumberValue sizeArray[] = { 20, 0 }; * ArkUI_AttributeItem item = { .value = sizeArray, .size = 2}; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); - * auto width = item->value[0].f32; + * auto imageSizeItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); + * auto width = imageSizeItem->value[0].f32; * @endcode * */ @@ -883,11 +933,11 @@ typedef enum { * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue imageSizeStyle[] = { {.i32 = static_cast(ARKUI_IMAGE_SIZE_COVER) } } + * ArkUI_NumberValue imageSizeStyle[] = { {.i32 = static_cast(ARKUI_IMAGE_SIZE_COVER) } }; * ArkUI_AttributeItem item = { .value = imageSizeStyle, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); - * auto blurStyle = item->value[0].i32 + * auto imageSizeStyleItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); + * auto blurStyleValue = imageSizeStyleItem->value[0].i32; * @endcode */ NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, @@ -913,11 +963,11 @@ typedef enum { * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue blurStyle[] = { { .i32 = static_cast(ARKUI_BLUR_STYLE_THICK)}} + * ArkUI_NumberValue blurStyle[] = { { .i32 = static_cast(ARKUI_BLUR_STYLE_THICK)}}; * ArkUI_AttributeItem item = { .value = blurStyle, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); - * auto blurStyle = item->value[0].i32 + * auto blurStyleItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); + * auto blurStyleType = blurStyleItem->value[0].i32; * @endcode * */ @@ -945,8 +995,8 @@ typedef enum { * ArkUI_NumberValue centerPointArray[] = { 20 }; * ArkUI_AttributeItem item = { .value = centerPointArray, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM_CENTER , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM_CENTER); - * auto centerX = item->value[0].f32; + * auto transformCenterItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM_CENTER); + * auto centerX = transformCenterItem->value[0].f32; * @endcode */ NODE_TRANSFORM_CENTER, @@ -978,8 +1028,8 @@ typedef enum { * { .i32 = static_cast(ARKUI_CURVE_EASE_IN_OUT)}}; * ArkUI_AttributeItem item = { .value = opacityTransition, .size = 3}; * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY_TRANSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); - * auto opacity = item->value[0].f32; + * auto opacityTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); + * auto opacity = opacityTransitionItem->value[0].f32; * @endcode */ NODE_OPACITY_TRANSITION, @@ -1019,8 +1069,8 @@ typedef enum { * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; * ArkUI_AttributeItem item = { .value = rotateTransition, .size = 7}; * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE_TRANSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); - * auto rotateX = item->value[0].f32; + * auto rotateTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); + * auto rotateX = rotateTransitionItem->value[0].f32; * @endcode */ NODE_ROTATE_TRANSITION, @@ -1056,8 +1106,8 @@ typedef enum { * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; * ArkUI_AttributeItem item = { .value = scaleTransition, .size = 5}; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE_TRANSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); - * auto scaleX = item->value[0].f32; + * auto scaleTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); + * auto scaleX = scaleTransitionItem->value[0].f32; * @endcode */ NODE_SCALE_TRANSITION, @@ -1093,8 +1143,8 @@ typedef enum { * { .i32 = 3000}, { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; * ArkUI_AttributeItem item = { .value = translateTransition, .size = 5}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); - * auto translateX = item->value[0].f32; + * auto translateTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); + * auto translateX = translateTransitionItem->value[0].f32; * @endcode */ NODE_TRANSLATE_TRANSITION, @@ -1213,32 +1263,48 @@ typedef enum { * @brief 角度渐变效果,支持属性设置,属性重置和属性获取接口。 * * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n - * .string: 字符串组合参数,入参7个,以分号分割: \n - * 入参1:指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。 \n - * 入参2:为角度渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标。 \n - * 入参3:为角度渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标。 \n - * 入参4:角度渐变的起点,默认值0。 \n - * 入参5:角度渐变的终点,默认值0。 \n - * 入参6:角度渐变的旋转角度,默认值0。 \n - * 入参7:为渐变的颜色重复着色,默认值 false。 \n + * .value[0]?.f32:为角度渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标 \n + * .value[1]?.f32:为角度渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标 \n + * .value[2]?.f32:角度渐变的起点,默认值0。 \n + * .value[3]?.f32:角度渐变的终点,默认值0。 \n + * .value[4]?.f32:角度渐变的旋转角度,默认值0。 \n + * .value[5]?.i32:为渐变的颜色重复着色,0表示不重复着色,1表示重复着色 \n + * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n + * colors:渐变色颜色颜色。 \n + * stops:渐变位置。 \n + * size:颜色个数。 \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .string: 字符串组合参数: \n - * 入参1:指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。 \n - * 入参2:为角度渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标。 \n - * 入参3:为角度渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标。 \n - * 入参4:角度渐变的起点,默认值0。 \n - * 入参5:角度渐变的终点,默认值0。 \n - * 入参6:角度渐变的旋转角度,默认值0。 \n - * 入参7:为渐变的颜色重复着色,默认值 false。 \n + * .value[0]?.f32:为角度渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标 \n + * .value[1]?.f32:为角度渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标 \n + * .value[2]?.f32:角度渐变的起点,默认值0。 \n + * .value[3]?.f32:角度渐变的终点,默认值0。 \n + * .value[4]?.f32:角度渐变的旋转角度,默认值0。 \n + * .value[5]?.i32:为渐变的颜色重复着色,0表示不重复着色,1表示重复着色 \n + * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n + * colors:渐变色颜色颜色。 \n + * stops:渐变位置。 \n + * size:颜色个数。 \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;5;10;60;180;60;true" }; + * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; + * float stops[] = { 0.0, 0.5 }; + * ArkUIColorStop colorStop = { colors, stops, 2 }; + * ArkUI_ColorStop* ptr = &colorStop; + * ArkUI_NumberValue value[] = { 50, 50, 60, 180, 180, {.i32 = 1}}; + * ArkUI_AttributeItem item = + * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); - * auto nodeSweepGradient = item->string; + * auto nodeSweepGradientCeneterX = item->value[0]; + * auto nodeSweepGradientCeneterY = item->value[1]; + * auto nodeSweepGradientStart = item->value[2]; + * auto nodeSweepGradientEnd = item->value[3]; + * auto nodeSweepGradientRotation = item->value[4]; + * auto nodeSweepGradientFill = item->value[5]; + * auto nodeSweepGradientColorStop = item->object; * @endcode * */ @@ -1247,28 +1313,42 @@ typedef enum { * @brief 径向渐变渐变效果,支持属性设置,属性重置和属性获取接口。 * * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n - * .string: 字符串组合参数,入5个,以分号分割: \n - * 入参1:指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。 \n - * 入参2:为径向渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标。 \n - * 入参3:为径向渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标。 \n - * 入参4:径向渐变的半径,默认值0。 \n - * 入参5:为渐变的颜色重复着色。 \n + * .value[0]?.f32:为径向渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标 \n + * .value[1]?.f32:为径向渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标 \n + * .value[2]?.f32:径向渐变的半径,默认值0。 \n + * .value[3]?.i32:为渐变的颜色重复着色,0表示不重复着色,1表示重复着色 \n + * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n + * colors:渐变色颜色颜色。 \n + * stops:渐变位置。 \n + * size:颜色个数。 \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .string: 字符串组合参数: \n - * 入参1:指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过。 \n - * 入参2:为径向渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标。 \n - * 入参3:为径向渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标。 \n - * 入参4:径向渐变的半径,默认值0。 \n - * 入参5:为渐变的颜色重复着色。 \n + * .value[0]?.f32:为径向渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标 \n + * .value[1]?.f32:为径向渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标 \n + * .value[2]?.f32:径向渐变的半径,默认值0。 \n + * .value[3]?.i32:为渐变的颜色重复着色,0表示不重复着色,1表示重复着色 \n + * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n + * colors:渐变色颜色颜色。 \n + * stops:渐变位置。 \n + * size:颜色个数。 \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;5;10;50;true" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_RADIAL_GRADIENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RADIAL_GRADIENT); - * auto nodeRadialGradient = item->string; + * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; + * float stops[] = { 0.0, 0.5 }; + * ArkUIColorStop colorStop = { colors, stops, 2 }; + * ArkUI_ColorStop* ptr = &colorStop; + * ArkUI_NumberValue value[] = { 50, 50, 20, {.i32 = 1}}; + * ArkUI_AttributeItem item = + * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); + * auto nodeRadialGradientCeneterX = item->value[0]; + * auto nodeRadialGradientCeneterY = item->value[1]; + * auto nodeRadialGradientradius = item->value[2]; + * auto nodeRadialGradientFill = item->value[3]; + * auto nodeRadialGradientColorStop = item->object; * @endcode * */ @@ -1276,39 +1356,101 @@ typedef enum { /** * @brief 组件上加上指定形状的遮罩,支持属性设置和属性获取接口。 * - * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n - * .value[0]?.u32:可选填充颜色,0xargb类型;\n - * .value[1]?.u32:可选描边颜色,0xargb类型;\n - * .value[2]?.f32:可选描边宽度,单位为vp;\n - * .string:形状描述,可选: \n - * "progressMask(10,10,#ff0000ff)"括号内分别为进度遮罩的当前值,进度遮罩的最大值与进度遮罩的颜色; \n - * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n - * "circle(10,10)"括号内分别为width、height; \n - * "ellipse(10,10)"括号内分别为width、height; \n - * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n - * \n - * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0].u32:填充颜色,0xargb类型;\n - * .value[1].u32:描边颜色,0xargb类型;\n - * .value[2].f32:描边宽度,单位为vp;\n - * .string:形状描述: \n - * "progressMask(10,10,#ff0000ff)"括号内分别为进度遮罩的当前值,进度遮罩的最大值与进度遮罩的颜色; \n - * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n - * "circle(10,10)"括号内分别为width、height; \n - * "ellipse(10,10)"括号内分别为width、height; \n - * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * 属性设置方法参数{@link ArkUI_AttributeItem}格式,共有5种类型: \n + * 1.rect类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_RECT; \n + * .value[4].f32:矩形宽度; \n + * .value[5].f32:矩形高度; \n + * .value[6].f32:矩形圆角宽度; \n + * .value[7].f32:矩形圆角高度; \n + * 2.circle类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_CIRCLE; \n + * .value[4].f32:圆形宽度; \n + * .value[5].f32:圆形高度; \n + * 3.ellipse类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_ELLIPSE; \n + * .value[4].f32:椭圆形宽度; \n + * .value[5].f32:椭圆形高度; \n + * 4.path类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_PATH; \n + * .value[4].f32:路径宽度; \n + * .value[5].f32:路径高度; \n + * .string:路径绘制的命令字符串; \n + * 4.progress类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_PROSGRESS; \n + * .value[4].f32:进度遮罩的当前值; \n + * .value[5].f32:进度遮罩的最大值; \n + * .value[6].u32:进度遮罩的颜色; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式,共有5种类型: \n + * 1.rect类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型; \n + * .value[4].f32:矩形宽度; \n + * .value[5].f32:矩形高度; \n + * .value[6].f32:矩形圆角宽度; \n + * .value[7].f32:矩形圆角高度; \n + * 2.circle类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型; \n + * .value[4].f32:圆形宽度; \n + * .value[5].f32:圆形高度; \n + * 3.ellipse类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型; \n + * .value[4].f32:椭圆形宽度; \n + * .value[5].f32:椭圆形高度; \n + * 4.path类型: \n + * .value[0].u32:可选填充颜色,0xargb类型; \n + * .value[1].u32:可选描边颜色,0xargb类型; \n + * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[3].i32:遮罩类型; \n + * .value[4].f32:路径宽度; \n + * .value[5].f32:路径高度; \n + * .string:路径绘制的命令字符串; \n + * 4.progress类型: \n + * .value[0].i32:遮罩类型; \n + * .value[1].f32:进度遮罩的当前值; \n + * .value[2].f32:进度遮罩的最大值; \n + * .value[3].u32:进度遮罩的颜色; \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "rect(10,10,10,10)" }; + * ArkUI_NumberValue value[] = + * {{ .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 , {.i32 = ARKUI_MASK_TYPE_RECT}, 100, 100, 15, 15 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_MASK, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MASK); * auto nodeMaskFill = item->value[0].u32; * auto nodeMaskStrokeColor = item->value[1].u32; - * auto nodeMaskStrokeWidth = item->value[1].f32; - * auto nodeMaskShape = item->string; + * auto nodeMaskStrokeWidth = item->value[2].f32; + * auto nodeMaskType = item->value[3].i32; + * auto nodeMaskWidth = item->value[4].f32; + * auto nodeMaskHeight = item->value[5].f32; + * auto nodeMaskRadiusWidth = item->value[6].f32; + * auto nodeMaskradiusHeight = item->value[7].f32; * @endcode * */ @@ -1447,10 +1589,10 @@ typedef enum { * @brief 对比度属性,支持属性设置,属性重置和属性获取接口. * * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n - * .value[0].f32:对比度,等于1时为原图,越大则对比度越高; \n + * .value[0].f32:对比度,等于1时为原图,越大则对比度越高,取值范围:[0, 10); \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0].f32:对比度; \n + * .value[0].f32:对比度,取值范围:[0, 10); \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); @@ -1499,8 +1641,8 @@ typedef enum { * ArkUI_NumberValue offsetArray[] = { 20, 0 }; * ArkUI_AttributeItem item = { .value = offsetArray, .size = 2}; * nativeNodeApi->setAttribute(nodeHandle, NODE_OFFSET , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); - * auto offsetX = item->value[0].f32; + * auto offsetItem = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); + * auto offsetX = offsetItem->value[0].f32; * @endcode * */ @@ -1522,8 +1664,8 @@ typedef enum { * ArkUI_NumberValue pointArray[] = { 20, 0 }; * ArkUI_AttributeItem item = { .value = pointArray, .size = 2}; * nativeNodeApi->setAttribute(nodeHandle, NODE_MARK_ANCHOR , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); - * auto pointX = item->value[0].f32; + * auto anchorItem = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); + * auto pointX = anchorItem->value[0].f32; * @endcode * */ @@ -1714,8 +1856,7 @@ typedef enum { * .string:无障碍文本。 * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0].i32:为1时表示该组件及其所有子组件为一整个可以选中的组件 - * 无障碍服务将不再关注其子组件内容。参数类型为1或者0。 + * .string:无障碍文本。 * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -1772,6 +1913,28 @@ typedef enum { */ NODE_ACCESSIBILITY_DESCRIPTION, + /** + * @brief 组件获取焦点属性,支持属性设置,属性获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:参数类型为1或者0。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:参数类型为1或者0。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUS_STATUS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUS_STATUS); + * auto value = item->data[0].i32; + * @endcode + * + */ + NODE_FOCUS_STATUS, + /** * @brief text组件设置文本内容属性,支持属性设置,属性重置,属性获取接口。 * @@ -1786,8 +1949,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CONTENT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); - * auto content = item->string + * auto textContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); + * auto content = textContentItem->string; * @endcode */ NODE_TEXT_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT, @@ -1886,8 +2049,8 @@ typedef enum { * ArkUI_NumberValue lineHeight[] = { 20 }; * ArkUI_AttributeItem item = { .value = lineHeight, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); - * auto pointX = item->value[0].f32; + * auto lineHeightItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); + * auto pointX = lineHeightItem->value[0].f32; * @endcode */ NODE_TEXT_LINE_HEIGHT, @@ -1907,9 +2070,9 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); - * auto nodeDecorationStyle = item->value[0].i32; - * auto nodeDecorationColor = item->value[1].u32; + * auto decorationItem = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); + * auto nodeDecorationStyle = decorationItem->value[0].i32; + * auto nodeDecorationColor = decorationItem->value[1].u32; * @endcode * */ @@ -1926,11 +2089,11 @@ typedef enum { * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue textCase[] = { {.i32 = static_cast(ARKUI_TEXT_CASE_LOWER) } }; + * ArkUI_NumberValue textCase[] = { {.i32 = static_cast(ARKUI_TEXT_CASE_LOWER) } }; * ArkUI_AttributeItem item = { .value = textCase, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CASE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); - * auto textCase = item->value[0].i32; + * auto textCaseItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); + * auto textCase = textCaseItem->value[0].i32; * @endcode * */ @@ -1950,8 +2113,8 @@ typedef enum { * ArkUI_NumberValue letterSpacing[] = { 20 }; * ArkUI_AttributeItem item = { .value = letterSpacing, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); - * auto letterSpacing = item->value[0].f32; + * auto letterSpacingItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); + * auto letterSpacing = letterSpacingItem->value[0].f32; * @endcode * */ @@ -1971,8 +2134,8 @@ typedef enum { * ArkUI_NumberValue maxLine[] = { { .i32 = 2 } }; * ArkUI_AttributeItem item = { .value = maxLine, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_LINES , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); - * auto maxLines = item->value[0].i32; + * auto maxLinesItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); + * auto maxLines = maxLinesItem->value[0].i32; * @endcode */ NODE_TEXT_MAX_LINES, @@ -1991,8 +2154,8 @@ typedef enum { * ArkUI_NumberValue alignMent[] = {{.i32 = static_cast(ARKUI_TEXT_ALIGNMENT_CENTER)}}; * ArkUI_AttributeItem item = { .value = alignMent, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_ALIGN , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); - * auto alignMent = item->value[0].i32; + * auto alignmentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); + * auto alignMent = alignmentItem->value[0].i32; * @endcode */ NODE_TEXT_ALIGN, @@ -2011,8 +2174,8 @@ typedef enum { * ArkUI_NumberValue textOverFlow[] = { { .i32 = static_cast(ARKUI_TEXT_OVERFLOW_CLIP) } }; * ArkUI_AttributeItem item = { .value = textOverFlow, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle,NODE_TEXT_OVERFLOW , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); - * auto textOverFlow = item->value[0].i32; + * auto textOverFlowItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); + * auto textOverFlow = textOverFlowItem->value[0].i32; * @endcode */ NODE_TEXT_OVERFLOW, @@ -2221,8 +2384,8 @@ typedef enum { * ArkUI_NumberValue textIndent[] = { 20 }; * ArkUI_AttributeItem item = { .value = textIndent, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INDENT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); - * auto indentValue = item->value[0].f32; + * auto indentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); + * auto indentValue = indentItem->value[0].f32; * @endcode */ NODE_TEXT_INDENT, @@ -2240,8 +2403,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SPAN_CONTENT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SPAN_CONTENT); - * auto spanContent = item->string; + * auto spanContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_SPAN_CONTENT); + * auto spanContent = spanContentItem->string; * @endcode */ NODE_SPAN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SPAN, @@ -2259,8 +2422,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC); - * auto spanScr = item->string; + * auto srcItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC); + * auto spanScr = srcItem->string; * @endcode */ NODE_IMAGE_SPAN_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE_SPAN, @@ -2279,8 +2442,8 @@ typedef enum { * ArkUI_NumberValue alignValue[] = { {.i32 = static_cast(ARKUI_IMAGE_SPAN_ALIGNMENT_TOP) } }; * ArkUI_AttributeItem item = {.value = alignValue, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN); - * auto verticalAlign = item->value[0].i32; + * auto verticalAlignItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN); + * auto verticalAlign = verticalAlignItem->value[0].i32; * @endcode */ NODE_IMAGE_SPAN_VERTICAL_ALIGN, @@ -2298,8 +2461,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SRC , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); - * auto imageSrc = item->string; + * auto imageSrcItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); + * auto imageSrc = imageSrcItem->string; * @endcode */ NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, @@ -2318,8 +2481,8 @@ typedef enum { * ArkUI_NumberValue objectFitValue[] = { { .i32 = static_cast(ARKUI_OBJECT_FIT_FILL) } }; * ArkUI_AttributeItem item = { .value = objectFitValue, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); - * auto objectFit = item->value[0].i32; + * auto objectFitItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); + * auto objectFit = objectFitItem->value[0].i32; * @endcode */ NODE_IMAGE_OBJECT_FIT, @@ -2335,11 +2498,11 @@ typedef enum { * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue interpolationValue[] = { { .i32 = ARKUI_INTERPOLATION_LOW } }; + * ArkUI_NumberValue interpolationValue[] = { { .i32 = ARKUI_IMAGE_INTERPOLATION_LOW } }; * ArkUI_AttributeItem item = { .value = interpolationValue, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); - * auto interpolation = item->value[0].i32; + * auto interpolationItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); + * auto interpolation = interpolationItem->value[0].i32; * @endcode */ NODE_IMAGE_INTERPOLATION, @@ -2358,8 +2521,8 @@ typedef enum { * ArkUI_NumberValue repeatValue[] = { { .i32 = static_cast(ARKUI_IMAGE_REPEAT_X) } }; * ArkUI_AttributeItem item = { .value = repeatValue, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); - * auto repeat = item->value[0].i32; + * auto objectRepeatItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); + * auto repeat = objectRepeatItem->value[0].i32; * @endcode */ NODE_IMAGE_OBJECT_REPEAT, @@ -2382,8 +2545,8 @@ typedef enum { * 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0} }; * ArkUI_AttributeItem item = { .value = filterValue, .size = sizeof(filterValue)/ sizeof(ArkUI_NumberValue)}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); - * auto colorFilter = item->value + * auto colorFilterItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); + * auto colorFilter = colorFilterItem->value; * @endcode */ NODE_IMAGE_COLOR_FILTER, @@ -2400,10 +2563,10 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_NumberValue resizeValue[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { .value = resizeValue, .size = 1}}; + * ArkUI_AttributeItem item = { .value = resizeValue, .size = 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); - * auto autoResize = item->value[0].i32; + * auto autoResizeItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); + * auto autoResize = autoResizeItem->value[0].i32; * @endcode */ NODE_IMAGE_AUTO_RESIZE, @@ -2421,8 +2584,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "/pages/loading.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_ALT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); - * auto altStr = item->string; + * auto altStrItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); + * auto altStr = altStrItem->string; * @endcode */ NODE_IMAGE_ALT, @@ -3726,7 +3889,93 @@ typedef enum { * @endcode */ NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, - + /** + * @brief 设置日历选中态底板圆角半径的参数,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 日历选中态底板圆角半径,取值范围[0,+∞),其中取值为0表示底板样式为直角矩形; + * 取值范围为(0, 16)时,底板样式为圆角矩形;取值范围为[16,+∞)时,底板样式为圆形。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].f32: 日历选中态底板圆角半径,取值范围[0,+∞),其中取值为0表示底板样式为直角矩形; + * 取值范围为(0, 16)时,底板样式为圆角矩形;取值范围为[16,+∞)时,底板样式为圆形。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 16.0f }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); + * auto borderRadius = item->value[0].f32; + * @endcode + */ + NODE_CALENDAR_PICKER_HINT_RADIUS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + /** + * @brief 设置日历选择选中日期的参数,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[1].u32: 选中的年。\n + * .value[2].u32: 选中的月。\n + * .value[3].u32: 选中的日。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[1].u32: 选中的年。\n + * .value[2].u32: 选中的月。\n + * .value[3].u32: 选中的日。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE); + * auto selectYear = item->value[0].u32; + * @endcode + */ + NODE_CALENDAR_PICKER_SELECTED_DATE, + /** + * @brief 设置日历选择器与入口组件的对齐方式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 对齐方式类型,参数类型{@link ArkUI_CalendarAlignment}。\n + * .value[1]?.f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n + * .value[2]?.f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 对齐方式类型,参数类型{@link ArkUI_CalendarAlignment}。\n + * .value[1]?.f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n + * .value[2]?.f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGNMENT_END) }, 10.0f, 0.0f }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT); + * auto alignType = item->value[0].i32; + * @endcode + */ + NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, + /** + * @brief 设置日历选择器入口区的文本颜色、字号、字体粗细。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.u32: 入口区的文本颜色。\n + * .value[1]?.f32: 入口区的文本字号,单位为fp。\n + * .value[2]?.i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0]?.u32: 入口区的文本颜色。\n + * .value[1]?.f32: 入口区的文本字号,单位为fp。\n + * .value[2]?.i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = + * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); + * auto textColor = item->value[0].u32; + * @endcode + */ + NODE_CALENDAR_PICKER_TEXT_STYLE, /** * @brief Slider滑块的颜色,支持属性设置,属性重置和属性获取。 * @@ -3794,7 +4043,7 @@ typedef enum { NODE_SLIDER_SELECTED_COLOR, /** - * @brief Slider滑动时是否显示气泡提示,支持属性设置,属性重置和属性获取。 + * @brief 设置是否显示步长刻度值,支持属性设置,属性重置和属性获取。 * * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n * .value[0].i32:是否显示气泡,1表示显示,0表示不显示,默认值为0。\n @@ -3808,14 +4057,14 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SHOW_TIPS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR); + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SHOW_STEPS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SHOW_STEPS); * auto value = item->value[0].i32; * @endcode * */ - NODE_SLIDER_SHOW_TIPS, + NODE_SLIDER_SHOW_STEPS, /** * @brief Slider滑块形状参数,支持属性设置,属性重置和属性获取。 @@ -3825,20 +4074,52 @@ typedef enum { * .string? 可选值,根据形状参数而定。\n * ARKUI_SLIDER_BLOCK_STYLE_IMAGE: 滑块图片资源。如/pages/common/icon.png。\n * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: 滑块使用的自定义形状。\n - * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n - * "circle(10,10)"括号内分别为width、height; \n - * "ellipse(10,10)"括号内分别为width、height; \n - * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * 共有5种类型: \n + * 1.rect类型: \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_RECT; \n + * .value[2].f32:矩形宽度; \n + * .value[3].f32:矩形高度; \n + * .value[4].f32:矩形圆角宽度; \n + * .value[5].f32:矩形圆角高度; \n + * 2.circle类型: \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_CIRCLE; \n + * .value[2].f32:圆形宽度; \n + * .value[3].f32:圆形高度; \n + * 3.ellipse类型: \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_ELLIPSE; \n + * .value[2].f32:椭圆形宽度; \n + * .value[3].f32:椭圆形高度; \n + * 4.path类型: \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_PATH; \n + * .value[2].f32:路径宽度; \n + * .value[3].f32:路径高度; \n + * .string:路径绘制的命令字符串; \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:形状参数。参数类型{@link ArkUI_SliderBlockStyle}。\n * .string? 可选值,根据形状参数而定。\n * ARKUI_SLIDER_BLOCK_STYLE_IMAGE: 滑块图片资源。如/pages/common/icon.png。\n * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: 滑块使用的自定义形状。\n - * "rect(10,10,10,10)"括号内分别为width、height、radiusWidth与radiusHeight"; \n - * "circle(10,10)"括号内分别为width、height; \n - * "ellipse(10,10)"括号内分别为width、height; \n - * "path(10,10,M0 0 L600 0)"括号内分别为width、height、commands; \n + * 共有5种类型: \n + * 1.rect类型: \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_RECT; \n + * .value[2].f32:矩形宽度; \n + * .value[3].f32:矩形高度; \n + * .value[4].f32:矩形圆角宽度; \n + * .value[5].f32:矩形圆角高度; \n + * 2.circle类型: \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_CIRCLE; \n + * .value[2].f32:圆形宽度; \n + * .value[3].f32:圆形高度; \n + * 3.ellipse类型: \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_ELLIPSE; \n + * .value[2].f32:椭圆形宽度; \n + * .value[3].f32:椭圆形高度; \n + * 4.path类型: \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_PATH; \n + * .value[2].f32:路径宽度; \n + * .value[3].f32:路径高度; \n + * .string:路径绘制的命令字符串; \n * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -3846,6 +4127,11 @@ typedef enum { * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_DEFAULT}}; * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); + * + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, + * {.i32 = ARKUI_CLIP_TYPE_RECT}, 100, 100, 15, 15 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE); * auto value = item->value[0].i32; * @endcode @@ -3912,7 +4198,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 100 }; * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE); * auto value = item->value[0].f32; * @endcode * @@ -4020,8 +4306,8 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); - * auto nodeStackAlignContent = item->value[0].i32; + * auto alignContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); + * auto alignContent = alignContentItem->value[0].i32; * @endcode */ NODE_STACK_ALIGN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_STACK, @@ -4194,12 +4480,12 @@ typedef enum { * @brief Scroll嵌套滚动选项,支持属性设置,属性重置和属性获取。 * * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n - * .value[0]?.i32:可滚动组件往末尾端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n - * .value[1]?.i32:可滚动组件往起始端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n + * .value[0].i32:可滚动组件往末尾端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n + * .value[1].i32:可滚动组件往起始端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0]?.i32:可滚动组件往末尾端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n - * .value[1]?.i32:可滚动组件往起始端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。 + * .value[0].i32:可滚动组件往末尾端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n + * .value[1].i32:可滚动组件往起始端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。 * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4244,13 +4530,13 @@ typedef enum { NODE_SCROLL_OFFSET, /** - * @brief Scroll滚动到容器边缘,支持属性设置,属性重置和属性获取。 + * @brief Scroll滚动到容器边缘,支持属性设置,属性获取。 * * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n * .value[0].i32:容器边缘,参数类型{@link ArkUI_ScrollEdge}。 \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32:容器边缘,参数类型{@link ArkUI_ScrollEdge}。 + * .value[0].i32:容器是否位于边缘,-1:表示未处于边缘,如果处于边缘状态参数类型{@link ArkUI_ScrollEdge}。 * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4410,10 +4696,10 @@ typedef enum { * @brief 设置Swiper自动播放时播放的时间间隔,支持属性设置,属性重置和属性获取接口。 * * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n - * .value[0].i32:使用自动播放时播放的时间间隔,单位为毫秒。 \n + * .value[0].f32:使用自动播放时播放的时间间隔,单位为毫秒。 \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0].i32:使用自动播放时播放的时间间隔,单位为毫秒。 \n + * .value[0].f32:使用自动播放时播放的时间间隔,单位为毫秒。 \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4422,7 +4708,7 @@ typedef enum { * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INTERVAL, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_INTERVAL); - * auto nodeSwiperInterval = item->value[0].i32; + * auto nodeSwiperInterval = item->value[0].f32; * @endcode * */ @@ -4665,93 +4951,28 @@ typedef enum { * @endcode */ NODE_LIST_ITEM_GROUP_SET_DIVIDER, + /** - * @brief 设置日历选中态底板圆角半径的参数,支持属性设置,属性重置和属性获取接口。 - * - * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[0].f32: 日历选中态底板圆角半径,取值范围[0,+∞),其中取值为0表示底板样式为直角矩形; - * 取值范围为(0, 16)时,底板样式为圆角矩形;取值范围为[16,+∞)时,底板样式为圆形。\n - * \n - * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0].f32: 日历选中态底板圆角半径,取值范围[0,+∞),其中取值为0表示底板样式为直角矩形; - * 取值范围为(0, 16)时,底板样式为圆角矩形;取值范围为[16,+∞)时,底板样式为圆形。\n - * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 16.0f }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); - * auto borderRadius = item->value[0].f32; - * @endcode - */ - NODE_CALENDAR_PICKER_HINT_RADIUS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, - /** - * @brief 设置日历选择选中日期的参数,支持属性设置,属性重置和属性获取接口。 - * - * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[1].u32: 选中的年。\n - * .value[2].u32: 选中的月。\n - * .value[3].u32: 选中的日。\n - * \n - * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[1].u32: 选中的年。\n - * .value[2].u32: 选中的月。\n - * .value[3].u32: 选中的日。\n - * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED); - * auto selectYear = item->value[0].u32; - * @endcode - */ - NODE_CALENDAR_PICKER_SELECTED, - /** - * @brief 设置日历选择器与入口组件的对齐方式,支持属性设置,属性重置和属性获取接口。 + * @brief 设置组件是否正在刷新,支持属性设置,属性获取。 * - * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32: 对齐方式类型,参数类型{@link ArkUI_CalendarAlignment}。\n - * .value[1]?.f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n - * .value[2]?.f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32:参数类型为1或者0。 * \n - * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32: 对齐方式类型,参数类型{@link ArkUI_CalendarAlignment}。\n - * .value[1]?.f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n - * .value[2]?.f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n - * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGN_END) }, 10.0f, 0.0f }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGN, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGN); - * auto alignType = item->value[0].i32; + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:参数类型为1或者0。 + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 0 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_REFRESH_REFRESHING, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_REFRESH_REFRESHING); + * auto value = item->data[0].i32; * @endcode - */ - NODE_CALENDAR_PICKER_EDGE_ALIGN, - /** - * @brief 设置日历选择器入口区的文本颜色、字号、字体粗细。 * - * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[0]?.u32: 入口区的文本颜色。\n - * .value[1]?.f32: 入口区的文本字号,单位为fp。\n - * .value[2]?.i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n - * \n - * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0]?.u32: 入口区的文本颜色。\n - * .value[1]?.f32: 入口区的文本字号,单位为fp。\n - * .value[2]?.i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n - * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = - * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); - * auto textColor = item->value[0].u32; - * @endcode */ - NODE_CALENDAR_PICKER_TEXT_STYLE, + NODE_REFRESH_REFRESHING = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, } ArkUI_NodeAttributeType; #define MAX_COMPONENT_EVENT_ARG_NUM 12 @@ -4897,13 +5118,33 @@ typedef enum { NODE_TOGGLE_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, NODE_TEXT_INPUT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, + /** + * @brief 定义ARKUI_NODE_TEXT_INPUT按下输入法回车键触发该回调。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:输入法回车键类型。\n + */ NODE_TEXT_INPUT_ON_SUBMIT, NODE_TEXT_INPUT_ON_CUT, NODE_TEXT_INPUT_ON_PASTE, NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, - NODE_REFRESH_STATE_CHANGE = 1000 * ARKUI_NODE_REFRESH + 1, + /** + * @brief 定义ARKUI_NODE_REFRESH刷新状态变更触发该事件。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:刷新状态。\n + */ + NODE_REFRESH_STATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, + /** + * @brief 定义ARKUI_NODE_REFRESH进入刷新状态时触发该事件。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数:\n + */ NODE_REFRESH_ON_REFRESH, /** diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index 79b10f29..f243343d 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -271,6 +271,11 @@ typedef enum { ARKUI_PROGRESS_CAPSULE, }ArkUI_ProgressType; +/** + * @brief 定义装饰线样式枚举值。 + * + * @since 12 + */ typedef enum { /** 不使用装饰线。*/ ARKUI_TEXT_DECORATION_TYPE_NONE = 0, @@ -282,6 +287,11 @@ typedef enum { ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH, } ArkUI_TextDecorationType; +/** + * @brief 定义文本大小写枚举值。 + * + * @since 12 + */ typedef enum { /** 保持原有大小写。*/ ARKUI_TEXT_CASE_NORMAL = 0, @@ -291,6 +301,11 @@ typedef enum { ARKUI_TEXT_CASE_UPPER, } ArkUI_TextCase; +/** + * @brief 定义文本复制黏贴模式枚举值。 + * + * @since 12 + */ typedef enum { /** 不支持复制。*/ ARKUI_COPY_OPTIONS_NONE = 0, @@ -302,6 +317,11 @@ typedef enum { ARKUI_COPY_OPTIONS_CROSS_DEVICE, } ArkUI_CopyOptions; +/** + * @brief 定义阴影类型枚举值。 + * + * @since 12 + */ typedef enum { /** 颜色。*/ ARKUI_SHADOW_TYPE_COLOR = 0, @@ -599,16 +619,10 @@ typedef enum { typedef enum { /** 竖直方向上边缘。*/ ARKUI_SCROLL_EDGE_TOP = 0, - /** 竖直方向居中位置。*/ - ARKUI_SCROLL_EDGE_CENTER, /** 竖直方向下边缘。*/ ARKUI_SCROLL_EDGE_BOTTOM, - /** 交叉轴方向文本基线位置。*/ - ARKUI_SCROLL_EDGE_BASELINE, /** 水平方向起始位置。*/ ARKUI_SCROLL_EDGE_START, - /** 水平方向居中位置。*/ - ARKUI_SCROLL_EDGE_MIDDLE, /** 水平方向末尾位置。*/ ARKUI_SCROLL_EDGE_END, } ArkUI_ScrollEdge; @@ -1049,6 +1063,69 @@ typedef enum { ARKUI_CALENDAR_ALIGNMENT_END, } ArkUI_CalendarAlignment; +/** + * @brief 遮罩类型枚举。 + * + * @since 12 + */ +typedef enum { + /** 矩形类型。 */ + ARKUI_MASK_TYPE_RECT = 0, + /** 圆形类型。 */ + ARKUI_MASK_TYPE_CIRCLE, + /** 椭圆形类型。 */ + ARKUI_MASK_TYPE_ELLIPSE, + /** 路径类型。 */ + ARKUI_MASK_TYPE_PATH, + /** 进度类型。 */ + ARKUI_MASK_TYPE_PROGRESS, +} ArkUI_MaskType; + +/** + * @brief 裁剪类型枚举。 + * + * @since 12 + */ +typedef enum { + /** 矩形类型。 */ + ARKUI_CLIP_TYPE_RECT = 0, + /** 圆形类型。 */ + ARKUI_CLIP_TYPE_CIRCLE, + /** 椭圆形类型。 */ + ARKUI_CLIP_TYPE_ELLIPSE, + /** 路径类型。 */ + ARKUI_CLIP_TYPE_PATH, +} ArkUI_ClipType; + +/** + * @brief 定义渐变色结构。 + * + * @since 12 + */ +typedef struct { + /** 颜色数组。*/ + const uint32_t* colors; + /** 位置数组。*/ + float* stops; + /** 数组长度。*/ + int size; +} ArkUI_ColorStop; + +/** + * @brief 自定义形状。 + * + * @since 12 + */ +typedef enum { + /** 矩形类型。 */ + ARKUI_SHAPE_TYPE_RECT = 0, + /** 圆形类型。 */ + ARKUI_SHAPE_TYPE_CIRCLE, + /** 椭圆形类型。 */ + ARKUI_SHAPE_TYPE_ELLIPSE, + /** 路径类型。 */ + ARKUI_SHAPE_TYPE_PATH, +} ArkUI_ShapeType; #ifdef __cplusplus }; #endif -- Gitee From 18219f280dbe6b84631c75d87531a2ac62d4338a Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Sat, 17 Feb 2024 09:59:22 +0800 Subject: [PATCH 0263/2135] [NDK] event description Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- zh-cn/native_sdk/ace/native_node.h | 62 ++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 4a9fd523..1d158dda 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -4895,15 +4895,71 @@ typedef enum { * */ NODE_TOGGLE_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, - + /** + * @brief textInput输入内容发生变化时触发该事件。 + * + * 触发该事件的条件:输入内容发生变化时。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_StringAsyncEvent}。\n + * {@link ArkUI_StringAsyncEvent}中包含1个参数:\n + * ArkUI_StringAsyncEvent.pStr:输入的文本内容。 + * + */ NODE_TEXT_INPUT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, + /** + * @brief textInput按下输入法回车键触发该事件。 + * + * 触发该事件的条件:按下输入法回车键。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:输入法回车键类型。 + * + */ NODE_TEXT_INPUT_ON_SUBMIT, + /** + * @brief 长按输入框内部区域弹出剪贴板后,点击剪切板剪切按钮,触发该回调。 + * + * 触发该事件的条件:长按输入框内部区域弹出剪贴板后,点击剪切板剪切按钮。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_StringAsyncEvent}。\n + * {@link ArkUI_StringAsyncEvent}中包含1个参数:\n + * ArkUI_StringAsyncEvent.pStr:剪切的文本内容。 + * + */ NODE_TEXT_INPUT_ON_CUT, + /** + * @brief 长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮,触发该回调。 + * + * 触发该事件的条件:长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_StringAsyncEvent}。\n + * {@link ArkUI_StringAsyncEvent}中包含1个参数:\n + * ArkUI_StringAsyncEvent.pStr:剪切的文本内容。 + * + */ NODE_TEXT_INPUT_ON_PASTE, - + /** + * @brief 输入内容发生变化时,触发该回调。 + * + * 触发该事件的条件:输入内容发生变化时。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_StringAsyncEvent}。\n + * {@link ArkUI_StringAsyncEvent}中包含1个参数:\n + * ArkUI_StringAsyncEvent.pStr:当前输入的文本内容。 + * + */ NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, - NODE_REFRESH_STATE_CHANGE = 1000 * ARKUI_NODE_REFRESH + 1, + /** + * @brief 定义ARKUI_NODE_REFRESH刷新状态变更触发该事件。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:刷新状态。\n + */ + NODE_REFRESH_STATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, + /** + * @brief 定义ARKUI_NODE_REFRESH进入刷新状态时触发该事件。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数:\n + */ NODE_REFRESH_ON_REFRESH, /** -- Gitee From bf0622528f2705f5cc9b229bc07629f1c1d8bced Mon Sep 17 00:00:00 2001 From: Gezhe Date: Sun, 18 Feb 2024 09:43:02 +0000 Subject: [PATCH 0264/2135] update zh-cn/native_sdk/media/drm/native_drm_common.h. Signed-off-by: Gezhe --- zh-cn/native_sdk/media/drm/native_drm_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/media/drm/native_drm_common.h b/zh-cn/native_sdk/media/drm/native_drm_common.h index a0389d9b..5ed6e3de 100644 --- a/zh-cn/native_sdk/media/drm/native_drm_common.h +++ b/zh-cn/native_sdk/media/drm/native_drm_common.h @@ -250,7 +250,7 @@ typedef struct DRM_MediaKeyRequestInfo { */ int32_t initDataLen; /** - * base64编码后格式为PSSH的初始数据。 + * base64解码后格式为PSSH的初始数据。 */ uint8_t initData[MAX_INIT_DATA_LEN]; /** -- Gitee From efdee83e30f0ca898928b8524de58d766a5b7776 Mon Sep 17 00:00:00 2001 From: zhaogan Date: Mon, 19 Feb 2024 10:36:40 +0800 Subject: [PATCH 0265/2135] =?UTF-8?q?Issue:=20#I91XEE=20Description:?= =?UTF-8?q?=E5=8C=85=E7=AE=A1=E7=90=86native=E5=A4=B4=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Sig:=20SIG=5FApplicaitonFramework=20Featur?= =?UTF-8?q?e=20or=20Bugfix:=20Bugfix=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaogan --- .../bundle/native_interface_bundle.h | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/bundle/native_interface_bundle.h b/zh-cn/native_sdk/bundle/native_interface_bundle.h index 86cf3ec8..06cc57b8 100644 --- a/zh-cn/native_sdk/bundle/native_interface_bundle.h +++ b/zh-cn/native_sdk/bundle/native_interface_bundle.h @@ -28,6 +28,8 @@ * * @brief 提供查询应用包信息的功能,获取到的信息包含应用包名和应用指纹信息。 * + * @library libbundle.z.so + * @syscap SystemCapability.BundleManager.BundleFramework.Core * @since 9 * @version 1.0 */ @@ -43,7 +45,7 @@ extern "C" { * @since 9 * @version 1.0 */ -struct OH_NativeBundle_ApplicationInfo +typedef struct OH_NativeBundle_ApplicationInfo { /** 应用的包名 */ char* bundleName; @@ -60,6 +62,24 @@ struct OH_NativeBundle_ApplicationInfo */ OH_NativeBundle_ApplicationInfo OH_NativeBundle_GetCurrentApplicationInfo(); +/** + * @brief 获取当前应用的appId。appId是应用的唯一标识,由应用包名和签名信息决定。 + * + * @return 接口调用成功,返回当前应用的appId信息。 + * @since 11 + * @version 1.0 + */ +char* OH_NativeBundle_GetAppId(); + +/** + * @brief 获取当前应用的载体ID。载体ID是应用的唯一标识,由云端统一分配。该ID在应用全生命周期中不会发生变化,包括版本升级、证书变更、开发者公私钥变更、应用转移等。 + * + * @return 接口调用成功,返回当前应用的载体ID信息。 + * @since 11 + * @version 1.0 + */ +char* OH_NativeBundle_GetAppIdentifier(); + #ifdef __cplusplus }; #endif -- Gitee From 8e03395dd5a6bce604dae66d16f9a677b1fcad8d Mon Sep 17 00:00:00 2001 From: li-kiao Date: Mon, 5 Feb 2024 14:06:34 +0000 Subject: [PATCH 0266/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9EDrawing=20C=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B5=84=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-kiao --- .../graphic/native_drawing/drawing_bitmap.h | 13 ++ .../graphic/native_drawing/drawing_brush.h | 11 ++ .../graphic/native_drawing/drawing_canvas.h | 186 ++++++++++++++++++ .../graphic/native_drawing/drawing_font.h | 56 ++++++ .../graphic/native_drawing/drawing_image.h | 119 +++++++++++ .../graphic/native_drawing/drawing_matrix.h | 150 ++++++++++++++ .../native_drawing/drawing_memory_stream.h | 76 +++++++ .../graphic/native_drawing/drawing_path.h | 133 +++++++++++++ .../native_drawing/drawing_path_effect.h | 76 +++++++ .../graphic/native_drawing/drawing_pen.h | 44 +++++ .../native_drawing/drawing_sampling_options.h | 102 ++++++++++ .../native_drawing/drawing_text_blob.h | 57 ++++++ .../graphic/native_drawing/drawing_typeface.h | 25 +++ .../graphic/native_drawing/drawing_types.h | 88 +++++++++ 14 files changed, 1136 insertions(+) create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_image.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index 4b783cd9..18cf2b01 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -78,6 +78,19 @@ OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void); */ void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); +/** + * @brief 用于创建一个位图对象,并将位图像素存储内存地址设置为开发者申请内存的地址。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image_Info 指向图片信息对象{@link OH_Drawing_Image_Info}的指针。 + * @param pixels 指向像素存储的内存首地址,内存由开发者申请,保证有效性。 + * @param rowBytes 每行像素的大小。 + * @return 函数返回一个指针,指针指向创建的位图对象{@link OH_Drawing_Bitmap}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels(OH_Drawing_Image_Info*, void* pixels, uint32_t rowBytes); + /** * @brief 用于初始化位图对象的宽度和高度,并且为该位图设置像素格式。 * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index f8d58cdb..b531c154 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -153,6 +153,17 @@ void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect* */ void OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*); +/** + * @brief 为画刷设置一个混合器,该混合器实现了指定的混合模式枚举。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush 指向画刷对象{@link OH_Drawing_Brush}的指针。 + * @param OH_Drawing_BlendMode 混合模式枚举类型{@link OH_Drawing_BlendMode}。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_BrushSetBlendMode(OH_Drawing_Brush*, OH_Drawing_BlendMode); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index 728a9f9d..ef206064 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -128,6 +128,19 @@ void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*); */ void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); +/** + * @brief 保存矩阵和裁剪区域,为后续绘制分配位图。调用恢复接口 + * {@link OH_Drawing_CanvasRestore}将放弃对矩阵和剪切区域所做的更改,并绘制位图。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Rect 指向矩形对象{@link OH_Drawing_Rect}的指针。 + * @param OH_Drawing_Brush 指向画刷对象{@link OH_Drawing_Brush}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas*, const OH_Drawing_Rect*, const OH_Drawing_Brush*); + /** * @brief 用于恢复保存在栈顶的画布状态(画布矩阵)。 * @@ -198,6 +211,78 @@ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); */ void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); +/** + * @brief 将位图的指定区域绘制到画布的指定区域。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Bitmap 指向位图对象{@link OH_Drawing_Bitmap}的指针。 + * @param src 源位图指定矩形区域,可以为空。 + * @param dst 目标画布指定矩形区域。 + * @param OH_Drawing_SamplingOptions 指向采样选项对象{@link OH_Drawing_SamplingOptions}的指针。 + * @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*); + +/** + * @brief 设置画布的矩阵状态。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针, + * 开发者可调用{@link OH_Drawing_MatrixCreate}接口创建。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasSetMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief 将图片绘制到画布的指定区域上。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Image 指向图片对象{@link OH_Drawing_Image}的指针。 + * @param OH_Drawing_Rect 指向矩形对象{@link OH_Drawing_Rect}的指针。 + * @param OH_Drawing_SamplingOptions 指向采样选项对象{@link OH_Drawing_SamplingOptions}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawImageRect(OH_Drawing_Canvas*, OH_Drawing_Image*, + OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*); + +/** + * @brief 从画布中拷贝像素数据到指定地址。该接口不可用于录制类型画布。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Image_Info 指向图片信息{@link OH_Drawing_Image_Info}的指针。 + * @param dstPixels 目标像素存储首地址。 + * @param dstRowBytes 一行像素的大小。 + * @param srcX 画布像素的x轴偏移量,单位为像素。 + * @param srcY 画布像素的y轴偏移量,单位为像素。 + * @return 函数返回true表示像素成功拷贝到目标像素存储首地址,函数返回false表示拷贝失败。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas*, OH_Drawing_Image_Info*, + void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY); + +/** + * @brief 从画布拷贝像素数据到位图中。该接口不可用于录制类型画布。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Bitmap 指向位图对象{@link OH_Drawing_Bitmap}的指针。 + * @param srcX 画布像素的x轴偏移量,单位为像素。 + * @param srcY 画布像素的y轴偏移量,单位为像素。 + * @return 函数返回true表示像素成功拷贝到位图,函数返回false表示拷贝失败。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, int32_t srcX, int32_t srcY); + /** * @brief 用于画一个矩形。 * @@ -362,6 +447,107 @@ void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); */ void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, uint32_t color); +/** + * @brief 获取画布宽度。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @return 函数返回画布宽度,单位为像素。 + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_CanvasGetWidth(OH_Drawing_Canvas*); + +/** + * @brief 获取画布高度。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @return 函数返回画布高度,单位为像素。 + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_CanvasGetHeight(OH_Drawing_Canvas*); + +/** + * @brief 获取画布裁剪区域的边界。该接口不可用于录制类型画布。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Rect 指向矩形对象{@link OH_Drawing_Rect}的指针, + * 开发者可调用{@link OH_Drawing_RectCreate}接口创建。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasGetLocalClipBounds(OH_Drawing_Canvas*, OH_Drawing_Rect*); + +/** + * @brief 获取画布3x3矩阵。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针, + * 开发者可调用{@link OH_Drawing_MatrixCreate}接口创建。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasGetTotalMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief 画布现有矩阵左乘以传入矩阵,不影响该接口之前的绘制操作。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief 阴影标志枚举。 + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** + * 无阴影标志。 + */ + SHADOW_FLAGS_NONE, + /** + * 遮挡物对象不透明标志。 + */ + SHADOW_FLAGS_TRANSPARENT_OCCLUDER, + /** + * 不分析阴影标志。 + */ + SHADOW_FLAGS_GEOMETRIC_ONLY, + /** + * 使能以上所有阴影标志。 + */ + SHADOW_FLAGS_ALL, +} OH_Drawing_CanvasShadowFlags; + +/** + * @brief 绘制射灯类型阴影,使用路径描述环境光阴影的轮廓。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas 指向画布对象{@link OH_Drawing_Canvas}的指针。 + * @param OH_Drawing_Path 指向路径对象{@link OH_Drawing_Path}的指针,用于生成阴影。 + * @param planeParams 基于x轴和y轴的遮挡器从画布返回z轴偏移量的函数值。 + * @param devLightPos 光线相对于画布的位置。 + * @param lightRadius 圆形灯半径。 + * @param ambientColor 环境阴影颜色。 + * @param spotColor 点阴影颜色。 + * @param flag 阴影标志枚举{@link OH_Drawing_CanvasShadowFlags}。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas*, OH_Drawing_Path*, OH_Drawing_Point3D planeParams, + OH_Drawing_Point3D devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, + OH_Drawing_CanvasShadowFlags flag); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index bbc3de54..979577c6 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -66,6 +66,17 @@ OH_Drawing_Font* OH_Drawing_FontCreate(void); */ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); +/** + * @brief 获取字形对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 指向字体对象{@link OH_Drawing_Font}的指针。 + * @return OH_Drawing_Typeface 函数返回一个指针,指向字形对象{@link OH_Drawing_Typeface}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_FontGetTypeface(OH_Drawing_Font*); + /** * @brief 用于给字体设置文字大小。 * @@ -77,6 +88,20 @@ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); */ void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); +/** + * @brief 获取文本所表示的字符数量。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 指向字体对象{@link OH_Drawing_Font}的指针。 + * @param text 文本存储首地址。 + * @param byteLength 文本长度,单位为字节。 + * @param encoding 文本编码类型{@link OH_Drawing_TextEncoding}。 + * @since 12 + * @version 1.0 + */ +int OH_Drawing_FontCountText(OH_Drawing_Font*, const void* text, size_t byteLength, + OH_Drawing_TextEncoding encoding); + /** * @brief 用于设置线性可缩放字体。 * @@ -120,6 +145,37 @@ void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); */ void OH_Drawing_FontDestroy(OH_Drawing_Font*); +/** + * @brief 定义字体度量信息的结构体。 + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** 字符最高点到基线的最大距离 */ + float top; + /** 字符最高点到基线的推荐距离 */ + float ascent; + /** 字符最低点到基线的推荐距离 */ + float descent; + /** 字符最低点到基线的最大距离 */ + float bottom; + /** 行间距 */ + float leading; +} OH_Drawing_Font_Metrics; + +/** + * @brief 获取字体度量信息。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font 指向字体对象{@link OH_Drawing_Font}的指针。 + * @param OH_Drawing_Font_Metrics 指向字体度量信息对象{@link OH_Drawing_Font_Metrics}的指针。 + * @return 函数返回一个浮点数变量,表示建议的行间距。 + * @since 12 + * @version 1.0 + */ +float OH_Drawing_FontGetMetrics(OH_Drawing_Font*, OH_Drawing_Font_Metrics*); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h new file mode 100644 index 00000000..9dbedd38 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h @@ -0,0 +1,119 @@ +/* + * 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 + * + * 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 C_INCLUDE_DRAWING_IMAGE_H +#define C_INCLUDE_DRAWING_IMAGE_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 8 + * @version 1.0 + */ + +/** + * @file drawing_image.h + * + * @brief 文件中定义了与图片相关的功能函数。 + * + * 引用文件"native_drawing/drawing_image.h" + * @library libnative_drawing.so + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 创建一个图片对象,描述了要绘制的二维像素数组。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 函数返回一个指针,指针指向创建的图片对象{@link OH_Drawing_Image}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Image* OH_Drawing_ImageCreate(void); + +/** + * @brief 销毁图片对象并回收该对象占有内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image 指向图片对象{@link OH_Drawing_Image}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_ImageDestroy(OH_Drawing_Image*); + +/** + * @brief 从位图构造图片对象内容,共享或复制位图像素。如果位图被标记为不可变状态, + * 像素内存是共享的,不是复制。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image 指向图片对象{@link OH_Drawing_Image}的指针。 + * @param OH_Drawing_Bitmap 指向位图对象{@link OH_Drawing_Bitmap}的指针。 + * @return 函数返回true表示构造图片内容成功,函数返回false表示构建图片内容失败。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_ImageBuildFromBitmap(OH_Drawing_Image*, OH_Drawing_Bitmap*); + +/** + * @brief 获取图片宽度,即每行的像素个数。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image 指向图片对象{@link OH_Drawing_Image}的指针。 + * @return 函数返回图片宽度。 + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_ImageGetWidth(OH_Drawing_Image*); + +/** + * @brief 获取图片高度,即像素行数。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image 指向图片对象{@link OH_Drawing_Image}的指针。 + * @return 函数返回图片高度。 + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_ImageGetHeight(OH_Drawing_Image*); + +/** + * @brief 获取图片信息。调用该接口后,传入的图片信息对象被填充。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image 指向图片对象{@link OH_Drawing_Image}的指针。 + * @param OH_Drawing_Image_Info 指向图片信息对象{@link OH_Drawing_Image_Info}的指针, + * 开发者可调用{@link OH_Drawing_Image_Info}创建。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_ImageGetImageInfo(OH_Drawing_Image*, OH_Drawing_Image_Info*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif \ No newline at end of file diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index 1d1fdb12..999ddcb2 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -55,6 +55,47 @@ extern "C" { */ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); +/** + * @brief 创建一个带旋转属性的矩阵对象。 + * 该矩阵对象为:单位矩阵在(x, y)旋转点以度为单位进行旋转。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param deg 旋转的角度,单位为度。正数表示按顺时针旋转,负数表示按逆时针旋转。 + * @param x x轴上坐标点。 + * @param y y轴上坐标点。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation(float deg, float x, float y); + +/** + * @brief 创建一个带缩放属性的矩阵对象。 + * 该矩阵对象为:单位矩阵在(px, py)旋转点以sx和sy为缩放因子进行缩放。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param sx 水平缩放因子。 + * @param sy 垂直缩放因子。 + * @param px x轴上坐标点。 + * @param py y轴上坐标点。 + * @return 函数返回一个指针,指针指向创建的矩阵对象{@link OH_Drawing_Matrix}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale(float sx, float sy, float px, float py); + +/** + * @brief 创建一个带平移属性的矩阵对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param dx 水平方向平移距离。 + * @param dy 垂直方向平移距离。 + * @return 函数返回一个指针,指针指向创建的矩阵对象{@link OH_Drawing_Matrix}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation(float dx, float dy); + /** * @brief 用于给矩阵对象设置参数。 * @@ -75,6 +116,115 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2); +/** + * @brief 将矩阵total设置为矩阵a乘以矩阵b。 + * 例如给定矩阵a和矩阵b如下所示: + * | A B C | | J K L | + * a = | D E F |, b = | M N O | + * | G H I | | P Q R | + * 设置的最终矩阵total为: + * | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | + * total = a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | + * | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param total 指向最终的矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param a 指向矩阵对象a{@link OH_Drawing_Matrix}的指针。 + * @param b 指向矩阵对象b{@link OH_Drawing_Matrix}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixConcat(OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, + const OH_Drawing_Matrix* b); + +/** + * @brief 获取矩阵给定索引位的值。索引范围0-8。 + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param index 索引位置,范围0-8。 + * @return 函数返回矩阵给定索引位对应的值。 + * @since 12 + * @version 1.0 + */ +float OH_Drawing_MatrixGetValue(OH_Drawing_Matrix*, int index); + +/** + * @brief 设置矩阵围绕位于(px, py)的旋转轴点进行旋转。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param degree 角度,单位为度。正数表示顺时针旋转,负数表示逆时针旋转。 + * @param px x轴上坐标点。 + * @param py y轴上坐标点。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixRotate(OH_Drawing_Matrix*, float degree, float px, float py); + +/** + * @brief 将矩阵进行平移(dx, dy)。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param dx 水平方向平移距离。 + * @param dy 垂直方向平移距离。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix*, float dx, float dy); + +/** + * @brief 设置矩阵围绕位于(px, py)的旋转轴点,以sx和sy进行缩放。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param sx 水平缩放因子。 + * @param sy 垂直缩放因子。 + * @param px x轴上坐标点。 + * @param py y轴上坐标点。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py); + +/** + * @brief 将矩阵inverse设置为矩阵的倒数,并返回结果。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param inverse 指向逆矩阵对象{@link OH_Drawing_Matrix}的指针, + * 开发者可调用{@link OH_Drawing_MatrixCreate}接口创建。 + * @return 函数返回true表示矩阵可逆,inverse被填充为逆矩阵;函数返回false表示矩阵不可逆,inverse不被改变。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse); + +/** + * @brief 判断两个矩阵是否相等。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向用于判断的其中一个矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param other 指向用于判断的另一个矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @return 函数返回两个矩阵的比较结果,返回true表示两个矩阵相等,返回false表示两个矩阵不相等。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixIsEqual(OH_Drawing_Matrix*, OH_Drawing_Matrix* other); + +/** + * @brief 判断矩阵是否是单位矩阵。 + * 单位矩阵为 : | 1 0 0 | + * | 0 1 0 | + * | 0 0 1 | + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @return 函数返回true表示矩阵是单位矩阵,函数返回false表示矩阵不是单位矩阵。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixIsIdentity(OH_Drawing_Matrix*); + /** * @brief 用于销毁矩阵对象并回收该对象占有的内存。 * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h new file mode 100644 index 00000000..e79d7b26 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h @@ -0,0 +1,76 @@ +/* + * 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 + * + * 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 C_INCLUDE_DRAWING_MEMORY_STREAM_H +#define C_INCLUDE_DRAWING_MEMORY_STREAM_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 8 + * @version 1.0 + */ + +/** + * @file drawing_memory_stream.h + * + * @brief 文件中定义了与内存流相关的功能函数。 + * + * 引用文件"native_drawing/drawing_memory_stream.h" + * @library libnative_drawing.so + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 创建一个内存流对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param data 数据段。 + * @param length 数据段长度。 + * @param copyData 是否拷贝数据。true表示内存流对象会拷贝一份数据段数据, + * false表示内存流对象直接使用数据段数据,不拷贝。 + * @return 函数会返回一个指针,指针指向创建的内存流对象{@link OH_Drawing_MemoryStream}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate(const void* data, size_t length, bool copyData); + +/** + * @brief 销毁内存流对象并回收该对象占有内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_MemoryStream 指向内存流对象{@link OH_Drawing_MemoryStream}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MemoryStreamDestroy(OH_Drawing_MemoryStream*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h index 1fbdde21..2e16a6ba 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h @@ -45,6 +45,36 @@ extern "C" { #endif +/** + * @brief 添加闭合轮廓方向枚举。 + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** 顺时针方向添加闭合轮廓 */ + PATH_DIRECTION_CW, + /** 逆时针方向添加闭合轮廓 */ + PATH_DIRECTION_CCW, +} OH_Drawing_PathDirection; + +/** + * @brief 定义路径的填充类型枚举。 + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** 绘制所有线段包围的区域 */ + PATH_FILL_TYPE_WINDING, + /** 绘制所有线段包围奇次数的区域 */ + PATH_FILL_TYPE_EVEN_ODD, + /** PATH_FILL_TYPE_WINDING 取反,绘制不在所有线段包围区域的点 */ + PATH_FILL_TYPE_INVERSE_WINDING, + /** PATH_FILL_TYPE_EVEN_ODD 取反,绘制不在所有线段包围奇次数区域的点 */ + PATH_FILL_TYPE_INVERSE_EVEN_ODD, +} OH_Drawing_PathFillType; + /** * @brief 用于创建一个路径对象。 * @@ -55,6 +85,17 @@ extern "C" { */ OH_Drawing_Path* OH_Drawing_PathCreate(void); +/** + * @brief 创建一个路径对象副本{@link OH_Drawing_Path},用于拷贝一个已有路径对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path 指向路径对象{@link OH_Drawing_Path}的指针。 + * @return 函数返回一个指针,指针指向创建的路径对象副本{@link OH_Drawing_Path}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path*); + /** * @brief 用于销毁路径对象并回收该对象占有的内存。 * @@ -137,6 +178,98 @@ void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float end void OH_Drawing_PathCubicTo( OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); +/** + * @brief 按指定方向,向路径添加矩形轮廓。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path 指向路径对象{@link OH_Drawing_Path}的指针。 + * @param left 矩形左上角的x轴坐标。 + * @param top 矩形左上角的y轴坐标。 + * @param right 矩形右下角的x轴坐标。 + * @param bottom 矩形右下角的y轴坐标。 + * @param OH_Drawing_PathDirection 路径方向{@link OH_Drawing_PathDirection}。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddRect(OH_Drawing_Path*, float left, float top, + float right, float bottom, OH_Drawing_PathDirection); + +/** + * @brief 按指定方向,向路径添加圆角矩形轮廓。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path 指向路径对象{@link OH_Drawing_Path}的指针。 + * @param OH_Drawing_RoundRect 指向圆角矩形对象{@link OH_Drawing_RoundRect}的指针。 + * @param OH_Drawing_PathDirection 路径方向{@link OH_Drawing_PathDirection}。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddRoundRect(OH_Drawing_Path*, const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection); + +/** + * @brief 将弧添加到路径中,作为新轮廓的起点。从起始角度到扫掠角度添加弧, + * 添加的弧是椭圆边界椭圆的一部分,单位为度。正扫掠表示按顺时针方向延长弧, + * 负扫掠表示按逆时针方向延长弧。如果扫掠角度<= -360°,或扫掠角度>= 360°, + * 并且起始角度对90取模接近于0,则添加椭圆而不是弧。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path 指向路径对象{@link OH_Drawing_Path}的指针。 + * @param OH_Drawing_Rect 指向矩形对象{@link OH_Drawing_Rect}的指针。 + * @param startAngle 弧的起始角度,单位为度。 + * @param sweepAngle 扫掠角度,单位为度。正数表示顺时针方向,负数表示逆时针方向。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddArc(OH_Drawing_Path*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); + +/** + * @brief 将原路径矩阵变换后,添加到当前路径中。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path 指向当前路径对象{@link OH_Drawing_Path}的指针。 + * @param src 指向原路径对象{@link OH_Drawing_Path}的指针。 + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddPath(OH_Drawing_Path*, const OH_Drawing_Path* src, const OH_Drawing_Matrix*); + +/** + * @brief 判断指定坐标点是否被路径包含。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path 指向路径对象{@link OH_Drawing_Path}的指针。 + * @param x x轴上坐标点。 + * @param y y轴上坐标点。 + * @return 函数返回true表示点在路径内,函数返回false表示点在路径外。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_PathContains(OH_Drawing_Path*, float x, float y); + +/** + * @brief 对路径进行矩阵变换。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path 指向路径对象{@link OH_Drawing_Path}的指针。 + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*); + +/** + * @brief 设置填充路径的规则。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path 指向路径对象{@link OH_Drawing_Path}的指针。 + * @param OH_Drawing_PathFillType 路径填充规则{@link OH_Drawing_PathFillType}。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathSetFillType(OH_Drawing_Path*, OH_Drawing_PathFillType); + + /** * @brief 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。 * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h new file mode 100644 index 00000000..f092f30c --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h @@ -0,0 +1,76 @@ +/* + * 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 + * + * 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 C_INCLUDE_DRAWING_PATH_EFFECT_H +#define C_INCLUDE_DRAWING_PATH_EFFECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 8 + * @version 1.0 + */ + +/** + * @file drawing_path_effect.h + * + * @brief 文件中定义了与路径效果相关的功能函数。 + * + * 引用文件"native_drawing/drawing_path_effect.h" + * @library libnative_drawing.so + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 创建一个虚线效果的路径效果对象。虚线效果由一组虚线开的间隔、虚线关的间隔数据决定。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param intervals 虚线间隔数组首地址,偶数项的值表示虚线开的间隔长度, + * 奇数项的值表示虚线关的间隔长度,单位为像素。 + * @param count 虚线间隔数组元素的个数,必须为大于0的偶数。 + * @param phase 虚线间隔数组中偏移量。 + * @return 函数返回一个指针,指针指向创建的路径效果对象{@link OH_Drawing_PathEffect}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect(float* intervals, int count, float phase); + +/** + * @brief 销毁路径效果对象并回收该对象占有内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PathEffect 指向路径效果对象{@link OH_Drawing_PathEffect}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathEffectDestroy(OH_Drawing_PathEffect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index 6daef580..52767877 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -250,6 +250,50 @@ OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen*); */ void OH_Drawing_PenSetJoin(OH_Drawing_Pen*, OH_Drawing_PenLineJoinStyle); +/** + * @brief 设置画笔着色器效果。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen 指向画笔对象{@link OH_Drawing_Pen}的指针。 + * @param OH_Drawing_ShaderEffect 指向着色器对象{@link OH_Drawing_ShaderEffect}的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*); + +/** + * @brief 设置画笔路径效果。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen 指向画笔对象{@link OH_Drawing_Pen}的指针。 + * @param OH_Drawing_PathEffect 指向路径效果对象{@link OH_Drawing_PathEffect}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PenSetPathEffect(OH_Drawing_Pen*, OH_Drawing_PathEffect*); + +/** + * @brief 设置画笔滤波器。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen 指向画笔对象{@link OH_Drawing_Pen}的指针。 + * @param OH_Drawing_Filter 指向滤波器{@link OH_Drawing_Filter}的指针。 + * @since 11 + * @version 1.0 + */ +void OH_Drawing_PenSetFilter(OH_Drawing_Pen*, OH_Drawing_Filter*); + +/** + * @brief 为画笔设置一个混合器,该混合器实现了指定的混合模式枚举。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen 指向画笔对象{@link OH_Drawing_Pen}的指针。 + * @param OH_Drawing_BlendMode 混合模式枚举类型{@link OH_Drawing_BlendMode}。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PenSetBlendMode(OH_Drawing_Pen*, OH_Drawing_BlendMode); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h new file mode 100644 index 00000000..f941b39f --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h @@ -0,0 +1,102 @@ +/* + * 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 + * + * 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 C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H +#define C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 8 + * @version 1.0 + */ + +/** + * @file drawing_sampling_options.h + * + * @brief 文件中定义了与采样相关的功能函数。用于图片或者纹理等图像的采样。 + * + * 引用文件"native_drawing/drawing_sampling_options.h" + * @library libnative_drawing.so + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 过滤模式枚举。 + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** 邻近过滤模式 */ + FILTER_MODE_NEAREST, + /** 线性过滤模式 */ + FILTER_MODE_LINEAR, +} OH_Drawing_FilterMode; + +/** + * @brief 多级渐远纹理模式枚举。 + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** 忽略多级渐远纹理级别 */ + MIPMAP_MODE_NONE, + /** 邻近多级渐远级别采样 */ + MIPMAP_MODE_NEAREST, + /** 两个邻近多级渐远纹理之间,线性插值采样 */ + MIPMAP_MODE_LINEAR, +} OH_Drawing_MipmapMode; + +/** + * @brief 创建一个采样选项对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FilterMode 过滤采样模式{@link OH_Drawing_FilterMode} + * @param OH_Drawing_MipmapMode 多级渐远纹理采样模式{@link OH_Drawing_MipmapMode}。 + * @return 函数会返回一个指针,指针指向创建的采样选项对象{@link OH_Drawing_SamplingOptions}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode, OH_Drawing_MipmapMode); + +/** + * @brief 销毁采样选项对象并回收该对象占有内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_SamplingOptions 指向采样选项对象{@link OH_Drawing_SamplingOptions}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SamplingOptionsDestroy(OH_Drawing_SamplingOptions*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index 4aa875e2..84d81349 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -55,6 +55,63 @@ extern "C" { */ OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void); +/** + * @brief 从文本中创建一个文本对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param text 指向文本的指针。 + * @param byteLength 文本的字节长度。 + * @param OH_Drawing_Font 指向字体对象{@link OH_Drawing_Font}的指针。 + * @param OH_Drawing_TextEncoding 文本编码类型{@link OH_Drawing_TextEncoding}。 + * @return 函数返回一个指针,指针指向创建的文本对象{@link OH_Drawing_TextBlob}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText(const void* text, size_t byteLength, + const OH_Drawing_Font*, OH_Drawing_TextEncoding); + +/** + * @brief 从文本和文本的位置中创建一个文本对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param text 指向文本的指针。 + * @param byteLength 文本的字节长度。 + * @param OH_Drawing_Point2D 二维点{@link OH_Drawing_Point2D}数组首地址,数组个数由{@link OH_Drawing_FontCountText}计算结果决定。 + * @param OH_Drawing_Font 指向字体对象{@link OH_Drawing_Font}的指针。 + * @param OH_Drawing_TextEncoding 文本编码类型{@link OH_Drawing_TextEncoding}。 + * @return 函数返回一个指针,指针指向创建的文本对象{@link OH_Drawing_TextBlob}。 + * @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); + +/** + * @brief 从字符串中创建文本对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param str 指向字符串的指针。 + * @param OH_Drawing_Font 指向字体对象{@link OH_Drawing_Font}的指针。 + * @param OH_Drawing_TextEncoding 文本编码类型{@link OH_Drawing_TextEncoding}。 + * @return 函数返回一个指针,指针指向创建的文本对象{@link OH_Drawing_TextBlob}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString(const char* str, + const OH_Drawing_Font*, OH_Drawing_TextEncoding); + +/** + * @brief 获取文本对象的边界范围。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlob 指向文本对象{@link OH_Drawing_TextBlob}的指针。 + * @param OH_Drawing_Rect 指向矩形对象{@link OH_Drawing_Rect}的指针, + * 开发者可调用{@link OH_Drawing_Rect}接口创建。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob*, OH_Drawing_Rect*); + /** * @brief 结构体用于描述一块内存,描述文字和位置信息。 * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h index efaaf537..e65c963e 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -56,6 +56,31 @@ extern "C" { */ OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); +/** + * @brief 通过文件创建一个字形对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path 指向文件路径的指针。 + * @param index 文件索引。 + * @return 函数返回一个指针,指针指向创建的字形对象{@link OH_Drawing_Typeface}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile(const char* path, int index); + +/** + * @brief 通过内存流创建一个字形对象。如果内存流是无效的字体文件,返回空指针。 + * 内存流传入后,所有权转移,开发者不能再释放它。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_MemoryStream 指向内存流对象{@link OH_Drawing_MemoryStream}的指针。 + * @param index 内存流索引。 + * @return 返回一个指针,指针指向创建的字形对象{@link OH_Drawing_Typeface}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream(OH_Drawing_MemoryStream*, int32_t index); + /** * @brief 用于销毁字形对象并回收该对象占有的内存。 * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index 4fc0f7a1..a1ee739c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -93,6 +93,37 @@ typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap; */ typedef struct OH_Drawing_Point OH_Drawing_Point; +/** + * @brief 定义一个二维的坐标点。 + * + * @since 12 + * @version 1.0 + */ +typedef struct { + float x; + float y; +} OH_Drawing_Point2D; + +/** + * @brief 定义一个三维的坐标点。 + * + * @since 12 + * @version 1.0 + */ +typedef struct { + float x; + float y; + float z; +} OH_Drawing_Point3D; + +/** + * @brief 定义一个路径效果,用于影响描边路径。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect; + /** * @brief 用于描述矩形。 * @@ -157,6 +188,14 @@ typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter; */ typedef struct OH_Drawing_Font OH_Drawing_Font; +/** + * @brief 用于描述内存流。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream; + /** * @brief 用于描述字形。 * @@ -174,6 +213,22 @@ typedef struct OH_Drawing_Typeface OH_Drawing_Typeface; */ typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob; +/** + * @brief 定义一个用于描述绘制二维像素数组的图片。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_Image OH_Drawing_Image; + +/** + * @brief 定义一个采样选项,用于描述图片、位图等图像的采样方法。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions; + /** * @brief 定义文本构建器,用于构建文本。 * @@ -307,6 +362,39 @@ typedef enum { BLEND_MODE_LUMINOSITY, } OH_Drawing_BlendMode; +/** + * @brief 定义图片信息结构体。 + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** 宽度,单位为像素 */ + int32_t width; + /** 高度,单位为像素 */ + int32_t height; + /** 颜色类型{@link OH_Drawing_ColorFormat} */ + OH_Drawing_ColorFormat colorType; + /** 透明度类型{@link OH_Drawing_AlphaFormat} */ + OH_Drawing_AlphaFormat alphaType; +} OH_Drawing_Image_Info; + +/** + * @brief 文本编码类型枚举。 + * @since 12 + * @version 1.0 + */ +typedef enum { + /** 单字节,表示UTF-8或ASCII */ + TEXT_ENCODING_UTF8, + /** 双字节,表示大部分Unicode */ + TEXT_ENCODING_UTF16, + /** 四字节,表示所有Unicode */ + TEXT_ENCODING_UTF32, + /** 双字节,表示字形索引 */ + TEXT_ENCODING_GLYPH_ID, +} OH_Drawing_TextEncoding; + #ifdef __cplusplus } #endif -- Gitee From b7530a7c1b34246d670b23066c4becaa66530c09 Mon Sep 17 00:00:00 2001 From: yyuanche Date: Mon, 19 Feb 2024 11:30:59 +0800 Subject: [PATCH 0267/2135] =?UTF-8?q?NDK=20=E8=A1=A5=E5=85=85=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E7=BB=84=E4=BB=B6=E5=A4=B4=E6=96=87=E4=BB=B6=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=20Signed-off-by:=20yyuanche=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_node.h | 127 +++++++++++++++++++++++++++++ zh-cn/native_sdk/ace/native_type.h | 28 +++---- 2 files changed, 141 insertions(+), 14 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index fee88381..5e5f9a83 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -4952,6 +4952,133 @@ typedef enum { */ NODE_LIST_ITEM_GROUP_SET_DIVIDER, + /** + * @brief 设置Column子组件在水平方向上的对齐格式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件在水平方向上的对齐格式,数据类型{@link ArkUI_HorizontalAlignment}, \n + * 默认值ARKUI_HORIZONTAL_ALIGNMENT_CENTER。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件在水平方向上的对齐格式,数据类型{@link ArkUI_HorizontalAlignment}。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_HORIZONTAL_ALIGNMENT_START } }; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS); + * auto nodeColumnAlignItems = item->value[0].i32; + * @endcode + * + */ + NODE_COLUMN_ALIGN_ITEMS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_COLUMN, + /** + * @brief 设置Column子组件在垂直方向上的对齐格式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件在垂直方向上的对齐格式,数据类型{@link ArkUI_FlexAlignment}, \n + * 默认值ARKUI_FLEX_ALIGNMENT_START。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件在垂直方向上的对齐格式,数据类型{@link ArkUI_FlexAlignment}。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT); + * auto nodeColumnJustifyContent = item->value[0].i32; + * @endcode + * + */ + NODE_COLUMN_JUSTIFY_CONTENT, + + /** + * @brief 设置Row子组件在垂直方向上的对齐格式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件在垂直方向上的对齐格式,数据类型{@link ArkUI_VerticalAlignment}, \n + * 默认值ARKUI_VERTICAL_ALIGNMENT_CENTER。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件在垂直方向上的对齐格式,数据类型{@link ArkUI_VerticalAlignment}。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_VERTICAL_ALIGNMENT_TOP } }; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS); + * auto nodeRowAlignItems = item->value[0].i32; + * @endcode + * + */ + NODE_ROW_ALIGN_ITEMS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_ROW, + /** + * @brief 设置Row子组件在水平方向上的对齐格式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件在水平方向上的对齐格式,数据类型{@link ArkUI_FlexAlignment}, \n + * 默认值ARKUI_FLEX_ALIGNMENT_START。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32:子组件在水平方向上的对齐格式,数据类型{@link ArkUI_FlexAlignment}。 \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT); + * auto nodeRowAlignItems = item->value[0].i32; + * @endcode + * + */ + NODE_ROW_JUSTIFY_CONTENT, + + /** + * @brief 设置Flex属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0]?.i32:子组件在Flex容器上排列的方向{@link ArkUI_FlexDirection},默认值为ARKUI_FLEX_DIRECTION_ROW; \n + * .value[1]?.i32:排列规则{@link ArkUI_FlexWrap},默认值为ARKUI_FLEX_WRAP_NO_WRAP; \n + * .value[2]?.i32:主轴上的对齐格式{@link ArkUI_FlexAlignment},默认值为ARKUI_FLEX_ALIGNMENT_START; \n + * .value[3]?.i32:交叉轴上的对齐格式{@link ArkUI_ItemAlignment},默认值为ARKUI_ITEM_ALIGNMENT_START; \n + * .value[4]?.i32: 交叉轴中有额外的空间时,多行内容的对齐方式{@link ArkUI_FlexAlignment},默认值为ARKUI_FLEX_ALIGNMENT_START; \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0]?.i32:子组件在Flex容器上排列的方向的枚举值; \n + * .value[1]?.i32:排列规则的枚举值; \n + * .value[2]?.i32:主轴上的对齐格式的枚举值; \n + * .value[3]?.i32:交叉轴上的对齐格式的枚举值; \n + * .value[4]?.i32: 交叉轴中有额外的空间时,多行内容的对齐方式的枚举值; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FLEX_DIRECTION_COLUMN}, {.i32 = ARKUI_FLEX_WRAP_WRAP}, + * {.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}, {.i32 = ARKUI_ITEM_ALIGNMENT_CENTER}, + * {.i32 = ARKUI_FLEX_ALIGNMENT_END}}; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_OPTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FLEX_OPTION); + * auto nodeFlexDirection = item->value[1].i32; + * auto nodeFlexWrap = item->value[2].i32; + * auto nodeFlexJustifyContent = item->value[3].i32; + * auto nodeFlexAlignItems = item->value[4].i32; + * auto nodeFlexAlignContent = item->value[5].i32; + * + * @endcode + * + */ + NODE_FLEX_OPTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_FLEX, + /** * @brief 设置组件是否正在刷新,支持属性设置,属性获取。 * diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index f243343d..0433f7cc 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -958,18 +958,18 @@ typedef enum { */ typedef enum { /** 使用Flex容器中默认配置。 */ - ARKUI_ITEM_ALIGN_AUTO = 0, + ARKUI_ITEM_ALIGNMENT_AUTO = 0, /** 元素在Flex容器中,交叉轴方向首部对齐。 */ - ARKUI_ITEM_ALIGN_START, + ARKUI_ITEM_ALIGNMENT_START, /** 元素在Flex容器中,交叉轴方向居中对齐。 */ - ARKUI_ITEM_ALIGN_CENTER, + ARKUI_ITEM_ALIGNMENT_CENTER, /** 元素在Flex容器中,交叉轴方向底部对齐。 */ - ARKUI_ITEM_ALIGN_END, + ARKUI_ITEM_ALIGNMENT_END, /** 元素在Flex容器中,交叉轴方向拉伸填充。 */ - ARKUI_ITEM_ALIGN_STRETCH, + ARKUI_ITEM_ALIGNMENT_STRETCH, /** 元素在Flex容器中,交叉轴方向文本基线对齐。 */ - ARKUI_ITEM_ALIGN_BASELINE, -} ArkUI_ItemAlign; + ARKUI_ITEM_ALIGNMENT_BASELINE, +} ArkUI_ItemAlignment; /** * @brief 前景色枚举值。 @@ -992,18 +992,18 @@ typedef enum { */ typedef enum { /** 主轴方向首端对齐。 */ - ARKUI_FLEX_ALIGN_START = 1, + ARKUI_FLEX_ALIGNMENT_START = 1, /** 主轴方向中心对齐。 */ - ARKUI_FLEX_ALIGN_CENTER = 2, + ARKUI_FLEX_ALIGNMENT_CENTER = 2, /** 主轴方向尾部对齐。 */ - ARKUI_FLEX_ALIGN_END = 3, + ARKUI_FLEX_ALIGNMENT_END = 3, /** Flex主轴方向均匀分配弹性元素,相邻元素之间距离相同,第一个元素行首对齐,最后的元素行尾对齐。 */ - ARKUI_FLEX_ALIGN_SPACE_BETWEEN = 6, + ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN = 6, /** Flex主轴方向均匀分配弹性元素,相邻元素之间距离相同,第一个元素到行首的距离时相邻元素间距离的一半。 */ - ARKUI_FLEX_ALIGN_SPACE_AROUND = 7, + ARKUI_FLEX_ALIGNMENT_SPACE_AROUND = 7, /** Flex主轴方向均匀分配弹性元素,相邻元素之间距离、第一个元素到行首的距离和最后的元素到行尾的距离均相等。 */ - ARKUI_FLEX_ALIGN_SPACE_EVENLY = 8, -} ArkUI_FlexAlign; + ARKUI_FLEX_ALIGNMENT_SPACE_EVENLY = 8, +} ArkUI_FlexAlignment; /** * @brief 定义Flex容器的主轴方向。 -- Gitee From 86ef85bda6dc82378b2236ac52f3e1994f22fc77 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Mon, 19 Feb 2024 17:07:08 +0800 Subject: [PATCH 0268/2135] [NDK] fix slider description Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- zh-cn/native_sdk/ace/native_node.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 5e5f9a83..7bc9636e 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -4046,12 +4046,10 @@ typedef enum { * @brief 设置是否显示步长刻度值,支持属性设置,属性重置和属性获取。 * * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n - * .value[0].i32:是否显示气泡,1表示显示,0表示不显示,默认值为0。\n - * .string? 可选值,气泡提示的文本内容,默认显示当前百分比字符串。\n + * .value[0].i32:是否显示步长刻度值,1表示显示,0表示不显示,默认值为0。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32:是否显示气泡,1表示显示,0表示不显示,默认值为0。\n - * .string? 可选值,气泡提示的文本内容,默认显示当前百分比字符串。\n + * .value[0].i32:是否显示步长刻度值,1表示显示,0表示不显示,默认值为0。\n * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = -- Gitee From aa857a73e502687ebf708f5296fc86c664d6799a Mon Sep 17 00:00:00 2001 From: d00613262 Date: Mon, 19 Feb 2024 16:12:32 +0800 Subject: [PATCH 0269/2135] docs bugfix Signed-off-by: ustc-tianyu --- .../graphic/native_drawing/drawing_bitmap.h | 7 ++++--- .../graphic/native_drawing/drawing_brush.h | 3 ++- .../graphic/native_drawing/drawing_canvas.h | 5 +++-- .../graphic/native_drawing/drawing_color.h | 3 ++- .../native_drawing/drawing_color_filter.h | 5 +++-- .../graphic/native_drawing/drawing_filter.h | 5 +++-- .../graphic/native_drawing/drawing_font.h | 5 +++-- .../native_drawing/drawing_font_collection.h | 3 ++- .../graphic/native_drawing/drawing_image.h | 3 ++- .../native_drawing/drawing_mask_filter.h | 5 +++-- .../graphic/native_drawing/drawing_matrix.h | 3 ++- .../native_drawing/drawing_memory_stream.h | 3 ++- .../graphic/native_drawing/drawing_path.h | 9 +++++---- .../native_drawing/drawing_path_effect.h | 3 ++- .../graphic/native_drawing/drawing_pen.h | 7 ++++--- .../graphic/native_drawing/drawing_point.h | 3 ++- .../graphic/native_drawing/drawing_rect.h | 3 ++- .../graphic/native_drawing/drawing_round_rect.h | 3 ++- .../native_drawing/drawing_sampling_options.h | 7 ++++--- .../native_drawing/drawing_shader_effect.h | 5 +++-- .../graphic/native_drawing/drawing_text_blob.h | 5 +++-- .../native_drawing/drawing_text_declaration.h | 1 + .../native_drawing/drawing_text_typography.h | 17 +++++++++-------- .../graphic/native_drawing/drawing_typeface.h | 3 ++- .../graphic/native_drawing/drawing_types.h | 15 ++++++++------- 25 files changed, 78 insertions(+), 53 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index 18cf2b01..4c19ff95 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -20,8 +20,9 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 - * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -51,7 +52,7 @@ extern "C" { * @since 8 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_BitmapFormat { /** 描述位图像素的存储格式 */ OH_Drawing_ColorFormat colorFormat; /** 描述位图像素的透明度分量 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index b531c154..bda5a13c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -21,7 +21,8 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index ef206064..834f777b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -21,6 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -360,7 +361,7 @@ void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_CanvasClipOp { /** * 将指定区域裁剪(取差集)。 */ @@ -510,7 +511,7 @@ void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); * @since 12 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_CanvasShadowFlags { /** * 无阴影标志。 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h index 87abdab5..307f4566 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h @@ -21,7 +21,8 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h index 46381c69..3c5685f6 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h @@ -20,11 +20,12 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h index bf91c840..2e93bcb3 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h @@ -20,11 +20,12 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index 979577c6..b38537e0 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -151,7 +152,7 @@ void OH_Drawing_FontDestroy(OH_Drawing_Font*); * @since 12 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_Font_Metrics { /** 字符最高点到基线的最大距离 */ float top; /** 字符最高点到基线的推荐距离 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 0a2a02e9..4834a108 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -20,7 +20,8 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h index 9dbedd38..3ab59ec5 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h @@ -20,7 +20,8 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h index 5e3ebd79..f489d280 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -51,7 +52,7 @@ extern "C" { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_BlurType { /** * 内外模糊。 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index 999ddcb2..0df8c3c5 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h index e79d7b26..8c25a955 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h @@ -20,7 +20,8 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h index 2e16a6ba..24740025 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h @@ -20,8 +20,9 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数. - * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -51,7 +52,7 @@ extern "C" { * @since 12 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_PathDirection { /** 顺时针方向添加闭合轮廓 */ PATH_DIRECTION_CW, /** 逆时针方向添加闭合轮廓 */ @@ -64,7 +65,7 @@ typedef enum { * @since 12 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_PathFillType { /** 绘制所有线段包围的区域 */ PATH_FILL_TYPE_WINDING, /** 绘制所有线段包围奇次数的区域 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h index f092f30c..a947c8dc 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h @@ -20,7 +20,8 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index 52767877..9ea2200c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -21,7 +21,8 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -182,7 +183,7 @@ void OH_Drawing_PenSetMiterLimit(OH_Drawing_Pen*, float miter); * @since 8 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_PenLineCapStyle { /** 没有笔帽样式,线条头尾端点处横切 */ LINE_FLAT_CAP, /** 笔帽的样式为方框,线条的头尾端点处多出一个方框,方框宽度和线段一样宽,高度时线段厚度的一半 */ @@ -219,7 +220,7 @@ void OH_Drawing_PenSetCap(OH_Drawing_Pen*, OH_Drawing_PenLineCapStyle); * @since 8 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_PenLineJoinStyle { /** 转角类型为尖角,如果折线角度比较小,则尖角会很长,需要使用限制值(miter limit)进行限制 */ LINE_MITER_JOIN, /** 转角类型为圆头 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h index e51db265..ea1ea58f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h index 539e3831..b28f062b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h index c9faf0c3..e43ec59a 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h index f941b39f..359cd779 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h @@ -20,7 +20,8 @@ * @addtogroup Drawing * @{ * - * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数 + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -51,7 +52,7 @@ extern "C" { * @since 12 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_FilterMode { /** 邻近过滤模式 */ FILTER_MODE_NEAREST, /** 线性过滤模式 */ @@ -64,7 +65,7 @@ typedef enum { * @since 12 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_MipmapMode { /** 忽略多级渐远纹理级别 */ MIPMAP_MODE_NONE, /** 邻近多级渐远级别采样 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h index 4807bdc9..9a7f7905 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -51,7 +52,7 @@ extern "C" { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_TileMode { /** * 如果着色器效果超出其原始边界,则复制边缘颜色。 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index 84d81349..2fa7ac01 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -118,7 +119,7 @@ void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob*, OH_Drawing_Rect*); * @since 11 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_RunBuffer { /** 存储文字索引 */ uint16_t* glyphs; /** 存储文字的位置 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index d4830ab1..f0b64992 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -21,6 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index c6f265ed..e2794b9a 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -21,6 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -154,7 +155,7 @@ enum OH_Drawing_FontStyle { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_PlaceholderVerticalAlignment { /** 偏移于基线对齐 */ ALIGNMENT_OFFSET_AT_BASELINE, /** 高于基线对齐 */ @@ -175,7 +176,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_PlaceholderSpan { /** 占位符宽度 */ double width; /** 占位符高度 */ @@ -194,7 +195,7 @@ typedef struct { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_TextDecorationStyle { /** 实心样式 */ TEXT_DECORATION_STYLE_SOLID, /** 双重样式 */ @@ -213,7 +214,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_EllipsisModal { /** 头部模式,即省略号放在文本头部 */ ELLIPSIS_MODAL_HEAD = 0, /** 中部模式,即省略号放在文本中部 */ @@ -228,7 +229,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_BreakStrategy { /** 贪心策略,换行时尽可能填满每一行 */ BREAK_STRATEGY_GREEDY = 0, /** 高质量策略,换行时优先考虑文本的连续性 */ @@ -243,7 +244,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_WordBreakType { /** 常规方式 */ WORD_BREAK_TYPE_NORMAL = 0, /** 全部中断方式 */ @@ -258,7 +259,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_RectHeightStyle { /** 紧密样式 */ RECT_HEIGHT_STYLE_TIGHT, /** 最大样式 */ @@ -279,7 +280,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_RectWidthStyle { /** 紧密样式 */ RECT_WIDTH_STYLE_TIGHT, /** 最大样式 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h index e65c963e..3b68dd3f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -21,10 +21,11 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index a1ee739c..5eab9d64 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -21,6 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和框架采用的像素单位保持一致。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -99,7 +100,7 @@ typedef struct OH_Drawing_Point OH_Drawing_Point; * @since 12 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_Point2D { float x; float y; } OH_Drawing_Point2D; @@ -110,7 +111,7 @@ typedef struct { * @since 12 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_Point3D { float x; float y; float z; @@ -243,7 +244,7 @@ typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder; * @since 8 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_ColorFormat { /** 未知格式. */ COLOR_FORMAT_UNKNOWN, /** 每个像素用一个8位的量表示,8个位比特位表示透明度 */ @@ -264,7 +265,7 @@ typedef enum { * @since 8 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_AlphaFormat { /** 未知格式 */ ALPHA_FORMAT_UNKNOWN, /** 位图无透明度 */ @@ -301,7 +302,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_BlendMode { /** 清除模式,r = 0. */ BLEND_MODE_CLEAR, /** r = s(result的4个通道,都等于source的4个通道,即结果等于源。) */ @@ -368,7 +369,7 @@ typedef enum { * @since 12 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_Image_Info { /** 宽度,单位为像素 */ int32_t width; /** 高度,单位为像素 */ @@ -384,7 +385,7 @@ typedef struct { * @since 12 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_TextEncoding { /** 单字节,表示UTF-8或ASCII */ TEXT_ENCODING_UTF8, /** 双字节,表示大部分Unicode */ -- Gitee From f983c2f99fbca73f319b1d9ee6e1df8064c25f36 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Tue, 20 Feb 2024 09:26:04 +0800 Subject: [PATCH 0270/2135] [NDK] fix slider description Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- zh-cn/native_sdk/ace/native_node.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 7bc9636e..f14120fc 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -2337,7 +2337,7 @@ typedef enum { * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 16, { .i32 = ARKUI_FONT_STYLE_NORMAL }, + * ArkUI_NumberValue value[] = { 16, { .i32 = ARKUI_FONT_WEIGHT_NORMAL }, * { .i32 = ARKUI_FONT_STYLE_NORMAL } }; * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_FONT, &item); @@ -3301,7 +3301,7 @@ typedef enum { * @brief CheckBox多选框内部图标样式,支持属性设置,属性重置和属性获取。 * * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n - * .value[0].i32:边框颜色, 类型为0xargb,如0xFF1122FF;\n + * .value[0].u32:边框颜色, 类型为0xargb,如0xFF1122FF;\n * .value[1]?.f32:可选,内部图标大小,单位vp;\n * .value[2]?.f32:可选,内部图标粗细,单位vp,默认值2。\n * \n @@ -3313,11 +3313,11 @@ typedef enum { * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 0xFF1122FF }, 20.0f, 2.0f }; + * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF }, 20.0f, 2.0f }; * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_MARK, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_MARK); - * auto value = item->value[0].i32; + * auto value = item->value[0].u32; * @endcode * */ -- Gitee From f5e2a37a42c37705fa920c1282a80991f8eeb07c Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Tue, 20 Feb 2024 11:44:55 +0800 Subject: [PATCH 0271/2135] Update docs (0220) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_node.h | 1537 ++++++++++++++++++++----------- en/native_sdk/ace/native_type.h | 243 +++-- 2 files changed, 1149 insertions(+), 631 deletions(-) diff --git a/en/native_sdk/ace/native_node.h b/en/native_sdk/ace/native_node.h index 6259bc2a..4c33e90f 100644 --- a/en/native_sdk/ace/native_node.h +++ b/en/native_sdk/ace/native_node.h @@ -369,7 +369,8 @@ typedef enum { *.value[1].f32: Y coordinate of the rotation axis vector. The default value is 0.\n *.value[2].f32: Z coordinate of the rotation axis vector. The default value is 0.\n *.value[3].f32: rotation angle. The default value is 0.\n - *.value[4].f32: line of sight, that is, the distance from the viewpoint to the z=0 plane, in vp. The default value is 0. \n + *.value[4].f32: line of sight, that is, the distance from the viewpoint to the z=0 plane, in vp. + * The default value is 0. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].f32: X coordinate of the rotation axis vector.\n @@ -410,10 +411,10 @@ typedef enum { /** * @brief Sets the saturation 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: saturation value. The default value is 1.0, and the recommended value range is [0, FLT_MAX]. + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n + *.value[0].f32: saturation value. The default value is 1.0, and the recommended value range is [0, FLT_MAX]. \n * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n + * Format of the return value {@link ArkUI_AttributeItem}: \n *.value[0].f32: saturation value. \n * * @code {.cpp} @@ -429,13 +430,13 @@ typedef enum { /** * @brief Sets the 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 + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n * .value[0].f32: blur radius. A larger value indicates a higher blur degree. If the value is 0, * the component is not blurred. The unit is vp. The default value is 0.0. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - *.value[0].f32: blur radius. The larger the fuzzy radius, the more blurred the image. - * When the value is 0, the image is not blurred. The unit is vp. \n + *.value[0].f32: blur radius. The larger the fuzzy radius, the more blurred the image. If the value is 0, + * the image is not blurred. The unit is vp. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); @@ -452,31 +453,43 @@ typedef enum { * @brief Sets the gradient attribute, which can be set, reset, and obtained as required through APIs. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .string: array of four parameters of the string type, separated by semicolons (;).\n - * Parameter 1: array of color stops, each of which consists of a color and its stop position. - * Invalid colors are automatically skipped. The color stops, set in vp, are separated by commas (,).\n - * Parameter 2: start angle of the linear gradient. A positive value indicates a clockwise rotation from - * the origin, (0, 0). The default value is 180.\n - * Parameter 3: - * direction of the linear gradient. It does not take effect when angle is set. + * .value[0].f32: start angle of the linear gradient. A positive value indicates a clockwise rotation from the + * origin, (0, 0). The default value is 180. \n + * .value[1].i32: direction of the linear gradient. It does not take effect when angle is set. * Value: ("left","top","right","bottom","left-top","left-bottom","right-top",\n - * "right-bottom","none",default value "bottom";\n - * Parameter 4: whether the colors are repeated. The default value is false.\n - * Example: "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" - * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n - * * .string: array of four parameters of the string type, separated by semicolons (;).\n - * Parameter 1: array of color stops, each of which consists of a color and its stop position. - * Invalid colors are automatically skipped. The color stops, set in vp, are separated by commas (,).\n - * Parameter 2: start angle of the linear gradient. - * A positive value indicates a clockwise rotation from the origin, (0, 0).\n - * Parameter 3: direction of the linear gradient. It does not take effect when angle is set. - * Parameter 4: whether the colors are repeated.\n \n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" }; + * "right-bottom","none",default value "bottom";\n + * .value[2].u32: whether the colors are repeated. The default value is false. + * Example: "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true". \n + * .object: array of color stops, each of which consists of a color and its stop position. + * Invalid colors are automatically skipped. \n + * colors: colors of the color stops. \n + * stops: stop positions of the color stops. \n + * size: number of colors. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}: \n + * .value[0].f32: start angle of the linear gradient. A positive value indicates a clockwise rotation from the + * origin, (0, 0). The default value is 180.\n + * .value[1].i32: direction of the linear gradient. It does not take effect when angle is set. \n + *.value[0].u32: whether the colors are repeated. The default value is false. \n + * .object: array of color stops, each of which consists of a color and its stop position. + * Invalid colors are automatically skipped. \n + * colors: colors of the color stops. \n + * stops: stop positions of the color stops. \n + * size: number of colors. \n + * @code {.cpp} + * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; + * float stops[] = { 0.0, 0.5 }; + * ArkUIColorStop colorStop = { colors, stops, 2 }; + * ArkUI_ColorStop* ptr = &colorStop; + * ArkUI_NumberValue value[] = {{ .f32 = 60 } , { .i32 = left } , { .i32 = true }}; + * ArkUI_AttributeItem item = + * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LINEAR_GRADIENT, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LINEAR_GRADIENT); - * auto nodeLinearGradient = item->string; + * auto nodeLinearGradientStartAngel = item->value[0]; + * auto nodeLinearGradientDirection = item->value[1]; + * auto nodeLinearGradientFill = item->value[2]; + * auto nodeLinearGradientColorStop = item->object; * @endcode * */ @@ -653,7 +666,7 @@ typedef enum { */ NODE_BORDER_STYLE, /** - * @brief Defines the z-index attribute for stacking. + * @brief Defines the z-index attribute for the stack sequence. * This attribute can be set, reset, and obtained as required through APIs. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n @@ -721,33 +734,72 @@ typedef enum { */ NODE_CLIP, /** - * @brief Defines the clip shape attribute, which can be set, reset, and obtained as required through APIs. + * @brief Defines the clipping region on 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 - * .string: shape. Optional.\n - * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, - * and radius height, respectively.\n - * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n - * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n - * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and commands, - * respectively.\n - * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n - * .string: shape.\n - * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, and - * radius height, respectively.\n - * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n - * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n - * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and commands, - * respectively.\n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute, + * which supports five types of shapes:\n + * 1. Rectangle:\n + * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. + * The value is ARKUI_CLIP_TYPE_RECT for the rectangle shape.\n + * .value[1].f32: width of the rectangle.\n + * .value[2].f32: height of rectangle.\n + * .value[3].f32: width of the rounded corner of the rectangle.\n + * .value[4].f32: height of the rounded corner of the rectangle.\n + * 2. Circle:\n + * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. + * The value is ARKUI_CLIP_TYPE_CIRCLE for the circle shape.\n + * .value[1].f32: width of the circle.\n + * .value[2].f32: height of the circle.\n + * 3.Ellipse:\n + * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. + * The value is ARKUI_CLIP_TYPE_ELLIPSE for the ellipse shape.\n + * .value[1].f32: width of the ellipse.\n + * .value[2].f32: height of the ellipse.\n + * 4. Path:\n + * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. + * The value is ARKUI_CLIP_TYPE_PATH for the path shape.\n + * .value[1].f32: width of the path.\n + * .value[2].f32: height of the path.\n + * .string: command for drawing the path.\n + * Format of the return value {@link ArkUI_AttributeItem}, which supports five types of shapes:\n + * 1. Rectangle:\n + * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. + * The value is ARKUI_CLIP_TYPE_RECT for the rectangle shape.\n + * .value[1].f32: width of the rectangle.\n + * .value[2].f32: height of rectangle.\n + * .value[3].f32: width of the rounded corner of the rectangle.\n + * .value[4].f32: height of the rounded corner of the rectangle.\n + * 2. Circle:\n + * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. + * The value is ARKUI_CLIP_TYPE_CIRCLE for the circle shape.\n + * .value[1].f32: width of the circle.\n + * .value[2].f32: height of the circle.\n + * 3.Ellipse:\n + * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. + * The value is ARKUI_CLIP_TYPE_ELLIPSE for the ellipse shape.\n + * .value[1].f32: width of the ellipse.\n + * .value[2].f32: height of the ellipse.\n + * 4. Path:\n + * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. + * The value is ARKUI_CLIP_TYPE_PATH for the path shape.\n + * .value[1].f32: width of the path.\n + * .value[2].f32: height of the path.\n + * .string: command for drawing the path.\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "rect(10,10,10,10)" }; + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = + * { {.i32 = ARKUI_CLIP_TYPE_RECT}, 100, 100, 15, 15, { .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP_SHAPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); - * auto nodeClipShape = item->string; + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP_SHAPE); + * auto nodeClipType = item->value[0].i32; + * auto nodeClipWidth = item->value[1].f32; + * auto nodeClipHeight = item->value[2].f32; + * auto nodeClipRadiusWidth = item->value[3].f32; + * auto nodeClipRadiusHeight = item->value[4].f32; * @endcode * */ @@ -799,8 +851,8 @@ typedef enum { */ NODE_HIT_TEST_BEHAVIOR, /** - * @brief Defines the offset attribute, which specifies the offset of the component's upper left corner relative to - * the parent container's. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the offset attribute, which specifies the offset of the component's upper left corner relative + * to the parent container's. 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: X coordinate. \n @@ -848,30 +900,39 @@ typedef enum { * @brief Defines the custom shadow effect. 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: array of six parameters of the string type, separated by semicolons (;).\n - * Parameter 1: shadow blur radius. \n - * Parameter 2: offset of the shadow along the x-axis. \n - * Parameter 3: offset of the shadow along the y-axis. \n - * Parameter 4: shadow type. \n - * Parameter 5: shadow color. \n - * Parameter 6: whether to fill the shadow. \n + * .value[0]?.f32: blur radius of the shadow, in vp.\n + * .value[1]? .i32: whether to enable the coloring strategy. The value 1 means to enable the coloring + * strategy, and 0 (default value) means the opposite.\n + * .value[2]?.f32: offset of the shadow along the x-axis, in vp.\n + * .value[3]?.f32: offset of the shadow along the y-axis, in vp.\n + * .value[4]?.i32: shadow type {@link ArkUI_ShadowType}. The default value is ARKUI_SHADOW_TYPE_COLOR.\n + * .value[5]?.u32: shadow color, in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * .value[6]?.u32: whether to fill the shadow. The value 1 means to fill the shadow, and 0 + * means the opposite.\n + * * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .string: array of six parameters of the string type, separated by semicolons (;).\n - * Parameter 1: shadow blur radius. \n - * Parameter 2: offset of the shadow along the x-axis. \n - * Parameter 3: offset of the shadow along the y-axis. \n - * Parameter 4: shadow type. \n - * Parameter 5: shadow color. \n - * Parameter 6: whether to fill the shadow. \n + * .value[0].f32: blur radius of the shadow, in vp.\n + * .value[1]?.i32: whether to enable the coloring strategy.\n + * .value[2].f32: offset of the shadow along the x-axis, in vp.\n + * .value[3].f32: offset of the shadow along the y-axis, in vp.\n + * .value[4].i32: shadow type {@link ArkUI_ShadowType}. The default value is ARKUI_SHADOW_TYPE_COLOR.\n + * .value[5].u32: shadow color, in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * .value[6].u32: whether to fill the shadow. The value 1 means to fill the shadow, and 0 + * means the opposite.\n * * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "5; 10; 10; COLOR; #FFF00FFF; true" }; + * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = + * { 10, {.i32 = 1},10, 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, {.i32 = 1} }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); - * auto nodeCustomShadow = item->string; + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); + * auto nodeCustomShadowRadius = item->value[0].f32; + * auto nodeCustomShadowOffsetX = item->value[1].f32; + * auto nodeCustomShadowOffsetY = item->value[2].f32; + * auto nodeCustomShadowType = item->value[3].i32; + * auto nodeCustomShadowColor = item->value[4].u32; * @endcode * */ @@ -891,11 +952,11 @@ typedef enum { * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue sizeArray[] = { 20, 0 } + * ArkUI_NumberValue sizeArray[] = { 20, 0 }; * ArkUI_AttributeItem item = { .value = sizeArray, .size = 2}; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); - * auto width = item->value[0].f32; + * auto imageSizeItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); + * auto width = imageSizeItem->value[0].f32; * @endcode * */ @@ -905,27 +966,24 @@ 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: size of the background image. - * The value is an enum of {@link ArkUI_ImageSize}. \n + * .value[0].i32: size of the background image. The value is an enum of {@link ArkUI_ImageSize}. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: size of the background image. - * The value is an enum of {@link ArkUI_ImageSize}. \n + * .value[0].i32: size of the background image. The value is an enum of {@link ArkUI_ImageSize}. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue imageSizeStyle[] = { {.i32 = static_cast(ARKUI_IMAGE_SIZE_COVER) } } + * ArkUI_NumberValue imageSizeStyle[] = { {.i32 = static_cast(ARKUI_IMAGE_SIZE_COVER) } }; * ArkUI_AttributeItem item = { .value = imageSizeStyle, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); - * auto blurStyle = item->value[0].i32 + * auto imageSizeStyleItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); + * auto blurStyleValue = imageSizeStyleItem->value[0].i32; * @endcode */ NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, /** - * @brief Defines the background blur attribute. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the background 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].i32: blue type. The value is an enum of {@link ArkUI_BlurStyle}. \n @@ -946,11 +1004,11 @@ typedef enum { * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue blurStyle[] = { { .i32 = static_cast(ARKUI_BLUR_STYLE_THICK)}} + * ArkUI_NumberValue blurStyle[] = { { .i32 = static_cast(ARKUI_BLUR_STYLE_THICK)}}; * ArkUI_AttributeItem item = { .value = blurStyle, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); - * auto blurStyle = item->value[0].i32 + * auto blurStyleItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); + * auto blurStyleType = blurStyleItem->value[0].i32; * @endcode * */ @@ -973,8 +1031,8 @@ typedef enum { * .value[0]? .f32: X coordinate of the center point, in vp.\n * .value[1]? .f32: Y coordinate of the center point, in vp.\n * .value[2]? .f32: Z coordinate of the center point, in vp.\n - * Note: If the coordinate is expressed in a number that represents a percentage, - * the attribute obtaining API returns the calculated value in vp. + * Note: If the coordinate is expressed in a number that represents a percentage, the attribute obtaining API + * returns the calculated value in vp. * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -982,8 +1040,8 @@ typedef enum { * ArkUI_NumberValue centerPointArray[] = { 20 }; * ArkUI_AttributeItem item = { .value = centerPointArray, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM_CENTER , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM_CENTER); - * auto centerX = item->value[0].f32; + * auto transformCenterItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM_CENTER); + * auto centerX = transformCenterItem->value[0].f32; * @endcode */ NODE_TRANSFORM_CENTER, @@ -1015,8 +1073,8 @@ typedef enum { * { .i32 = static_cast(ARKUI_CURVE_EASE_IN_OUT)}}; * ArkUI_AttributeItem item = { .value = opacityTransition, .size = 3}; * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY_TRANSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); - * auto opacity = item->value[0].f32; + * auto opacityTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); + * auto opacity = opacityTransitionItem->value[0].f32; * @endcode */ NODE_OPACITY_TRANSITION, @@ -1056,8 +1114,8 @@ typedef enum { * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; * ArkUI_AttributeItem item = { .value = rotateTransition, .size = 7}; * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE_TRANSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); - * auto rotateX = item->value[0].f32; + * auto rotateTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); + * auto rotateX = rotateTransitionItem->value[0].f32; * @endcode */ NODE_ROTATE_TRANSITION, @@ -1093,8 +1151,8 @@ typedef enum { * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; * ArkUI_AttributeItem item = { .value = scaleTransition, .size = 5}; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE_TRANSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); - * auto scaleX = item->value[0].f32; + * auto scaleTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); + * auto scaleX = scaleTransitionItem->value[0].f32; * @endcode */ NODE_SCALE_TRANSITION, @@ -1131,8 +1189,8 @@ typedef enum { * { .i32 = 3000}, { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; * ArkUI_AttributeItem item = { .value = translateTransition, .size = 5}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); - * auto translateX = item->value[0].f32; + * auto translateTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); + * auto translateX = translateTransitionItem->value[0].f32; * @endcode */ NODE_TRANSLATE_TRANSITION, @@ -1226,16 +1284,16 @@ typedef enum { * .value[0]?.i32: position of the overlay relative to the component. Optional. * The value is an enum of {@link ArkUI_Alignment}. * The default value is ARKUI_ALIGNMENT_TOP_START. \n - * .value[1]? .f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. Optional. \n - * .value[2]? .f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. Optional. + * .value[1]?.f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. Optional. \n + * .value[2]?.f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. Optional. * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: mask text.\n * .value[0]?.i32: position of the overlay relative to the component. Optional. * The value is an enum of {@link ArkUI_Alignment}. * The default value is ARKUI_ALIGNMENT_TOP_START. \n - * .value[1]? .f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. Optional. \n - * .value[2]? .f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. Optional. + * .value[1]?.f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. Optional. \n + * .value[2]?.f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. Optional. * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -1250,37 +1308,56 @@ typedef enum { */ NODE_OVERLAY, /** - * @brief Defines the sweep gradient effect. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the sweep gradient effect. + * 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: array of seven parameters of the string type, separated by semicolons (;).\n - * Parameter 1: array of color stops, each of which consists of a color and its stop position. - * Invalid colors are automatically skipped. \n - * Parameter 2: X-coordinate of the sweep gradient center relative to the upper left corner of the component. \n - * Parameter 3: Y-coordinate of the sweep gradient center relative to the upper left corner of the component. \n - * Parameter 4: start point of the sweep gradient. The default value is 0. \n - * Parameter 5: end point of the sweep gradient. The default value is 0. \n - * Parameter 6: rotation angle of the sweep gradient. The default value is 0. \n - * Parameter 7: whether the colors are repeated. The default value is false. \n - * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n - *.string: array of parameters of the string type.\n - * Parameter 1: array of color stops, each of which consists of a color and its stop position. - * Invalid colors are automatically skipped. \n - * Parameter 2: X-coordinate of the sweep gradient center relative to the upper left corner of the component. \n - * Parameter 3: Y-coordinate of the sweep gradient center relative to the upper left corner of the component. \n - * Parameter 4: start point of the sweep gradient. The default value is 0. \n - * Parameter 5: end point of the sweep gradient. The default value is 0. \n - * Parameter 6: rotation angle of the sweep gradient. The default value is 0. \n - * Parameter 7: whether the colors are repeated. The default value is false. \n + * .value[0]?.f32: X coordinate of the sweep gradient center relative to the upper left corner of the component.\n + * .value[1]?.f32: Y coordinate of the sweep gradient center relative to the upper left corner of the component.\n + * .value[2]?.f32: start point of the sweep gradient. The default value is 0. \n + * .value[3]?.f32: end point of the sweep gradient. The default value is 0. \n + * .value[4]?.f32: rotation angle of the sweep gradient. The default value is 0. \n + * .value[5]?.i32: whether the colors are repeated. The value 1 means that the colors are repeated, + * and 0 means the opposite.\n + * .object: array of color stops, each of which consists of a color and its stop position. Invalid colors are + * automatically skipped.\n + * colors: colors of the color stops. \n + * stops: stop positions of the color stops. \n + * size: number of colors. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0]?.f32: X coordinate of the sweep gradient center relative to the upper left corner of the component.\n + * .value[1]?.f32: Y coordinate of the sweep gradient center relative to the upper left corner of the component.\n + * .value[2]?.f32: start point of the sweep gradient. The default value is 0. \n + * .value[3]?.f32: end point of the sweep gradient. The default value is 0. \n + * .value[4]?.f32: rotation angle of the sweep gradient. The default value is 0. \n + * .value[5]?.i32: whether the colors are repeated. The value 1 means that the colors are repeated, + * and 0 means the opposite.\n + * .object: array of color stops, each of which consists of a color and its stop position. Invalid colors are + * automatically skipped.\n + * colors: colors of the color stops. \n + * stops: stop positions of the color stops. \n + * size: number of colors. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;5;10;60;180;60;true" }; + * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; + * float stops[] = { 0.0, 0.5 }; + * ArkUIColorStop colorStop = { colors, stops, 2 }; + * ArkUI_ColorStop* ptr = &colorStop; + * ArkUI_NumberValue value[] = { 50, 50, 60, 180, 180, {.i32 = 1}}; + * ArkUI_AttributeItem item = + * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); - * auto nodeSweepGradient = item->string; + * auto nodeSweepGradientCeneterX = item->value[0]; + * auto nodeSweepGradientCeneterY = item->value[1]; + * auto nodeSweepGradientStart = item->value[2]; + * auto nodeSweepGradientEnd = item->value[3]; + * auto nodeSweepGradientRotation = item->value[4]; + * auto nodeSweepGradientFill = item->value[5]; + * auto nodeSweepGradientColorStop = item->object; * @endcode * */ @@ -1289,78 +1366,156 @@ typedef enum { * @brief Defines the radial gradient effect. * 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: array of five parameters of the string type, separated by semicolons (;).\n - * Parameter 1: array of color stops, each of which consists of a color and its stop position. - * Invalid colors are automatically skipped. \n - * Parameter 2: X-coordinate of the radial gradient center relative to the upper left corner of the component. \n - * Parameter 3: Y-coordinate of the radial gradient center relative to the upper left corner of the component. \n - * Parameter 4: radius of the radial gradient. The default value is 0. \n - * Parameter 5: whether the colors are repeated. \n - * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n - *.string: array of parameters of the string type.\n - * Parameter 1: array of color stops, each of which consists of a color and its stop position. - * Invalid colors are automatically skipped. \n - * Parameter 2: X-coordinate of the radial gradient center relative to the upper left corner of the component. \n - * Parameter 3: Y-coordinate of the radial gradient center relative to the upper left corner of the component. \n - * Parameter 4: radius of the radial gradient. The default value is 0. \n - * Parameter 5: whether the colors are repeated. \n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n + * .value[0]?.f32: X coordinate of the radial gradient center relative to the upper left corner of the component. \n + * .value[1]?.f32: Y coordinate of the radial gradient center relative to the upper left corner of the component. \n + * .value[2]?.f32: radius of the radial gradient. The default value is 0. \n + * .value[3]?.i32: whether the colors are repeated. The value 1 means that the colors are repeated, + * and 0 means the opposite. \n + * .object: array of color stops, each of which consists of a color and its stop position. Invalid colors are + * automatically skipped. \n + * colors: colors of the color stops. \n + * stops: stop positions of the color stops. \n + * size: number of colors. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0]?.f32: X coordinate of the radial gradient center relative to the upper left corner of the component. \n + * .value[1]?.f32: Y coordinate of the radial gradient center relative to the upper left corner of the component. \n + * .value[2]?.f32: radius of the radial gradient. The default value is 0. \n + * .value[3]?.i32: whether the colors are repeated. The value 1 means that the colors are repeated, + * and 0 means the opposite.\n + * .object: array of color stops, each of which consists of a color and its stop position. Invalid colors are + * automatically skipped. \n + * colors: colors of the color stops. \n + * stops: stop positions of the color stops. \n + * size: number of colors. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;5;10;50;true" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_RADIAL_GRADIENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RADIAL_GRADIENT); - * auto nodeRadialGradient = item->string; + * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; + * float stops[] = { 0.0, 0.5 }; + * ArkUIColorStop colorStop = { colors, stops, 2 }; + * ArkUI_ColorStop* ptr = &colorStop; + * ArkUI_NumberValue value[] = { 50, 50, 20, {.i32 = 1}}; + * ArkUI_AttributeItem item = + * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); + * auto nodeRadialGradientCeneterX = item->value[0]; + * auto nodeRadialGradientCeneterY = item->value[1]; + * auto nodeRadialGradientradius = item->value[2]; + * auto nodeRadialGradientFill = item->value[3]; + * auto nodeRadialGradientColorStop = item->object; * @endcode * */ NODE_RADIAL_GRADIENT, /** * @brief Adds a mask of the specified shape to the component. - * This attribute can be set and obtained as required through APIs. + * 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: fill color, in 0xARGB format. Optional.\n - * .value[1]?.u32: stroke color, in 0xARGB format. Optional.\n - * .value[2]?.f32: stroke width, in vp. Optional.\n - * .string: shape. Optional.\n - * In "progressMask(10,10,#ff0000ff)", the values in parentheses indicate the current value, maximum value, - * and color of the progress mask, respectively.\n - * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, - * and radius height, respectively.\n - * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n - * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n - * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and - * commands, respectively.\n - * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].u32 fill color, in 0xARGB format.\n - * .value[1].u32: stroke color, in 0xARGB format.\n - * .value[2].f32: stroke width, in vp.\n - * .string: shape.\n - * In "progressMask(10,10,#ff0000ff)", the values in parentheses indicate the current value, maximum value, - * and color of the progress mask, respectively.\n - * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, - * and radius height, respectively.\n - * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n - * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n - * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and - * commands, respectively.\n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute, which supports five types of + * shapes:\n + * 1. Rectangle:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_RECT for the rectangle shape.\n + * .value[4].f32: width of the rectangle.\n + * .value[5].f32: height of the rectangle.\n + * .value[6].f32: width of the rounded corner of the rectangle.\n + * .value[7].f32: height of the rounded corner of the rectangle.\n + * 2. Circle:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_CIRCLE for the circle shape.\n + * .value[4].f32: width of the circle.\n + * .value[5].f32: height of the circle.\n + * 3.Ellipse:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_ELLIPSE for the ellipse shape.\n + * .value[4].f32: width of the ellipse.\n + * .value[5].f32: height of the ellipse.\n + * 4. Path:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_PATH for the path shape.\n + * .value[4].f32: width of the path.\n + * .value[5].f32: height of the path.\n + * .string: command for drawing the path.\n + * 4. Progress:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_PROSGRESS for the progress shape.\n + * .value[4].f32: current value of the progress indicator.\n + * .value[5].f32: maximum value of the progress indicator.\n + * .value[6].u32: color of the progress indicator.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}, which supports five types of shapes:\n + * 1. Rectangle:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + * .value[3].i32: mask type.\n + * .value[4].f32: width of the rectangle.\n + * .value[5].f32: height of the rectangle.\n + * .value[6].f32: width of the rounded corner of the rectangle.\n + * .value[7].f32: height of the rounded corner of the rectangle.\n + * 2. Circle:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + * .value[3].i32: mask type.\n + * .value[4].f32: width of the circle.\n + * .value[5].f32: height of the circle.\n + * 3.Ellipse:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + * .value[3].i32: mask type.\n + * .value[4].f32: width of the ellipse.\n + * .value[5].f32: height of the ellipse.\n + * 4. Path:\n + * .value[0].u32: fill color, in 0xARGB format. Optional.\n + * .value[1].u32: stroke color, in 0xARGB format. Optional.\n + * .value[2].f32: stroke width, in vp. Optional.\n + * .value[3].i32: mask type.\n + * .value[4].f32: width of the path.\n + * .value[5].f32: height of the path.\n + * .string: command for drawing the path.\n + * 4. Progress:\n + * .value[0].i32: mask type.\n + * .value[1].f32: current value of the progress indicator.\n + * .value[2].f32: maximum value of the progress indicator.\n + * .value[3].u32: color of the progress indicator.\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "rect(10,10,10,10)" }; + * ArkUI_NumberValue value[] = + * {{ .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 , {.i32 = ARKUI_MASK_TYPE_RECT}, 100, 100, 15, 15 }; + * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_MASK, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MASK); * auto nodeMaskFill = item->value[0].u32; * auto nodeMaskStrokeColor = item->value[1].u32; - * auto nodeMaskStrokeWidth = item->value[1].f32; - * auto nodeMaskShape = item->string; + * auto nodeMaskStrokeWidth = item->value[2].f32; + * auto nodeMaskType = item->value[3].i32; + * auto nodeMaskWidth = item->value[4].f32; + * auto nodeMaskHeight = item->value[5].f32; + * auto nodeMaskRadiusWidth = item->value[6].f32; + * auto nodeMaskradiusHeight = item->value[7].f32; * @endcode * */ @@ -1414,7 +1569,8 @@ typedef enum { */ NODE_DIRECTION, /** - * @brief Defines the size constraints. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the size constraints. + * 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 width, in vp.\n @@ -1443,11 +1599,12 @@ typedef enum { */ NODE_CONSTRAINT_SIZE, /** - * @brief Defines the grayscale effect. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the grayscale effect. + * 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: grayscale conversion ratio. - * The value ranges from 0 to 1. For example, 0.5 indicates a 50% grayscale conversion ratio.\n + * .value[0].f32: grayscale conversion ratio. The value ranges from 0 to 1. + * For example, 0.5 indicates a 50% grayscale conversion ratio.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: grayscale conversion ratio. The value ranges from 0 to 1.\n @@ -1463,7 +1620,8 @@ typedef enum { */ NODE_GRAY_SCALE, /** - * @brief Inverts the image. This attribute can be set, reset, and obtained as required through APIs. + * @brief Inverts the image. + * 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: image inversion ratio. The value ranges from 0 to 1. @@ -1483,7 +1641,8 @@ typedef enum { */ NODE_INVERT, /** - * @brief Defines the sepia conversion ratio. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the sepia conversion ratio. + * 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: sepia conversion ratio. The value ranges from 0 to 1. @@ -1507,10 +1666,10 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n *.value[0].f32: contrast. If the value is 1, the source image is displayed. - * A larger value indicates a higher contrast and a clearer image. + * A larger value indicates a higher contrast. Value range: [0, 10).\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].f32: contrast.\n + * .value[0].f32: contrast. Value range: [0, 10).\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); @@ -1560,8 +1719,8 @@ typedef enum { * ArkUI_NumberValue offsetArray[] = { 20, 0 }; * ArkUI_AttributeItem item = { .value = offsetArray, .size = 2}; * nativeNodeApi->setAttribute(nodeHandle, NODE_OFFSET , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); - * auto offsetX = item->value[0].f32; + * auto offsetItem = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); + * auto offsetX = offsetItem->value[0].f32; * @endcode * */ @@ -1584,15 +1743,15 @@ typedef enum { * ArkUI_NumberValue pointArray[] = { 20, 0 }; * ArkUI_AttributeItem item = { .value = pointArray, .size = 2}; * nativeNodeApi->setAttribute(nodeHandle, NODE_MARK_ANCHOR , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); - * auto pointX = item->value[0].f32; + * auto anchorItem = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); + * auto pointX = anchorItem->value[0].f32; * @endcode * */ NODE_MARK_ANCHOR, /** - * @brief Defines the position of the background image in the component, that is, the coordinates relative to the - * upper left corner of the component. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the position of the background image in the component, that is, the coordinates relative to + * the upper left corner 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].f32: position along the x-axis, in vp. \n @@ -1629,7 +1788,8 @@ typedef enum { * .value[6]?.i32: ID of the component that functions as the anchor point for top alignment. \n * .value[7]?.i32: alignment mode relative to the anchor component for top alignment. * The value is an enum of {@link ArkUI_VerticalAlignment}. \n - * .value[8]?.i32: ID of the component that functions as the anchor point for center alignment in the vertical direction. \n + * .value[8]?.i32: ID of the component that functions as the anchor point for center alignment in the + * vertical direction. \n * .value[9]?.i32: alignment mode relative to the anchor component forcenter alignment in the vertical direction. * The value is an enum of {@link ArkUI_VerticalAlignment}. \n * .value[10]?.i32: ID of the component that functions as the anchor point for bottom alignment. \n @@ -1651,7 +1811,8 @@ typedef enum { * .value[6]?.i32: ID of the component that functions as the anchor point for top alignment. \n * .value[7]?.i32: alignment mode relative to the anchor component for top alignment. * The value is an enum of {@link ArkUI_VerticalAlignment}. \n - * .value[8]?.i32: ID of the component that functions as the anchor point for center alignment in the vertical direction. \n + * .value[8]?.i32: ID of the component that functions as the anchor point for center alignment in the + * vertical direction. \n * .value[9]?.i32: alignment mode relative to the anchor component forcenter alignment in the vertical direction. * The value is an enum of {@link ArkUI_VerticalAlignment}. \n * .value[10]?.i32: ID of the component that functions as the anchor point for bottom alignment. \n @@ -1746,10 +1907,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: base size of the component. \n + * .value[0].f32: percentage of the parent container's remaining space that is allocated to the component. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].f32: base size of the component. \n + * .value[0].f32: percentage of the parent container's remaining space that is allocated to the component. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -1767,8 +1928,8 @@ typedef enum { * @brief Sets the accessibility group. 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: Accessibility group. The value 1 means that the component and - * all its child components form an entire selectable component. + * .value[0].i32: Accessibility group. The value 1 means that the component and all its child components + * form an entire selectable component. * In this case, the accessibility service will no longer be available for the content of its child components. * The value is 1 or 0. * \n @@ -1856,6 +2017,28 @@ typedef enum { */ NODE_ACCESSIBILITY_DESCRIPTION, + /** + * @brief Defines the focused state. 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. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 1 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUS_STATUS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUS_STATUS); + * auto value = item->data[0].i32; + * @endcode + * + */ + NODE_FOCUS_STATUS, + /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. * @@ -1870,8 +2053,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CONTENT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); - * auto content = item->string + * auto textContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); + * auto content = textContentItem->string; * @endcode */ NODE_TEXT_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT, @@ -1970,8 +2153,8 @@ typedef enum { * ArkUI_NumberValue lineHeight[] = { 20 }; * ArkUI_AttributeItem item = { .value = lineHeight, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); - * auto pointX = item->value[0].f32; + * auto lineHeightItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); + * auto pointX = lineHeightItem->value[0].f32; * @endcode */ NODE_TEXT_LINE_HEIGHT, @@ -1993,9 +2176,9 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); - * auto nodeDecorationStyle = item->value[0].i32; - * auto nodeDecorationColor = item->value[1].u32; + * auto decorationItem = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); + * auto nodeDecorationStyle = decorationItem->value[0].i32; + * auto nodeDecorationColor = decorationItem->value[1].u32; * @endcode * */ @@ -2012,11 +2195,11 @@ typedef enum { * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue textCase[] = { {.i32 = static_cast(ARKUI_TEXT_CASE_LOWER) } }; + * ArkUI_NumberValue textCase[] = { {.i32 = static_cast(ARKUI_TEXT_CASE_LOWER) } }; * ArkUI_AttributeItem item = { .value = textCase, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CASE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); - * auto textCase = item->value[0].i32; + * auto textCaseItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); + * auto textCase = textCaseItem->value[0].i32; * @endcode * */ @@ -2036,8 +2219,8 @@ typedef enum { * ArkUI_NumberValue letterSpacing[] = { 20 }; * ArkUI_AttributeItem item = { .value = letterSpacing, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); - * auto letterSpacing = item->value[0].f32; + * auto letterSpacingItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); + * auto letterSpacing = letterSpacingItem->value[0].f32; * @endcode * */ @@ -2058,8 +2241,8 @@ typedef enum { * ArkUI_NumberValue maxLine[] = { { .i32 = 2 } }; * ArkUI_AttributeItem item = { .value = maxLine, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_LINES , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); - * auto maxLines = item->value[0].i32; + * auto maxLinesItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); + * auto maxLines = maxLinesItem->value[0].i32; * @endcode */ NODE_TEXT_MAX_LINES, @@ -2079,8 +2262,8 @@ typedef enum { * ArkUI_NumberValue alignMent[] = {{.i32 = static_cast(ARKUI_TEXT_ALIGNMENT_CENTER)}}; * ArkUI_AttributeItem item = { .value = alignMent, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_ALIGN , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); - * auto alignMent = item->value[0].i32; + * auto alignmentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); + * auto alignMent = alignmentItem->value[0].i32; * @endcode */ NODE_TEXT_ALIGN, @@ -2099,8 +2282,8 @@ typedef enum { * ArkUI_NumberValue textOverFlow[] = { { .i32 = static_cast(ARKUI_TEXT_OVERFLOW_CLIP) } }; * ArkUI_AttributeItem item = { .value = textOverFlow, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle,NODE_TEXT_OVERFLOW , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); - * auto textOverFlow = item->value[0].i32; + * auto textOverFlowItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); + * auto textOverFlow = textOverFlowItem->value[0].i32; * @endcode */ NODE_TEXT_OVERFLOW, @@ -2145,7 +2328,7 @@ typedef enum { */ NODE_TEXT_COPY_OPTION, /** - * @brief Defines the text baseline offset attribute. + * @brief Defines the text baseline offset attribute * This attribute can be set, reset, and obtained as required through APIs. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n @@ -2314,8 +2497,8 @@ typedef enum { * ArkUI_NumberValue textIndent[] = { 20 }; * ArkUI_AttributeItem item = { .value = textIndent, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INDENT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); - * auto indentValue = item->value[0].f32; + * auto indentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); + * auto indentValue = indentItem->value[0].f32; * @endcode */ NODE_TEXT_INDENT, @@ -2333,8 +2516,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SPAN_CONTENT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SPAN_CONTENT); - * auto spanContent = item->string; + * auto spanContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_SPAN_CONTENT); + * auto spanContent = spanContentItem->string; * @endcode */ NODE_SPAN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SPAN, @@ -2353,8 +2536,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC); - * auto spanScr = item->string; + * auto srcItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC); + * auto spanScr = srcItem->string; * @endcode */ NODE_IMAGE_SPAN_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE_SPAN, @@ -2376,8 +2559,8 @@ typedef enum { * ArkUI_NumberValue alignValue[] = { {.i32 = static_cast(ARKUI_IMAGE_SPAN_ALIGNMENT_TOP) } }; * ArkUI_AttributeItem item = {.value = alignValue, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN); - * auto verticalAlign = item->value[0].i32; + * auto verticalAlignItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN); + * auto verticalAlign = verticalAlignItem->value[0].i32; * @endcode */ NODE_IMAGE_SPAN_VERTICAL_ALIGN, @@ -2396,8 +2579,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SRC , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); - * auto imageSrc = item->string; + * auto imageSrcItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); + * auto imageSrc = imageSrcItem->string; * @endcode */ NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, @@ -2417,8 +2600,8 @@ typedef enum { * ArkUI_NumberValue objectFitValue[] = { { .i32 = static_cast(ARKUI_OBJECT_FIT_FILL) } }; * ArkUI_AttributeItem item = { .value = objectFitValue, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); - * auto objectFit = item->value[0].i32; + * auto objectFitItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); + * auto objectFit = objectFitItem->value[0].i32; * @endcode */ NODE_IMAGE_OBJECT_FIT, @@ -2435,16 +2618,17 @@ typedef enum { * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue interpolationValue[] = { { .i32 = ARKUI_INTERPOLATION_LOW } }; + * ArkUI_NumberValue interpolationValue[] = { { .i32 = ARKUI_IMAGE_INTERPOLATION_LOW } }; * ArkUI_AttributeItem item = { .value = interpolationValue, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); - * auto interpolation = item->value[0].i32; + * auto interpolationItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); + * auto interpolation = interpolationItem->value[0].i32; * @endcode */ NODE_IMAGE_INTERPOLATION, /** - * @brief Defines how the image is repeated. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines how the image is repeated. + * 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: how the image is repeated. The value is an enum of {@link ArkUI_ImageRepeat}. \n @@ -2458,8 +2642,8 @@ typedef enum { * ArkUI_NumberValue repeatValue[] = { { .i32 = static_cast(ARKUI_IMAGE_REPEAT_X) } }; * ArkUI_AttributeItem item = { .value = repeatValue, .size = 1}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); - * auto repeat = item->value[0].i32; + * auto objectRepeatItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); + * auto repeat = objectRepeatItem->value[0].i32; * @endcode */ NODE_IMAGE_OBJECT_REPEAT, @@ -2483,8 +2667,8 @@ typedef enum { * 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0} }; * ArkUI_AttributeItem item = { .value = filterValue, .size = sizeof(filterValue)/ sizeof(ArkUI_NumberValue)}; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); - * auto colorFilter = item->value + * auto colorFilterItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); + * auto colorFilter = colorFilterItem->value; * @endcode */ NODE_IMAGE_COLOR_FILTER, @@ -2501,10 +2685,10 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_NumberValue resizeValue[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { .value = resizeValue, .size = 1}}; + * ArkUI_AttributeItem item = { .value = resizeValue, .size = 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); - * auto autoResize = item->value[0].i32; + * auto autoResizeItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); + * auto autoResize = autoResizeItem->value[0].i32; * @endcode */ NODE_IMAGE_AUTO_RESIZE, @@ -2523,8 +2707,8 @@ typedef enum { * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "/pages/loading.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_ALT , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); - * auto altStr = item->string; + * auto altStrItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); + * auto altStr = altStrItem->string; * @endcode */ NODE_IMAGE_ALT, @@ -2792,7 +2976,7 @@ typedef enum { * .value[2]?.i32: font weight {@link ArkUI_FontWeight}. Optional. * The default value is ARKUI_FONT_WEIGHT_NORMAL.\n * ?.string: font family. Multiple font families are separated by commas (,). - * For example, "font weight; font family 1, font family 2". \n + * Example: "font weight; font family 1, font family 2". \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: font size, in fp.\n @@ -2888,8 +3072,8 @@ typedef enum { * The value true means to display the password icon, and false means the opposite.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: The value 1 means to display the password icon at the end of the - * password text box, and 0 means the opposite. \n + * .value[0].i32: The value 1 means to display the password icon at the end of the password text box, + * and 0 means the opposite. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); @@ -2903,15 +3087,16 @@ typedef enum { */ NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, /** - * @brief Defines the editable state for the single-line text box. This attribute can be set as required through APIs. + * @brief Defines the editable state for the single-line text box. + * This attribute can be set as required through APIs. * - * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].i32: whether to remain in the editable state. - * The value true means to remain in the editable state, and false means to exit the editable state.\n \n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n + * .value[0].i32: whether to remain in the editable state. The value + * true means to remain in the editable state, and false means to exit the editable state. \n * \n * Format of the {@link ArkUI_AttributeItem} parameter for obtaining the attribute: - * .value[0].i32: whether to remain in the editable state. - * The value true means to remain in the editable state, and false means to exit the editable state.\n + * .value[0].i32: whether to remain in the editable state. The value true means to remain in the editable + * state, and false means to exit the editable state. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); @@ -2926,11 +3111,11 @@ typedef enum { * @brief Defines the style of the cancel button on the right of the single-line text box. * This attribute can be set, reset, and obtained as required through APIs. * - * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n * .value[0].i32: button style {@link ArkUI_CancelButtonStyle}. * The default value is ARKUI_CANCELBUTTON_STYLE_INPUT.\n * .value[1]? .f32: button icon size, in vp.\n - * .value[2]? .u32: button icon color, in 0xARGB format. For example, 0xFFFF0000 indicates red.\n + * .value[2]? .u32: button icon color, in 0xARGB format. For example, 0xFFFF0000 indicates red. \n * ?.string: button icon image source. The value is the local address of the image, for example, /pages/icon.png. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n @@ -2956,7 +3141,7 @@ typedef enum { /** * @brief Defines the default placeholder text for the multi-line text box. - * The attribute setting, attribute resetting, and attribute obtaining interfaces are supported. + * 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: default placeholder text. \n @@ -2976,7 +3161,7 @@ typedef enum { NODE_TEXT_AREA_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, /** * @brief Defines the default text content for the multi-line text box. - * The attribute setting, attribute resetting, and attribute obtaining interfaces are supported. + * 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: default text content. \n @@ -3088,15 +3273,16 @@ typedef enum { */ NODE_TEXT_AREA_CARET_COLOR, /** - * @brief Defines the editable state for the multi-line text box. This attribute can be set as required through APIs. + * @brief Defines the editable state for the multi-line text box. + * This attribute can be set as required through APIs. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].i32: whether to remain in the editable state. - * The value true means to remain in the editable state, and false means to exit the editable state.\n \n + * .value[0].i32: whether to remain in the editable state. The value true means to remain in the + * editable state, and false means to exit the editable state.\n \n * \n * Format of the {@link ArkUI_AttributeItem} parameter for obtaining the attribute: - * .value[0].i32: whether to remain in the editable state. - * The value true means to remain in the editable state, and false means to exit the editable state.\n \n + * .value[0].i32: whether to remain in the editable state. The value true means to remain in the editable + * state, and false means to exit the editable state.\n \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); @@ -3218,11 +3404,11 @@ 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: whether the check box is selected. The value 1 means that the check box is selected, - * and 0 means the opposite.\n + * .value[0].i32: whether the check box is selected. + * The value 1 means that the check box 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 check box is selected, and 0 means the opposite.\n + * .value[0].i32: The value 1 means that the check box is selected, and 0 means the opposite. \n * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -3358,7 +3544,7 @@ 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: type {@link ArkUI_XComponentType}. The default value is ARKUI_XCOMPONENT_TYPE_SURFACE.\n + * .value[0].i32: type {@link ArkUI_XComponentType}. The default value is ARKUI_XCOMPONENT_TYPE_SURFACE. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: type {@link ArkUI_XComponentType}. \n @@ -3502,8 +3688,8 @@ typedef enum { */ NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, /** - * @brief Defines the font color, font size, and font weight of all items except the top, bottom, and selected items - * in the date picker. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the font color, font size, and font weight of all items except the top, bottom, and selected + * items in 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 * .string: array of five parameters of the string type, separated by semicolons (;).\n @@ -3694,8 +3880,8 @@ typedef enum { * The default value is ARKUI_TEXTPICKER_RANGETYPE_SINGLE.\n * ?.string: string input, whose format varies by picker type.\n * 1: single-column picker. The input format is a group of strings separated by semicolons (;).\n - * 2: multi-column picker. Multiple pairs of plain text strings are supported. - * The pairs are separated by semicolons (;), and strings within each pair are separated by commas (,).\n + * 2: multi-column picker. Multiple pairs of plain text strings are supported. The pairs are separated by + * semicolons (;), and strings within each pair are separated by commas (,).\n * ?.object: Object input, whose format varies by picker type.\n * 1: single-column picker with image support. The input structure is {@link ARKUI_TextPickerRangeContent}.\n * 2: multi-column interconnected picker. The input structure is {@link ARKUI_TextPickerCascadeRangeContent}.\n @@ -3704,8 +3890,8 @@ typedef enum { * .value[0].i32: type of the text picker {@link ArkUI_TextPickerRangeType}.\n * ?.string: string output, whose format varies by picker type.\n * 1: single-column picker. The output format is a group of strings separated by semicolons (;).\n - * 2: multi-column picker. Multiple pairs of plain text strings are supported. - * The pairs are separated by semicolons (;), and strings within each pair are separated by commas (,).\n + * 2: multi-column picker. Multiple pairs of plain text strings are supported. The pairs are separated by + * semicolons (;), and strings within each pair are separated by commas (,).\n * ?.string: Object output, whose format varies by picker type.\n * 1: single-column picker with image support. The output structure is {@link ARKUI_TextPickerRangeContent}.\n * 2: multi-column interconnected picker. The output structure is {@link ARKUI_TextPickerCascadeRangeContent}.\n @@ -3795,8 +3981,8 @@ typedef enum { */ NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, /** - * @brief Defines the font color, font size, and font weight for all items except the top, bottom, and - * selected items in the text picker. This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the font color, font size, and font weight for all items except the top, bottom, and selected + * items in 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 * .string: array of five parameters of the string type, separated by semicolons (;).\n @@ -3853,7 +4039,7 @@ typedef enum { */ NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, /** - * @brief Defines the index of the default item in the data selection range of the text picker. + * @brief Defines the index of the default selected item in the data selection range 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 @@ -3871,8 +4057,8 @@ 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: whether to support scroll looping. - * The value true means to support scroll looping, and false means the opposite.\n \n + * .value[0].i32: whether to support scroll looping. The value true means to support scroll looping, and + * false means the opposite.\n \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * value[0].i32: The value 1 means to support scroll looping, and 0 means the opposite. \n @@ -3888,8 +4074,8 @@ typedef enum { */ NODE_TEXT_PICKER_CAN_LOOP, /** - * @brief Defines the height of each item in the picker. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the height of each item in the 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: item height, in vp. \n @@ -3907,7 +4093,104 @@ typedef enum { * @endcode */ NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, - + /** + * @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, +∞). + * 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 + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { 16.0f }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); + * auto borderRadius = item->value[0].f32; + * @endcode + */ + NODE_CALENDAR_PICKER_HINT_RADIUS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + /** + * @brief Defines the date of the selected item in 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[1].u32: selected year. \n + * .value[2].u32: selected month. \n + * .value[3].u32: selected day. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[1].u32: selected year. \n + * .value[2].u32: selected month. \n + * .value[3].u32: selected day. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE); + * auto selectYear = item->value[0].u32; + * @endcode + */ + NODE_CALENDAR_PICKER_SELECTED_DATE, + /** + * @brief Defines how the calendar picker is aligned with the entry 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: alignment mode. The parameter type is {@link ArkUI_CalendarAlignment}. \n + * .value[1]? .f32: offset of the picker relative to the entry component along the x-axis after alignment based on + * the specified alignment mode. \n + * .value[2]? .f32: offset of the picker relative to the entry component along the y-axis after alignment based on + * the specified alignment mode. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: alignment mode. The parameter type is {@link ArkUI_CalendarAlignment}. \n + * .value[1]? .f32: offset of the picker relative to the entry component along the x-axis after alignment based on + * the specified alignment mode. \n + * .value[2]? .f32: offset of the picker relative to the entry component along the y-axis after alignment based on + * the specified alignment mode. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGNMENT_END) }, 10.0f, 0.0f }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT); + * auto alignType = item->value[0].i32; + * @endcode + */ + NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, + /** + * @brief Defines the font color, font size, and font weight in the entry area of the calendar picker. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0]? .u32: font color of the entry area. \n + * .value[1]? .f32: font size of the entry area, in fp. \n + * .value[2]? .i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0]? .u32: font color of the entry area. \n + * .value[1]? .f32: font size of the entry area, in fp. \n + * .value[2]? .i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = + * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; + * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); + * auto textColor = item->value[0].u32; + * @endcode + */ + NODE_CALENDAR_PICKER_TEXT_STYLE, /** * @brief Defines the color of the slider. This attribute can be set, reset, and obtained as required through APIs. * @@ -3931,8 +4214,8 @@ typedef enum { NODE_SLIDER_BLOCK_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, /** - * @brief Defines the background color of the slider. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the background color of the slider. 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: background color, in 0xARGB format, for example, 0xFF1122FF. \n @@ -3954,8 +4237,8 @@ typedef enum { NODE_SLIDER_TRACK_COLOR, /** - * @brief Defines the color of the selected part of the slider track. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the color of the selected part of the slider track. 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 selected part of the slider track, in 0xARGB format, for example, 0xFF1122FF. \n @@ -3977,31 +4260,29 @@ typedef enum { NODE_SLIDER_SELECTED_COLOR, /** - * @brief Defines whether to display a tooltip when the user drags the slider. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Sets whether to display the stepping value. 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 display a tooltip when the user drags the slider. - * The value 1 means to display a tooltip, and 0 means the opposite. The default value is 0.\n \n - * .string?: text content of the tooltip. Optional. The default value is the current percentage. \n + * .value[0].i32: whether to display the stepping value. The value 1 means to display the stepping value, + * and 0 (default value) means the opposite. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: whether to display a tooltip when the user drags the slider. - * The value 1 means to display a tooltip, and 0 means the opposite. The default value is 0.\n \n - * .string?: text content of the tooltip. Optional. The default value is the current percentage. \n - * + * .value[0].i32: whether to display the stepping value. The value 1 means to display the stepping value, + * and 0 (default value) means the opposite. \n + * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SHOW_TIPS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR); + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SHOW_STEPS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SHOW_STEPS); * auto value = item->value[0].i32; * @endcode * */ - NODE_SLIDER_SHOW_TIPS, + NODE_SLIDER_SHOW_STEPS, /** * @brief Defines the slider shape, which can be set, reset, and obtained as required through APIs. @@ -4011,23 +4292,60 @@ typedef enum { * .string?: depending on the shape. Optional. \n * ARKUI_SLIDER_BLOCK_STYLE_IMAGE: image resource of the slider. Example: /pages/common/icon.png. \n * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: custom shape of the slider. \n - * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, and - * radius height, respectively.\n - * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n - * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n - * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and commands, respectively.\n + * There are five types:\n + * 1. Rectangle:\n + * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. + * The value is ARKUI_SHAPE_TYPE_RECT for the rectangle shape.\n + * .value[2].f32: width of the rectangle.\n + * .value[3].f32: height of the rectangle.\n + * .value[4].f32: width of the rounded corner of the rectangle.\n + * .value[5].f32: height of the rounded corner of the rectangle.\n + * 2. Circle:\n + * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. + * The value is ARKUI_SHAPE_TYPE_CIRCLE for the circle shape.\n + * .value[2].f32: width of the circle.\n + * .value[3].f32: height of the circle.\n + * 3.Ellipse:\n + * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. + * The value is ARKUI_SHAPE_TYPE_ELLIPSE for the ellipse shape.\n + * .value[2].f32: width of the ellipse.\n + * .value[3].f32: height of the ellipse;\n + * 4. Path:\n + * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. + * The value is ARKUI_SHAPE_TYPE_PATH for the path shape.\n + * .value[2].f32: width of the path.\n + *.value[3].f32: height of the path.\n + * .string: command for drawing the path.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: shape. The parameter type is {@link ArkUI_SliderBlockStyle}. \n - * .string? depending on the shape. Optional. \n + * .string?: depending on the shape. Optional. \n * ARKUI_SLIDER_BLOCK_STYLE_IMAGE: image resource of the slider. Example: /pages/common/icon.png. \n * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: custom shape of the slider. \n - * In "rect(10,10,10,10)", the values in parentheses indicate the width, height, radius width, - * and radius height, respectively.\n - * In "circle (10,10)", the values in parentheses indicate width and height, respectively.\n - * In "ellipse(10,10)", the values in parentheses indicate width and height, respectively.\n - * In "path(10,10,M0 0 L600 0)", the values in parentheses indicate width, height, and - * commands, respectively.\n + * There are five types:\n + * 1. Rectangle:\n + * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. + * The value is ARKUI_SHAPE_TYPE_RECT for the rectangle shape.\n + * .value[2].f32: width of the rectangle.\n + * .value[3].f32: height of the rectangle.\n + * .value[4].f32: width of the rounded corner of the rectangle.\n + * .value[5].f32: height of the rounded corner of the rectangle.\n + * 2. Circle:\n + * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. + * The value is ARKUI_SHAPE_TYPE_CIRCLE for the circle shape.\n + * .value[2].f32: width of the circle.\n + * .value[3].f32: height of the circle.\n + * 3.Ellipse:\n + * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. + * The value is ARKUI_SHAPE_TYPE_ELLIPSE for the ellipse shape.\n + * .value[2].f32: width of the ellipse.\n + * .value[3].f32: height of the ellipse;\n + * 4. Path:\n + * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. + * The value is ARKUI_SHAPE_TYPE_PATH for the path shape.\n + * .value[2].f32: width of the path.\n + *.value[3].f32: height of the path.\n + * .string: command for drawing the path.\n * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4035,6 +4353,11 @@ typedef enum { * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_DEFAULT}}; * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); + * + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, + * {.i32 = ARKUI_CLIP_TYPE_RECT}, 100, 100, 15, 15 }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE); * auto value = item->value[0].i32; * @endcode @@ -4043,8 +4366,8 @@ typedef enum { NODE_SLIDER_BLOCK_STYLE, /** - * @brief Defines the current value of the slider. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the current value of the slider. 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: current value. \n @@ -4066,8 +4389,8 @@ typedef enum { NODE_SLIDER_VALUE, /** - * @brief Defines the minimum value of the slider. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the minimum value of the slider. 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 value. \n @@ -4089,8 +4412,8 @@ typedef enum { NODE_SLIDER_MIN_VALUE, /** - * @brief Defines the maximum value of the slider. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the maximum value of the slider. 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 value. \n @@ -4104,7 +4427,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 100 }; * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE); * auto value = item->value[0].f32; * @endcode * @@ -4134,8 +4457,8 @@ typedef enum { NODE_SLIDER_STEP, /** - * @brief Defines whether the slider moves horizontally or vertically. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines whether the slider moves horizontally or vertically. 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 slider moves horizontally or vertically. @@ -4159,16 +4482,16 @@ typedef enum { NODE_SLIDER_DIRECTION, /** - * @brief Defines whether the slider values are reversed. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines whether the slider values are reversed. 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 slider values are reversed. - * The value 1 means that the slider values are reversed, and 0 means the opposite. \n + * .value[0].i32: whether the slider values are reversed. The value 1 means that the slider values are + * reversed, and 0 means the opposite. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: whether the slider values are reversed. - * The value 1 means that the slider values are reversed, and 0 means the opposite. + * .value[0].i32: whether the slider values are reversed. The value 1 means that the slider values are + * reversed, and 0 means the opposite. * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4184,8 +4507,8 @@ typedef enum { NODE_SLIDER_REVERSE, /** - * @brief Defines the style of the slider thumb and track. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the style of the slider thumb and track. 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: style of the slider thumb and track. The parameter type is {@link ArkUI_SliderStyle}. \n @@ -4207,22 +4530,22 @@ typedef enum { NODE_SLIDER_STYLE, /** - * @brief Defines the alignment mode of the child components in the container. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the alignment mode of the child components in the container. 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: alignment mode. The parameter type is {@link ArkUI_Alignment}. + *.value[0].i32: alignment mode. The data type is {@link ArkUI_Alignment}. * The default value is ARKUI_ALIGNMENT_CENTER. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: alignment mode. The parameter type is {@link ArkUI_Alignment}. \n + * .value[0].i32: alignment mode. The data type is {@link ArkUI_Alignment}. \n * * @code {.cpp} * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); - * auto nodeStackAlignContent = item->value[0].i32; + * auto alignContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); + * auto alignContent = alignContentItem->value[0].i32; * @endcode */ NODE_STACK_ALIGN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_STACK, @@ -4231,8 +4554,8 @@ typedef enum { * @brief Defines the scrollbar status. 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: scrollbar status. The parameter type is {@link ArkUI_ScrollBarDisplayMode}. - * The default value is ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO. \n + * .value[0].i32: scrollbar status. The parameter type is {@link ArkUI_ScrollBarDisplayMode}. The default value is + * ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: scrollbar status. The parameter type is {@link ArkUI_ScrollBarDisplayMode}. \n @@ -4248,8 +4571,8 @@ typedef enum { */ NODE_SCROLL_BAR_DISPLAY_MODE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, /** - * @brief Defines the width of the scrollbar. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the width of the scrollbar. 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: width of the scrollbar, in vp. The default value is 4. \n @@ -4268,8 +4591,8 @@ typedef enum { */ NODE_SCROLL_BAR_WIDTH, /** - * @brief Defines the color of the scrollbar. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the color of the scrollbar. This attribute can be set, reset, and obtained as required + * through APIs. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .data[0].u32: color of the scrollbar, in 0xARGB format. \n @@ -4314,9 +4637,9 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\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}. The default value is ARKUI_EDGE_EFFECT_NONE.\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. The default value is 1. \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. The default value is 1. \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. @@ -4355,12 +4678,12 @@ typedef enum { */ NODE_SCROLL_ENABLE_SCROLL_INTERACTION, /** - * @brief Defines the friction coefficient. It applies only to gestures in the scrolling area, and - * it affects only indirectly the scroll chaining during the inertial scrolling process. + * @brief Defines the friction coefficient. It applies only to gestures in the scrolling area, and it affects only + * indirectly the scroll chaining during the inertial scrolling process. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].f32: friction coefficient. - * The default value is 0.6 for non-wearable devices and 0.9 for wearable devices. \n + * .value[0].f32: friction coefficient. The default value is 0.6 for non-wearable devices and 0.9 + * for wearable devices. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: friction coefficient. @@ -4383,14 +4706,14 @@ typedef enum { * The default value is ARKUI_SCROLL_SNAP_ALIGN_NONE.\n * .value[1].i32: whether to enable the snap to start feature. When scroll snapping is defined for the * component, setting this attribute to false enables the component to scroll between the - * start edge and the first snap point. The default value is true. - * t is valid only when there are multiple snap points.\n + * start edge and the first snap point. The default value is true. It is valid only when there are multiple + * snap points.\n * .value[2].i32: Whether to enable the snap to end feature. When scroll snapping is defined for the * component, setting this attribute to false enables the component to scroll between the - * end edge and the last snap point. The default value is true. - * It is valid only when there are multiple snap points.\n - * .value[3...].f32: snap points for the component. - * Each snap point defines the offset from an edge to which the component can scroll. \n + * end edge and the last snap point. The default value is true. It is valid only when there are multiple + * snap points.\n + * .value[3...].f32: snap points for the component. Each snap point defines the offset from an + * edge to which the component can scroll. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].i32: alignment mode for the scroll snap position. The parameter type is {@link ArkUI_ScrollSnapAlign}.\n @@ -4400,8 +4723,8 @@ typedef enum { * .value[2].i32: Whether to enable the snap to end feature. When scroll snapping is defined for the * component, setting this attribute to false enables the component to scroll between the * end edge and the last snap point.\n - * .value[3...].f32: snap points for the component. Each snap point defines the offset from - * an edge to which the component can scroll. \n + * .value[3...].f32: snap points for the component. Each snap point defines the offset from an edge + * to which the component can scroll. \n * * @code {.cpp} * ArkUI_NumberValue value[] = { @@ -4418,21 +4741,21 @@ typedef enum { NODE_SCROLL_SNAP, /** - * @brief Defines the nested scrolling options. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the nested scrolling options. 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: nested scrolling option when the component scrolls forward. + * .value[0].i32: nested scrolling option when the component scrolls forward. * The parameter type is {@link ArkUI_ScrollNestedMode}. \n - * .value[1]? .i32: nested scrolling option when the component scrolls backward. + * .value[1].i32: nested scrolling option when the component scrolls backward. * The parameter type is {@link ArkUI_ScrollNestedMode}. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0]? .i32: nested scrolling option when the component scrolls forward. + * .value[0].i32: nested scrolling option when the component scrolls forward. * The parameter type is {@link ArkUI_ScrollNestedMode}. \n - * .value[1]? .i32: nested scrolling option when the component scrolls backward. + * .value[1].i32: nested scrolling option when the component scrolls backward. * The parameter type is {@link ArkUI_ScrollNestedMode}. - * + * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); @@ -4448,17 +4771,17 @@ typedef enum { */ NODE_SCROLL_NESTED_SCROLL, /** - * @brief Defines the specified position to scroll to. - * This attribute can be set, reset, and obtained as required through APIs. - * + * @brief Defines the specified position to scroll to. 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: horizontal scrolling offset, in vp. \n * .value[1].f32: vertical scrolling offset, in vp. \n * .value[2]? .i32: scrolling duration, in milliseconds. Optional. \n *.value[3]? .i32: scrolling curve. Optional. The parameter type is {@link ArkUI_AnimationCurve}. * The default value is ARKUI_CURVE_EASE. \n - * .value[4]? .i32: whether to enable the default spring animation. Optional. - * The default value 0 means not to enable the default spring animation. \n + * .value[4]? .i32: whether to enable the default spring animation. Optional. The default value 0 means not + * to enable the default spring animation. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: horizontal scrolling offset, in vp. \n @@ -4479,15 +4802,15 @@ typedef enum { NODE_SCROLL_OFFSET, /** - * @brief Defines the edge position to scroll to. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the edge position to scroll to. 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: edge position to scroll to. The parameter type is {@link ArkUI_ScrollEdge}. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: edge position to scroll to. The parameter type is {@link ArkUI_ScrollEdge}. - * + * .value[0].i32: whether the container at the edge position. The value -1 means that the container is not + * at the edge position. If the container is at the edge position, the parameter type is {@link ArkUI_ScrollEdge}. + * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); @@ -4502,11 +4825,11 @@ typedef enum { NODE_SCROLL_EDGE, /** - * @brief Defines whether to enable the swipe-to-turn-pages feature. - * This attribute can be set, reset, and obtained as required through APIs. - * - * If both enablePaging and scrollSnap are set, scrollSnap takes effect, - * but enablePaging does not. \n + * @brief Defines whether to enable the swipe-to-turn-pages feature. This attribute can be set, reset, and obtained + * as required through APIs. + * + * If both enablePaging and scrollSnap are set, scrollSnap takes effect, but + * enablePaging does not. \n * \n * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: whether to enable the swipe-to-turn-pages feature. The default value is false. \n @@ -4526,8 +4849,8 @@ typedef enum { NODE_SCROLL_ENABLE_PAGING, /** - * @brief Defines the direction in which the list items are arranged. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the direction in which the list items are arranged. 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: direction in which the list items are arranged. The parameter type is {@link ArkUI_Axis}. @@ -4553,7 +4876,7 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: whether to pin the header to the top or the footer to the bottom in the * component. It is used together with the component. The parameter type is - * {@link ArkUI_StickyStyle}. The default value is ARKUI_STICKY_STYLE_NONE. \n + * {@link ArkUI_StickyStyle}. The default value is ARKUI_STICKY_STYLE_NONE. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: whether to pin the header to the top or the footer to the bottom in the @@ -4571,8 +4894,8 @@ typedef enum { */ NODE_LIST_STICKY, /** - * @brief Defines the spacing between list items. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the spacing between list items. 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: spacing between list items along the main axis. The default value is 0. \n @@ -4592,16 +4915,16 @@ typedef enum { NODE_LIST_SPACE, /** - * @brief Defines whether to enable loop playback for the swiper. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines whether to enable loop playback for the swiper. 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 loop playback. The value 1 means to enable loop playback, - * and 0 means the opposite. The default value is 1/b>. \n + * .value[0].i32: whether to enable loop playback. The value 1 means to enable loop playback, and 0 + * means the opposite. The default value is 1/b>. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: whether to enable loop playback. The value 1 means to enable loop playback, and - * 0 means the opposite. The default value is 1. \n + * .value[0].i32: whether to enable loop playback. The value 1 means to enable loop playback, and 0 + * means the opposite. The default value is 1. \n * * @code {.cpp} * ArkUI_NumberValue value[] = { {.i32 = 0} }; @@ -4618,14 +4941,12 @@ 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: 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[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 * 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[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 * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4640,16 +4961,16 @@ typedef enum { */ NODE_SWIPER_AUTO_PLAY, /** - * @brief Defines whether to enable the navigation point indicator for the swiper. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines whether to enable the navigation point indicator for the swiper. 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 the navigation point indicator. The value 1 means to - * enable the navigation point indicator, and 0 means the opposite. The default value is 1. \n + * .value[0].i32: whether to enable the navigation point indicator. The value 1 means to enable the + * navigation point indicator, and 0 means the opposite. The default value is 1. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: whether to enable the navigation point indicator. The value 1 means to - * enable the navigation point indicator, and 0 means the opposite. The default value is 1. \n + * .value[0].i32: whether to enable the navigation point indicator. The value 1 means to enable the + * navigation point indicator, and 0 means the opposite. The default value is 1. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4664,14 +4985,14 @@ typedef enum { */ NODE_SWIPER_SHOW_INDICATOR, /** - * @brief Defines the interval for automatic playback. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the interval for automatic playback. 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: interval for automatic playback, in milliseconds. \n + * .value[0].f32: interval for automatic playback, in milliseconds. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: interval for automatic playback, in milliseconds. \n + * .value[0].f32: interval for automatic playback, in milliseconds. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4680,22 +5001,22 @@ typedef enum { * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INTERVAL, &item); * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_INTERVAL); - * auto nodeSwiperInterval = item->value[0].i32; + * auto nodeSwiperInterval = item->value[0].f32; * @endcode * */ NODE_SWIPER_INTERVAL, /** - * @brief Defines whether vertical swiping is used for the swiper. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines whether vertical swiping is used for the swiper. 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 vertical swiping is used. The value 1 means that vertical swiping is used, - * and 0 means the opposite. The default value is 0. \n + * .value[0].i32: whether vertical swiping is used. The value 1 means that vertical swiping is used, and + * 0 means the opposite. The default value is 0. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: whether vertical swiping is used. The value 1 means that vertical swiping is used, - * and 0 means the opposite. The default value is 0. \n + * .value[0].i32: whether vertical swiping is used. The value 1 means that vertical swiping is used, and + * 0 means the opposite. The default value is 0. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4711,16 +5032,16 @@ typedef enum { NODE_SWIPER_VERTICAL, /** - * @brief Defines the duration of the animation for switching child components. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the duration of the animation for switching child components. 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: duration of the animation for switching child components, in milliseconds. - * The default value is 400. \n + * .value[0].f32: duration of the animation for switching child components, in milliseconds. The default value is + * 400. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].f32: duration of the animation for switching child components, in milliseconds. - * The default value is 400. \n + * .value[0].f32: duration of the animation for switching child components, in milliseconds. The default value is + * 400. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4736,8 +5057,8 @@ typedef enum { NODE_SWIPER_DURATION, /** - * @brief Defines the animation curve for the swiper. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the animation curve for the swiper. 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: animation curve. The parameter type is {@link ArkUI_AnimationCurve}. @@ -4811,10 +5132,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].i32: number of elements to display per page. \n + * .value[0].i32: index value of the child component. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: number of elements to display per page. \n + * .value[0].i32: index value of the child component. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4834,12 +5155,12 @@ 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: whether to disable the swipe feature. The value 1 means to disable the swipe feature, - * and 0 means the opposite. The default value is 0. \n + * .value[0].i32: whether to disable the swipe feature. The value 1 means to disable + * the swipe feature, and 0 means the opposite. The default value is 0. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: whether to disable the swipe feature. The value 1 means to disable the swipe feature, - * and 0 means the opposite. The default value is 0. \n + * .value[0].i32: whether to disable the swipe feature. The value 1 means to disable the swipe + * feature, and 0 means the opposite. The default value is 0. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -4901,8 +5222,8 @@ typedef enum { */ NODE_LIST_ITEM_GROUP_SET_HEADER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST_ITEM_GROUP, /** - * @brief Defines the footer of the list item group. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the footer of the list item group. 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_NodeHandle} object to be used as the footer of the list item group. \n @@ -4920,8 +5241,8 @@ typedef enum { */ NODE_LIST_ITEM_GROUP_SET_FOOTER, /** - * @brief Defines the style of the divider for the list items. - * This attribute can be set, reset, and obtained as required through APIs. + * @brief Defines the style of the divider for the list items. 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 divider, in 0xARGB format.\n @@ -4944,104 +5265,171 @@ typedef enum { * @endcode */ NODE_LIST_ITEM_GROUP_SET_DIVIDER, + /** - * @brief Defines the style of the background in the selected state of the calendar picker. + * @brief Defines the horizontal alignment mode of child components in the column. * 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: horizontal alignment mode of child components. + * The parameter type is {@link ArkUI_HorizontalAlignment}.\n + * Default value: ARKUI_HORIZONTAL_ALIGNMENT_CENTER. \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, +∞). 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: horizontal alignment mode of child components. + * The parameter type is {@link ArkUI_HorizontalAlignment}. \n * * @code {.cpp} - * ArkUI_NumberValue value[] = { 16.0f }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); - * auto borderRadius = item->value[0].f32; + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_HORIZONTAL_ALIGNMENT_START } }; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS); + * auto nodeColumnAlignItems = item->value[0].i32; * @endcode + * */ - NODE_CALENDAR_PICKER_HINT_RADIUS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + NODE_COLUMN_ALIGN_ITEMS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_COLUMN, /** - * @brief Defines the date of the selected item in the calendar picker. + * @brief Defines the vertical alignment mode of child components in the column. * 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[1].u32: selected year. \n - * .value[2].u32: selected month. \n - * .value[3].u32: selected day. \n + * .value[0].i32: vertical alignment mode of child components. The parameter type is {@link ArkUI_FlexAlignment}.\n + * Default value: ARKUI_FLEX_ALIGNMENT_START. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[1].u32: selected year. \n - * .value[2].u32: selected month. \n - * .value[3].u32: selected day. \n + * .value[0].i32: vertical alignment mode of child components. The parameter type is {@link ArkUI_FlexAlignment}. \n * * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED); - * auto selectYear = item->value[0].u32; + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT); + * auto nodeColumnJustifyContent = item->value[0].i32; * @endcode + * */ - NODE_CALENDAR_PICKER_SELECTED, + NODE_COLUMN_JUSTIFY_CONTENT, + /** - * @brief Defines how the calendar picker is aligned with the entry component. + * @brief Defines the vertical alignment mode of child components in the row. * 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: alignment mode. The parameter type is {@link ArkUI_CalendarAlignment}. \n - * .value[1]? .f32: offset of the picker relative to the entry component along the x-axis after alignment - * based on the specified alignment mode. \n - * .value[2]? .f32: offset of the picker relative to the entry component along the y-axis after alignment - * based on the specified alignment mode. \n + * .value[0].i32: vertical alignment mode of child components. + * The parameter type is {@link ArkUI_VerticalAlignment}.\n + * Default value: ARKUI_VERTICAL_ALIGNMENT_CENTER. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: alignment mode. The parameter type is {@link ArkUI_CalendarAlignment}. \n - * .value[1]? .f32: offset of the picker relative to the entry component along the x-axis after alignment - * based on the specified alignment mode. \n - * .value[2]? .f32: offset of the picker relative to the entry component along the y-axis after alignment - * based on the specified alignment mode. \n + * .value[0].i32: vertical alignment mode of child components. + * The parameter type is {@link ArkUI_VerticalAlignment}. \n * * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGN_END) }, 10.0f, 0.0f }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGN, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGN); - * auto alignType = item->value[0].i32; + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_VERTICAL_ALIGNMENT_TOP } }; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS); + * auto nodeRowAlignItems = item->value[0].i32; * @endcode + * */ - NODE_CALENDAR_PICKER_EDGE_ALIGN, + NODE_ROW_ALIGN_ITEMS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_ROW, /** - * @brief Defines the font color, font size, and font weight in the entry area of the calendar picker. + * @brief Defines the horizontal alignment mode of child components in the row. + * 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: font color of the entry area. \n - * .value[1]? .f32: font size of the entry area, in fp. \n - * .value[2]? .i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n + * .value[0].i32: horizontal alignment mode of child components. + * The parameter type is {@link ArkUI_FlexAlignment}.\n + * Default value: ARKUI_FLEX_ALIGNMENT_START. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0]? .u32: font color of the entry area. \n - * .value[1]? .f32: font size of the entry area, in fp. \n - * .value[2]? .i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n + * .value[0].i32: horizontal alignment mode of child components. + * The parameter type is {@link ArkUI_FlexAlignment}. \n * * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = - * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); - * auto textColor = item->value[0].u32; + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT); + * auto nodeRowAlignItems = item->value[0].i32; * @endcode + * */ - NODE_CALENDAR_PICKER_TEXT_STYLE, + NODE_ROW_JUSTIFY_CONTENT, + + /** + * @brief Defines the flex attribute. 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: direction in which flex items are arranged. The parameter type is {@link ArkUI_FlexDirection}. + * The default value is ARKUI_FLEX_DIRECTION_ROW.\n + *.value[1]? .i32: how the flex items are wrapped. The parameter type is {@link ArkUI_FlexWrap}. + * The default value is ARKUI_FLEX_WRAP_NO_WRAP.\n + * .value[2]?.i32: alignment mode along the main axis. The parameter type is {@link ArkUI_FlexAlignment}. + * The default value is ARKUI_FLEX_ALIGNMENT_START.\n + * .value[3]?.i32: alignment mode along the cross axis. The parameter type is {@link ArkUI_ItemAlignment}. + * The default value is ARKUI_ITEM_ALIGNMENT_START.\n + * .value[4]?.i32: alignment mode along the cross axis for multi-line content. The parameter type is + * {@link ArkUI_FlexAlignment}. The default value is ARKUI_FLEX_ALIGNMENT_START.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0]? .i32: direction in which flex items are arranged.\n + * .value[1]?.i32: how the flex items are wrapped.\n + * .value[2]?.i32: alignment mode along the main axis.\n + * .value[3]?.i32: alignment mode along the cross axis.\n + * .value[4]?.i32: alignment mode along the cross axis for multi-line content.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FLEX_DIRECTION_COLUMN}, {.i32 = ARKUI_FLEX_WRAP_WRAP}, + * {.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}, {.i32 = ARKUI_ITEM_ALIGNMENT_CENTER}, + * {.i32 = ARKUI_FLEX_ALIGNMENT_END}}; + * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_OPTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FLEX_OPTION); + * auto nodeFlexDirection = item->value[1].i32; + * auto nodeFlexWrap = item->value[2].i32; + * auto nodeFlexJustifyContent = item->value[3].i32; + * auto nodeFlexAlignItems = item->value[4].i32; + * auto nodeFlexAlignContent = item->value[5].i32; + * + * @endcode + * + */ + NODE_FLEX_OPTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_FLEX, + + /** + * @brief Sets whether the component is being refreshed. + * 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. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = { { .i32 = 0 } }; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_REFRESH_REFRESHING, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_REFRESH_REFRESHING); + * auto value = item->data[0].i32; + * @endcode + * + */ + NODE_REFRESH_REFRESHING = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, } ArkUI_NodeAttributeType; #define MAX_COMPONENT_EVENT_ARG_NUM 12 @@ -5082,7 +5470,8 @@ typedef enum { * @brief Defines the mount event. * * This event is triggered when the component is mounted and displayed. \n - * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent}. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} does not contain parameters. */ NODE_EVENT_ON_APPEAR, @@ -5090,33 +5479,33 @@ typedef enum { /** * @brief Defines the area change event. * - * The area change event is triggered when the component's size, position, or any other attribute that may affect - * its display area changes. \n - * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object - * is {@link ArkUI_NodeComponentEvent}. \n + * This event is triggered when the component's size, position, or any other attribute that may + * affect its display area changes. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} contains 12 parameters:\n * ArkUI_NodeComponentEvent.data[0].f32: original width of the target element, in vp. * The value type is number. \n * ArkUI_NodeComponentEvent.data[1].f32: original height of the target element, in vp. * The value type is number. \n * ArkUI_NodeComponentEvent.data[2].f32: original X coordinate of the target element's upper left corner - * relative to the parent element's, in vp. The value type is number.\n + * relative to the parent element's, in vp. The value type is number. \n * ArkUI_NodeComponentEvent.data[3].f32: original Y coordinate of the target element's upper left corner - * relative to the parent element's, in vp. The value type is number.\n + * relative to the parent element's, in vp. The value type is number. \n * ArkUI_NodeComponentEvent.data[4].f32: original X coordinate of the target element's upper left corner - * relative to the page's, in vp. The value type is number.\n + * relative to the page's, in vp. The value type is number. \n * ArkUI_NodeComponentEvent.data[5].f32: original Y coordinate of the target element's upper left corner - * relative to the page's, in vp. The value type is number.\n - * ArkUI_NodeComponentEvent.data[6].f32: new width of the target element, in vp. The value type is number.\n - * ArkUI_NodeComponentEvent.data[7].f32: new height of the target element, in vp. The value type is number.\n - * ArkUI_NodeComponentEvent.data[8].f32: new X coordinate of the target element's upper left corner - * relative to the parent element's, in vp. The value type is number.\n - * ArkUI_NodeComponentEvent.data[9].f32: new Y coordinate of the target element's upper left corner - * relative to the parent element's, in vp. The value type is number.\n - * ArkUI_NodeComponentEvent.data[10].f32: new X coordinate of the target element's upper left corner - * relative to the page's, in vp. The value type is number.\n - * ArkUI_NodeComponentEvent.data[11].f32: new Y coordinate of the target element's upper left corner - * relative to the page's, in vp. The value type is number.\n + * relative to the page's, in vp. The value type is number. \n + * ArkUI_NodeComponentEvent.data[6].f32: new width of the target element, in vp. The value is a number. \n + * ArkUI_NodeComponentEvent.data[7].f32: new height of the target element, in vp. The value is a number. \n + * ArkUI_NodeComponentEvent.data[8].f32: new X coordinate of the target element's upper left corner relative + * to the parent element's, in vp. The value type is number. \n + * ArkUI_NodeComponentEvent.data[9].f32: new Y coordinate of the target element's upper left corner relative + * to the parent element's, in vp. The value type is number. \n + * ArkUI_NodeComponentEvent.data[10].f32: new X coordinate of the target element's upper left corner relative + * to the page's, in vp. The value type is number. \n + * ArkUI_NodeComponentEvent.data[11].f32: new Y coordinate of the target element's upper left corner relative + * to the page's, in vp. The value type is number. \n */ NODE_EVENT_ON_AREA_CHANGE, /** @@ -5142,7 +5531,7 @@ typedef enum { * * This event is triggered when the component is clicked. \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is - * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} contains 12 parameters:\n * ArkUI_NodeComponentEvent.data[0].f32: X coordinate of the click relative to the upper left corner of the * clicked component's original area, in vp. \n @@ -5150,8 +5539,8 @@ typedef enum { * clicked component's original area, in vp. \n * ArkUI_NodeComponentEvent.data[2].f32: event timestamp. It is the interval between the time when the event * is triggered and the time when the system starts, in microseconds. \n - * ArkUI_NodeComponentEvent.data[3].i32: event input device. The value 1 indicates the mouse, 2 - * indicates the touchscreen, and 4 indicates the key. \n + * ArkUI_NodeComponentEvent.data[3].i32: event input device. The value 1 indicates the mouse, + * 2 indicates the touchscreen, and 4 indicates the key. \n * ArkUI_NodeComponentEvent.data[4].f32: X coordinate of the click relative to the upper left corner of the * application window, in vp. \n * ArkUI_NodeComponentEvent.data[5].f32: Y coordinate of the click relative to the upper left corner of the @@ -5175,10 +5564,10 @@ typedef enum { * ArkUI_NodeComponentEvent.data[2].f32: height of the image, in px. \n * ArkUI_NodeComponentEvent.data[3].f32: width of the component, in px. \n * ArkUI_NodeComponentEvent.data[4].f32: height of the component, in px. \n - * ArkUI_NodeComponentEvent.data[5].f32: offset of the rendered content relative to the component on - * the x-axis, in px. \n - * ArkUI_NodeComponentEvent.data[6].f32: offset of the rendered content relative to the component on - * the y-axis, in px. \n + * ArkUI_NodeComponentEvent.data[5].f32: offset of the rendered content relative to the component on the + * x-axis, in px. \n + * ArkUI_NodeComponentEvent.data[6].f32: offset of the rendered content relative to the component on the + * y-axis, in px. \n * ArkUI_NodeComponentEvent.data[7].f32: actual rendered width of the image, in px. \n * ArkUI_NodeComponentEvent.data[8].f32: actual rendered height of the image, in px. \n */ @@ -5186,51 +5575,120 @@ typedef enum { /** * @brief Defines the image loading failure event. * - * This event is triggered when an error occurs during image loading.\n + * This event is triggered when an error occurs during image loading. \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is - * {@link ArkUI_NodeComponentEvent}.\n + * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} contains one parameter:\n * ArkUI_NodeComponentEvent.data[0].i32error code:\n - * 401: The image could not be obtained because the image path is invalid.\n + * 401: The image could not be obtained because the image path is invalid. \n * 103101: The image format is not supported. \n */ NODE_IMAGE_ON_ERROR, /** * @brief Defines the SVG animation playback completion event. * - * This event is triggered when the animation playback in the loaded SVG image is complete.\n + * This event is triggered when the animation playback in the loaded SVG image is complete. \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is - * {@link ArkUI_NodeComponentEvent}.\n + * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} does not contain parameters. */ NODE_IMAGE_ON_SVG_PLAY_FINISH, /** - * @brief Defines the event triggered when the toggle status changes.\n + * @brief Defines the event triggered when the toggle status changes. + * + \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 + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains one parameter: \n * ArkUI_NodeComponentEvent.data[0].i32: toggle status. 1: on; 0: off. * */ NODE_TOGGLE_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, - + /** + * @brief Defines the event triggered when the text input content changes. + * + \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_StringAsyncEvent}. \n + * {@link ArkUI_StringAsyncEvent} contains one parameter:\n + * ArkUI_StringAsyncEvent.pStr: text input. + * + */ NODE_TEXT_INPUT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, + /** + * @brief Defines the event triggered when the Enter key of the text input method is pressed. + * + \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: Enter key type of the input method. + * + */ NODE_TEXT_INPUT_ON_SUBMIT, + /** + * @brief Defines the event triggered when the cut button on the pasteboard, which displays when the text box + * is long pressed, is clicked. + * + \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_StringAsyncEvent}. \n + * {@link ArkUI_StringAsyncEvent} contains one parameter:\n + * ArkUI_StringAsyncEvent.pStr: text that is cut. + * + */ NODE_TEXT_INPUT_ON_CUT, + /** + * @brief Defines the event triggered when the paste button on the pasteboard, which displays when the text box + * is long pressed, is clicked. + * + \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_StringAsyncEvent}. \n + * {@link ArkUI_StringAsyncEvent} contains one parameter:\n + * ArkUI_StringAsyncEvent.pStr: text that is pasted + * + */ NODE_TEXT_INPUT_ON_PASTE, - + /** + * @brief Defines the event triggered when the input in the text box changes. + * + \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_StringAsyncEvent}. \n + * {@link ArkUI_StringAsyncEvent} contains one parameter:\n + * ArkUI_StringAsyncEvent.pStr: text entered. + * + */ NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, - NODE_REFRESH_STATE_CHANGE = 1000 * ARKUI_NODE_REFRESH + 1, + /** + * @brief Defines the event triggered when the refresh state of the ARKUI_NODE_REFRESH object changes. + * + * 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: refresh state. \n + */ + NODE_REFRESH_STATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, + /** + * @brief Defines the event triggered when the ARKUI_NODE_REFRESH object enters the refresh state. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} does not contain parameters:\n + */ NODE_REFRESH_ON_REFRESH, /** - * @brief Defines the event triggered when a date is selected in the ARKUI_NODE_DATE_PICKER component.\n + * @brief Defines the event triggered when a date is selected in the ARKUI_NODE_DATE_PICKER component. + * + \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is - * {@link ArkUI_NodeComponentEvent}.\n + * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} contains three parameters:\n * ArkUI_NodeComponentEvent.data[0].i32: year of the selected date. \n - * ArkUI_NodeComponentEvent.data[1].i32: month of the selected date. Value range: [0-11].\n + * ArkUI_NodeComponentEvent.data[1].i32: month of the selected date. Value range: [0-11]. \n * ArkUI_NodeComponentEvent.data[2].i32: day of the selected date. \n */ NODE_DATE_PICKER_EVENT_ON_DATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_DATE_PICKER, @@ -5240,7 +5698,7 @@ typedef enum { * \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is - * {@link ArkUI_NodeComponentEvent}.\n + * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} contains two parameters:\n * ArkUI_NodeComponentEvent.data[0].i32: hour of the selected time. Value range: [0-23]. \n * ArkUI_NodeComponentEvent.data[1].i32: minute of the selected time. Value range: [0-59]. \n @@ -5252,9 +5710,10 @@ typedef enum { * \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...11].i32: value of the selected item. \n + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains two parameters:\n + * ArkUI_NodeComponentEvent.data[0].i32: hour of the selected time. Value range: [0-23]. \n + * ArkUI_NodeComponentEvent.data[1].i32: minute of the selected time. Value range: [0-59]. \n */ NODE_TEXT_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, @@ -5335,8 +5794,8 @@ typedef enum { */ NODE_SCROLL_EVENT_ON_SCROLL_STOP, /** - * @brief Defines the event triggered when scrolling of the ARKUI_NODE_SCROLL component - * reaches one of the edges. + * @brief Defines the event triggered when scrolling of the ARKUI_NODE_SCROLL component reaches + * one of the edges. * * Notes for triggering the event:\n * 1. This event is triggered when scrolling reaches the edge after being started by the ARKUI_NODE_SCROLL @@ -5487,8 +5946,8 @@ typedef struct { * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. - * @param position Indicates the position to which the target child node is to be inserted. - * If the value is a negative number or invalid, the node is inserted at the end of the parent node. + * @param position Indicates the position to which the target child node is to be inserted. If the value is a + * negative number or invalid, the node is inserted at the end of the parent node. * @return Returns 0 if success. * Returns 401 if a parameter exception occurs. */ @@ -5509,9 +5968,9 @@ typedef struct { /** * @brief Obtains an attribute. * - * The pointer returned by this API is an internal buffer pointer of the ArkUI framework. - * As such, you do not need to call delete to release the memory. However, the pointer must be used before - * this API is called next time. Otherwise, the pointer may be overwritten by other values. + * The pointer returned by this API is an internal buffer pointer of the ArkUI framework. As such, you do not need + * to call delete to release the memory. However, the pointer must be used before this API is called next + * time. Otherwise, the pointer may be overwritten by other values. * * @param node Indicates the node whose attribute needs to be obtained. * @param attribute Indicates the type of attribute to obtain. @@ -5535,7 +5994,7 @@ typedef struct { * * @param node Indicates the target node. * @param eventType Indicates the type of event to register. - * @param eventId Indicates the custom event ID, which is passed in the callback of <@link ArkUI_NodeEvent> + * @param eventId Indicates the custom event ID, which is passed in the callback of {@link ArkUI_NodeEvent} * when the event is triggered. * @return Returns 0 if success. * Returns 401 if a parameter exception occurs. @@ -5554,8 +6013,8 @@ typedef struct { /** * @brief Registers an event receiver. * - * The ArkUI framework collects component events generated during the process and calls back the events through - * the registered event receiver. \n + * The ArkUI framework collects component events generated during the process and calls back the events through the + * registered event receiver. \n * A new call to this API will overwrite the previously registered event receiver. * * @param eventReceiver Indicates the event receiver to register. diff --git a/en/native_sdk/ace/native_type.h b/en/native_sdk/ace/native_type.h index 752f0b75..2ec8ceaa 100644 --- a/en/native_sdk/ace/native_type.h +++ b/en/native_sdk/ace/native_type.h @@ -104,9 +104,9 @@ typedef enum { typedef enum { /** The image is not repeatedly drawn. */ ARKUI_IMAGE_REPEAT_NONE = 0, - /** The image is repeatedly drawn only along the horizontal axis. */ + /** The image is repeatedly drawn only along the x-axis. */ ARKUI_IMAGE_REPEAT_X, - /** The image is repeatedly drawn only along the vertical axis. */ + /** The image is repeatedly drawn only along the y-axis. */ ARKUI_IMAGE_REPEAT_Y, /** The image is repeatedly drawn along both axes. */ ARKUI_IMAGE_REPEAT_XY, @@ -274,6 +274,11 @@ typedef enum { ARKUI_PROGRESS_CAPSULE, }ArkUI_ProgressType; +/** + * @brief Enumerates the text decoration styles. + * + * @since 12 + */ typedef enum { /** No text decoration. */ ARKUI_TEXT_DECORATION_TYPE_NONE = 0, @@ -285,6 +290,11 @@ typedef enum { ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH, } ArkUI_TextDecorationType; +/** + * @brief Enumerates the text cases. + * + * @since 12 + */ typedef enum { /** The original case of the text is retained. */ ARKUI_TEXT_CASE_NORMAL = 0, @@ -294,6 +304,11 @@ typedef enum { ARKUI_TEXT_CASE_UPPER, } ArkUI_TextCase; +/** + * @brief Enumerates the text copy and paste modes. + * + * @since 12 + */ typedef enum { /** Copy is not allowed. */ ARKUI_COPY_OPTIONS_NONE = 0, @@ -305,6 +320,11 @@ typedef enum { ARKUI_COPY_OPTIONS_CROSS_DEVICE, } ArkUI_CopyOptions; +/** + * @brief Enumerates the shadow types. + * + * @since 12 + */ typedef enum { /** Color. */ ARKUI_SHADOW_TYPE_COLOR = 0, @@ -355,15 +375,14 @@ typedef struct { } ARKUI_TextPickerCascadeRangeContent; /** - * @brief Enumerates the effects used at the edges of the component when the boundary of the - * scrollable content is reached. + * @brief Enumerates the effects used at the edges of the component when the boundary of the scrollable content is + * reached. * * @since 12 */ typedef enum { - /** Spring effect. When at one of the edges, the component can move beyond the bounds based on the - * initial speed or through touches, and produces a bounce effect when the user releases their finger. - */ + /** Spring effect. When at one of the edges, the component can move beyond the bounds based on the initial + * speed or through touches, and produces a bounce effect when the user releases their finger. */ ARKUI_EDGE_EFFECT_SPRING = 0, /** Fade effect. When at one of the edges, the component produces a fade effect. */ ARKUI_EDGE_EFFECT_FADE, @@ -450,17 +469,14 @@ typedef enum { * @since 12 */ typedef enum { - /** Both the node and its child node respond to the hit test of a touch event, - * but its sibling node is blocked from the hit test. - */ + /** Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from + * the hit test. */ ARKUI_HIT_TEST_MODE_DEFAULT = 0, - /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from - * the hit test. - */ + /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the + * hit test. */ ARKUI_HIT_TEST_MODE_BLOCK, /** Both the node and its child node respond to the hit test of a touch event, and its sibling node is also - * considered during the hit test. - */ + * considered during the hit test. */ ARKUI_HIT_TEST_MODE_TRANSPARENT, /** The node does not respond to the hit test of a touch event. */ ARKUI_HIT_TEST_MODE_NONE @@ -590,22 +606,19 @@ typedef enum { */ typedef enum { /** The scrolling is contained within the component, and no scroll chaining occurs, that is, the parent component - * does not scroll when the component scrolling reaches the boundary. */ + * does not scroll when the component scrolling reaches the boundary. */ ARKUI_SCROLL_NESTED_MODE_SELF_ONLY = 0, /** The component scrolls first, and when it hits the boundary, the parent component scrolls. - * When the parent component hits the boundary, its edge effect is displayed. If no edge effect is specified for - * the parent component, the edge effect of the child component is displayed instead. - */ + /** When the parent component hits the boundary, its edge effect is displayed. If no edge + * effect is specified for the parent component, the edge effect of the child component is displayed instead. */ ARKUI_SCROLL_NESTED_MODE_SELF_FIRST, /** The parent component scrolls first, and when it hits the boundary, the component scrolls. - * When the component hits the boundary, its edge effect is displayed. If no edge effect is specified for the - * component, the edge effect of the parent component is displayed instead. - */ + * When the component hits the boundary, its edge effect is displayed. If no edge effect is specified for the + * component, the edge effect of the parent component is displayed instead. */ ARKUI_SCROLL_NESTED_MODE_PARENT_FIRST, /** The component and its parent component scroll at the same time. When both the component and its parent component - * hit the boundary, the edge effect of the component is displayed. If no edge effect is specified for the - * component, the edge effect of the parent component is displayed instead. - */ + * hit the boundary, the edge effect of the component is displayed. If no edge effect is specified for the + * component, the edge effect of the parent component is displayed instead. */ ARKUI_SCROLL_NESTED_MODE_PARALLEL, } ArkUI_ScrollNestedMode; @@ -618,16 +631,10 @@ typedef enum { typedef enum { /** Top edge in the vertical direction. */ ARKUI_SCROLL_EDGE_TOP = 0, - /** Center position in the vertical direction. */ - ARKUI_SCROLL_EDGE_CENTER, /** Bottom edge in the vertical direction. */ ARKUI_SCROLL_EDGE_BOTTOM, - /** Text baseline position in the cross axis direction. */ - ARKUI_SCROLL_EDGE_BASELINE, /** Start position in the horizontal direction. */ ARKUI_SCROLL_EDGE_START, - /** Center position in the horizontal direction. */ - ARKUI_SCROLL_EDGE_MIDDLE, /** End position in the horizontal direction. */ ARKUI_SCROLL_EDGE_END, } ArkUI_ScrollEdge; @@ -692,13 +699,11 @@ typedef enum { ARKUI_ANIMATION_PLAY_MODE_NORMAL = 0, /** The animation is played reversely. */ ARKUI_ANIMATION_PLAY_MODE_REVERSE, - /** The animation is played normally for an odd number of times (1, 3, 5...) and reversely for an even number of - * times (2, 4, 6...). - */ + /** The animation is played normally for an odd number of times (1, 3, 5...) and reversely for an even number + * of times (2, 4, 6...). */ ARKUI_ANIMATION_PLAY_MODE_ALTERNATE, - /** The animation is played reversely for an odd number of times (1, 3, 5...) and normally for an even number of - * times (2, 4, 6...). - */ + /** The animation is played reversely for an odd number of times (1, 3, 5...) and normally for an even number + * of times (2, 4, 6...). */ ARKUI_ANIMATION_PLAY_MODE_ALTERNATE_REVERSE, } ArkUI_AnimationPlayMode; @@ -710,11 +715,11 @@ typedef enum { typedef enum { /** The original image aspect ratio is retained. */ ARKUI_IMAGE_SIZE_AUTO = 0, - /** Default value. The image is scaled with its aspect ratio retained for both sides to be greater than or equal to - * the display boundaries. */ + /** Default value. The image is scaled with its aspect ratio retained for both sides to be greater than or equal + * to the display boundaries. */ ARKUI_IMAGE_SIZE_COVER, - /** The image is scaled with its aspect ratio retained for the content to be completely displayed within the - * display boundaries. */ + /** The image is scaled with its aspect ratio retained for the content to be completely displayed within the display + * boundaries. */ ARKUI_IMAGE_SIZE_CONTAIN, } ArkUI_ImageSize; @@ -845,20 +850,17 @@ typedef enum { */ typedef enum { /** The image is scaled with its aspect ratio retained for the content to be completely displayed within the - * display boundaries. - */ + * display boundaries. */ ARKUI_OBJECT_FIT_CONTAIN = 0, /** The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the - * display boundaries. - */ + * display boundaries. */ ARKUI_OBJECT_FIT_COVER, /** The image is scaled automatically to fit the display area. */ ARKUI_OBJECT_FIT_AUTO, /** The image is scaled to fill the display area, and its aspect ratio is not retained. */ ARKUI_OBJECT_FIT_FILL, /** The image content is displayed with its aspect ratio retained. The size is smaller than or equal to the - * original size. - */ + * original size. */ ARKUI_OBJECT_FIT_SCALE_DOWN, /** The original size is retained. */ ARKUI_OBJECT_FIT_NONE, @@ -908,22 +910,22 @@ typedef enum { /** r = d * (1 - sa): Only the part of the target pixels that do not overlap with the source pixels is displayed. */ ARKUI_BLEND_MODE_DST_OUT, /** r = s * da + d * (1 - sa): The part of the source pixels that overlap with the target pixels is displayed and - * the part of the target pixels that do not overlap with the source pixels are displayed. + * the part of the target pixels that do not overlap with the source pixels are displayed. */ ARKUI_BLEND_MODE_SRC_ATOP, /** r = d * sa + s * (1 - da): The part of the target pixels that overlap with the source pixels and the part of - * the source pixels that do not overlap with the target pixels are displayed. + * the source pixels that do not overlap with the target pixels are displayed. */ ARKUI_BLEND_MODE_DST_ATOP, /** r = s * (1 - da) + d * (1 - sa): Only the non-overlapping part between the source pixels and the target pixels - * is displayed. */ + * is displayed. */ ARKUI_BLEND_MODE_XOR, /** r = min(s + d, 1): New pixels resulting from adding the source pixels to the target pixels are displayed. */ ARKUI_BLEND_MODE_PLUS, /** r = s * d: New pixels resulting from multiplying the source pixels with the target pixels are displayed. */ ARKUI_BLEND_MODE_MODULATE, /** r = s + d - s * d: Pixels are blended by adding the source pixels to the target pixels and subtracting the - * product of their multiplication. */ + * product of their multiplication. */ ARKUI_BLEND_MODE_SCREEN, /** The MULTIPLY or SCREEN mode is used based on the target pixels. */ ARKUI_BLEND_MODE_OVERLAY, @@ -940,32 +942,27 @@ typedef enum { ARKUI_BLEND_MODE_HARD_LIGHT, /** The LIGHTEN or DARKEN mode is used, depending on the source pixels. */ ARKUI_BLEND_MODE_SOFT_LIGHT, - /** rc = s + d - 2 * (min(s * da, d * sa)), ra = kSrcOver: The final pixel is the result of subtracting the darker - * of the two pixels (source and target) from the lighter one. - */ + /** rc = s + d - 2 * (min(s * da, d * sa)), ra = + kSrcOver: The final pixel is the result of subtracting the darker of the two pixels (source and target) from + the lighter one. */ ARKUI_BLEND_MODE_DIFFERENCE, /** rc = s + d - two(s * d), ra = kSrcOver: The final pixel is similar to DIFFERENCE, but with less contrast. */ ARKUI_BLEND_MODE_EXCLUSION, - /** r = s * (1 - da) + d * (1 - sa) + s * d: The final pixel is the result of multiplying the source pixel by - * the target pixel. - */ + /** r = s * (1 - da) + d * (1 - sa) + s * d: The final pixel is the result of multiplying the source pixel + * by the target pixel. */ ARKUI_BLEND_MODE_MULTIPLY, - /** The resultant image is created with the luminance and saturation of the source image and the hue of the - * target image. - */ + /** The resultant image is created with the luminance and saturation of the source image and the hue of the target + * image. */ ARKUI_BLEND_MODE_HUE, - /** The resultant image is created with the luminance and hue of the target image and the saturation of the - * source image. - */ + /** The resultant image is created with the luminance and hue of the target image and the saturation of the source + * image. */ ARKUI_BLEND_MODE_SATURATION, - /** The resultant image is created with the saturation and hue of the source image and the luminance of the - * target image. - */ + /** The resultant image is created with the saturation and hue of the source image and the luminance of the target + * image. */ ARKUI_BLEND_MODE_COLOR, - /** The resultant image is created with the saturation and hue of the target image and the luminance of the - * source image. - */ + /** The resultant image is created with the saturation and hue of the target image and the luminance of the source + * image. */ ARKUI_BLEND_MODE_LUMINOSITY, } ArkUI_BlendMode; @@ -990,19 +987,19 @@ typedef enum { */ typedef enum { /** The default configuration in the container is used. */ - ARKUI_ITEM_ALIGN_AUTO = 0, + ARKUI_ITEM_ALIGNMENT_AUTO = 0, /** The items in the container are aligned with the cross-start edge. */ - ARKUI_ITEM_ALIGN_START, + ARKUI_ITEM_ALIGNMENT_START, /** The items in the container are centered along the cross axis. */ - ARKUI_ITEM_ALIGN_CENTER, + ARKUI_ITEM_ALIGNMENT_CENTER, /** The items in the container are aligned with the cross-end edge. */ - ARKUI_ITEM_ALIGN_END, + ARKUI_ITEM_ALIGNMENT_END, /** The items in the container are stretched and padded along the cross axis. */ - ARKUI_ITEM_ALIGN_STRETCH, + ARKUI_ITEM_ALIGNMENT_STRETCH, /** The items in the container are aligned in such a manner that their text baselines are aligned along the - * cross axis. */ - ARKUI_ITEM_ALIGN_BASELINE, -} ArkUI_ItemAlign; + * cross axis. */ + ARKUI_ITEM_ALIGNMENT_BASELINE, +} ArkUI_ItemAlignment; /** * @brief Enumerates the foreground colors. @@ -1025,25 +1022,24 @@ typedef enum { */ typedef enum { /** The child components are aligned with the start edge of the main axis. */ - ARKUI_FLEX_ALIGN_START = 1, + ARKUI_FLEX_ALIGNMENT_START = 1, /** The child components are aligned in the center of the main axis. */ - ARKUI_FLEX_ALIGN_CENTER = 2, + ARKUI_FLEX_ALIGNMENT_CENTER = 2, /** The child components are aligned with the end edge of the main axis. */ - ARKUI_FLEX_ALIGN_END = 3, + ARKUI_FLEX_ALIGNMENT_END = 3, /** The child components are evenly distributed along the main axis. The space between any two adjacent components - * is the same. The first component is aligned with the main-start, and the last component is aligned with the - * main-end. - */ - ARKUI_FLEX_ALIGN_SPACE_BETWEEN = 6, + * is the same. The first component is aligned with the main-start, and the last component is aligned with + * the main-end. */ + ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN = 6, /** The child components are evenly distributed along the main axis. The space between any two adjacent components - * is the same. The space between the first component and main-start, and that between the last component and - * cross-main are both half the size of the space between two adjacent components. */ - ARKUI_FLEX_ALIGN_SPACE_AROUND = 7, - /** The child components are evenly distributed along the main axis. The space between the first component and - * main-start, the space between the last component and main-end, and the space between any two adjacent components - * are the same. */ - ARKUI_FLEX_ALIGN_SPACE_EVENLY = 8, -} ArkUI_FlexAlign; + * is the same. The space between the first component and main-start, and that between the last component and + * cross-main are both half the size of the space between two adjacent components. */ + ARKUI_FLEX_ALIGNMENT_SPACE_AROUND = 7, + /** The child components are evenly distributed along the main axis. The space between the first component + * and main-start, the space between the last component and main-end, and the space between any two adjacent + * components are the same. */ + ARKUI_FLEX_ALIGNMENT_SPACE_EVENLY = 8, +} ArkUI_FlexAlignment; /** * @brief Enumerates the directions of the main axis in the flex container. @@ -1103,6 +1099,69 @@ typedef enum { ARKUI_CALENDAR_ALIGNMENT_END, } ArkUI_CalendarAlignment; +/** + * @brief Enumerates the mask types. + * + * @since 12 + */ +typedef enum { + /** Rectangle. */ + ARKUI_MASK_TYPE_RECT = 0, + /** Circle. */ + ARKUI_MASK_TYPE_CIRCLE, + /** Ellipse. */ + ARKUI_MASK_TYPE_ELLIPSE, + /** Path. */ + ARKUI_MASK_TYPE_PATH, + /** Progress indicator. */ + ARKUI_MASK_TYPE_PROGRESS, +} ArkUI_MaskType; + +/** + * @brief Enumerates the clipping region types. + * + * @since 12 + */ +typedef enum { + /** Rectangle. */ + ARKUI_CLIP_TYPE_RECT = 0, + /** Circle. */ + ARKUI_CLIP_TYPE_CIRCLE, + /** Ellipse. */ + ARKUI_CLIP_TYPE_ELLIPSE, + /** Path. */ + ARKUI_CLIP_TYPE_PATH, +} ArkUI_ClipType; + +/** + * @brief Defines the gradient color stop structure. + * + * @since 12 + */ +typedef struct { + /** Color array. */ + const uint32_t* colors; + /** Position array. */ + float* stops; + /** Length array. */ + int size; +} ArkUI_ColorStop; + +/** + * @brief Enumerates the custom shapes. + * + * @since 12 + */ +typedef enum { + /** Rectangle. */ + ARKUI_SHAPE_TYPE_RECT = 0, + /** Circle. */ + ARKUI_SHAPE_TYPE_CIRCLE, + /** Ellipse. */ + ARKUI_SHAPE_TYPE_ELLIPSE, + /** Path. */ + ARKUI_SHAPE_TYPE_PATH, +} ArkUI_ShapeType; #ifdef __cplusplus }; #endif -- Gitee From b2c2de016cb4c467b9130d37974a46eda98a02d3 Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Tue, 20 Feb 2024 14:18:54 +0800 Subject: [PATCH 0272/2135] =?UTF-8?q?fix=20NDK=20C-API=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=AD=97=E7=AC=A6=E9=97=AE=E9=A2=98=20Signed-off-by:?= =?UTF-8?q?=20liyi0309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_node.h | 252 +++++++++++++++-------------- zh-cn/native_sdk/ace/native_type.h | 14 ++ 2 files changed, 141 insertions(+), 125 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index f14120fc..785a1251 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -144,7 +144,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 1.2 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_WIDTH, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_WIDTH); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_WIDTH); * auto nodeWidth = item->value[0].f32; * @endcode * @@ -164,7 +164,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 1.2 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_HEIGHT, &item);clang-tid - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_HEIGHT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HEIGHT); * auto nodeHeight = item->value[0].f32; * @endcode * @@ -184,7 +184,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); * auto nodeBackgroundColor = item->value[0].u32; * @endcode * @@ -206,7 +206,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_IMAGE_REPEAT_NONE} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); * auto nodeBackgroundImageUrl = item->string; * auto nodeBackgroundImageRepeat = item->value[0].i32; * @endcode @@ -239,7 +239,7 @@ typedef enum { * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item1); * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item2); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PADDING); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PADDING); * auto nodePaddingTop = item->value[0].f32; * @endcode * @@ -258,7 +258,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "test" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_ID, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ID); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ID); * auto nodeId = item->string; * @endcode * @@ -278,7 +278,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = false} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_ENABLED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ENABLED); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ENABLED); * auto nodeEnabled = item->value[0].i32; * @endcode */ @@ -309,7 +309,7 @@ typedef enum { * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item1); * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item2); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_MARGIN); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARGIN); * auto nodeMarginTop = item->value[0].f32; * @endcode * @@ -888,7 +888,7 @@ typedef enum { * { 10, {.i32 = 1},10, 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, {.i32 = 1} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); * auto nodeCustomShadowRadius = item->value[0].f32; * auto nodeCustomShadowOffsetX = item->value[1].f32; * auto nodeCustomShadowOffsetY = item->value[2].f32; @@ -1519,7 +1519,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0, 5, 0, 5 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CONSTRAINT_SIZE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); * auto nodeMinWidth = item->value[0].f32; * auto nodeMaxWidth = item->value[1].f32; * auto nodeMinHeight = item->value[2].f32; @@ -1542,7 +1542,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0.5 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_GRAY_SCALE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_GRAY_SCALE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_GRAY_SCALE); * auto nodeGrayScale = item->value[0].f32; * @endcode */ @@ -1561,7 +1561,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0.5 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_INVERT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_INVERT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_INVERT); * auto nodeInvert = item->value[0].f32; * @endcode */ @@ -1580,7 +1580,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0.5 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SEPIA, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SEPIA); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SEPIA); * auto nodeSepia = item->value[0].f32; * @endcode */ @@ -1599,7 +1599,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CONTRAST, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONTRAST); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CONTRAST); * auto nodeContrast = item->value[0].f32; * @endcode */ @@ -1618,7 +1618,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { {.u32=0xFFFF0000} }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FOREGROUND_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); * auto nodeForegroundColor = item->value[0].u32; * @endcode */ @@ -1968,7 +1968,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_COLOR); * auto nodeFontColor = item->value[0].u32; * @endcode * @@ -1988,7 +1988,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_SIZE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_SIZE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_SIZE); * auto nodeFontSize = item->value[0].f32; * @endcode * @@ -2008,7 +2008,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_STYLE_NORMAL} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_STYLE); * auto nodeFontStyle = item->value[0].i32; * @endcode * @@ -2028,7 +2028,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_WEIGHT_NORMAL} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_WEIGHT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_WEIGHT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_WEIGHT); * auto nodeFontWeight = item->value[0].i32; * @endcode * @@ -2070,7 +2070,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); - * auto decorationItem = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); + * auto decorationItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_DECORATION); * auto nodeDecorationStyle = decorationItem->value[0].i32; * auto nodeDecorationColor = decorationItem->value[1].u32; * @endcode @@ -2213,7 +2213,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_COPY_OPTIONS_NONE} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_COPY_OPTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); * auto nodeTextCopyOption = item->value[0].i32; * @endcode * @@ -2233,7 +2233,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); * auto nodeTextBaselineOffset = item->value[0].f32; * @endcode * @@ -2261,7 +2261,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, 10, 10 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); * auto nodeTextShadowRadius = item->value[0].f32; * auto nodeTextShadowType = item->value[1].i32; * auto nodeTextShadowColor = item->value[2].u32; @@ -2623,7 +2623,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); * auto nodeSwitchPointColor = item->value[0].u32; * @endcode * @@ -2644,7 +2644,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .u32 = 0x99666666 } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR); * auto nodeLoadingProgressColor = item->value[0].u32; * @endcode * @@ -2664,7 +2664,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING); * auto nodeLoadingProgressEnableLoading = item->value[0].i32; * @endcode */ @@ -2683,7 +2683,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="input" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER); * auto nodeTextInputPlaceholder = item->string; * @endcode * @@ -2702,7 +2702,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="input" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT); * auto nodeTextInputText = item->string; * @endcode * @@ -2722,7 +2722,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR); * auto nodeTextInputCaretColor = item->value[0].u32; * @endcode * @@ -2742,7 +2742,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 100 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE); * auto nodeTextInputCaretStyle = item->value[0].f32; * @endcode * @@ -2762,7 +2762,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = true} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE); * auto nodeTextInputUnderline = item->value[0].i32; * @endcode * @@ -2782,7 +2782,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = 50 } }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH); * auto nodeTextInputMaxlength = item->value[0].i32; * @endcode * @@ -2802,7 +2802,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_ENTER_KEY_TYPE_DONE} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE); * auto nodeTextInputMaxlength = item->value[0].i32; * @endcode * @@ -2822,7 +2822,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR); * auto nodeTextInputPlaceholderColor = item->value[0].u32; * @endcode * @@ -2848,7 +2848,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT); * auto nodeTextInputPlaceholderFontSize = item->value[0].f32; * auto nodeTextInputPlaceholderFontStyle = item->value[1].i32; * auto nodeTextInputPlaceholderFontWeight = item->value[2].i32; @@ -2871,7 +2871,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = true} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS); * auto nodeTextInputFocusKeyboard = item->value[0].i32; * @endcode * @@ -2891,7 +2891,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXTINPUT_TYPE_NORMAL} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE); * auto nodeTextInputType = item->value[0].i32; * @endcode * @@ -2911,7 +2911,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR); * auto nodeTextInputSelectedColor = item->value[0].u32; * @endcode * @@ -2931,7 +2931,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = true} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON); * auto nodeTextInputPasswordIcon = item->value[0].i32; * @endcode * @@ -2975,7 +2975,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32=ARKUI_CANCELBUTTON_STYLE_INPUT}, 10.0, {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON); * auto nodeCancelButtonStyle = item->value[0].i32; * auto nodeCancelButtonSize = item->value[1].f32; * auto nodeCancelButtonColor = item->value[2].u32; @@ -2998,7 +2998,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="input" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER); * auto nodeTextAreaPlaceholder = item->string; * @endcode * @@ -3017,7 +3017,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="input" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_TEXT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_TEXT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_TEXT); * auto nodeTextAreaText = item->string; * @endcode * @@ -3037,7 +3037,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = 50 } }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH); * auto nodeTextAreaMaxlength = item->value[0].i32; * @endcode * @@ -3057,7 +3057,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR); * auto nodeTextAreaPlaceholderColor = item->value[0].u32; * @endcode * @@ -3083,7 +3083,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT); * auto nodeTextAreaPlaceholderFontSize = item->value[0].f32; * auto nodeTextAreaPlaceholderFontStyle = item->value[1].i32; * auto nodeTextAreaPlaceholderFontWeight = item->value[2].i32; @@ -3106,7 +3106,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR); * auto nodeTextAreaCaretColor = item->value[0].u32; * @endcode * @@ -3144,7 +3144,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="click" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BUTTON_LABEL); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BUTTON_LABEL); * auto nodeButtonLabelr = item->string; * @endcode * @@ -3165,7 +3165,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_VALUE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_VALUE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_VALUE); * auto nodeProgressValue = item->value[0].f32; * @endcode * @@ -3185,7 +3185,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 100 }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TOTAL, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_TOTAL); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_TOTAL); * auto nodeProgressTotal = item->value[0].f32; * @endcode * @@ -3205,7 +3205,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_COLOR); * auto nodeProgressColor = item->value[0].u32; * @endcode * @@ -3225,7 +3225,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32=ARKUI_PROGRESS_LINEAR} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TYPE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_TYPE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_TYPE); * auto nodeProgressType = item->value[0].i32; * @endcode */ @@ -3358,7 +3358,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "test" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_ID, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_ID); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_ID); * auto nodeXcomponentId = item->string; * @endcode * @@ -3378,7 +3378,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_XCOMPONENT_TYPE_SURFACE} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_TYPE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_TYPE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_TYPE); * auto nodeXcomponentType = item->value[0].i32; * @endcode * @@ -3388,19 +3388,19 @@ typedef enum { * @brief 设置XComponent的宽高,支持属性设置和获取接口。 * * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[0].u32:宽数值,单位为vp;\n - * .value[1].u32:高数值,单位为vp;\n + * .value[0].u32:宽数值,单位为px;\n + * .value[1].u32:高数值,单位为px;\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0].u32:宽数值,单位为vp;\n - * .value[1].u32:高数值,单位为vp;\n + * .value[0].u32:宽数值,单位为px;\n + * .value[1].u32:高数值,单位为px;\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_NumberValue value[] = { {.u32=300}, {.u32=50} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); * auto nodeXcomponentSurfaceWidth = item->value[0].u32; * auto nodeXcomponentSurfaceHeight = item->value[1].u32; * @endcode @@ -3421,7 +3421,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR); * auto nodeDatePickerLunar = item->value[0].i32; * @endcode */ @@ -3438,7 +3438,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "1970-1-1" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_START, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_START); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_START); * auto nodeDatePickerStart = item->string; * @endcode */ @@ -3455,7 +3455,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "2100-12-31" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_END, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_END); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_END); * auto nodeDatePickerEnd = item->string; * @endcode */ @@ -3472,7 +3472,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "2024-01-22" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED); * auto nodeDatePickerSelected = item->string; * @endcode */ @@ -3500,7 +3500,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); * auto nodeDatePickerDisappearTextStyle = item->string; * @endcode */ @@ -3528,7 +3528,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE); * auto nodeDatePickerTextStyle = item->string; * @endcode */ @@ -3556,7 +3556,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE); * auto nodeDatePickerSelectedTextStyle = item->string; * @endcode */ @@ -3573,7 +3573,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "17-11" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED); * auto nodeTimePickerSelected = item->string; * @endcode */ @@ -3592,7 +3592,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME); * auto nodeTimePickerUseMilitaryTime = item->value[0].i32; * @endcode */ @@ -3620,7 +3620,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); * auto nodeDatePickerDisappearTextStyle = item->string; * @endcode */ @@ -3648,7 +3648,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE); * auto nodeTimePickerTextStyle = item->string; * @endcode */ @@ -3676,7 +3676,7 @@ typedef enum { * @code {.c} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE); * auto nodeDatePickerSelectedTextStyle = item->string; * @endcode */ @@ -3708,7 +3708,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32=ARKUI_TEXTPICKER_RANGETYPE_MULTI} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "1,2,3;A,B,C" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE); * auto nodeTextPickerRangeType = item->value[0].i32; * auto nodeTextPickerMultiRange = item->string; * @endcode @@ -3729,7 +3729,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32 = 1}, {.u32 = 2} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED); * auto nodeTextPickerSelected = item->value[0].u32; * @endcode * @@ -3748,7 +3748,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "A;B" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE); * auto nodeTextPickerValue = item->string; * @endcode * @@ -3777,7 +3777,7 @@ typedef enum { * @code {.c} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE); * auto nodeDatePickerDisappearTextStyle = item->string; * @endcode */ @@ -3805,7 +3805,7 @@ typedef enum { * @code {.c} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE); * auto nodeDatePickerTextStyle = item->string; * @endcode */ @@ -3833,7 +3833,7 @@ typedef enum { * @code {.c} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE); * auto nodeTextPickerSelectedTextStyle = item->string; * @endcode */ @@ -3865,7 +3865,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32=true} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP); * auto nodePickerCanLoop = item->value[0].i32; * @endcode */ @@ -3884,7 +3884,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 100 }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT); * auto nodePickerItemHeight = item->value[0].f32; * @endcode */ @@ -3904,7 +3904,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 16.0f }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); * auto borderRadius = item->value[0].f32; * @endcode */ @@ -3926,7 +3926,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE); * auto selectYear = item->value[0].u32; * @endcode */ @@ -3948,7 +3948,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGNMENT_END) }, 10.0f, 0.0f }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT); * auto alignType = item->value[0].i32; * @endcode */ @@ -3971,7 +3971,7 @@ typedef enum { * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); * auto textColor = item->value[0].u32; * @endcode */ @@ -4323,7 +4323,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); * auto nodeScrollBarDisplayMode = item->value[0].i32; * @endcode * @@ -4342,7 +4342,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 20 }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); * auto nodeScrollBarWidth = item->value[0].f32; * @endcode * @@ -4361,7 +4361,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); * auto nodeScrollBarColor = item->value[0].u32; * @endcode * @@ -4371,16 +4371,16 @@ typedef enum { * @brief 设置滚动方向,支持属性设置,属性重置和属性获取接口。 * * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32:滚动方向,数据类型{@link ArkUI_Axis},默认值ARKUI_AXIS_VERTICAL。\n + * .value[0].i32:滚动方向,数据类型{@link ArkUI_ScrollDirection},默认值ARKUI_SCROLL_DIRECTION_VERTICAL。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32:滚动方向,数据类型{@link ArkUI_Axis}。\n + * .value[0].i32:滚动方向,数据类型{@link ArkUI_ScrollDirection}。\n * * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_DIRECTION_VERTICAL } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); * auto nodeScrollBarDirection = item->value[0].i32; * @endcode * @@ -4401,7 +4401,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_EDGE_EFFECT_NONE }, { .i32 = 1 } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); * auto nodeScrollEdgeEffect = item->value[0].i32; * @endcode * @@ -4420,7 +4420,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); * auto nodeScrollEnableScroll = item->value[0].i32; * @endcode * @@ -4439,7 +4439,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0.6 }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_FRICTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_FRICTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_FRICTION); * auto nodeScrollFriction = item->value[0].f32; * @endcode * @@ -4467,7 +4467,7 @@ typedef enum { * }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SNAP, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SNAP); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_SNAP); * auto nodeScrollSnap = item->value[0].i32; * @endcode * @@ -4564,7 +4564,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); * auto nodeScrollEnablePaging = item->value[0].i32; * @endcode * @@ -4584,7 +4584,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_DIRECTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_DIRECTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_DIRECTION); * auto nodeListDirection = item->value[0].i32; * @endcode * @@ -4603,7 +4603,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_STICKY_STYLE_NONE } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_STICKY, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_STICKY); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_STICKY); * auto nodeListSticky = item->value[0].i32; * @endcode * @@ -4622,7 +4622,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_SPACE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_SPACE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_SPACE); * auto nodeListSpace = item->value[0].f32; * @endcode * @@ -4902,7 +4902,7 @@ typedef enum { * auto header = nodeAPI->createNode(ARKUI_NODE_TEXT); * ArkUI_AttributeItem item = { .object = header }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); * auto nodeListItemGroupSetHeader = item->object; * @endcode */ @@ -4920,7 +4920,7 @@ typedef enum { * auto footer = nodeAPI->createNode(ARKUI_NODE_TEXT); * ArkUI_AttributeItem item = { .object = footer }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); * auto nodeListItemGroupSetFooter = item->value[0].object; * @endcode */ @@ -4943,8 +4943,8 @@ typedef enum { * @code {.cpp} * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF }, 1, 0, 0 }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_DIVIDER, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_DIVIDER); * auto nodeListItemDividerColor = item->value[0].u32; * @endcode */ @@ -4966,7 +4966,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_HORIZONTAL_ALIGNMENT_START } }; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS); * auto nodeColumnAlignItems = item->value[0].i32; * @endcode * @@ -4988,7 +4988,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT); * auto nodeColumnJustifyContent = item->value[0].i32; * @endcode * @@ -5011,7 +5011,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_VERTICAL_ALIGNMENT_TOP } }; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS); * auto nodeRowAlignItems = item->value[0].i32; * @endcode * @@ -5033,7 +5033,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT); * auto nodeRowAlignItems = item->value[0].i32; * @endcode * @@ -5065,7 +5065,7 @@ typedef enum { * {.i32 = ARKUI_FLEX_ALIGNMENT_END}}; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_OPTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FLEX_OPTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_OPTION); * auto nodeFlexDirection = item->value[1].i32; * auto nodeFlexWrap = item->value[2].i32; * auto nodeFlexJustifyContent = item->value[3].i32; @@ -5293,20 +5293,12 @@ typedef enum { NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, /** - * @brief 定义ARKUI_NODE_REFRESH刷新状态变更触发该事件。 - * - * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n - * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n - * ArkUI_NodeComponentEvent.data[0].i32:刷新状态。\n - */ - NODE_REFRESH_STATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, - /** - * @brief 定义ARKUI_NODE_REFRESH进入刷新状态时触发该事件。 + * @brief 定义ARKUI_NODE_CHECKBOX当选中状态发生变化时,触发该回调。 * * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n - * {@link ArkUI_NodeComponentEvent}中不包含参数:\n + * ArkUI_NodeComponentEvent.data[0].i321:表示已选中, 0: 表示未选中\n */ - NODE_REFRESH_ON_REFRESH, + NODE_CHECKBOX_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, /** * @brief 定义ARKUI_NODE_DATE_PICKER列表组件的滚动触摸事件枚举值。 @@ -5343,12 +5335,15 @@ typedef enum { NODE_TEXT_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, /** - * @brief 定义ARKUI_NODE_CHECKBOX当选中状态发生变化时,触发该回调。 + * @brief 定义NODE_CALENDAR_PICKER选中日期时触发的事件。 * * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n - * ArkUI_NodeComponentEvent.data[0].i321:表示已选中, 0: 表示未选中\n + * ArkUI_NodeComponent.data[0].u32选中的年。\n + * ArkUI_NodeComponent.data[1].u32选中的月。\n + * ArkUI_NodeComponent.data[2].u32选中的日。\n */ - NODE_CHECKBOX_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, + NODE_CALENDAR_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + /** * @brief 定义ARKUI_NODE_SLIDER拖动或点击时触发事件回调。 * @@ -5419,15 +5414,22 @@ typedef enum { * ArkUI_NodeComponentEvent.data[0].i32表示当前碰到的是上下左右哪个边。\n */ NODE_SCROLL_EVENT_ON_SCROLL_EDGE, + /** - * @brief 定义NODE_CALENDAR_PICKER选中日期时触发的事件。 + * @brief 定义ARKUI_NODE_REFRESH刷新状态变更触发该事件。 * * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n - * ArkUI_NodeComponent.data[0].u32选中的年。\n - * ArkUI_NodeComponent.data[1].u32选中的月。\n - * ArkUI_NodeComponent.data[2].u32选中的日。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:刷新状态。\n */ - NODE_CALENDAR_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + NODE_REFRESH_STATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, + /** + * @brief 定义ARKUI_NODE_REFRESH进入刷新状态时触发该事件。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数:\n + */ + NODE_REFRESH_ON_REFRESH, } ArkUI_NodeEventType; /** diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index 0433f7cc..24547229 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -385,6 +385,20 @@ typedef enum { ARKUI_EDGE_EFFECT_NONE, } ArkUI_EdgeEffect; +/** + * @brief 定义Scroll组件排列方向枚举值。 + * + * @since 12 + */ +typedef enum { + /** 仅支持竖直方向滚动。*/ + ARKUI_SCROLL_DIRECTION_VERTICAL = 0, + /** 仅支持水平方向滚动。*/ + ARKUI_SCROLL_DIRECTION_HORIZONTAL, + /** 禁止滚动。*/ + ARKUI_SCROLL_DIRECTION_NONE = 3, +} ArkUI_ScrollDirection; + /** * @brief 定义列表项滚动结束对齐效果枚举值。 * -- Gitee From f157b9a0ecaed22e7bcfe69b5e6c1ea0c97ba242 Mon Sep 17 00:00:00 2001 From: cuiruibin Date: Mon, 19 Feb 2024 20:25:03 +0800 Subject: [PATCH 0273/2135] =?UTF-8?q?FileUri=E6=96=B0=E5=A2=9Endk=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A4=B4=E6=96=87=E4=BB=B6=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cuiruibin --- .../filemanagement/fileuri/oh_file_uri.h | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 zh-cn/native_sdk/filemanagement/fileuri/oh_file_uri.h diff --git a/zh-cn/native_sdk/filemanagement/fileuri/oh_file_uri.h b/zh-cn/native_sdk/filemanagement/fileuri/oh_file_uri.h new file mode 100644 index 00000000..c272bd38 --- /dev/null +++ b/zh-cn/native_sdk/filemanagement/fileuri/oh_file_uri.h @@ -0,0 +1,94 @@ +/* + * 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 FILE_MANAGEMENT_OH_FILE_URI_H +#define FILE_MANAGEMENT_OH_FILE_URI_H + +/** + * @addtogroup fileuri + * @{ + * + * @brief 文件统一资源标识符(File Uniform Resource Identifier),支持fileuri与路径path的转换、有效性校验、以及指向的变换(指向的文件或路径)。 + * + * @syscap SystemCapability.FileManagement.AppFileService + * @since 12 + */ + +/** + * @file oh_file_uri.h + * + * @brief 提供uri和路径path之间的相互转换,目录uri获取,以及URi的有效性校验的方法。 + * @library libohfileuri.so + * @since 12 + */ + +#include "error_code.h" +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 将传入的路径path转换成uri。 + * + * @param path 表示要转换的路径。 + * @param length 表示要转换路径的字节长度。 + * @param result 表示转换后的uri, 需要使用standard library标准库的free()方法释放申请的资源。 + * @return 返回特定的错误码值,详细信息可以查看{@link FileManagement_ErrCode}。 + * @syscap SystemCapability.FileManagement.AppFileService + * @since 12 + */ +FileManagement_ErrCode OH_FileUri_GetUriFromPath(const char *path, unsigned int length, char **result); + +/** + * @brief 将传入的uri转换成路径path。 + * + * @param uri 表示要转换的uri。 + * @param length 表示要转换uri的字节长度。 + * @param result 表示转换后的路径path. 需要使用standard library标准库的free()方法释放申请的资源。 + * @return 返回特定的错误码值,详细信息可以查看{@link FileManagement_ErrCode}。 + * @syscap SystemCapability.FileManagement.AppFileService + * @since 12 + */ +FileManagement_ErrCode OH_FileUri_GetPathFromUri(const char *uri, unsigned int length, char **result); + +/** + * @brief 获取uri所在目录的uri,如果是文件uri则获取父目录的uri,如果是目录uri则返回本身。 + * + * @param uri 表示要获取目录的uri的原始uri。 + * @param length 表示原始uri的字节长度。 + * @param result 表示获取到的目录URi, 需要使用standard library标准库的free()方法释放申请的资源。 + * @return 返回特定的错误码值,详细信息可以查看{@link FileManagement_ErrCode}。 + * @syscap SystemCapability.FileManagement.AppFileService + * @since 12 + */ +FileManagement_ErrCode OH_FileUri_GetFullDirectoryUri(const char *uri, unsigned int length, char **result); + +/** + * @brief 校验传入的uri是否有效。 + * + * @param uri 表示需要校验的uri。 + * @param length 需要校验uri的字节长度。 + * @return 返回 true: 传入uri是有效的uri, false: 传入的uri是无效的uri。 + * @syscap SystemCapability.FileManagement.AppFileService + * @since 12 + */ +bool OH_FileUri_IsValidUri(const char *uri, unsigned int length); +#ifdef __cplusplus +}; +#endif +#endif // FILE_MANAGEMENT_OH_FILE_URI_H -- Gitee From ba778cfd0f61730c6a7d0424ba3977f303125a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A2=A6?= <2387440390@qq.com> Date: Mon, 29 Jan 2024 15:15:31 +0800 Subject: [PATCH 0274/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9Ejsvm.h=E5=92=8Cjsvm?= =?UTF-8?q?=5Ftypes.h=E7=9A=84=E4=B8=AD=E6=96=87=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 小梦 <2387440390@qq.com> --- zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h | 2046 +++++++++++++++++ .../native_sdk/ark_runtime/jsvm/jsvm_types.h | 485 ++++ 2 files changed, 2531 insertions(+) create mode 100644 zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h create mode 100644 zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h diff --git a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h new file mode 100644 index 00000000..3081db56 --- /dev/null +++ b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h @@ -0,0 +1,2046 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ARK_RUNTIME_JSVM_JSVM_H +#define ARK_RUNTIME_JSVM_JSVM_H + +/** + * @addtogroup JSVM + * @{ + * + * @brief 提供标准的JavaScript引擎能力。 + * + * 功能概述: + * 标准JS引擎是严格遵守Ecmascript规范的JavaScript代码执行引擎。 + * 支持Ecmascript规范定义的标准库,提供完备的C++交互JS的native API。 + * 通过jit加速代码执行,为应用提供安全、高效的JS执行能力。 + * 标准JS引擎的能力通过一套稳定的ABI,即JSVM-API提供。JSVM-API支持动态链接到不同版本的JS引擎库, + * 从而为开发者屏蔽掉不同引擎接口的差异。JSVM-API提供引擎生命周期管理、JS context管理、 + * JS代码执行、JS/C++互操作、执行环境快照、codecache等能力。 + * 使用平台:arm64平台。 + * 使用方法:链接SDK中的libjsvm.so,并在C++代码中包含ark_runtime/jsvm.h头文件。 + * + * @since 11 + */ + +/** + * @file jsvm.h + * + * @brief 提供JSVM-API接口定义。 + * + * 通过API接口为开发者提供独立、标准、完整的JavaScript引擎能力, + * 包括管理引擎生命周期、编译运行JS代码、实现JS/C++跨语言调用、拍摄快照等。 + * @library libjsvm.so + * @syscap SystemCapability.ArkCompiler.JSVM + * @since 11 + */ + +// 此文件必须与C编译器兼容。 +#include // NOLINT(modernize-deprecated-headers) +#include // NOLINT(modernize-deprecated-headers) + +// 使用INT_MAX,只能由预处理器消费。 +#define JSVM_VERSION_EXPERIMENTAL 2147483647 +#ifndef JSVM_VERSION +#ifdef JSVM_EXPERIMENTAL +#define JSVM_VERSION JSVM_VERSION_EXPERIMENTAL +#else + +#define JSVM_VERSION 8 +#endif +#endif + +#include "jsvm_types.h" + +#ifndef JSVM_EXTERN +#ifdef _WIN32 +/** + * @brief 对外可见。 + * + * @since 11 + */ +#define JSVM_EXTERN __declspec(dllexport) +#elif defined(__wasm__) +#define JSVM_EXTERN \ + __attribute__((visibility("default"))) \ + __attribute__((__import_module__("jsvm"))) +#else +#define JSVM_EXTERN __attribute__((visibility("default"))) +#endif +#endif + +/** + * @brief 自动长度。 + * + * @since 11 + */ +#define JSVM_AUTO_LENGTH SIZE_MAX + +#ifdef __cplusplus +#define EXTERN_C_START extern "C" { +#define EXTERN_C_END } +#else +#define EXTERN_C_START +#define EXTERN_C_END +#endif + +EXTERN_C_START + +/** + * @brief 初始化一个JavaScript虚拟机。 + * + * @param options 用于初始化JavaScript虚拟机的选项。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_Init(const JSVM_InitOptions* options); + +/** + * @brief 创建一个虚拟机实例。 + * + * @param options 用于创建虚拟机实例的选项。 + * @param result 新的虚拟机实例。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateVM(const JSVM_CreateVMOptions* options, + JSVM_VM* result); + +/** + * @brief 销毁一个虚拟机实例。 + * + * @param vm 待销毁的虚拟机实例。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DestroyVM(JSVM_VM vm); + +/** + * @brief 为虚拟机实例打开一个新的虚拟机作用域。 + * + * @param vm 目标虚拟机实例。 + * @param result 新的虚拟机作用域。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_OpenVMScope(JSVM_VM vm, + JSVM_VMScope* result); + +/** + * @brief 关闭虚拟机实例的虚拟机作用域。 + * + * @param vm 目标虚拟机实例。 + * @param scope 将要关闭的虚拟机作用域。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CloseVMScope(JSVM_VM vm, + JSVM_VMScope scope); + +/** + * @brief 基于新环境上下文的可选属性,创建一个新环境。 + * + * @param vm 虚拟机实例,新环境将在该实例中创建。 + * @param propertyCount 属性数组中元素的个数。 + * @param properties 属性描述符的数组。 + * @param result 创建的新环境。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateEnv(JSVM_VM vm, + size_t propertyCount, + const JSVM_PropertyDescriptor* properties, + JSVM_Env* result); + +/** + * @brief 基于虚拟机的起始快照,创建一个新的环境。 + * + * @param vm 虚拟机实例,新环境将在该实例中创建。 + * @param index 环境在快照中的索引。 + * @param result 创建的新环境。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateEnvFromSnapshot(JSVM_VM vm, + size_t index, + JSVM_Env* result); + +/** + * @brief 销毁环境。 + * + * @param env 待销毁的环境。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DestroyEnv(JSVM_Env env); + +/** + * @brief 打开一个新的环境作用域。 + * + * @param env 目标环境,JSVM-API接口将在该环境下调用。 + * @param result 新的环境作用域。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_OpenEnvScope(JSVM_Env env, + JSVM_EnvScope* result); + +/** + * @brief 关闭环境作用域。 + * + * @param env 目标环境,JSVM-API接口将在该环境下调用。 + * @param scope 将要关闭的环境作用域。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CloseEnvScope(JSVM_Env env, + JSVM_EnvScope scope); + +/** + * @brief 编译一串JavaScript代码,并返回编译后的脚本。 + * + * @param env 目标环境,JSVM-API接口将在该环境下调用。 + * @param script 包含要编译的脚本的JavaScript代码。 + * @param cachedData 可选。脚本的代码缓存数据。 + * @param cacheDataLength cachedData数组的长度。 + * @param eagerCompile 是否立即编译脚本。 + * @param cacheRejected 代码缓存是否被编译拒绝。 + * @param result 编译后的脚本。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_STRING_EXPECTED或JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CompileScript(JSVM_Env env, + JSVM_Value script, + const uint8_t* cachedData, + size_t cacheDataLength, + bool eagerCompile, + bool* cacheRejected, + JSVM_Script* result); + +/** + * @brief 为编译后的脚本创建代码缓存。 + * + * @param env 目标环境,JSVM-API接口将在该环境下调用。 + * @param script 目标编译脚本。 + * @param data 代码缓存的数据。 + * @param length 代码缓存数据的长度。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateCodeCache(JSVM_Env env, + JSVM_Script script, + const uint8_t** data, + size_t* length); + +/** + * @brief 执行一串JavaScript代码并返回其结果,其中包含以下注意事项: + * 与eval不同的是,该函数不允许脚本访问当前词法作用域,因此也不允许访问模块作用域, + * 这意味着require等伪全局变量将不可用。 + * 脚本可以访问全局作用域。 + * 脚本中的函数和var声明将被添加到全局对象。 + * 使用let和const的变量声明将全局可见,但不会被添加到全局对象。 + * this的值在脚本内是global。 + * + * @param env 调用JSVM-API的环境。 + * @param script 包含要执行的脚本的JavaScript字符串。 + * @param result 执行脚本产生的值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_RunScript(JSVM_Env env, + JSVM_Script script, + JSVM_Value* result); + +/** + * @brief 将data与当前运行的JSVM环境相关联。后续可以使用OH_JSVM_GetInstanceData()检索data。 + * 通过先前调用OH_JSVM_SetInstanceData()设置的任何与当前运行的JSVM环境相关联的现有数据都将 + * 被覆盖。如果先前提供了finalizeCb,则不会调用它。 + * + * @param env 调用JSVM-API的环境。 + * @param data 可用于此实例的绑定的数据项。 + * @param finalizeCb 销毁环境时调用的函数,该函数接收data以便释放它。 + * @param finalizeHint 在收集期间传递给最终回调的可选提示。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetInstanceData(JSVM_Env env, + void* data, + JSVM_Finalize finalizeCb, + void* finalizeHint); + +/** + * @brief 检索通过OH_JSVM_SetInstanceData()与当前运行的JSVM环境相关联的数据。 + * 如果未设置任何关联数据,该函数调用将成功,且data设置为NULL。 + * + * @param env 调用JSVM-API的环境。 + * @param data 之前通过调用OH_JSVM_SetInstanceData()与当前运行的JSVM环境关联的数据项。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetInstanceData(JSVM_Env env, + void** data); + +/** + * @brief 检索JSVM_ExtendedErrorInfo结构,其中包含有关发生的最后一个错误的信息。 + * 返回的JSVM_ExtendedErrorInfo的内容仅在对同一env调用JSVM-API函数之前有效。 + * 这包括对OH_JSVM_IsExceptionPending的调用,因此可能经常需要复制信息以便以后使用。 + * error_message中返回的指针指向一个静态定义的字符串,因此如果你在调用另一个JSVM-API + * 函数之前将它从error_message字段(将被覆盖)中复制出来,则可以安全地使用该指针。 + * + * @param env 调用JSVM-API的环境。 + * @param result 包含有关错误的更多信息的JSVM_ExtendedErrorInfo结构。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetLastErrorInfo(JSVM_Env env, + const JSVM_ExtendedErrorInfo** result); + +/** + * @brief 抛出提供的JavaScript值。 + * + * @param env 调用JSVM-API的环境。 + * @param error 要抛出的JavaScript值。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_Throw(JSVM_Env env, + JSVM_Value error); + +/** + * @brief 会抛出带有所提供文本的JavaScript Error。 + * + * @param env 调用JSVM-API的环境。 + * @param code 要在错误上设置的可选错误代码。 + * @param msg 表示与错误关联的文本的C字符串。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ThrowError(JSVM_Env env, + const char* code, + const char* msg); + +/** + * @brief 会抛出带有所提供文本的JavaScript TypeError。 + * + * @param env 调用JSVM-API的环境。 + * @param code 要在错误上设置的可选错误代码。 + * @param msg 表示与错误关联的文本的C字符串。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ThrowTypeError(JSVM_Env env, + const char* code, + const char* msg); + +/** + * @brief 会抛出带有所提供文本的JavaScript RangeError。 + * + * @param env 调用JSVM-API的环境。 + * @param code 要在错误上设置的可选错误代码。 + * @param msg 表示与错误关联的文本的C字符串。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ThrowRangeError(JSVM_Env env, + const char* code, + const char* msg); + +/** + * @brief 会抛出带有所提供文本的JavaScript SyntaxError。 + * + * @param env 调用JSVM-API的环境。 + * @param code 要在错误上设置的可选错误代码。 + * @param msg 表示与错误关联的文本的C字符串。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ThrowSyntaxError(JSVM_Env env, + const char* code, + const char* msg); + +/** + * @brief 查询JSVM_Value以检查它是否表示错误对象。 + * + * @param env 调用JSVM-API的环境。 + * @param value 待检查的JSVM_Value。 + * @param result 如果JSVM_Value表示错误,则设置为true的布尔值,否则设置为false。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsError(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief 返回带有所提供文本的JavaScript Error。 + * + * @param env 调用JSVM-API的环境。 + * @param code 可选的JSVM_Value,带有与错误关联的错误代码的字符串。 + * @param msg 引用JavaScript string用作Error的消息。 + * @param result 表示创建的错误。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_STRING_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateError(JSVM_Env env, + JSVM_Value code, + JSVM_Value msg, + JSVM_Value* result); + +/** + * @brief 返回带有所提供文本的JavaScript TypeError。 + * + * @param env 调用JSVM-API的环境。 + * @param code 可选的JSVM_Value,带有与错误关联的错误代码的字符串。 + * @param msg 引用JavaScript string用作Error的消息。 + * @param result 表示创建的错误。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_STRING_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateTypeError(JSVM_Env env, + JSVM_Value code, + JSVM_Value msg, + JSVM_Value* result); + +/** + * @brief 返回带有所提供文本的JavaScript RangeError。 + * + * @param env 调用JSVM-API的环境。 + * @param code 可选的JSVM_Value,带有与错误关联的错误代码的字符串。 + * @param msg 引用JavaScript string用作Error的消息。 + * @param result 表示创建的错误。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_STRING_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateRangeError(JSVM_Env env, + JSVM_Value code, + JSVM_Value msg, + JSVM_Value* result); + +/** + * @brief 返回带有所提供文本的JavaScript SyntaxError。 + * + * @param env 调用JSVM-API的环境。 + * @param code 可选的JSVM_Value,带有与错误关联的错误代码的字符串。 + * @param msg 引用JavaScript string用作Error的消息。 + * @param result 表示创建的错误。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_STRING_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateSyntaxError(JSVM_Env env, + JSVM_Value code, + JSVM_Value msg, + JSVM_Value* result); + +/** + * @brief 获取并清除上一次异常。如果出现挂起,则返回JavaScript异常,否则返回NULL。 + * + * @param env 调用JSVM-API的环境。 + * @param result 如果出现挂起则返回异常,否则为NULL。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetAndClearLastException(JSVM_Env env, + JSVM_Value* result); + +/** + * @brief 查询上一次异常是否由挂起导致的。如果由异常导致,则返回true,否则返回false。 + * + * @param env 调用JSVM-API的环境。 + * @param result 如果异常挂起,则设置为true的布尔值。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsExceptionPending(JSVM_Env env, + bool* result); + +/** + * @brief 开辟了一个新的作用域。 + * + * @param env 调用JSVM-API的环境。 + * @param result 代表新作用域。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_OpenHandleScope(JSVM_Env env, + JSVM_HandleScope* result); + +/** + * @brief 关闭传入的作用域。必须按照创建作用域的相反顺序关闭作用域。 + * + * @param env 调用JSVM-API的环境。 + * @param scope 表示要关闭的作用域。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CloseHandleScope(JSVM_Env env, + JSVM_HandleScope scope); + +/** + * @brief 会打开一个新作用域,从中可以将一个对象提升到外部作用域。 + * + * @param env 调用JSVM-API的环境。 + * @param result 代表新作用域。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_OpenEscapableHandleScope(JSVM_Env env, + JSVM_EscapableHandleScope* result); + +/** + * @brief 关闭传入的作用域。必须按照创建作用域的相反顺序关闭作用域。 + * 即使存在挂起的JavaScript异常,也可以调用此JSVM_API。 + * + * @param env 调用JSVM-API的环境。 + * @param scope 表示要关闭的作用域。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_HANDLE_SCOPE_MISMATCH。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CloseEscapableHandleScope(JSVM_Env env, + JSVM_EscapableHandleScope scope); + +/** + * @brief 提升JavaScript对象的句柄,使其在外部作用域的生命周期内有效。 + * 每个作用域只能调用一次。如果多次调用,将返回错误。 + * + * @param env 调用JSVM-API的环境。 + * @param scope 表示当前的作用域。 + * @param escapee 表示要提升的JavaScript Object。 + * @param result 被提升的Object在外部作用域中的句柄。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_ESCAPE_CALLED_TWICE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_EscapeHandle(JSVM_Env env, + JSVM_EscapableHandleScope scope, + JSVM_Value escapee, + JSVM_Value* result); + +/** + * @brief 对传入的值创建一个具有指定引用计数的新引用。 + * + * @param env 调用JSVM-API的环境。 + * @param value 正在为其创建引用的JSVM_Value。 + * @param initialRefcount 新引用的初始引用计数。 + * @param result 指向新的引用。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateReference(JSVM_Env env, + JSVM_Value value, + uint32_t initialRefcount, + JSVM_Ref* result); + +/** + * @brief 删除传入的引用。 + * + * @param env 调用JSVM-API的环境。 + * @param ref 需删除的JSVM_Ref。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DeleteReference(JSVM_Env env, + JSVM_Ref ref); + +/** + * @brief 增加传入引用的引用计数并返回生成的引用计数。 + * + * @param env 调用JSVM-API的环境。 + * @param ref 传入的引用,其引用计数将增加。 + * @param result 新的引用计数。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ReferenceRef(JSVM_Env env, + JSVM_Ref ref, + uint32_t* result); + +/** + * @brief 递减传入引用的引用计数并返回生成的引用计数。 + * + * @param env 调用JSVM-API的环境。 + * @param ref 将减少其引用计数的JSVM_Ref。 + * @param result 新的引用计数。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ReferenceUnref(JSVM_Env env, + JSVM_Ref ref, + uint32_t* result); + +/** + * @brief 如果仍然有效,此JSVM-API将返回JSVM_Value, + * 表示与JSVM_Ref关联的JavaScript值。否则,结果将为NULL。 + * + * @param env 调用JSVM-API的环境。 + * @param ref 请求相应值的JSVM_Ref。 + * @param result JSVM_Ref引用的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetReferenceValue(JSVM_Env env, + JSVM_Ref ref, + JSVM_Value* result); + +/** + * @brief 返回对应于JavaScript Array类型的JSVM-API值。 + * + * @param env 调用JSVM-API的环境。 + * @param result 代表JavaScript Array的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateArray(JSVM_Env env, + JSVM_Value* result); + + +/** + * @brief 返回对应于JavaScript Array类型的JSVM-API值。Array + * 的长度属性设置为传入的长度参数。但是,不保证底层缓冲区在创建 + * 数组时由VM预先分配。该行为留给底层VM实现。 + * + * @param env 调用JSVM-API的环境。 + * @param length 数组的初始长度。 + * @param result 代表JavaScript Array的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateArrayWithLength(JSVM_Env env, + size_t length, + JSVM_Value* result); + +/** + * @brief 返回JavaScript ArrayBuffer类型对应的JSVM-API值。ArrayBuffer用于 + * 表示固定长度的二进制数据缓冲区。通常用作TypedArray对象的后备缓冲区。 + * 分配的ArrayBuffer有一个底层字节缓冲区,其大小由传入的length参数决定。 + * 底层缓冲区可选择返回给调用方,调用方可直接操作该缓冲区。 + * 此缓冲区只能直接从native代码写入。如果想从JavaScript写入该缓冲区, + * 需创建TypedArray或DataView对象。 + * + * @param env 调用JSVM-API的环境。 + * @param byteLength 要创建的数组缓冲区的字节长度。 + * @param data 指向ArrayBuffer的底层字节缓冲区的指针。data可以选择性地通过传递NULL来忽略。 + * @param result 代表JavaScript ArrayBuffer的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateArraybuffer(JSVM_Env env, + size_t byteLength, + void** data, + JSVM_Value* result); + +/** + * @brief 分配一个JavaScript Date对象。此API不处理闰秒。 + * 这是因为ECMAScript遵循POSIX时间规范,对闰秒进行忽略。 + * + * @param env 调用JSVM-API的环境。 + * @param time 自1970年1月1日UTC以来的ECMAScript时间值(以毫秒为单位)。 + * @param result 表示JavaScript Date对象的JSVM_Value。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateDate(JSVM_Env env, + double time, + JSVM_Value* result); + +/** + * @brief 分配一个带有外部数据的JavaScript值。这用于通过JavaScript代码传递外部数据。 + * 后续可以使用OH_JSVM_GetValueExternal由native代码检索。 + * 该API添加了一个JSVM_Finalize回调,当刚刚创建的JavaScript对象被垃圾回收时将调用该回调。 + * 创建的值不是一个对象,因此不支持附加属性。它被认为是一个独特的值类型: + * 使用外部值调用OH_JSVM_Typeof()会生成JSVM_EXTERNAL。 + * + * @param env 调用JSVM-API的环境。 + * @param data 指向外部数据的原始指针。 + * @param finalizeCb 收集外部值时调用的可选回调。JSVM_Finalize提供了更多详细信息。 + * @param finalizeHint 在收集期间传递给最终回调的可选提示。 + * @param result 表示外部值的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateExternal(JSVM_Env env, + void* data, + JSVM_Finalize finalizeCb, + void* finalizeHint, + JSVM_Value* result); + +/** + * @brief 分配一个默认的JavaScript对象。该函数功能等同于在JavaScript中执行new Object()。 + * + * @param env 调用JSVM-API的环境。 + * @param result 表示JavaScript对象的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateObject(JSVM_Env env, + JSVM_Value* result); + +/** + * @brief 从UTF8 编码的C字符串创建JavaScript symbol值。 + * + * @param env 调用JSVM-API的环境。 + * @param description 可选的JSVM_Value,它指的是要设置为符号描述的JavaScript string。 + * @param result 代表JavaScript symbol的JSVM_Value。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_STRING_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateSymbol(JSVM_Env env, + JSVM_Value description, + JSVM_Value* result); + +/** + * @brief 在全局注册表中搜索具有给定描述的现有符号。如果该 + * 符号已经存在,它将被返回,否则将在注册表中创建一个新符号。 + * + * @param env 调用JSVM-API的环境。 + * @param utf8description UTF-8 C 字符串,表示用作符号描述的文本。 + * @param length 描述字符串的长度,以字节为单位。如果字符串以null结尾,则为JSVM_AUTO_LENGTH。 + * @param result 表示JavaScript 符号的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SymbolFor(JSVM_Env env, + const char* utf8description, + size_t length, + JSVM_Value* result); + +/** + * @brief 基于已有的ArrayBuffer对象,创建一个JavaScript TypedArray对象。TypedArray + * 对象在底层数据缓冲区上提供了一个类似数组的视图,其中每个元素都具有 + * 相同的底层二进制标量数据类型。要求:(length* 元素大小)+ byteOffset + * 小于等于传入的数组的大小(以字节为单位)。否则,将抛出范围错误(RangeError)。 + * + * @param env 调用JSVM-API的环境。 + * @param type TypedArray中元素的标量数据类型。 + * @param length TypedArray中的元素个数。 + * @param arraybuffer ArrayBuffer是类型化数组的基础。 + * @param byteOffset ArrayBuffer中开始投影TypedArray的字节偏移量。 + * @param result 表示JavaScript TypedArray的JSVM_Value。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateTypedarray(JSVM_Env env, + JSVM_TypedarrayType type, + size_t length, + JSVM_Value arraybuffer, + size_t byteOffset, + JSVM_Value* result); + +/** + * @brief 基于已有的ArrayBuffer对象,创建一个JavaScript DataView对象。DataView + * 对象在底层数据缓冲区上提供了一个类似数组的视图,其中的元素可以具有不同的大小和类型。 + * 要求:二进制的length + byteOffset + * 小于或等于传入的数组的大小(以字节为单位)。否则,将抛出范围错误(RangeError)。 + * + * @param env 调用JSVM-API的环境。 + * @param length DataView中的元素个数。 + * @param arraybuffer 位于DataView底层的ArrayBuffer。 + * @param byteOffset ArrayBuffer中的字节偏移量,指示投影DataView的开始位置。 + * @param result 表示JavaScript DataView对象的JSVM_Value。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_PENDING_EXCEPTION。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateDataview(JSVM_Env env, + size_t length, + JSVM_Value arraybuffer, + size_t byteOffset, + JSVM_Value* result); + +/** + * @brief 将C int32_t类型的值转换为JavaScript number类型。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要在JavaScript中表示的整数值。 + * @param result 表示JavaScript number类型的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateInt32(JSVM_Env env, + int32_t value, + JSVM_Value* result); + +/** + * @brief 将C uint32_t类型的值转换为JavaScript number类型。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要在JavaScript中表示的无符号整数值。 + * @param result 表示JavaScript number类型的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateUint32(JSVM_Env env, + uint32_t value, + JSVM_Value* result); + +/** + * @brief 将C int64_t类型的值转换为JavaScript number类型。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要在JavaScript中表示的整数值。 + * @param result 代表JavaScript number类型的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateInt64(JSVM_Env env, + int64_t value, + JSVM_Value* result); + +/** + * @brief 将C double类型的值转换为JavaScript number类型。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要在JavaScript中表现的双精度值。 + * @param result 代表JavaScript number类型的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateDouble(JSVM_Env env, + double value, + JSVM_Value* result); + +/** + * @brief 将C int64_t类型的值转换为JavaScript BigInt类型。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要在JavaScript中表现的整数值。 + * @param result 表示JavaScript BigInt类型的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateBigintInt64(JSVM_Env env, + int64_t value, + JSVM_Value* result); + +/** + * @brief 将C uint64_t类型的值转换为JavaScript BigInt类型。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要在JavaScript中表示的无符号整数值。 + * @param result 代表JavaScript BigInt类型的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateBigintUint64(JSVM_Env env, + uint64_t value, + JSVM_Value* result); + +/** + * @brief 将一组无符号64位字转换为单个BigInt值。 + * + * @param env 调用JSVM-API的环境。 + * @param signBit 确定生成的BigInt是正数还是负数。 + * @param wordCount words数组的长度。 + * @param words uint64_t little-endian 64位字数组。 + * @param result 代表JavaScript BigInt类型的JSVM_Value。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG或JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateBigintWords(JSVM_Env env, + int signBit, + size_t wordCount, + const uint64_t* words, + JSVM_Value* result); + +/** + * @brief 将采用ISO-8859-1编码的C字符串转换为JavaScript string值。 + * 复制原生字符串。 + * + * @param env 调用JSVM-API的环境。 + * @param str 表示ISO-8859-1编码的字符串的字符缓冲区。 + * @param length 字符串的长度,以字节为单位。如果它以null结尾,则为JSVM_AUTO_LENGTH。 + * @param result 表示JavaScript字符串的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateStringLatin1(JSVM_Env env, + const char* str, + size_t length, + JSVM_Value* result); + +/** + * @brief 将采用UTF16-LE编码的C字符串转换为JavaScript字符串值。 + * 复制原生字符串。 + * + * @param env 调用JSVM-API的环境。 + * @param str 表示UTF16-LE编码的字符串的字符缓冲区。 + * @param length 以两字节代码单元表示的字符串长度,如果它以null终止,则为JSVM_AUTO_LENGTH。 + * @param result 代表JavaScript string的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateStringUtf16(JSVM_Env env, + const char16_t* str, + size_t length, + JSVM_Value* result); + +/** + * @brief 从UTF8编码的C字符串创建JavaScript string值。 + * 复制原生字符串。 + * + * @param env 调用JSVM-API的环境。 + * @param str 表示UTF8编码字符串的字符缓冲区。 + * @param length 字符串的长度,以字节为单位。如果字符串以null结尾,则为JSVM_AUTO_LENGTH。 + * @param result 代表JavaScript字符串的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateStringUtf8(JSVM_Env env, + const char* str, + size_t length, + JSVM_Value* result); + +/** + * @brief 返回数组的长度。 + * + * @param env 调用JSVM-API的环境。 + * @param value: 代表查询长度的JavaScript Array。 + * @param result uint32代表数组的长度。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_ARRAY_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetArrayLength(JSVM_Env env, + JSVM_Value value, + uint32_t* result); + +/** + * @brief 用于检索ArrayBuffer的底层数据缓冲区及其长度。 + * + * @param env 调用JSVM-API的环境。 + * @param arraybuffer 代表被查询的ArrayBuffer。 + * @param data ArrayBuffer的底层数据缓冲区。如果byte_length为0,则该值可能为NULL + * 或任何其他指针值。 + * @param byteLength 底层数据缓冲区的字节长度。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetArraybufferInfo(JSVM_Env env, + JSVM_Value arraybuffer, + void** data, + size_t* byteLength); + +/** + * @brief 返回对象的原型。 + * + * @param env 调用JSVM-API的环境。 + * @param object 表示待返回其原型的JavaScript object。 + * 这将返回Object.getPrototypeOf的等价值(与函数的prototype属性不同)。 + * @param result 表示给定对象的原型。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetPrototype(JSVM_Env env, + JSVM_Value object, + JSVM_Value* result); + +/** + * @brief 返回类型化数组的各种属性。如果不需要该属性,则任何输出参数都可以是 NULL。 + * + * @param env 调用JSVM-API的环境。 + * @param typedarray 表示要查询其属性的TypedArray。 + * @param type TypedArray中元素的标量数据类型。 + * @param length TypedArray中的元素数。 + * @param data TypedArray底层的数据缓冲区由byte_offset值调整,使其指向TypedArray + * 中的第一个元素。如果数组的长度是0,这可能是NULL或任何其他指针值。 + * @param arraybuffer 位于TypedArray下的ArrayBuffer。 + * @param byteOffset 数组的第一个元素所在的基础原生数组中的字节偏移量。 + * data 参数的值已经过调整,因此data指向数组中的第一个元素。因此, + * 原生数组的第一个字节将位于data - byte_offset。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetTypedarrayInfo(JSVM_Env env, + JSVM_Value typedarray, + JSVM_TypedarrayType* type, + size_t* length, + void** data, + JSVM_Value* arraybuffer, + size_t* byteOffset); + +/** + * @brief 返回DataView的各种属性。 + * 如果不需要某一属性,则任何出参都可以设置为NULL。 + * + * @param env 调用JSVM-API的环境。 + * @param dataview 表示要查询其属性的DataView。 + * @param bytelength DataView中的字节个数。 + * @param data DataView下的数据缓冲区。如果bytelength是0, + * 则这可能是NULL或任何其他指针值。 + * @param arraybuffer ArrayBuffer是DataView的基础。 + * @param byteOffset 开始投影DataView的数据缓冲区中的字节偏移量。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetDataviewInfo(JSVM_Env env, + JSVM_Value dataview, + size_t* bytelength, + void** data, + JSVM_Value* arraybuffer, + size_t* byteOffset); + +/** + * @brief 返回给定JavaScript Date的时间值的C双精度基础类型。如果调用成功,返回JSVM_OK。 + * 如果传入一个非JavaScript Date类型的JSVM_Value,返回JSVM_DATA_EXPECTED。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表一个JavaScript Date。 + * @param result 作为double的时间值表示为自1970年1月1日UTC午夜以来的毫秒数。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_DATE_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetDateValue(JSVM_Env env, + JSVM_Value value, + double* result); + +/** + * @brief 返回给定JavaScript Boolean的C布尔基础类型等价值。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript Boolean。 + * @param result 给定JavaScript Boolean的C布尔基础类型等价值。 + * @return 成功则返回JSVM_OK。如果传入非布尔值的JSVM_Value,则返回JSVM_BOOLEAN_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueBool(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief 返回给定JavaScript number的C双精度基础类型等价值。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript number。 + * @param result 给定的JavaScript number的C双精度基础类型等价值。 + * @return 成功则返回JSVM_OK。如果传入非数字的JSVM_Value,则返回JSVM_NUMBER_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueDouble(JSVM_Env env, + JSVM_Value value, + double* result); + +/** + * @brief 返回给定JavaScript BigInt的C int64_t基础类型等价值。 + * 如果需要,它将截断该值,将lossless设置为false。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript BigInt。 + * @param result 给定的JavaScript BigInt的C int64_t基础类型等价值。 + * @param lossless 指示BigInt值是否已无损转换。 + * @return 成功则返回JSVM_OK。如果传入的值非BigInt,则返回JSVM_BIGINT_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueBigintInt64(JSVM_Env env, + JSVM_Value value, + int64_t* result, + bool* lossless); + +/** + * @brief 返回给定JavaScript BigInt的C uint64_t基础类型等价值。 + * 如果需要,它将截断该值,将lossless设置为false。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript BigInt。 + * @param result 给定的JavaScript BigInt的C uint64_t基础类型等价值。 + * @param lossless 指示BigInt值是否已无损转换。 + * @return 成功则返回JSVM_OK。如果传入的值非BigInt,则返回JSVM_BIGINT_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueBigintUint64(JSVM_Env env, + JSVM_Value value, + uint64_t* result, + bool* lossless); + +/** + * @brief 将单个BigInt值转换为符号位、64位小端数组和数组中的元素数。 + * signBit和words参数可以都设置为NULL。这种情况下,只获取wordCount。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript BigInt。 + * @param signBit 表示JavaScript BigInt是正数还是负数的整数。 + * @param wordCount 必须初始化为words数组的长度。返回后,将被设置为存储此BigInt所需的实际字数。 + * @param words 指向预分配的64位字数组的指针。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_BIGINT_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueBigintWords(JSVM_Env env, + JSVM_Value value, + int* signBit, + size_t* wordCount, + uint64_t* words); + +/** + * @brief 检索之前传递给OH_JSVM_CreateExternal()的外部数据指针。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript外部值。 + * @param result 指向被JavaScript外部值封装的数据的指针。 + * @return 成功则返回JSVM_OK。如果传入非外部的JSVM_Value,则返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueExternal(JSVM_Env env, + JSVM_Value value, + void** result); + +/** + * @brief 返回给定JavaScript number的C int32基础类型等价值。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript number。 + * @param result 给定的JavaScript number的C int32基础类型等价值。 + * @return 成功则返回JSVM_OK。如果传入非数字的JSVM_Value,则返回JSVM_NUMBER_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueInt32(JSVM_Env env, + JSVM_Value value, + int32_t* result); + +/** + * @brief 返回给定JavaScript number的C int64基础类型等价值。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript number。 + * @param result 给定的JavaScript number的C int64基础类型等价值。 + * @return 成功则返回JSVM_OK。如果传入非数字的JSVM_Value,则返回JSVM_NUMBER_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueInt64(JSVM_Env env, + JSVM_Value value, + int64_t* result); + +/** + * @brief 返回对应于传入值的ISO-8859-1编码字符串 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript number。 + * @param buf 写入ISO-8859-1编码字符串的缓冲区。如果传入NULL,则将在result中返回 + * 字符串的长度(以字节为单位,不包括null结束符)。 + * @param bufsize 目的缓冲区大小。当大小不够时,返回的字符串将被截断并以null结尾。 + * @param result 复制到缓冲区中的字节数,不包括空终止符。 + * @return 成功则返回JSVM_OK。如果传入非string的JSVM_Value,则返回JSVM_STRING_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueStringLatin1(JSVM_Env env, + JSVM_Value value, + char* buf, + size_t bufsize, + size_t* result); + +/** + * @brief 返回对应于传入值的UTF8编码字符串。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript字符串。 + * @param buf 将UTF8编码的字符串写入的缓冲区。如果传入NULL,则在result中 + * 返回以字节为单位的字符串长度,不包括空终止符。 + * @param bufsize 目标缓冲区的大小。当此值不足时,返回的字符串将被截断并以null终止。 + * @param result 复制到缓冲区的字节数,不包括null结束符。 + * @return 成功则返回JSVM_OK。如果传入非string的JSVM_Value,则返回JSVM_STRING_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueStringUtf8(JSVM_Env env, + JSVM_Value value, + char* buf, + size_t bufsize, + size_t* result); + +/** + * @brief 基于传入的值,查询对应的采用UTF16编码的字符串。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript字符串。 + * @param buf 将UTF16-LE编码字符串写入的缓冲区。如果传入NULL,则返回字符串的 + * 2字节代码单元长度,不包括空终止符。 + * @param bufsize 目标缓冲区的大小。当此值不足时,返回的字符串将被截断并以null终止。 + * @param result 复制到缓冲区中的2字节代码单元数,不包括空终止符。 + * @return 成功则返回JSVM_OK。如果传入非string的JSVM_Value,则返回JSVM_STRING_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueStringUtf16(JSVM_Env env, + JSVM_Value value, + char16_t* buf, + size_t bufsize, + size_t* result); + +/** + * @brief 返回给定JavaScript number的C uint_32基础类型等价值。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript number。 + * @param result 将给定的JSVM_Value等效为uint32_t 的C基础类型。 + * @return 成功则返回JSVM_OK。如果传入非数字的JSVM_Value,则返回JSVM_NUMBER_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetValueUint32(JSVM_Env env, + JSVM_Value value, + uint32_t* result); + +/** + * @brief 返回用于表示给定布尔值的JavaScript单例对象。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要检索的布尔值。 + * @param result 表示待检索的JavaScript Boolean单例。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetBoolean(JSVM_Env env, + bool value, + JSVM_Value* result); + +/** + * @brief 返回global对象。 + * + * @param env 调用JSVM-API的环境。 + * @param result 代表JavaScript global对象。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetGlobal(JSVM_Env env, + JSVM_Value* result); + +/** + * @brief 返回null对象。 + * + * @param env 调用JSVM-API的环境。 + * @param result 代表JavaScript null对象。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetNull(JSVM_Env env, + JSVM_Value* result); + +/** + * @brief 返回Undefined对象。 + * + * @param env 调用JSVM-API的环境。 + * @param value 代表JavaScript undefined值。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetUndefined(JSVM_Env env, + JSVM_Value* result); + +/** + * @brief 实现抽象操作ToBoolean()。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要强制转换的JavaScript值。 + * @param result 代表强制的JavaScript Boolean。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToBool(JSVM_Env env, + JSVM_Value value, + JSVM_Value* result); + +/** + * @brief 实现抽象操作ToNumber()。 + * 如果传入的值是对象,则函数可能会运行JavaScript代码。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要强制转换的JavaScript值。 + * @param result 代表强制的JavaScript number。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToNumber(JSVM_Env env, + JSVM_Value value, + JSVM_Value* result); + +/** + * @brief 实现抽象操作ToObject()。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要强制转换的JavaScript值。 + * @param result 代表强制的JavaScript object。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToObject(JSVM_Env env, + JSVM_Value value, + JSVM_Value* result); + +/** + * @brief 实现抽象操作ToString()。 + * 如果传入的值是对象,则函数可能会运行JavaScript代码。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要强制转换的JavaScript值。 + * @param result 代表强制的JavaScript string。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToString(JSVM_Env env, + JSVM_Value value, + JSVM_Value* result); + +/** + * @brief 提供类似于在定义的对象上调用typeof运算符的行为。 + * 不同点在于,该函数支持检测外部值;它将null检测为单独的类型, + * 而ECMAScript typeof将用于检测object。如果value的类型无效,则返回错误。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要查询其类型的JavaScript值。 + * @param result JavaScript值的类型。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_Typeof(JSVM_Env env, + JSVM_Value value, + JSVM_ValueType* result); + +/** + * @brief 提供类似于在对象上调用instanceof运算符的行为。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要检查的JavaScript值。 + * @param constructor 要检查的构造函数的JavaScript函数对象 + * @param result 如果object instanceof constructor为true,则设置为true的布尔值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_FUNCTION_EXPECTED或JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_Instanceof(JSVM_Env env, + JSVM_Value object, + JSVM_Value constructor, + bool* result); + +/** + * @brief 提供类似于在对象上调用IsArray的行为。 + * + * @param env 调用JSVM-API的环境。 + * @param value 待检查的JavaScript值。 + * @param result 表示给定的对象是否为数组。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsArray(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief 检查传入的对象是否为ArrayBuffer。 + * + * @param env 调用JSVM-API的环境。 + * @param value 待检查的JavaScript值。 + * @param result 表示指定的对象是否为ArrayBuffer。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsArraybuffer(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief 检查传入的Object是否为日期。 + * + * @param env 调用JSVM-API的环境。 + * @param value 待检查的JavaScript值。 + * @param isDate 给定的JSVM_Value是否表示JavaScript Date对象。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsDate(JSVM_Env env, + JSVM_Value value, + bool* isDate); + +/** + * @brief 检查传入的Object是否为类型化数组。 + * + * @param env 调用JSVM-API的环境。 + * @param value 待检查的JavaScript值。 + * @param result 给定的JSVM_Value是否代表TypedArray。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsTypedarray(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief 检查传入的对象是否是DataView。 + * + * @param env 调用JSVM-API的环境。 + * @param value 待检查的JavaScript值。 + * @param result 给定的JSVM_Value是否代表DataView。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsDataview(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief 提供类似调用严格相等算法的行为。 + * + * @param env 调用JSVM-API的环境。 + * @param lhs 待检查的JavaScript值。 + * @param rhs 要检查的JavaScript值。 + * @param result 表示两个JSVM_Value对象是否相等。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_StrictEquals(JSVM_Env env, + JSVM_Value lhs, + JSVM_Value rhs, + bool* result); + +/** + * @brief 提供类似于调用ArrayBuffer detach操作的行为。 + * + * @param env 调用JSVM-API的环境。 + * @param arraybuffer 待分离的JavaScript ArrayBuffer。 + * @return 如果成功则返回JSVM_OK。如果传入的是不可拆解的ArrayBuffer, + * 则返回JSVM_DETACHABLE_ARRAYBUFFER_EXPECTED。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DetachArraybuffer(JSVM_Env env, + JSVM_Value arraybuffer); + +/** + * @brief 提供类似调用ArrayBuffer IsDetachedBuffer操作的行为。 + * + * @param env 调用JSVM-API的环境。 + * @param value 待检查的JavaScript ArrayBuffer。 + * @param result 表示ArrayBuffer是否被分离。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsDetachedArraybuffer(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief 以字符数数组的形式返回object的可枚举属性的名称。 + * key为符号的object的属性将不会被包含在内。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待进行属性检索的对象。 + * @param result 表示一个JavaScript值的数组,这些值表示对象的属性名称。 + * 可以使用OH_JSVM_GetArrayLength以及OH_JSVM_GetElement对结果进行迭代。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetPropertyNames(JSVM_Env env, + JSVM_Value object, + JSVM_Value* result); + +/** + * @brief 返回一个数组,其中包含此对象的可用属性的名称。 + * + * @param env 调用JSVM-API的环境。 + * @param object 从中检索属性的对象。 + * @param keyMode 是否也检索原型属性。 + * @param keyFilter 要检索哪些属性(可枚举/可读/可写)。 + * @param keyConversion 表示是否将编号的属性键转换为字符串。 + * @param result 表示JavaScript值的数组,这些值表示对象的属性名称。 + * 可以使用OH_JSVM_GetArrayLength和OH_JSVM_GetElement对结果进行迭代。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG或JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetAllPropertyNames(JSVM_Env env, + JSVM_Value object, + JSVM_KeyCollectionMode keyMode, + JSVM_KeyFilter keyFilter, + JSVM_KeyConversion keyConversion, + JSVM_Value* result); + +/** + * @brief 为传入的object设置一个属性。 + * + * @param env 调用JSVM-API的环境。 + * @param object 将进行属性设置的对象。 + * @param key 待设置的属性名。 + * @param value 属性值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetProperty(JSVM_Env env, + JSVM_Value object, + JSVM_Value key, + JSVM_Value value); + +/** + * @brief 从传入的object中获取请求的属性。 + * + * @param env 调用JSVM-API的环境。 + * @param object 从中检索属性的对象。 + * @param key 要检索的属性的名称。 + * @param result 属性值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetProperty(JSVM_Env env, + JSVM_Value object, + JSVM_Value key, + JSVM_Value* result); + +/** + * @brief 检查传入的Object是否具有指定命名的属性。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待查询的对象。 + * @param key 要检查其存在的属性的名称。 + * @param result 该属性是否存在于对象上。 + * @return 成功则返回JSVM_OK,可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_HasProperty(JSVM_Env env, + JSVM_Value object, + JSVM_Value key, + bool* result); + +/** + * @brief 尝试从object中删除key自己的属性。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待查询的对象。 + * @param key 待删除的属性名。 + * @param result 表示属性删除是否成功。result可以选择性地通过传递NULL来忽略。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DeleteProperty(JSVM_Env env, + JSVM_Value object, + JSVM_Value key, + bool* result); + +/** + * @brief 检查传入的Object是否具有命名的自己的属性。key必须是string或symbol, + * 否则将抛出错误。JSVM-API不会执行任何数据类型之间的转换。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待查询的对象。 + * @param key 要检查其存在的自有属性的名称。 + * @param result 表示对象上是否存在该自身属性。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_NAME_EXPECTED或JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_HasOwnProperty(JSVM_Env env, + JSVM_Value object, + JSVM_Value key, + bool* result); + +/** + * @brief 此方法等效于调用OH_JSVM_SetProperty, + * 其中,通过utf8Name传入的字符串用于创建JSVM_Value。 + * + * @param env 调用JSVM-API的环境。 + * @param object 要对其设置属性的对象。 + * @param utf8Name 要设置的属性的名称。 + * @param value 属性值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetNamedProperty(JSVM_Env env, + JSVM_Value object, + const char* utf8name, + JSVM_Value value); + +/** + * @brief 此方法等效于调用OH_JSVM_GetProperty, + * 其中,通过utf8Name传入的字符串用于创建JSVM_Value。 + * + * @param env 调用JSVM-API的环境。 + * @param object 从中检索属性的对象。 + * @param utf8Name 要获取的属性名。 + * @param result 属性值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetNamedProperty(JSVM_Env env, + JSVM_Value object, + const char* utf8name, + JSVM_Value* result); + +/** + * @brief 此方法等效于使用从作为utf8Name传入的字符串创建的JSVM_Value + * 调用OH_JSVM_HasProperty。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待查询的对象。 + * @param utf8Name 待检查的属性名。 + * @param result 该属性是否存在于对象上。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_HasNamedProperty(JSVM_Env env, + JSVM_Value object, + const char* utf8name, + bool* result); + +/** + * @brief 在传入的Object上设置一个元素。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待进行属性设置的对象。 + * @param index 要设置的属性的索引。 + * @param value 属性值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetElement(JSVM_Env env, + JSVM_Value object, + uint32_t index, + JSVM_Value value); + +/** + * @brief 获取请求索引处的元素。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待进行属性检索的对象。 + * @param index 要获取的属性的索引。 + * @param result 属性值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetElement(JSVM_Env env, + JSVM_Value object, + uint32_t index, + JSVM_Value* result); + +/** + * @brief 如果传入的Object在指定的索引处有一个元素,则此JSVM-API返回true。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待查询的对象。 + * @param index 待确定是否存在元素的索引位置。 + * @param result 该属性是否存在于对象上。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_HasElement(JSVM_Env env, + JSVM_Value object, + uint32_t index, + bool* result); + +/** + * @brief 尝试从object中删除指定index处的元素。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待查询的对象。 + * @param index 要删除的属性的索引。 + * @param result 表示元素删除是否成功。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DeleteElement(JSVM_Env env, + JSVM_Value object, + uint32_t index, + bool* result); + +/** + * @brief 通过此方法可以在给定对象上高效定义多个属性, + * 这些属性使用属性描述符进行定义。通过一个属性描述符的数组, + * 此API将为对象依次设置数组中的属性。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待进行属性检索的对象。 + * @param propertyCount properties数组中的元素数。 + * @param properties 属性描述符的数组。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG或JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DefineProperties(JSVM_Env env, + JSVM_Value object, + size_t propertyCount, + const JSVM_PropertyDescriptor* properties); + +/** + * @brief 冻结指定的对象。这样可以防止为其添加新的属性、删除现有属性、更改现有属性的 + * 可枚举性、可配置性或可写性、或者更改现有属性的值。它还可以防止改变对象的原型。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待冻结的对象。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ObjectFreeze(JSVM_Env env, + JSVM_Value object); + +/** + * @brief 封装指定的对象。这样可以防止为其添加新的属性并且将所有现有属性标记为不可配置。 + * + * @param env 调用JSVM-API的环境。 + * @param object 待封装的对象。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ObjectSeal(JSVM_Env env, + JSVM_Value object); + +/** + * @brief 支持从native代码调用JavaScript函数对象, + * 这是从native代码回调到JavaScript的主要机制。 + * + * @param env 调用JSVM-API的环境。 + * @param recv 传递给被调用函数的this值。 + * @param func 表示将调用的JavaScript函数。 + * @param argc argv数组中的元素个数。 + * @param argv JSVM_values数组,表示将作为参数传递给函数的JavaScript值。 + * @param result 表示返回的JavaScript对象。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_PENDING_EXCEPTION或JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CallFunction(JSVM_Env env, + JSVM_Value recv, + JSVM_Value func, + size_t argc, + const JSVM_Value* argv, + JSVM_Value* result); + + /** + * @brief 支持在native代码中创建函数对象,这是从JavaScript调用native代码的主要机制。 + * 在此调用之后,新创建的函数在脚本中不再自动可见。相反,必须在JavaScript可见的任何对象上显示设置属性, + * 才能从脚本访问该函数。 + * + * @param env 调用JSVM-API的环境。 + * @param utf8Name 编码为UTF8的函数的可选名称。这在JavaScript中是可见的, + * 作为新函数对象的name属性。 + * @param length utf8name的长度(以字节为单位)或JSVM_AUTO_LENGTH(如果以 null 结尾)。 + * @param cb 调用此函数对象时应调用的native函数。详情请参考JSVM_Callback。 + * @param result 表示新创建函数的JavaScript函数对象。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateFunction(JSVM_Env env, + const char* utf8name, + size_t length, + JSVM_Callback cb, + JSVM_Value* result); + + /** + * @brief 此方法在回调函数中用于检索有关调用的详细信息, + * 例如来自给定回调信息的参数和this指针。 + * + * @param env 调用JSVM-API的环境。 + * @param cbinfo 传入回调函数的回调信息。 + * @param argc 指定所提供的argv数组的长度并接收参数的实际数量, + * 可以通过传递NULL来选择性地忽略。 + * @param argv JSVM_Value的C数组,用于存储复制的参数。如果参数数量超过提供的数量, + * 则只复制请求数量的参数。如果提供的参数比声明的少,则argv的其余部分将由代表undefined + * 的JSVM_Value值填充。可以通过传递NULL来忽略argv。 + * @param thisArg 接收调用的JavaScript this参数。thisArg可以通过传递NULL来进行忽略。 + * @param data 接收回调的数据指针。data可以通过传递NULL来进行忽略。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetCbInfo(JSVM_Env env, + JSVM_CallbackInfo cbinfo, + size_t* argc, + JSVM_Value* argv, + JSVM_Value* thisArg, + void** data); + +/** + * @brief 返回构造函数调用的new target。 + * 如果当前回调不是构造函数调用,结果为NULL。 + * + * @param env 调用JSVM-API的环境。 + * @param cbinfo 传递给回调函数的回调信息。 + * @param result 构造函数调用的new target。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetNewTarget(JSVM_Env env, + JSVM_CallbackInfo cbinfo, + JSVM_Value* result); + +/** + * @brief 使用给定的JSVM_Value表示的构造函数来实例化新的JavaScript值。 + * + * @param env 调用JSVM-API的环境。 + * @param constructor 表示将作为构造函数调用的JavaScript函数。 + * @param argc argv数组中的元素个数。 + * @param argv JavaScript值数组。其中JSVM_Value表示构造函数的参数。 + * 如果argc为零,则可以通过传入NULL来忽略此参数。 + * @param result 表示返回的JavaScript对象, + * 在本例中是构造的对象。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_PENDING_EXCEPTION。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_NewInstance(JSVM_Env env, + JSVM_Value constructor, + size_t argc, + const JSVM_Value* argv, + JSVM_Value* result); + +/** + * @brief 定义一个JavaScript类。 + * + * @param env 调用JSVM-API的环境。 + * @param utf8name JavaScript构造函数的名称,建议在包装C++类时使用C++类名。 + * @param length utf8name的长度(以字节为单位)或JSVM_AUTO_LENGTH(如果以 null 结尾)。 + * @param constructor 用于创建类的构造函数的回调函数。包装C++类时,此方法必须是符合JSVM_Callback。 + * callback签名的静态成员。不能使用C++类构造函数。详情请参考JSVM_Callback。 + * @param propertyCount properties数组参数中的项数。 + * @param properties 类的属性描述符,用于定义类的属性和方法。 + * @param result 表示类的构造函数的JSVM_Value。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DefineClass(JSVM_Env env, + const char* utf8name, + size_t length, + JSVM_Callback constructor, + size_t propertyCount, + const JSVM_PropertyDescriptor* properties, + JSVM_Value* result); + +/** + * @brief 在JavaScript对象中封装native实例。native实例 + * 后续可以通过OH_JSVM_Unwrap()进行检索。 + * + * @param env 调用JSVM-API的环境。 + * @param jsObject 将成为原生对象封装器的JavaScript对象。 + * @param nativeObject 将封装在JavaScript对象中的native实例。 + * @param finalizeCb 可选的原生回调,可用于在 JavaScript 对象被垃圾回收时释放native实例。 + * @param finalizeHint 传递给完成回调的可选上下文提示。 + * @param result 对封装对象的可选引用。 + * @return 成功则返回JSVM_OK,如果jsObject传入的不是一个对象,失败返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_Wrap(JSVM_Env env, + JSVM_Value jsObject, + void* nativeObject, + JSVM_Finalize finalizeCb, + void* finalizeHint, + JSVM_Ref* result); + +/** + * @brief 当JavaScript代码调用类的方法或属性访问器时,对应的JSVM_Callback将被调用。 + * 如果回调是针对实例方法或访问器的,则回调的this参数是封装器对象;然后可以通过调用 + * 封装器对象的OH_JSVM_Unwrap()获得作为调用目标的C++实例。 + * + * @param env 调用JSVM-API的环境。 + * @param jsObject 与native实例关联的对象。 + * @param result 指向封装的native实例的指针。 + * @return 成功则返回JSVM_OK,如果jsObject传入的不是一个对象,失败返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_Unwrap(JSVM_Env env, + JSVM_Value jsObject, + void** result); + +/** + * @brief 使用OH_JSVM_Wrap()检索先前封装在JavaScript对象js_object中的native实例并移除封装。 + * 如果finalize回调与封装相关联,则当JavaScript对象被垃圾回收时将不再调用它。 + * + * @param env 调用JSVM-API的环境。 + * @param jsObject 与native实例关联的对象。 + * @param result 指向封装的native实例的指针。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_RemoveWrap(JSVM_Env env, + JSVM_Value jsObject, + void** result); + +/** + * @brief 将typeTag指针的值与JavaScript对象或外部值相关联。可调用OH_JSVM_CheckObjectTypeTag() + * 判断附加在对象上的标记类型,以确保对象的类型正确。如果对象已经有关联的类型标记,则返回JSVM_INVALID_ARG。 + * + * @param env 调用JSVM-API的环境。 + * @param value 要标记的JavaScript对象或外部值。 + * @param typeTag 要标记对象的标签。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE或JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_TypeTagObject(JSVM_Env env, + JSVM_Value value, + const JSVM_TypeTag* typeTag); + +/** + * @brief 将类型标签typeTag与JavaScript对象或外部值上的标签作对比。如果找到相同标签, + * 设置result为true,否则为false。 + * + * @param env 调用JSVM-API的环境。 + * @param value 待检查类型标记的JavaScript对象或外部值。 + * @param typeTag 用于比较在对象上找到的任何标签的标签。 + * @param result 表示指定的类型标记是否与对象上的类型标记匹配。如果在对象上找不到该类型标记,也会返回false。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CheckObjectTypeTag(JSVM_Env env, + JSVM_Value value, + const JSVM_TypeTag* typeTag, + bool* result); + +/** + * @brief 为JavaScript对象添加JSVM_Finalize回调,当JavaScript对象被垃圾回收时调用该回调函数。 + * 可以在单个JavaScript对象上多次调用OH_JSVM_AddFinalizer。 + * + * @param env 调用JSVM-API的环境。 + * @param jsObject 关联native数据的JavaScript对象。 + * @param finalizeData 要传递给finalizeCb的可选数据。 + * @param finalizeCb 当JavaScript对象被垃圾回收时,将用于释放native + * 数据的原生回调。JSVM_Finalize提供了更多详细信息。 + * @param finalizeHint 传递给finalize回调的可选上下文提示。 + * @param result 可选的对JavaScript对象的引用。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_INVALID_ARG。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_AddFinalizer(JSVM_Env env, + JSVM_Value jsObject, + void* finalizeData, + JSVM_Finalize finalizeCb, + void* finalizeHint, + JSVM_Ref* result); + +/** + * @brief 返回JSVM运行时支持的最高JSVM-API版本。 + * 后续将新增JSVM-API,以便支持更多的功能。引入该API的目的:在支持某功能的JSVM版本, + * 可以使用新的功能;在不支持某功能的JSVM版本,可以提供回调行为。 + * + * @param env 调用JSVM-API的环境。 + * @param result 支持的最高版本的JSVM-API。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetVersion(JSVM_Env env, + uint32_t* result); + +/** + * @brief 返回虚拟机的信息。 + * + * @param result 虚拟机的信息。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetVMInfo(JSVM_VMInfo* result); + +/** + * @brief 此函数将因JavaScript对象而保持活跃的外部分配的内存大小通知给底层虚拟机。 + * 注册外部分配的内存将比其他方式更频繁地触发全局垃圾回收。 + * + * @param env 调用JSVM-API的环境。 + * @param changeInBytes 因JavaScript对象而保持活动状态的外部分配内存的变化。 + * @param result 调整值。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_AdjustExternalMemory(JSVM_Env env, + int64_t changeInBytes, + int64_t* result); + +/** + * @brief 通知虚拟机系统内存不足并有选择地触发垃圾回收。 + * + * @param env 调用JSVM-API的环境。 + * @param level 要为当前虚拟机设置的内存压力等级。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_MemoryPressureNotification(JSVM_Env env, + JSVM_MemoryPressureLevel level); + +/** + * @brief 创建一个延迟对象和一个JavaScript promise。 + * + * @param env 调用JSVM-API的环境。 + * @param deferred 一个新创建的延迟对象,后续可以传递给OH_JSVM_ResolveDeferred()或 + * OH_JSVM_RejectDeferred()以解析resp。或拒绝相关的Promise。 + * @param promise 与延迟对象关联的JavaScript Promise。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreatePromise(JSVM_Env env, + JSVM_Deferred* deferred, + JSVM_Value* promise); + +/** + * @brief 通过与之关联的延迟对象来解析JavaScript promise。 + * 它只能用于解析对应的可用的延迟对象的JavaScript Promise。 + * 这意味着Promise必须使用OH_JSVM_CreatePromise()创建,并且 + * 从该调用返回的对象必须保留,才能将其传递给此API。 + * + * @param env 调用JSVM-API的环境。 + * @param deferred 要解析其关联promise的延迟对象。 + * @param resolution 用来解决Promise的值。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ResolveDeferred(JSVM_Env env, + JSVM_Deferred deferred, + JSVM_Value resolution); + +/** + * @brief 通过与之关联的延迟对象来拒绝JavaScript Promise。 + * 它只能用于拒绝对应的可用延迟对象的JavaScript Promise。 + * 这意味着Promise必须使用OH_JSVM_CreatePromise()创建,并且 + * 从该调用返回的对象必须保留,才能将其传递给此API。 + * + * @param env 调用JSVM-API的环境。 + * @param deferred 要解析其关联promise的延迟对象。 + * @param rejection 用来拒绝Promise的值。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_RejectDeferred(JSVM_Env env, + JSVM_Deferred deferred, + JSVM_Value rejection); + +/** + * @brief 查询Promise是否为原生Promise对象。 + * @param env 调用JSVM-API的环境。 + * @param value 待检查的值。 + * @param isPromise 表示是否为原生Promise对象(即底层引擎创建的promise对象)的标志。 + * @return 成功则返回JSVM_OK。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsPromise(JSVM_Env env, + JSVM_Value value, + bool* isPromise); + +/** + * @brief 解析JSON字符串,并返回成功解析的值。 + * @param env 调用JSVM-API的环境。 + * @param jsonString 待解析的字符串。 + * @param result 成功解析的值。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_STRING_EXPECTED或JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_JsonParse(JSVM_Env env, + JSVM_Value jsonString, + JSVM_Value* result); + +/** + * @brief 将对象字符串化,并返回成功转换后的字符串。 + * @param env 调用JSVM-API的环境。 + * @param jsonObject 待字符串化的对象。 + * @param result 成功转换后返回的字符串。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_JsonStringify(JSVM_Env env, + JSVM_Value jsonObject, + JSVM_Value* result); + +/** + * @brief 创建虚拟机的启动快照。 + * @param vm 目标环境,API接口将在该环境下调用。 + * @param contextCount 上下文个数。 + * @param contexts 要添加到快照的上下文数组。 + * @param blobData 快照数据。 + * @param blobSize 快照数据的大小。 + * @return 成功则返回JSVM_OK,失败可能返回JSVM_GENERIC_FAILURE。 + * @since 11 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateSnapshot(JSVM_VM vm, + size_t contextCount, + const JSVM_Env* contexts, + const char** blobData, + size_t* blobSize); + +EXTERN_C_END + +/** @} */ +#endif /* ARK_RUNTIME_JSVM_JSVM_H */ diff --git a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h new file mode 100644 index 00000000..2d56667a --- /dev/null +++ b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h @@ -0,0 +1,485 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ARK_RUNTIME_JSVM_JSVM_TYPE_H +#define ARK_RUNTIME_JSVM_JSVM_TYPE_H + +/** + * @addtogroup JSVM + * @{ + * + * @brief 提供标准的JavaScript引擎能力。 + * + * 通过API接口为开发者提供独立、标准、完整的JavaScript引擎能力, + * 包括管理引擎生命周期、编译运行JS代码、实现JS/C++跨语言调用、拍摄快照等。 + * + * @since 11 + */ + +/** + * @file jsvm_types.h + * + * @brief 提供JSVM-API类型定义。 + * + * 通过API接口为开发者提供独立、标准、完整的JavaScript引擎能力, + * 包括管理引擎生命周期、编译运行JS代码、实现JS/C++跨语言调用、拍摄快照等。 + * @library libjsvm.so + * @syscap SystemCapability.ArkCompiler.JSVM + * @since 11 + */ + +#include // NOLINT(modernize-deprecated-headers) +#include // NOLINT(modernize-deprecated-headers) + +#if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900) +typedef uint16_t char16_t; +#endif + +#ifndef JSVM_CDECL +#ifdef _WIN32 +#define JSVM_CDECL __cdecl +#else +#define JSVM_CDECL +#endif +#endif + +/** + * @brief 表示JavaScript虚拟机实例。 + * + * @since 11 + */ +typedef struct JSVM_VM__* JSVM_VM; + +/** + * @brief 表示JavaScript虚拟机作用域。 + * + * @since 11 + */ +typedef struct JSVM_VMScope__* JSVM_VMScope; + +/** + * @brief 表示用于控制附加到当前虚拟机实例的环境。只有当线程通过 + * OH_JSVM_OpenEnvScope进入该环境的JSVM_EnvScope后,该环境才 + * 对线程的虚拟机实例可用。 + * + * @since 11 + */ +typedef struct JSVM_EnvScope__* JSVM_EnvScope; + +/** + * @brief 表示一段JavaScript代码。 + * + * @since 11 + */ +typedef struct JSVM_Script__* JSVM_Script; + +/** + * @brief 表示虚拟机特定状态的上下文环境,需要在调用native函数时作为参数传递, + * 并且传递给后续任何的JSVM-API嵌套调用。 + * + * @since 11 + */ +typedef struct JSVM_Env__* JSVM_Env; + +/** + * @brief 表示JavaScript值。 + * + * @since 11 + */ +typedef struct JSVM_Value__* JSVM_Value; + +/** + * @brief 表示JavaScript值的引用。 + * + * @since 11 + */ +typedef struct JSVM_Ref__* JSVM_Ref; + +/** + * @brief 表示JavaScript值的作用域,用于控制和修改在特定范围内创建的对象的生命周期。 + * 通常,JSVM-API值是在JSVM_HandleScope的上下文中创建的。当从JavaScript调用native方法时, + * 将存在默认JSVM_HandleScope。如果用户没有显式创建新的JSVM_HandleScope,将在默认 + * JSVM_HandleScope中创建JSVM-API值。对于native方法执行之外的任何代码调用(例如,在libuv回调调用期间), + * 模块需要在调用任何可能导致创建JavaScript值的函数之前创建一个作用域。JSVM_HandleScope是使用 + * OH_JSVM_OpenHandleScope创建的,并使用OH_JSVM_CloseHandleScope销毁的。 + * 关闭作用域代表向GC指示在JSVM_HandleScope作用域的生命周期内创建的所有JSVM_Value将不再从当前堆的栈帧中引用。 + * + * @since 11 + */ +typedef struct JSVM_HandleScope__* JSVM_HandleScope; + +/** + * @brief 表示一种特殊类型的handle scope,用于将在特定handle scope内创建的值返回到父作用域。 + * + * @since 11 + */ +typedef struct JSVM_EscapableHandleScope__* JSVM_EscapableHandleScope; + +/** + * @brief 表示传递给回调函数的不透明数据类型。可用于获取调用该函数的上下文的附加信息。 + * + * @since 11 + */ +typedef struct JSVM_CallbackInfo__* JSVM_CallbackInfo; + +/** + * @brief 表示Promise延迟对象。 + * + * @since 11 + */ +typedef struct JSVM_Deferred__* JSVM_Deferred; + + +/** + * @brief 用户提供的native函数的回调函数指针和数据,这些函数通过JSVM-API接口暴露给JavaScript。 + * + * @since 11 + */ +typedef struct { + JSVM_Value(JSVM_CDECL* callback)(JSVM_Env env, + JSVM_CallbackInfo info); + void* data; +} JSVM_CallbackStruct; + +/** + * @brief 用户提供的native函数的函数指针类型,这些函数通过JSVM-API接口暴露给JavaScript。 + * + * @since 11 + */ +typedef JSVM_CallbackStruct* JSVM_Callback; + +/** + * @brief 函数指针类型,当native类型对象或数据与JS对象被关联时,传入该指针。该函数将会 + * 在关联的JS对象被GC回收时被调用,用以执行native的清理动作。 + * + * @since 11 + */ +typedef void(JSVM_CDECL* JSVM_Finalize)(JSVM_Env env, + void* finalizeData, + void* finalizeHint); + +/** + * @brief 用于控制JavaScript对象属性的行为。 + * + * @since 11 + */ +typedef enum { + /** 没有在属性上设置显式属性。*/ + JSVM_DEFAULT = 0, + /** 该属性是可写的。*/ + JSVM_WRITABLE = 1 << 0, + /** 该属性是可枚举的。*/ + JSVM_ENUMERABLE = 1 << 1, + /** 该属性是可配置的。*/ + JSVM_CONFIGURABLE = 1 << 2, + /** 该属性将被定义为类的静态属性,而不是默认的实例属性。这仅由OH_JSVM_DefineClass使用。*/ + JSVM_STATIC = 1 << 10, + /** 就像JS类中的方法一样,该属性是可配置和可写的,但不可枚举。*/ + JSVM_DEFAULT_METHOD = JSVM_WRITABLE | JSVM_CONFIGURABLE, + /** 就像JavaScript中通过赋值设置的属性一样,属性是可写、可枚举和可配置的。*/ + JSVM_DEFAULT_JSPROPERTY = JSVM_WRITABLE | JSVM_ENUMERABLE | JSVM_CONFIGURABLE, +} JSVM_PropertyAttributes; + +/** + * @brief 描述JSVM_Value的类型。 + * + * @since 11 + */ +typedef enum { + /** 未定义类型。*/ + JSVM_UNDEFINED, + /** Null类型。*/ + JSVM_NULL, + /** 布尔类型。*/ + JSVM_BOOLEAN, + /** 数字类型。*/ + JSVM_NUMBER, + /** 字符串类型。*/ + JSVM_STRING, + /** 符号类型。*/ + JSVM_SYMBOL, + /** 对象类型。*/ + JSVM_OBJECT, + /** 函数类型。*/ + JSVM_FUNCTION, + /** 外部类型。*/ + JSVM_EXTERNAL, + /** bigint类型。*/ + JSVM_BIGINT, +} JSVM_ValueType; + +/** + * @brief 描述TypedArray的类型。 + * + * @since 11 + */ +typedef enum { + /** int8类型。*/ + JSVM_INT8_ARRAY, + /** uint8类型。*/ + JSVM_UINT8_ARRAY, + /** uint8固定类型。*/ + JSVM_UINT8_CLAMPED_ARRAY, + /** int16类型。*/ + JSVM_INT16_ARRAY, + /** uint16类型。*/ + JSVM_UINT16_ARRAY, + /** int32类型。*/ + JSVM_INT32_ARRAY, + /** uint32类型。*/ + JSVM_UINT32_ARRAY, + /** float32类型。*/ + JSVM_FLOAT32_ARRAY, + /** float64类型。*/ + JSVM_FLOAT64_ARRAY, + /** bigint64类型。*/ + JSVM_BIGINT64_ARRAY, + /** biguint64类型。*/ + JSVM_BIGUINT64_ARRAY, +} JSVM_TypedarrayType; + +/** + * @brief 表示JSVM-API调用成功或失败的完整状态码。 + * + * @since 11 + */ +typedef enum { + /** 成功状态。*/ + JSVM_OK, + /** 无效的状态。*/ + JSVM_INVALID_ARG, + /** 期待传入对象类型。*/ + JSVM_OBJECT_EXPECTED, + /** 期望传入字符串类型。*/ + JSVM_STRING_EXPECTED, + /** 期望传入名字类型。*/ + JSVM_NAME_EXPECTED, + /** 期待传入函数类型。*/ + JSVM_FUNCTION_EXPECTED, + /** 期待传入数字类型。*/ + JSVM_NUMBER_EXPECTED, + /** 期待传入布尔类型。*/ + JSVM_BOOLEAN_EXPECTED, + /** 期待传入数组类型。*/ + JSVM_ARRAY_EXPECTED, + /** 泛型失败状态。*/ + JSVM_GENERIC_FAILURE, + /** 挂起异常状态。*/ + JSVM_PENDING_EXCEPTION, + /** 取消状态。*/ + JSVM_CANCELLED, + /** 转义调用了两次。*/ + JSVM_ESCAPE_CALLED_TWICE, + /** 句柄作用域不匹配。*/ + JSVM_HANDLE_SCOPE_MISMATCH, + /** 回调作用域不匹配。*/ + JSVM_CALLBACK_SCOPE_MISMATCH, + /** 队列满。*/ + JSVM_QUEUE_FULL, + /** 关闭中。*/ + JSVM_CLOSING, + /** 期望传入Bigint类型。*/ + JSVM_BIGINT_EXPECTED, + /** 期望传入日期类型。*/ + JSVM_DATE_EXPECTED, + /** 期望传入ArrayBuffer类型。*/ + JSVM_ARRAYBUFFER_EXPECTED, + /** 可分离的数组缓冲区预期状态。*/ + JSVM_DETACHABLE_ARRAYBUFFER_EXPECTED, + /** 将死锁状态。*/ + JSVM_WOULD_DEADLOCK, + /** 不允许外部缓冲区。*/ + JSVM_NO_EXTERNAL_BUFFERS_ALLOWED, + /** 不能执行JS。*/ + JSVM_CANNOT_RUN_JS, +} JSVM_Status; + +/** + * @brief 限制查找属性的范围。 + * + * @since 11 + */ +typedef enum { + /** 也包含对象原型链上的属性。*/ + JSVM_KEY_INCLUDE_PROTOTYPES, + /** 仅包含对象自身属性。*/ + JSVM_KEY_OWN_ONLY +} JSVM_KeyCollectionMode; + +/** + * @brief 属性过滤器,可以通过使用or来构造一个复合过滤器。 + * + * @since 11 + */ +typedef enum { + /** 所有属性的键。*/ + JSVM_KEY_ALL_PROPERTIES = 0, + /** 可写的键。*/ + JSVM_KEY_WRITABLE = 1, + /** 可枚举的键。*/ + JSVM_KEY_ENUMERABLE = 1 << 1, + /** 可配置的键。*/ + JSVM_KEY_CONFIGURABLE = 1 << 2, + /** 排除字符串类型的键。*/ + JSVM_KEY_SKIP_STRINGS = 1 << 3, + /** 排除符号类型的键。*/ + JSVM_KEY_SKIP_SYMBOLS = 1 << 4 +} JSVM_KeyFilter; + +/** + * @brief 键转换选项。 + * + * @since 11 + */ +typedef enum { + /** 将返回整数索引的数字。*/ + JSVM_KEY_KEEP_NUMBERS, + /** 将整数索引转换为字符串。*/ + JSVM_KEY_NUMBERS_TO_STRINGS +} JSVM_KeyConversion; + +/** + * @brief 内存压力水平。 + * + * @since 11 + */ +typedef enum { + /** 无压力。*/ + JSVM_MEMORY_PRESSURE_LEVEL_NONE, + /** 中等压力。*/ + JSVM_MEMORY_PRESSURE_LEVEL_MODERATE, + /** 临界压力。*/ + JSVM_MEMORY_PRESSURE_LEVEL_CRITICAL, +} JSVM_MemoryPressureLevel; + +/** + * @brief 初始化选项,用于初始化JavaScript虚拟机。 + * + * @since 11 + */ +typedef struct { + /** + * 可选。嵌入器中可选的、以nullptr结尾的原始地址数组, + * 虚拟机可以在序列化期间与之匹配,并可用于反序列化。 + * 此数组及其内容必须在虚拟机实例的整个生命周期内保持有效。 + */ + const intptr_t* externalReferences; + + /** + * 虚拟机的标志。如果removeFlags为true,则已识别的标志将从 + *(argc, argv)中移除。请注意,这些标志当前仅限于V8虚拟机。 + * 它们主要用于开发。不要将它们用于生产环境,因为如果虚拟机与 + * 开发环境不同,它们可能不会生效。 + */ + int* argc; + /** argv . */ + char** argv; + /** 删除标志。*/ + bool removeFlags; +} JSVM_InitOptions; + +/** + * @brief 创建JavaScript虚拟机的选项。 + * + * @since 11 + */ +typedef struct { + /** 老年代内存大小上限。*/ + size_t maxOldGenerationSize; + /** 年轻代内存大小上限。*/ + size_t maxYoungGenerationSize; + /** 老年代内存大小初始值。*/ + size_t initialOldGenerationSize; + /** 年轻代内存大小初始值。*/ + size_t initialYoungGenerationSize; + /** 启动快照数据。*/ + const char* snapshotBlobData; + /** 启动快照数据的大小。*/ + size_t snapshotBlobSize; + /** 虚拟机是否用于创建快照。*/ + bool isForSnapshotting; +} JSVM_CreateVMOptions; + +/** + * @brief JavaScript虚拟机信息。 + * + * @since 11 + */ +typedef struct { + /** 此虚拟机支持的最高API版本。*/ + uint32_t apiVersion; + /** 实现虚拟机的引擎名称。*/ + const char* engine; + /** 虚拟机的版本。*/ + const char* version; + /** 缓存数据版本标签。*/ + uint32_t cachedDataVersionTag; +} JSVM_VMInfo; + +/** + * @brief 属性描述符。 + * + * @since 11 + */ +typedef struct { + /** 描述属性键值的可选字符串,UTF8编码。 + * 必须为属性提供utf8name或name之一。 + */ + const char* utf8name; + /** 可选的JSVM_Value,指向用作属性键的JavaScript字符串或符号。 + * 必须为属性提供utf8name或name之一。 + */ + JSVM_Value name; + /** 设置此项使属性描述符对象的value属性成为method表示的JavaScript函数。*/ + JSVM_Callback method; + /** 执行对属性的获取访问时调用的函数。*/ + JSVM_Callback getter; + /** 执行属性的设置访问时调用的函数。*/ + JSVM_Callback setter; + /** 如果属性是数据属性,则通过属性的get访问检索到的值。*/ + JSVM_Value value; + /** 与特定属性关联的属性。*/ + JSVM_PropertyAttributes attributes; +} JSVM_PropertyDescriptor; + +/** + * @brief 扩展的异常信息。 + * @since 11 + */ +typedef struct { + /** UTF8编码的字符串,包含异常信息描述。*/ + const char* errorMessage; + /** 特定于VM的详细异常信息。目前尚未为任何VM实现此功能。*/ + void* engineReserved; + /** 特定于VM的异常代码。目前尚未为任何VM实现此功能。*/ + uint32_t engineErrorCode; + /** 源自最后一个异常的JSVM-API状态代码。*/ + JSVM_Status errorCode; +} JSVM_ExtendedErrorInfo; + +/** + * @brief 类型标记,存储为两个无符号64位整数的128位值。 + * 作为一个UUID,通过它,JavaScript对象可以是"tagged", + * 以确保它们的类型保持不变。 + * + * @since 11 + */ +typedef struct { + uint64_t lower; + uint64_t upper; +} JSVM_TypeTag; + +/** @} */ +#endif /* ARK_RUNTIME_JSVM_JSVM_TYPE_H */ -- Gitee From 2779f149eee37dffe5ed3960a03e89e48f84bcea Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Tue, 20 Feb 2024 16:02:58 +0800 Subject: [PATCH 0275/2135] Update docs (0220) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_node.h | 258 ++++++++++++++++---------------- en/native_sdk/ace/native_type.h | 16 +- 2 files changed, 145 insertions(+), 129 deletions(-) diff --git a/en/native_sdk/ace/native_node.h b/en/native_sdk/ace/native_node.h index 4c33e90f..5b29789c 100644 --- a/en/native_sdk/ace/native_node.h +++ b/en/native_sdk/ace/native_node.h @@ -145,7 +145,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 1.2 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_WIDTH, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_WIDTH); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_WIDTH); * auto nodeWidth = item->value[0].f32; * @endcode * @@ -165,7 +165,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 1.2 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_HEIGHT, &item);clang-tid - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_HEIGHT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HEIGHT); * auto nodeHeight = item->value[0].f32; * @endcode * @@ -185,7 +185,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); * auto nodeBackgroundColor = item->value[0].u32; * @endcode * @@ -208,7 +208,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_IMAGE_REPEAT_NONE} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); * auto nodeBackgroundImageUrl = item->string; * auto nodeBackgroundImageRepeat = item->value[0].i32; * @endcode @@ -241,7 +241,7 @@ typedef enum { * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item1); * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item2); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PADDING); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PADDING); * auto nodePaddingTop = item->value[0].f32; * @endcode * @@ -260,7 +260,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "test" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_ID, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ID); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ID); * auto nodeId = item->string; * @endcode * @@ -280,7 +280,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = false} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_ENABLED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ENABLED); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ENABLED); * auto nodeEnabled = item->value[0].i32; * @endcode */ @@ -311,7 +311,7 @@ typedef enum { * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item1); * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item2); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_MARGIN); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARGIN); * auto nodeMarginTop = item->value[0].f32; * @endcode * @@ -927,7 +927,7 @@ typedef enum { * { 10, {.i32 = 1},10, 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, {.i32 = 1} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); * auto nodeCustomShadowRadius = item->value[0].f32; * auto nodeCustomShadowOffsetX = item->value[1].f32; * auto nodeCustomShadowOffsetY = item->value[2].f32; @@ -1589,7 +1589,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0, 5, 0, 5 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CONSTRAINT_SIZE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); * auto nodeMinWidth = item->value[0].f32; * auto nodeMaxWidth = item->value[1].f32; * auto nodeMinHeight = item->value[2].f32; @@ -1614,7 +1614,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0.5 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_GRAY_SCALE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_GRAY_SCALE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_GRAY_SCALE); * auto nodeGrayScale = item->value[0].f32; * @endcode */ @@ -1635,7 +1635,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0.5 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_INVERT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_INVERT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_INVERT); * auto nodeInvert = item->value[0].f32; * @endcode */ @@ -1656,7 +1656,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0.5 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SEPIA, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SEPIA); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SEPIA); * auto nodeSepia = item->value[0].f32; * @endcode */ @@ -1676,7 +1676,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CONTRAST, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONTRAST); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CONTRAST); * auto nodeContrast = item->value[0].f32; * @endcode */ @@ -1695,7 +1695,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { {.u32=0xFFFF0000} }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FOREGROUND_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); * auto nodeForegroundColor = item->value[0].u32; * @endcode */ @@ -2072,7 +2072,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_COLOR); * auto nodeFontColor = item->value[0].u32; * @endcode * @@ -2092,7 +2092,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_SIZE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_SIZE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_SIZE); * auto nodeFontSize = item->value[0].f32; * @endcode * @@ -2112,7 +2112,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_STYLE_NORMAL} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_STYLE); * auto nodeFontStyle = item->value[0].i32; * @endcode * @@ -2132,7 +2132,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_WEIGHT_NORMAL} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_WEIGHT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_WEIGHT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_WEIGHT); * auto nodeFontWeight = item->value[0].i32; * @endcode * @@ -2176,7 +2176,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); - * auto decorationItem = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); + * auto decorationItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_DECORATION); * auto nodeDecorationStyle = decorationItem->value[0].i32; * auto nodeDecorationColor = decorationItem->value[1].u32; * @endcode @@ -2321,7 +2321,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_COPY_OPTIONS_NONE} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_COPY_OPTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); * auto nodeTextCopyOption = item->value[0].i32; * @endcode * @@ -2342,7 +2342,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); * auto nodeTextBaselineOffset = item->value[0].f32; * @endcode * @@ -2370,7 +2370,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, 10, 10 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); * auto nodeTextShadowRadius = item->value[0].f32; * auto nodeTextShadowType = item->value[1].i32; * auto nodeTextShadowColor = item->value[2].u32; @@ -2748,7 +2748,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); * auto nodeSwitchPointColor = item->value[0].u32; * @endcode * @@ -2770,7 +2770,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .u32 = 0x99666666 } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR); * auto nodeLoadingProgressColor = item->value[0].u32; * @endcode * @@ -2792,7 +2792,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING); * auto nodeLoadingProgressEnableLoading = item->value[0].i32; * @endcode */ @@ -2812,7 +2812,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="input" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER); * auto nodeTextInputPlaceholder = item->string; * @endcode * @@ -2832,7 +2832,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="input" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT); * auto nodeTextInputText = item->string; * @endcode * @@ -2853,7 +2853,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR); * auto nodeTextInputCaretColor = item->value[0].u32; * @endcode * @@ -2874,7 +2874,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 100 }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE); * auto nodeTextInputCaretStyle = item->value[0].f32; * @endcode * @@ -2896,7 +2896,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = true} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE); * auto nodeTextInputUnderline = item->value[0].i32; * @endcode * @@ -2917,7 +2917,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = 50 } }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH); * auto nodeTextInputMaxlength = item->value[0].i32; * @endcode * @@ -2938,7 +2938,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_ENTER_KEY_TYPE_DONE} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE); * auto nodeTextInputMaxlength = item->value[0].i32; * @endcode * @@ -2959,7 +2959,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR); * auto nodeTextInputPlaceholderColor = item->value[0].u32; * @endcode * @@ -2989,7 +2989,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT); * auto nodeTextInputPlaceholderFontSize = item->value[0].f32; * auto nodeTextInputPlaceholderFontStyle = item->value[1].i32; * auto nodeTextInputPlaceholderFontWeight = item->value[2].i32; @@ -3015,7 +3015,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = true} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS); * auto nodeTextInputFocusKeyboard = item->value[0].i32; * @endcode * @@ -3036,7 +3036,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXTINPUT_TYPE_NORMAL} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE); * auto nodeTextInputType = item->value[0].i32; * @endcode * @@ -3057,7 +3057,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR); * auto nodeTextInputSelectedColor = item->value[0].u32; * @endcode * @@ -3080,7 +3080,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = true} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON); * auto nodeTextInputPasswordIcon = item->value[0].i32; * @endcode * @@ -3129,7 +3129,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32=ARKUI_CANCELBUTTON_STYLE_INPUT}, 10.0, {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON); * auto nodeCancelButtonStyle = item->value[0].i32; * auto nodeCancelButtonSize = item->value[1].f32; * auto nodeCancelButtonColor = item->value[2].u32; @@ -3153,7 +3153,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="input" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER); * auto nodeTextAreaPlaceholder = item->string; * @endcode * @@ -3173,7 +3173,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="input" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_TEXT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_TEXT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_TEXT); * auto nodeTextAreaText = item->string; * @endcode * @@ -3194,7 +3194,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = 50 } }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH); * auto nodeTextAreaMaxlength = item->value[0].i32; * @endcode * @@ -3215,7 +3215,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR); * auto nodeTextAreaPlaceholderColor = item->value[0].u32; * @endcode * @@ -3242,7 +3242,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT); * auto nodeTextAreaPlaceholderFontSize = item->value[0].f32; * auto nodeTextAreaPlaceholderFontStyle = item->value[1].i32; * auto nodeTextAreaPlaceholderFontWeight = item->value[2].i32; @@ -3266,7 +3266,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR); * auto nodeTextAreaCaretColor = item->value[0].u32; * @endcode * @@ -3307,7 +3307,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string="click" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BUTTON_LABEL); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BUTTON_LABEL); * auto nodeButtonLabelr = item->string; * @endcode * @@ -3329,7 +3329,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_VALUE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_VALUE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_VALUE); * auto nodeProgressValue = item->value[0].f32; * @endcode * @@ -3350,7 +3350,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 100 }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TOTAL, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_TOTAL); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_TOTAL); * auto nodeProgressTotal = item->value[0].f32; * @endcode * @@ -3371,7 +3371,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_COLOR); * auto nodeProgressColor = item->value[0].u32; * @endcode * @@ -3393,7 +3393,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32=ARKUI_PROGRESS_LINEAR} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TYPE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PROGRESS_TYPE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_TYPE); * auto nodeProgressType = item->value[0].i32; * @endcode */ @@ -3533,7 +3533,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "test" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_ID, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_ID); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_ID); * auto nodeXcomponentId = item->string; * @endcode * @@ -3554,7 +3554,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32 = ARKUI_XCOMPONENT_TYPE_SURFACE} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_TYPE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_TYPE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_TYPE); * auto nodeXcomponentType = item->value[0].i32; * @endcode * @@ -3565,19 +3565,19 @@ typedef enum { * 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].u32: width, in vp.\n - * .value[1].u32: height, in vp.\n + * .value[0].u32: width, in px. \n + * .value[1].u32: height, in px. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].u32: width, in vp.\n - * .value[1].u32: height, in vp.\n + * .value[0].u32: width, in px. \n + * .value[1].u32: height, in px. \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_NumberValue value[] = { {.u32=300}, {.u32=50} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); * auto nodeXcomponentSurfaceWidth = item->value[0].u32; * auto nodeXcomponentSurfaceHeight = item->value[1].u32; * @endcode @@ -3599,7 +3599,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR); * auto nodeDatePickerLunar = item->value[0].i32; * @endcode */ @@ -3617,7 +3617,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "1970-1-1" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_START, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_START); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_START); * auto nodeDatePickerStart = item->string; * @endcode */ @@ -3635,7 +3635,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "2100-12-31" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_END, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_END); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_END); * auto nodeDatePickerEnd = item->string; * @endcode */ @@ -3653,7 +3653,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "2024-01-22" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED); * auto nodeDatePickerSelected = item->string; * @endcode */ @@ -3682,7 +3682,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); * auto nodeDatePickerDisappearTextStyle = item->string; * @endcode */ @@ -3711,7 +3711,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE); * auto nodeDatePickerTextStyle = item->string; * @endcode */ @@ -3740,7 +3740,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE); * auto nodeDatePickerSelectedTextStyle = item->string; * @endcode */ @@ -3758,7 +3758,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "17-11" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED); * auto nodeTimePickerSelected = item->string; * @endcode */ @@ -3778,7 +3778,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME); * auto nodeTimePickerUseMilitaryTime = item->value[0].i32; * @endcode */ @@ -3807,7 +3807,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); * auto nodeDatePickerDisappearTextStyle = item->string; * @endcode */ @@ -3836,7 +3836,7 @@ typedef enum { * @code {.cpp} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE); * auto nodeTimePickerTextStyle = item->string; * @endcode */ @@ -3865,7 +3865,7 @@ typedef enum { * @code {.c} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE); * auto nodeDatePickerSelectedTextStyle = item->string; * @endcode */ @@ -3901,7 +3901,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32=ARKUI_TEXTPICKER_RANGETYPE_MULTI} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "1,2,3;A,B,C" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE); * auto nodeTextPickerRangeType = item->value[0].i32; * auto nodeTextPickerMultiRange = item->string; * @endcode @@ -3923,7 +3923,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.u32 = 1}, {.u32 = 2} }; * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED); * auto nodeTextPickerSelected = item->value[0].u32; * @endcode * @@ -3945,7 +3945,7 @@ typedef enum { * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); * ArkUI_AttributeItem item = { .string = "A;B" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE); * auto nodeTextPickerValue = item->string; * @endcode * @@ -3975,7 +3975,7 @@ typedef enum { * @code {.c} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE); * auto nodeDatePickerDisappearTextStyle = item->string; * @endcode */ @@ -4004,7 +4004,7 @@ typedef enum { * @code {.c} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE); * auto nodeDatePickerTextStyle = item->string; * @endcode */ @@ -4033,7 +4033,7 @@ typedef enum { * @code {.c} * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE); * auto nodeTextPickerSelectedTextStyle = item->string; * @endcode */ @@ -4068,7 +4068,7 @@ typedef enum { * ArkUI_NumberValue value[] = { {.i32=true} }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP); * auto nodePickerCanLoop = item->value[0].i32; * @endcode */ @@ -4088,7 +4088,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 100 }; * ArkUI_AttributeItem item = { value, 1 }; * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT); * auto nodePickerItemHeight = item->value[0].f32; * @endcode */ @@ -4113,7 +4113,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 16.0f }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); * auto borderRadius = item->value[0].f32; * @endcode */ @@ -4136,7 +4136,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE); * auto selectYear = item->value[0].u32; * @endcode */ @@ -4163,7 +4163,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGNMENT_END) }, 10.0f, 0.0f }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT); * auto alignType = item->value[0].i32; * @endcode */ @@ -4186,7 +4186,7 @@ typedef enum { * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); * auto textColor = item->value[0].u32; * @endcode */ @@ -4564,7 +4564,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); * auto nodeScrollBarDisplayMode = item->value[0].i32; * @endcode * @@ -4584,7 +4584,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 20 }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); * auto nodeScrollBarWidth = item->value[0].f32; * @endcode * @@ -4604,7 +4604,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); * auto nodeScrollBarColor = item->value[0].u32; * @endcode * @@ -4614,17 +4614,17 @@ typedef enum { * @brief Defines the scroll direction. 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: scroll direction. The parameter type is {@link ArkUI_Axis}. - * The default value is ARKUI_AXIS_VERTICAL. \n + * .value[0].i32: scroll direction. The parameter type is {@link ArkUI_ScrollDirection}. + * The default value is ARKUI_SCROLL_DIRECTION_VERTICAL. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: scroll direction. The parameter type is {@link ArkUI_Axis}. \n + * .value[0].i32: scroll direction. The parameter type is {@link ArkUI_ScrollDirection}. \n * * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; + * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_DIRECTION_VERTICAL } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); * auto nodeScrollBarDirection = item->value[0].i32; * @endcode * @@ -4637,7 +4637,7 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\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}. The default value is ARKUI_EDGE_EFFECT_NONE.\n - * .value[1]? .i32: whether to enable the scroll effect when the component content size is smaller than the + * .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 * \n @@ -4651,7 +4651,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_EDGE_EFFECT_NONE }, { .i32 = 1 } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); * auto nodeScrollEdgeEffect = item->value[0].i32; * @endcode * @@ -4671,7 +4671,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); * auto nodeScrollEnableScroll = item->value[0].i32; * @endcode * @@ -4692,7 +4692,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 0.6 }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_FRICTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_FRICTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_FRICTION); * auto nodeScrollFriction = item->value[0].f32; * @endcode * @@ -4733,7 +4733,7 @@ typedef enum { * }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SNAP, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SNAP); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_SNAP); * auto nodeScrollSnap = item->value[0].i32; * @endcode * @@ -4841,7 +4841,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = true } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); * auto nodeScrollEnablePaging = item->value[0].i32; * @endcode * @@ -4863,7 +4863,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_DIRECTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_DIRECTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_DIRECTION); * auto nodeListDirection = item->value[0].i32; * @endcode * @@ -4887,7 +4887,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_STICKY_STYLE_NONE } }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_STICKY, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_STICKY); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_STICKY); * auto nodeListSticky = item->value[0].i32; * @endcode * @@ -4907,7 +4907,7 @@ typedef enum { * ArkUI_NumberValue value[] = { 10 }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_SPACE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_SPACE); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_SPACE); * auto nodeListSpace = item->value[0].f32; * @endcode * @@ -5216,7 +5216,7 @@ typedef enum { * auto header = nodeAPI->createNode(ARKUI_NODE_TEXT); * ArkUI_AttributeItem item = { .object = header }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); * auto nodeListItemGroupSetHeader = item->object; * @endcode */ @@ -5235,7 +5235,7 @@ typedef enum { * auto footer = nodeAPI->createNode(ARKUI_NODE_TEXT); * ArkUI_AttributeItem item = { .object = footer }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); * auto nodeListItemGroupSetFooter = item->value[0].object; * @endcode */ @@ -5259,8 +5259,8 @@ typedef enum { * @code {.cpp} * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF }, 1, 0, 0 }; * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_DIVIDER, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_DIVIDER); * auto nodeListItemDividerColor = item->value[0].u32; * @endcode */ @@ -5285,7 +5285,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_HORIZONTAL_ALIGNMENT_START } }; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS); * auto nodeColumnAlignItems = item->value[0].i32; * @endcode * @@ -5308,7 +5308,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT); * auto nodeColumnJustifyContent = item->value[0].i32; * @endcode * @@ -5334,7 +5334,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_VERTICAL_ALIGNMENT_TOP } }; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS); * auto nodeRowAlignItems = item->value[0].i32; * @endcode * @@ -5359,7 +5359,7 @@ typedef enum { * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT); * auto nodeRowAlignItems = item->value[0].i32; * @endcode * @@ -5396,7 +5396,7 @@ typedef enum { * {.i32 = ARKUI_FLEX_ALIGNMENT_END}}; * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_OPTION, &item); - * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FLEX_OPTION); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_OPTION); * auto nodeFlexDirection = item->value[1].i32; * auto nodeFlexWrap = item->value[2].i32; * auto nodeFlexJustifyContent = item->value[3].i32; @@ -5663,22 +5663,13 @@ typedef enum { NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, /** - * @brief Defines the event triggered when the refresh state of the ARKUI_NODE_REFRESH object changes. - * - * 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: refresh state. \n - */ - NODE_REFRESH_STATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, - /** - * @brief Defines the event triggered when the ARKUI_NODE_REFRESH object enters the refresh state. + * @brief Defines the event triggered when the selected status of the ARKUI_NODE_CHECKBOX component changes. * * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is * {@link ArkUI_NodeComponentEvent}. \n - * {@link ArkUI_NodeComponentEvent} does not contain parameters:\n + * ArkUI_NodeComponentEvent.data[0].i321: selected; 0: not selected.\n */ - NODE_REFRESH_ON_REFRESH, + NODE_CHECKBOX_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, /** * @brief Defines the event triggered when a date is selected in the ARKUI_NODE_DATE_PICKER component. @@ -5718,13 +5709,16 @@ typedef enum { NODE_TEXT_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, /** - * @brief Defines the event triggered when the selected status of the ARKUI_NODE_CHECKBOX component changes. + * @brief Defines the event triggered when a date is selected in the NODE_CALENDAR_PICKER. * * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is * {@link ArkUI_NodeComponentEvent}. \n - * ArkUI_NodeComponentEvent.data[0].i321: selected; 0: not selected.\n + * ArkUI_NodeComponent.data[0].u32: year of the selected date. \n + * ArkUI_NodeComponent.data[1].u32: month of the selected date. \n + * ArkUI_NodeComponent.data[2].u32: day of the selected date. \n */ - NODE_CHECKBOX_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, + NODE_CALENDAR_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + /** * @brief Defines the event triggered when the ARKUI_NODE_SLIDER component is dragged or clicked. * @@ -5808,16 +5802,24 @@ typedef enum { * ArkUI_NodeComponentEvent.data[0].i32: edge (top, bottom, left, or right) that the scrolling reaches. \n */ NODE_SCROLL_EVENT_ON_SCROLL_EDGE, + /** - * @brief Defines the event triggered when a date is selected in the NODE_CALENDAR_PICKER. + * @brief Defines the event triggered when the refresh state of the ARKUI_NODE_REFRESH object changes. * * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is * {@link ArkUI_NodeComponentEvent}. \n - * ArkUI_NodeComponent.data[0].u32: year of the selected date. \n - * ArkUI_NodeComponent.data[1].u32: month of the selected date. \n - * ArkUI_NodeComponent.data[2].u32: day of the selected date. \n + * {@link ArkUI_NodeComponentEvent} contains one parameter:\n + * ArkUI_NodeComponentEvent.data[0].i32: refresh state. \n */ - NODE_CALENDAR_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, + NODE_REFRESH_STATE_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, + /** + * @brief Defines the event triggered when the ARKUI_NODE_REFRESH object enters the refresh state. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} does not contain parameters:\n + */ + NODE_REFRESH_ON_REFRESH, } ArkUI_NodeEventType; /** diff --git a/en/native_sdk/ace/native_type.h b/en/native_sdk/ace/native_type.h index 2ec8ceaa..862136d7 100644 --- a/en/native_sdk/ace/native_type.h +++ b/en/native_sdk/ace/native_type.h @@ -390,6 +390,20 @@ typedef enum { ARKUI_EDGE_EFFECT_NONE, } ArkUI_EdgeEffect; +/** + * @brief Enumerates the scroll directions for the component. + * + * @since 12 + */ +typedef enum { + /** Only vertical scrolling is supported. */ + ARKUI_SCROLL_DIRECTION_VERTICAL = 0, + /** Only horizontal scrolling is supported. */ + ARKUI_SCROLL_DIRECTION_HORIZONTAL, + /** Scrolling is not allowed. */ + ARKUI_SCROLL_DIRECTION_NONE = 3, +} ArkUI_ScrollDirection; + /** * @brief Enumerates the alignment modes of list items when scrolling ends. * @@ -421,7 +435,7 @@ typedef enum { } ArkUI_ScrollBarDisplayMode; /** - * @brief Enumerates the scroll directions. + * @brief Enumerates the scroll directions for the component. * * @since 12 */ -- Gitee From 9b2c6d7d5967b3dfd97be6a51c69032a2c1b27b7 Mon Sep 17 00:00:00 2001 From: baoxy92 Date: Tue, 20 Feb 2024 09:40:10 +0000 Subject: [PATCH 0276/2135] =?UTF-8?q?drm=E6=96=87=E6=A1=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: baoxy92 --- .../media/drm/native_mediakeysystem.h | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h index 30c8e2fb..e63685b5 100644 --- a/zh-cn/native_sdk/media/drm/native_mediakeysystem.h +++ b/zh-cn/native_sdk/media/drm/native_mediakeysystem.h @@ -54,7 +54,7 @@ extern "C" { * @param info 从媒体密钥系统获取的事件信息。 * @param infoLen 事件信息长度。 * @param extra 从媒体密钥系统获得的额外信息。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -94,54 +94,54 @@ bool OH_MediaKeySystem_IsSupported3(const char *name, const char *mimeType, * @brief 根据名称创建媒体密钥系统实例。 * @param name 说明将按名称创建哪个drm系统。 * @param mediaKeySystem 媒体密钥系统实例。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM.ERR_OK, + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK, * 当达到媒体密钥系统的最大数量时,返回DRM_ERR_MAX_SYSTEM_NUM_REACHED。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_Create(const char *name, MediaKeySystem **mediaKeySystem); /** - * @brief 按名称设置媒体密钥系统配置值。 + * @brief 按字符串类型名称设置媒体密钥系统配置值。 * @param mediaKeySystem 媒体密钥系统实例。 * @param configName 配置名称字符串。 * @param value 要设置的字符串的配置值。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_SetConfigurationString(MediaKeySystem *mediaKeySystem, const char *configName, const char *value); /** - * @brief 按名称获取媒体密钥系统配置值。 + * @brief 按字符串类型名称获取媒体密钥系统配置值。 * @param mediaKeySystem 媒体密钥系统实例。 * @param configName 字符串类型配置名。 * @param value 字符串形式配置值。 * @param valueLen 字符串形式配置值长度。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_GetConfigurationString(MediaKeySystem *mediaKeySystem, const char *configName, char *value, int32_t valueLen); /** - * @brief 通过配置名设置MediaKeySystem的配置值。 + * @brief 通过字符数组类型配置名设置MediaKeySystem的配置值。 * @param mediaKeySystem 媒体密钥系统实例。 - * @param configName 字符串类型配置名。 + * @param configName 字符数组类型配置名。 * @param value 字节数组形式配置值。 * @param valueLen 字节数组形式配置值长度。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ Drm_ErrCode OH_MediaKeySystem_SetConfigurationByteArray(MediaKeySystem *mediaKeySystem, const char *configName, uint8_t *value, int32_t valueLen); /** - * @brief 按名称获取媒体密钥系统配置值。 + * @brief 按字符数组类型名称获取媒体密钥系统配置值。 * @param mediaKeySystem 媒体密钥系统实例。 - * @param configName 配置名称字符串。 + * @param configName 字符数组类型配置名称。 * @param value 要获取数组中的配置值。 * @param valueLen 数据的配置值长度。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -151,7 +151,7 @@ Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray(MediaKeySystem *mediaKey * @brief 获取媒体密钥系统度量信息。 * @param mediaKeySystem 媒体密钥系统实例。 * @param statistics 已获取度量信息。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -160,7 +160,7 @@ Drm_ErrCode OH_MediaKeySystem_GetStatistics(MediaKeySystem *mediaKeySystem, DRM_ * @brief 获取支持的最高内容保护级别的媒体密钥系统。 * @param mediaKeySystem 媒体密钥系统实例。 * @param contentProtectionLevel 内容保护级别。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -170,7 +170,7 @@ Drm_ErrCode OH_MediaKeySystem_GetMaxContentProtectionLevel(MediaKeySystem *media * @brief 设置媒体密钥系统事件回调。 * @param mediaKeySystem 媒体密钥系统实例。 * @param callback 将回调设置为媒体密钥系统。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -182,8 +182,8 @@ Drm_ErrCode OH_MediaKeySystem_SetMediaKeySystemCallback(MediaKeySystem *mediaKey * @param mediaKeySystem 将创建媒体密钥会话的媒体密钥系统实例。 * @param level 指定内容保护级别。 * @param mediaKeySession 媒体密钥会话实例。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM.ERR_OK, - * 当达到媒体密钥系统的最大数量时,返回DRM_ERR_MAX_SESSION_NUM_REACHED。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK, + * 当达到媒体密钥会话的最大数量时,返回DRM_ERR_MAX_SESSION_NUM_REACHED。 * @since 11 * @version 1.0 */ @@ -197,7 +197,7 @@ Drm_ErrCode OH_MediaKeySystem_CreateMediaKeySession(MediaKeySystem *mediaKeySyst * @param requestLen 设备证书请求的长度。 * @param defaultUrl 设备证书服务器的网址。 * @param defaultUrlLen 设备证书服务器的网址长度。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -209,7 +209,7 @@ Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest(MediaKeySystem *mediaKeyS * @param mediaKeySystem 媒体密钥系统实例。 * @param response 将处理的响应。 * @param responseLen 响应长度. - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -220,7 +220,7 @@ Drm_ErrCode OH_MediaKeySystem_ProcessKeySystemResponse(MediaKeySystem *mediaKeyS * @brief 获取离线媒体密钥ID。 * @param mediaKeySystem 媒体密钥系统实例。 * @param offlineMediaKeyIds 所有离线媒体密钥的媒体密钥ID。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -233,7 +233,7 @@ Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyIds(MediaKeySystem *mediaKeySyst * @param offlineMediaKeyId 离线媒体密钥标识符。 * @param offlineMediaKeyIdLen 离线媒体密钥标识符长度。 * @param status 已获取媒体密钥状态。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -245,7 +245,7 @@ Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyStatus(MediaKeySystem *mediaKeyS * @param mediaKeySystem 媒体密钥系统实例。 * @param offlineMediaKeyId 离线媒体密钥标识符。 * @param offlineMediaKeyIdLen 离线媒体密钥标识符长度。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -255,8 +255,8 @@ Drm_ErrCode OH_MediaKeySystem_ClearOfflineMediaKeys(MediaKeySystem *mediaKeySyst /** * @brief 获取媒体密钥系统的证书状态。 * @param mediaKeySystem 媒体密钥系统实例。 - * @param 将获得certStatus状态。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @param certStatus 获得的证书状态值。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ @@ -266,7 +266,7 @@ Drm_ErrCode OH_MediaKeySystem_GetCertificateStatus(MediaKeySystem *mediaKeySyste /** * @brief Destroy a 媒体密钥系统实例。 * @param mediaKeySystem 指定将销毁哪个媒体密钥系统实例。 - * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM-ERR_OK。 + * @return 当参数检查失败时返回DRM_ERR_INVALID_VAL,当函数调用成功时返回DRM_ERR_OK。 * @since 11 * @version 1.0 */ -- Gitee From 8193fb2ad34be4ed66a02fa1139a5fa094694b4e Mon Sep 17 00:00:00 2001 From: ustc-tianyu Date: Tue, 20 Feb 2024 19:32:16 +0800 Subject: [PATCH 0277/2135] docs bugfix Signed-off-by: ustc-tianyu --- zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_color.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_font.h | 2 +- .../native_sdk/graphic/native_drawing/drawing_font_collection.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_image.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_path.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_point.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h | 2 +- .../graphic/native_drawing/drawing_sampling_options.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h | 2 +- .../graphic/native_drawing/drawing_text_declaration.h | 2 +- .../native_sdk/graphic/native_drawing/drawing_text_typography.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h | 2 +- zh-cn/native_sdk/graphic/native_drawing/drawing_types.h | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index 4c19ff95..04430456 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h index bda5a13c..c274b170 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_brush.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h index 834f777b..74df1fbe 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h index 307f4566..5b3fd7c9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h index 3c5685f6..82aaa4ab 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_color_filter.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h index 2e93bcb3..2d98207c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_filter.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index b38537e0..093431ed 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 4834a108..3ba72df9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h index 3ab59ec5..3f1e1c05 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_image.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h index f489d280..6bcb7c49 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index 0df8c3c5..2eb61977 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h index 8c25a955..e111d8eb 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_memory_stream.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h index 24740025..63f320cc 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h index a947c8dc..34bc5d79 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_path_effect.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h index 9ea2200c..6825f461 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_pen.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h index ea1ea58f..674e86db 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_point.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h index b28f062b..69015172 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_rect.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h index e43ec59a..90515207 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h index 359cd779..c11c42e8 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_sampling_options.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h index 9a7f7905..0cb06ff8 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h index 2fa7ac01..6f1d9caa 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index f0b64992..57247124 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index e2794b9a..1d8188cd 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h index 3b68dd3f..52f06b13 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index 5eab9d64..26847f3e 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -21,7 +21,7 @@ * @{ * * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 - * 本模块不提供像素单位,和框架采用的像素单位保持一致。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * -- Gitee From 55793515bea54210043f6c695bb7c57503d48cea Mon Sep 17 00:00:00 2001 From: 18721213663 Date: Tue, 20 Feb 2024 20:34:12 +0800 Subject: [PATCH 0278/2135] add_ndk Signed-off-by: 18721213663 --- .../environment/oh_environment.h | 76 ++++++++++++++++++ .../filemanagement/fileio/error_code.h | 78 +++++++++++++++++++ .../filemanagement/fileio/oh_fileio.h | 75 ++++++++++++++++++ 3 files changed, 229 insertions(+) create mode 100644 zh-cn/native_sdk/filemanagement/environment/oh_environment.h create mode 100644 zh-cn/native_sdk/filemanagement/fileio/error_code.h create mode 100644 zh-cn/native_sdk/filemanagement/fileio/oh_fileio.h diff --git a/zh-cn/native_sdk/filemanagement/environment/oh_environment.h b/zh-cn/native_sdk/filemanagement/environment/oh_environment.h new file mode 100644 index 00000000..2f00ffab --- /dev/null +++ b/zh-cn/native_sdk/filemanagement/environment/oh_environment.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H +#define FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H + +/** + * @addtogroup Environment + * + * @brief 提供获取公共文件根目录路径的能力。 + * @since 12 + */ + +/** + * @file oh_environment.h + * + * @brief environment模块接口定义,使用environment提供的native接口,获取公共文件根目录的沙箱路径。 + * + * 注意:使用environment模块需设备具有以下syscap:SystemCapability.FileManagement.File.Environment.FolderObtain。 + * + * @library libohenvironment.so + * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain + * @since 12 + */ + +#include "error_code.h" + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief 获取Download根目录沙箱路径。 + * + * @permission 调用此接口需要请求权限:ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY。 + * @param result Download根目录路径指针。请使用free()进行资源释放。 + * @return 返回FileManageMent模块错误码。 + * @since 12 + */ +FileManagement_ErrCode OH_Environment_GetUserDownloadDir(char **result); + +/** + * @brief 获取Desktop根目录沙箱路径。 + * + * @permission 调用此接口需要请求权限:ohos.permission.READ_WRITE_DESKTOP_DIRECTORY。 + * @param result Desktop根目录路径指针。请使用free()进行资源释放。 + * @return 返回FileManageMent模块错误码。 + * @since 12 + */ +FileManagement_ErrCode OH_Environment_GetUserDesktopDir(char **result); + +/** + * @brief 获取Document根目录沙箱路径。 + * + * @permission 调用此接口需要请求权限:ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY + * @param result Document根目录路径指针。请使用free()进行资源释放。 + * @return 返回FileManageMent模块错误码。 + * @since 12 + */ +FileManagement_ErrCode OH_Environment_GetUserDocumentDir(char **result); + +#ifdef __cplusplus +}; +#endif + +#endif //FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H diff --git a/zh-cn/native_sdk/filemanagement/fileio/error_code.h b/zh-cn/native_sdk/filemanagement/fileio/error_code.h new file mode 100644 index 00000000..8b4c19c7 --- /dev/null +++ b/zh-cn/native_sdk/filemanagement/fileio/error_code.h @@ -0,0 +1,78 @@ +/* + * 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 FILE_MANAGEMENT_FILEIO_ERROR_CODE_H +#define FILE_MANAGEMENT_FILEIO_ERROR_CODE_H + +/** + * @addtogroup FileIO + * @{ + * + * @brief 提供文件管理模块的错误码定义。 + * @since 12 + */ + +/** + * @file error_code.h + * + * @brief 提供文件管理模块的错误码定义。 + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 12 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 文件管理模块错误码。 + * @since 12 + */ +typedef enum FileManagement_ErrCode { + /** + * 接口调用成功。 + */ + ERR_OK = 0, + /** + * 接口权限校验失败。 + */ + ERR_PERMISSION_ERROR = 201, + /** + * 设备不具备此接口所需syscap。 + */ + ERR_DEVICE_NOT_SUPPORTED = 801, + /** + * 操作不被允许。 + */ + ERR_EPERM = 13900001, + /** + * 不存在此文件或文件夹。 + */ + ERR_ENOENT = 13900002, + /** + * 内存不足。 + */ + ERR_ENOMEM = 139000011, + /** + * 内部未知错误。 + */ + ERR_UNKNOWN = 13900042 +} FileManagement_ErrCode; + +#ifdef __cplusplus +} +#endif + +#endif // FILE_MANAGEMENT_FILEIO_ERROR_CODE_H diff --git a/zh-cn/native_sdk/filemanagement/fileio/oh_fileio.h b/zh-cn/native_sdk/filemanagement/fileio/oh_fileio.h new file mode 100644 index 00000000..9a37f40a --- /dev/null +++ b/zh-cn/native_sdk/filemanagement/fileio/oh_fileio.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef FILE_MANAGEMENT_FILEIO_OH_FILEIO_H +#define FILE_MANAGEMENT_FILEIO_OH_FILEIO_H + +/** + * @addtogroup FileIO + * + * @brief 提供基础文件操作的能力。 + * @since 12 + */ + +/** + * @file oh_fileio.h + * + * @brief fileio模块接口定义,使用fileio提供的native接口,进行文件基础操作。 + * @library libohfileio.so + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 12 + */ + +#include "error_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 文件存储位置枚举值。 + * @since 12 + */ +typedef enum FileIO_FileLocation { + /** + * @brief 文件存储于本地。 + */ + LOCAL = 1, + /** + * @brief 文件存储于云侧。 + */ + CLOUD = 2, + /** + * @brief 文件存储于本地及云侧。 + */ + LOCAL_AND_CLOUD = 3 +} FileIO_FileLocation; + +/** + * @brief 获取文件存储位置。 + * + * @param uri 指向入参uri的指针。 + * @param uriLength 入参uri字符串的长度。 + * @param location 输出文件存储位置的指针。 + * @return 返回FileManageMent模块错误码。 + * @since 12 + */ +FileManagement_ErrCode OH_FileIO_GetFileLocation(char *uri, int uriLength, + FileIO_FileLocation *location); + +#ifdef __cplusplus +}; +#endif + +#endif //FILE_MANAGEMENT_FILEIO_OH_FILEIO_H -- Gitee From 807b28ed13c3a5aa14a7eb95e747d1082b4b5fe0 Mon Sep 17 00:00:00 2001 From: MengYao Date: Wed, 21 Feb 2024 16:54:54 +0800 Subject: [PATCH 0279/2135] =?UTF-8?q?4.1NDK=E6=8E=A5=E5=8F=A3=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MengYao --- .../database/rdb/relational_store.h | 125 +++++++++++++++++- 1 file changed, 123 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/database/rdb/relational_store.h b/zh-cn/native_sdk/database/rdb/relational_store.h index 9e115847..911631b3 100644 --- a/zh-cn/native_sdk/database/rdb/relational_store.h +++ b/zh-cn/native_sdk/database/rdb/relational_store.h @@ -478,6 +478,79 @@ typedef enum Rdb_SubscribeType { RDB_SUBSCRIBE_TYPE_CLOUD_DETAILS, } Rdb_SubscribeType; +/** + * @brief 端云数据更改事件的回调函数。 + * + * @param context 表示数据观察者的上下文。 + * @param values 表示更改的端云帐户。 + * @param count 表示更改的端云帐户数量。 + * @since 11 + */ +typedef void (*Rdb_BriefObserver)(void *context, const char *values[], uint32_t count); + +/** + * @brief 端云数据更改事件的细节的回调函数。 + * + * @param context 表示数据观察者的上下文。 + * @param changeInfo 表示已更改表的信息{@link Rdb_ChangeInfo}。 + * @param count 表示更改的表的数量。 + * @see Rdb_ChangeInfo. + * @since 11 + */ +typedef void (*Rdb_DetailsObserver)(void *context, const Rdb_ChangeInfo **changeInfo, uint32_t count); + +/** + * @brief 表示回调函数。 + * + * @since 11 + */ +typedef union Rdb_SubscribeCallback { + /** 端云数据更改事件的细节的回调函数。 */ + Rdb_DetailsObserver detailsObserver; + + /** 端云数据更改事件的回调函数。 */ + Rdb_BriefObserver briefObserver; +} Rdb_SubscribeCallback; + +/** + * @brief 表示数据观察者。 + * + * @since 11 + */ +typedef struct Rdb_DataObserver { + /** 表示数据观察者的上下文。 */ + void *context; + + /** 数据观察者的回调。 */ + Rdb_SubscribeCallback callback; +} Rdb_DataObserver; + +/** + * @brief 为数据库注册观察者。当分布式数据库中的数据发生更改时,将调用回调。 + * + * @param store 表示指向{@link OH_Rdb_Store}实例的指针。 + * @param type 表示在{@link Rdb_SubscribeType}中定义的订阅类型。 + * @param observer 数据库中更改事件的观察者{@link Rdb_DataObserver}。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_Rdb_Store. + * @see Rdb_DataObserver. + * @since 11 + */ +int OH_Rdb_Subscribe(OH_Rdb_Store *store, Rdb_SubscribeType type, const Rdb_DataObserver *observer); + +/** + * @brief 从数据库中删除指定类型的指定观察者。 + * + * @param store 表示指向{@link OH_Rdb_Store}实例的指针. + * @param type 表示在{@link Rdb_SubscribeType}中定义的订阅类型。 + * @param observer 数据库中更改事件的观察者{@link Rdb_DataObserver}。如果这是nullptr,表示删除该类型的所有观察者。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_Rdb_Store. + * @see Rdb_DataObserver. + * @since 11 + */ +int OH_Rdb_Unsubscribe(OH_Rdb_Store *store, Rdb_SubscribeType type, const Rdb_DataObserver *observer); + /** * @brief 表示数据库的同步模式 * @@ -594,6 +667,15 @@ typedef struct Rdb_ProgressDetails { */ Rdb_TableDetails *OH_Rdb_GetTableDetails(Rdb_ProgressDetails *progress, int32_t version); +/** + * @brief 端云同步进度的回调函数。 + * + * @param progressDetails 端云同步进度的详细信息。 + * @see Rdb_ProgressDetails. + * @since 11 + */ +typedef void (*Rdb_ProgressCallback)(void *context, Rdb_ProgressDetails *progressDetails); + /** * @brief 数据库端云同步的回调函数。 * @@ -603,6 +685,19 @@ Rdb_TableDetails *OH_Rdb_GetTableDetails(Rdb_ProgressDetails *progress, int32_t */ typedef void (*Rdb_SyncCallback)(Rdb_ProgressDetails *progressDetails); +/** + * @brief 端云同步进度观察者。 + * + * @since 11 + */ +typedef struct Rdb_ProgressObserver { + /** 端云同步进度观察者的上下文。 */ + void *context; + + /** 端云同步进度观察者的回调函数。 */ + Rdb_ProgressCallback callback; +} Rdb_ProgressObserver; + /** * @brief 进行端云同步。 * @@ -610,12 +705,38 @@ typedef void (*Rdb_SyncCallback)(Rdb_ProgressDetails *progressDetails); * @param mode 表示同步过程的类型{@link Rdb_SyncMode}. * @param tables 表示需要同步的表名。 * @param count 同步的表的数量,如果传入的值为0,同步数据库的所有表。 - * @param progress 数据库端云同步的回调函数。 + * @param observer 端云同步进度的观察者{@link Rdb_ProgressObserver}。 + * @return 返回操作是否成功,出错时返回对应的错误码。 * @see OH_Rdb_Store. * @since 11 */ int OH_Rdb_CloudSync(OH_Rdb_Store *store, Rdb_SyncMode mode, const char *tables, int count, - Rdb_SyncCallback *progress); + const Rdb_ProgressObserver *observer); + +/** + * @brief 订阅RDB存储的自动同步进度。 + * 当收到自动同步进度的通知时,将调用回调。 + * + * @param store 表示指向目标{@Link OH_Rdb_Store}实例的指针。 + * @param observer 用于自动同步进度的观察者{@link Rdb_ProgressObserver}。表示调用返回自动同步进度的回调。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_Rdb_Store. + * @see Rdb_ProgressObserver. + * @since 11 + **/ +int OH_Rdb_SubscribeAutoSyncProgress(OH_Rdb_Store *store, const Rdb_ProgressObserver *observer); + +/** + * @brief 取消订阅RDB存储的自动同步进程。 + * + * @param store 表示指向目标{@Link OH_Rdb_Store}实例的指针。 + * @param observer 表示自动同步进度的观察者{@link Rdb_ProgressObserver}。如果是空指针,则自动同步进程的所有回调都将被取消注册。 + * @return 返回操作是否成功,出错时返回对应的错误码。 + * @see OH_Rdb_Store. + * @see Rdb_ProgressObserver. + * @since 11 + */ +int OH_Rdb_UnsubscribeAutoSyncProgress(OH_Rdb_Store *store, const Rdb_ProgressObserver *observer); #ifdef __cplusplus }; -- Gitee From 2986276c3102560d6a2de36b2d6a56ee2cfa5e03 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Wed, 21 Feb 2024 07:19:43 +0000 Subject: [PATCH 0280/2135] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ndk=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_font.h | 22 + .../native_drawing/drawing_font_collection.h | 20 + .../native_drawing/drawing_text_declaration.h | 16 + .../native_drawing/drawing_text_typography.h | 652 +++++++++++++++++- 4 files changed, 709 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index 093431ed..707dedb5 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -153,6 +153,8 @@ void OH_Drawing_FontDestroy(OH_Drawing_Font*); * @version 1.0 */ typedef struct OH_Drawing_Font_Metrics { + /** 指示哪些度量是有效的 */ + uint32_t fFlags; /** 字符最高点到基线的最大距离 */ float top; /** 字符最高点到基线的推荐距离 */ @@ -163,6 +165,26 @@ typedef struct OH_Drawing_Font_Metrics { float bottom; /** 行间距 */ float leading; + /** 平均字符宽度,如果未知则为零 */ + float avgCharWidth; + /** 最大字符宽度,如果未知则为零 */ + float maxCharWidth; + /** 任何字形边界框原点左侧的最大范围,通常为负值;不推荐使用可变字体 */ + float xMin; + /** 任何字形边界框原点右侧的最大范围,通常为负值;不推荐使用可变字体 */ + float xMax; + /** 小写字母“x”的高度,如果未知则为零,通常为负数 */ + float xHeight; + /** 大写字母的高度,如果未知则为零,通常为负数 */ + float capHeight; + /** 下划线粗细 */ + float underlineThickness; + /** 表示下划线的位置,即从基线到文字下方笔画顶部的垂直距离,通常为正值。 */ + float underlinePosition; + /** 删除线粗细 */ + float strikeoutThickness; + /** 表示删除线的位置,即从基线到文字上方笔画底部的垂直距离,通常为负值。 */ + float strikeoutPosition; } OH_Drawing_Font_Metrics; /** diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 3ba72df9..701ada98 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -65,6 +65,26 @@ OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void); */ void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection*); +/** + * @brief 禁用备用字体。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontCollection 指向字体集对象的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection* fontCollection); + +/** + * @brief 禁用系统字体。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontCollection 指向字体集对象的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection* fontCollection); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h index 57247124..7c05a0d1 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -108,6 +108,22 @@ typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity; */ typedef struct OH_Drawing_Range OH_Drawing_Range; +/** + * @brief 用于管理文本阴影。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow; + +/** + * @brief 用来解析系统字体文件。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontParser OH_Drawing_FontParser; + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 1d8188cd..6e5d2628 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -42,6 +42,7 @@ #include "drawing_canvas.h" #include "drawing_color.h" +#include "drawing_font.h" #include "drawing_text_declaration.h" #include "drawing_types.h" @@ -287,6 +288,66 @@ typedef enum OH_Drawing_RectWidthStyle { RECT_WIDTH_STYLE_MAX, } OH_Drawing_RectWidthStyle; +/** + * @brief 描述字体的详细信息。 + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** 系统字体的文件路径 */ + char* path; + /** 系统字体的postScript名称 */ + char* postScriptName; + /** 系统字体的名称 */ + char* fullName; + /** 系统字体的字体家族 */ + char* fontFamily; + /** 系统字体的子字体家族 */ + char* fontSubfamily; + /** 系统字体的粗细程度 */ + int weight; + /** 系统字体的宽窄风格属性 */ + int width; + /** 系统字体是否倾斜 */ + int italic; + /** 系统字体是否紧凑 */ + bool monoSpace; + /** 系统字体是否支持符号字体 */ + bool symbolic; +} OH_Drawing_FontDescriptor; + +/** + * @brief 文字行位置信息 + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** 文字ascender高度 */ + double ascender; + /** 文字descender高度 */ + double descender; + /** 大写字母的高度 */ + double capHeight; + /** 小写字母的高度 */ + double xHeight; + /** 文字宽度 */ + double width; + /** 行高 */ + double height; + /** 文字左端到容器左端距离,左对齐为0,右对齐为容器宽度减去行文字宽度 */ + double x; + /** 文字上端到容器上端高度,第一行为0,第二行为第一行高度 */ + double y; + /** 行起始位置字符索引 */ + size_t startIndex; + /** 行结束位置字符索引 */ + size_t endIndex; + /** 第一个字的度量信息 */ + OH_Drawing_Font_Metrics firstCharMetrics; +} OH_Drawing_LineMetrics; + /** * @brief 创建指向OH_Drawing_TypographyStyle对象的指针。 * @@ -329,6 +390,17 @@ void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle*, int /* O */ void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Drawing_TextAlign */); +/** + * @brief 获取文字对齐方式。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @return 返回文字对齐方式。 + * @since 12 + * @version 1.0 + */ +int OH_Drawing_TypographyGetEffectiveAlignment(OH_Drawing_TypographyStyle* style); + /** * @brief 设置文本最大行数。 * @@ -350,6 +422,17 @@ void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle*, int /* ma */ OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); +/** + * @brief 获取字体风格。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @return 返回文本类型。返回类型为{@link OH_Drawing_TextStyle}结构体 + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle(OH_Drawing_TypographyStyle* style); + /** * @brief 释放被OH_Drawing_TextStyle对象占据的内存。 * @@ -473,6 +556,94 @@ void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_F */ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); +/** + * @brief 设置前景色画刷。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Brush 指向OH_Drawing_Brush对象的指针,由{@link OH_Drawing_Brush}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief 返回设置的前景色画刷。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Brush 指向OH_Drawing_Brush对象的指针,由{@link OH_Drawing_Brush}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief 设置前景色画笔。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Pen 指向OH_Drawing_Pen对象的指针,由{@link OH_Drawing_Pen}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief 返回设置的前景色画笔。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Pen 指向OH_Drawing_Pen对象的指针,由{@link OH_Drawing_Pen}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief 设置背景色画刷。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Brush 指向OH_Drawing_Brush对象的指针,由{@link OH_Drawing_Brush}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief 返回设置的背景色画刷。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Brush 指向OH_Drawing_Brush对象的指针,由{@link OH_Drawing_Brush}获取。 + * @since 12 + * @version 1.0 + */ + void OH_Drawing_TextStyleGetBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief 设置背景色画笔。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Pen 指向OH_Drawing_Pen对象的指针,由{@link OH_Drawing_Pen}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief 返回设置的背景色画笔。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Pen 指向OH_Drawing_Pen对象的指针,由{@link OH_Drawing_Pen}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + /** * @brief 创建指向OH_Drawing_TypographyCreate对象的指针。 * @@ -988,7 +1159,18 @@ void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int) void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); /** - * @brief 获取指定行的行高。 + * @brief 设置省略号样式。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param char 省略号样式。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextEllipsis(OH_Drawing_TypographyStyle* style, const char* ellipsis); + +/** + * @brief 获取指定行的行高 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 @@ -1011,6 +1193,474 @@ double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); */ double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); +/** + * @brief 设置文本划分比率。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param float 文本划分比率。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle* style, float textSplitRatio); + +/** + * @brief 获取文本是否有最大行数限制。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @return 返回文本是否有最大行数限制,true表示有最大行数限制,false表示无最大行数限制。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle* style); + +/** + * @brief 获取文本是否有省略号。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @return 返回文本是否有省略号,true表示有省略号,false表示无省略号。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle* style); + +/** + * @brief 设置文本位置。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param char 文本位置。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const char* locale); + +/** + * @brief 获取文本字体属性。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Typography 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @return 返回文本字体属性。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_Font_Metrics* OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_TextStyle*, OH_Drawing_Typography*); + +/** + * @brief 设置文本类型。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TextStyle 指向文本类型OH_Drawing_TextStyle的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*,OH_Drawing_TextStyle*); + +/** + * @brief 构造OH_Drawing_FontDescriptor对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 返回指向已创建的OH_Drawing_FontDescriptor对象的指针。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); + +/** + * @brief 释放OH_Drawing_FontDescriptor对象占用的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontDescriptor 指向OH_Drawing_FontDescriptor对象的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); + +/** + * @brief 构造OH_Drawing_FontDescriptor对象。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 返回指向已创建的OH_Drawing_FontParser对象的指针。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void); + +/** + * @brief 释放OH_Drawing_FontParser对象占用的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser 指向OH_Drawing_FontParser对象的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser*); + +/** + * @brief 获取系统字体名称列表。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser 指向OH_Drawing_FontParser对象的指针。 + * @param size_t 返回获取到的系统字体名称数量。 + * @return 返回获取到的系统字体列表。 + * @since 12 + * @version 1.0 + */ +char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*); + +/** + * @brief 释放系统字体名称列表占用的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param char** 指向系统字体名称列表的指针。 + * @param size_t* 系统字体名称列表的数量。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroySystemFontList(char**, size_t); + +/** + * @brief 根据传入的系统字体名称获取系统字体的相关信息。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser 指向OH_Drawing_FontParser对象的指针。 + * @param char* 系统字体名。 + * @return Returns system fonts. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontParser*, const char*); + +/** + * @brief 获取行度量信息。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @return 返回指向OH_Drawing_LineMetrics对象的指针。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typography*); + +/** + * @brief 获取行数量。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_LineMetrics 指向OH_Drawing_LineMetrics对象的指针。 + * @return 返回行数量。 + * @since 12 + * @version 1.0 + */ +size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics*); + +/** + * @brief 释放行度量占用的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_LineMetrics 指向OH_Drawing_LineMetrics对象的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); + +/** + * @brief 获取指定行度量。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param int 要获取的行数。 + * @return 返回获取到的指定行度量信息。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int); + +/** + * @brief 获取指定行的位置信息或指定行第一个字符的位置信息 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param int 行号 + * @param bool true为获取整行的位置信息,false为获取第一个字符的位置信息 + * @param bool 文字宽度是否包含空白符 + * @param OH_Drawing_LineMetrics 指向OH_Drawing_LineMetrics对象的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, OH_Drawing_LineMetrics*); + +/** + * @brief 设置文本排版字重。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, + * 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见{@link OH_Drawing_FontWeight}枚举。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int); + +/** + * @brief 设置文本排版风格。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见{@link OH_Drawing_FontStyle}枚举。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle*, int); + +/** + * @brief 设置文本排版字体类型。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param char 字体类型,数据类型为指向char的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle*, const char*); + +/** + * @brief 设置文本排版字号。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param double 字号。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); + +/** + * @brief 设置文本排版字体高度。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param double 字体高度。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle*, double); + +/** + * @brief 设置文本排版为一半行间距。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief 设置文本排版是否启用行样式。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param bool 设置行样式是否启用,true表示启用,false表示不启用 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief 设置文本排版行样式字重。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, + * 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见{@link OH_Drawing_FontWeight}枚举。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle*, int); + +/** + * @brief 设置文本排版行样式风格。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见{@link OH_Drawing_FontStyle}枚举。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, int); + +/** + * @brief 设置文本排版行样式字体类型。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param int 字体名称数量。 + * @param char 指向字体类型的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle*, + int /* fontFamiliesNumber */, const char* fontFamilies[]); + +/** + * @brief 设置文本排版行样式字号。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param double 字号。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); + +/** + * @brief 设置文本排版行样式字体高度。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param double 字体高度。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle*, double /* fontHeight */); + +/** + * @brief 设置文本排版行样式为一半行间距。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief 设置文本排版行样式间距比例。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param double 间距比例。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyle*, double); + +/** + * @brief 设置文本排版是否仅启用行样式。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param bool 设置仅启用行样式是否生效,true表示生效,false表示不生效。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief 创建指向OH_Drawing_TextShadow对象的指针。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 指向创建的OH_Drawing_TextShadow对象的指针。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); + +/** + * @brief 释放被OH_Drawing_TextShadow对象占据的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextShadow 指向OH_Drawing_TextShadow对象的指针,由{@link OH_Drawing_CreateTextShadow}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow*); + +/** + * @brief 获取文本阴影容器。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @return 返回指向容器的指针,返回类型为{@link OH_Drawing_TextShadow}结构体。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*); + +/** + * @brief 获取文本阴影容器的大小。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @return int 返回文本阴影容器的大小。 + * @since 12 + * @version 1.0 + */ +int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); + +/** + * @brief 文本阴影容器中添加元素。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_TextShadow 指向OH_Drawing_TextShadow对象的指针,由{@link OH_Drawing_CreateTextShadow}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, OH_Drawing_TextShadow*); + +/** + * @brief 清除文本阴影容器中的所有元素。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*); + +/** + * @brief 根据下标获取文本阴影容器中的元素。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param int 下标索引。 + * @return 返回指向索引对应元素的指针,返回类型为{@link OH_Drawing_TextShadow}结构体。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextStyle*, int); + +/** + * @brief 设置排版缩进。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param int 排版缩进数量。 + * @param float 指向缩进类型的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographySetIndents(OH_Drawing_Typography*, int, const float indents[]); + +/** + * @brief 根据下标获取排版缩进容器中的元素。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param int 下标索引。 + * @return float 返回索引对应的元素值。 + * @since 12 + * @version 1.0 + */ +float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); + /** * @brief 获取行的边界。 * -- Gitee From 7f950c5814159e8a3d764ee145a746b803c9d5f4 Mon Sep 17 00:00:00 2001 From: li-kiao Date: Wed, 21 Feb 2024 08:36:35 +0000 Subject: [PATCH 0281/2135] =?UTF-8?q?Drawing=20C=20API=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-kiao --- zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h | 6 +++--- zh-cn/native_sdk/graphic/native_drawing/drawing_types.h | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index 2eb61977..9efd7f8f 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -149,7 +149,7 @@ void OH_Drawing_MatrixConcat(OH_Drawing_Matrix* total, const OH_Drawing_Matrix* float OH_Drawing_MatrixGetValue(OH_Drawing_Matrix*, int index); /** - * @brief 设置矩阵围绕位于(px, py)的旋转轴点进行旋转。 + * @brief 设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点进行旋转。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 @@ -162,7 +162,7 @@ float OH_Drawing_MatrixGetValue(OH_Drawing_Matrix*, int index); void OH_Drawing_MatrixRotate(OH_Drawing_Matrix*, float degree, float px, float py); /** - * @brief 将矩阵进行平移(dx, dy)。 + * @brief 设置矩阵为单位矩阵,并平移(dx, dy)。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 @@ -174,7 +174,7 @@ void OH_Drawing_MatrixRotate(OH_Drawing_Matrix*, float degree, float px, float p void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix*, float dx, float dy); /** - * @brief 设置矩阵围绕位于(px, py)的旋转轴点,以sx和sy进行缩放。 + * @brief 设置矩阵为单位矩阵,并围绕位于(px, py)的旋转轴点,以sx和sy进行缩放。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h index 26847f3e..695f8714 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_types.h @@ -101,7 +101,9 @@ typedef struct OH_Drawing_Point OH_Drawing_Point; * @version 1.0 */ typedef struct OH_Drawing_Point2D { + /** x轴坐标 */ float x; + /** y轴坐标 */ float y; } OH_Drawing_Point2D; @@ -112,8 +114,11 @@ typedef struct OH_Drawing_Point2D { * @version 1.0 */ typedef struct OH_Drawing_Point3D { + /** x轴坐标 */ float x; + /** y轴坐标 */ float y; + /** z轴坐标 */ float z; } OH_Drawing_Point3D; -- Gitee From 6af6c88051918de79295704bcabdb8e0507fe910 Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Wed, 21 Feb 2024 19:49:54 +0800 Subject: [PATCH 0282/2135] =?UTF-8?q?fix=20NDK=20C-API=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=AD=97=E7=AC=A6=E9=97=AE=E9=A2=98=20Signed-off-by:?= =?UTF-8?q?=20liyi0309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_node.h | 164 ++++++++++++++--------------- zh-cn/native_sdk/ace/native_type.h | 27 +++++ 2 files changed, 108 insertions(+), 83 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 785a1251..92346ffa 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -449,18 +449,17 @@ typedef enum { * * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n * .value[0].f32: 线性渐变的起始角度。0点方向顺时针旋转为正向角度,默认值:180; \n - * .value[1].i32:线性渐变的方向,设置angle后不生效。取值("left","top","right","bottom","left-top","left-bottom","right-top", \n - * "right-bottom","none", 默认值 "bottom"); \n - * .value[2].u32: 为渐变的颜色重复着色,默认值 false;如 "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true" 。 \n + * .value[1].i32:线性渐变的方向,设置angle后不生效。数据类型{@link ArkUI_LinearGridientDirection} \n + * .value[2].i32: 为渐变的颜色重复着色,默认值 false。 \n * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n * colors:渐变色颜色颜色。 \n * stops:渐变位置。 \n * size:颜色个数。 \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0].f32: 线性渐变的起始角度。0点方向顺时针旋转为正向角度,默认值:180;\n + * .value[0].f32: 线性渐变的起始角度。\n * .value[1].i32:线性渐变的方向,设置angle后不生效。\n - * .value[0].u32: 为渐变的颜色重复着色,默认值 false;\n + * .value[0].i32: 为渐变的颜色重复着色。\n * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n * colors:渐变色颜色颜色。 \n * stops:渐变位置。 \n @@ -470,7 +469,7 @@ typedef enum { * float stops[] = { 0.0, 0.5 }; * ArkUIColorStop colorStop = { colors, stops, 2 }; * ArkUI_ColorStop* ptr = &colorStop; - * ArkUI_NumberValue value[] = {{ .f32 = 60 } , { .i32 = left } , { .i32 = true }}; + * ArkUI_NumberValue value[] = {{ .f32 = 60 } , { .i32 = ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT } , { .i32 = true }}; * ArkUI_AttributeItem item = * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; * nativeNodeApi->setAttribute(nodeHandle, NODE_LINEAR_GRADIENT, &item); @@ -875,7 +874,7 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:阴影模糊半径,单位为vp;\n - * .value[1]?.i32:是否开启智能取色;\n + * .value[1].i32:是否开启智能取色;\n * .value[2].f32:阴影X轴偏移量,单位为vp;\n * .value[3].f32:阴影Y轴偏移量,单位为vp;\n * .value[4].i32:阴影类型{@link ArkUI_ShadowType},默认值为ARKUI_SHADOW_TYPE_COLOR;\n @@ -954,11 +953,11 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示模糊类型,取{@link ArkUI_BlurStyle}枚举值。\n - * .value[1]?.i32 表示深浅色模式,取{@link ArkUI_ColorMode}枚举值。\n - * .value[2]?.i32 表示取色模式,取{@link ArkUI_AdaptiveColor}枚举值。\n - * .value[3]?.f32 表示模糊效果程度,取[0.0,1.0]范围内的值。\n - * .value[4]?.f32 表示灰阶模糊起始边界。\n - * .value[5]?.f32 表示灰阶模糊终点边界。\n + * .value[1].i32 表示深浅色模式,取{@link ArkUI_ColorMode}枚举值。\n + * .value[2].i32 表示取色模式,取{@link ArkUI_AdaptiveColor}枚举值。\n + * .value[3].f32 表示模糊效果程度,取[0.0,1.0]范围内的值。\n + * .value[4].f32 表示灰阶模糊起始边界。\n + * .value[5].f32 表示灰阶模糊终点边界。\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -984,9 +983,9 @@ typedef enum { * .value[5]?.f32 表示中心点Z轴坐标的百分比位置,如0.2表示百分之20的位置,该属性覆盖value[2].f32,默认值:0.0f。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0]?.f32 表示中心点X轴坐标,单位为vp \n - * .value[1]?.f32 表示中心点Y轴坐标,单位为vp \n - * .value[2]?.f32 表示中心点Z轴坐标,单位为vp \n + * .value[0].f32 表示中心点X轴坐标,单位为vp \n + * .value[1].f32 表示中心点Y轴坐标,单位为vp \n + * .value[2].f32 表示中心点Z轴坐标,单位为vp \n * 注:如果设置坐标百分比位置,属性获取方法返回计算后的vp为单位的值。 * * @code {.cpp} @@ -1016,10 +1015,10 @@ typedef enum { * .value[0].f32 表示起终点的透明度值 \n * .value[1].i32 表示动画时长,单位ms \n * .value[2].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值 \n - * .value[3]?.i32 表示动画延迟时长,单位ms \n - * .value[4]?.i32 表示动画播放次数 \n - * .value[5]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值 \n - * .value[6]?.f32 表示动画播放速度 \n + * .value[3].i32 表示动画延迟时长,单位ms \n + * .value[4].i32 表示动画播放次数 \n + * .value[5].i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值 \n + * .value[6].f32 表示动画播放速度 \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -1057,10 +1056,10 @@ typedef enum { * .value[4].f32 表示视距。\n * .value[5].i32 表示动画时长,单位ms。\n * .value[6].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n - * .value[7]?.i32 表示动画延迟时长,单位ms。\n - * .value[8]?.i32 表示动画播放次数。\n - * .value[9]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n - * .value[10]?.f32 表示动画播放速度。\n + * .value[7].i32 表示动画延迟时长,单位ms。\n + * .value[8].i32 表示动画播放次数。\n + * .value[9].i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * .value[10].f32 表示动画播放速度。\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -1094,10 +1093,10 @@ typedef enum { * .value[2].f32 竖向放大倍数。\n * .value[3].i32 表示动画时长,单位ms。\n * .value[4].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n - * .value[5]?.i32 表示动画延迟时长,单位ms。\n - * .value[6]?.i32 表示动画播放次数。\n - * .value[7]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n - * .value[8]?.f32 表示动画播放速度。\n + * .value[5].i32 表示动画延迟时长,单位ms。\n + * .value[6].i32 表示动画播放次数。\n + * .value[7].i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * .value[8].f32 表示动画播放速度。\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -1131,10 +1130,10 @@ typedef enum { * value[2].f32 表示竖向平移距离值,单位为vp \n * value[3].i32 表示动画时长,单位ms。\n * value[4].i32 表示动画曲线类型,取{@link ArkUI_AnimationCurve}枚举值。\n - * value[5]?.i32 表示动画延迟时长,单位ms。\n - * value[6]?.i32 表示动画播放次数。\n - * value[7]?.i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n - * value[8]?.f32 表示动画播放速度。\n + * value[5].i32 表示动画延迟时长,单位ms。\n + * value[6].i32 表示动画播放次数。\n + * value[7].i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n + * value[8].f32 表示动画播放速度。\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -1242,10 +1241,10 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .string 遮罩文本; \n - * .value[0]?.i32:可选值,浮层相对于组件的位置,参数类型{@link ArkUI_Alignment}, + * .value[0].i32:浮层相对于组件的位置,参数类型{@link ArkUI_Alignment}, * 默认值为ARKUI_ALIGNMENT_TOP_START。 \n - * .value[1]?.f32:可选值,浮层基于自身左上角的偏移量X,单位为vp。 \n - * .value[2]?.f32:可选值,浮层基于自身左上角的偏移量Y,单位为vp。 + * .value[1].f32:浮层基于自身左上角的偏移量X,单位为vp。 \n + * .value[2].f32:浮层基于自身左上角的偏移量Y,单位为vp。 * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -1275,12 +1274,12 @@ typedef enum { * size:颜色个数。 \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0]?.f32:为角度渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标 \n - * .value[1]?.f32:为角度渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标 \n - * .value[2]?.f32:角度渐变的起点,默认值0。 \n - * .value[3]?.f32:角度渐变的终点,默认值0。 \n - * .value[4]?.f32:角度渐变的旋转角度,默认值0。 \n - * .value[5]?.i32:为渐变的颜色重复着色,0表示不重复着色,1表示重复着色 \n + * .value[0].f32:为角度渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标 \n + * .value[1].f32:为角度渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标 \n + * .value[2].f32:角度渐变的起点,默认值0。 \n + * .value[3].f32:角度渐变的终点,默认值0。 \n + * .value[4].f32:角度渐变的旋转角度,默认值0。 \n + * .value[5].i32:为渐变的颜色重复着色,0表示不重复着色,1表示重复着色 \n * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n * colors:渐变色颜色颜色。 \n * stops:渐变位置。 \n @@ -1323,10 +1322,10 @@ typedef enum { * size:颜色个数。 \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0]?.f32:为径向渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标 \n - * .value[1]?.f32:为径向渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标 \n - * .value[2]?.f32:径向渐变的半径,默认值0。 \n - * .value[3]?.i32:为渐变的颜色重复着色,0表示不重复着色,1表示重复着色 \n + * .value[0].f32:为径向渐变的中心点,即相对于当前组件左上角的坐标,X轴坐标 \n + * .value[1].f32:为径向渐变的中心点,即相对于当前组件左上角的坐标,Y轴坐标 \n + * .value[2].f32:径向渐变的半径,默认值0。 \n + * .value[3].i32:为渐变的颜色重复着色,0表示不重复着色,1表示重复着色 \n * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n * colors:渐变色颜色颜色。 \n * stops:渐变位置。 \n @@ -1711,20 +1710,20 @@ typedef enum { * .value[13]?.f32 垂直方向的bias值。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0]?.i32 左对齐规则锚点组件id。\n - * .value[1]?.i32 左对齐规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n - * .value[2]?.i32 横向居中规则锚点组件id。\n - * .value[3]?.i32 横向居中规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n - * .value[4]?.i32 右对齐规则锚点组件id。\n - * .value[5]?.i32 右对齐规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n - * .value[6]?.i32 顶部对齐规则锚点组件id。\n - * .value[7]?.i32 顶部对齐规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n - * .value[8]?.i32 纵向居中规则锚点组件id。\n - * .value[9]?.i32 纵向居中规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n - * .value[10]?.i32 底部对齐规则锚点组件id。\n - * .value[11]?.i32 底部对齐规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n - * .value[12]?.f32 水平方向的bias值。\n - * .value[13]?.f32 垂直方向的bias值。\n + * .value[0].i32 左对齐规则锚点组件id。\n + * .value[1].i32 左对齐规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[2].i32 横向居中规则锚点组件id。\n + * .value[3].i32 横向居中规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[4].i32 右对齐规则锚点组件id。\n + * .value[5].i32 右对齐规则相对锚点组件的对齐方式,取{@link ArkUI_HorizontalAlignment}枚举值。\n + * .value[6].i32 顶部对齐规则锚点组件id。\n + * .value[7].i32 顶部对齐规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[8].i32 纵向居中规则锚点组件id。\n + * .value[9].i32 纵向居中规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[10].i32 底部对齐规则锚点组件id。\n + * .value[11].i32 底部对齐规则相对锚点组件的对齐方式,取{@link ArkUI_VerticalAlignment}枚举值。\n + * .value[12].f32 水平方向的bias值。\n + * .value[13].f32 垂直方向的bias值。\n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -2327,11 +2326,11 @@ typedef enum { * 默认值为ARKUI_FONT_STYLE_NORMAL。 * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .string?:可选值 字体列表,使用多个字体,使用','进行分割。 \n + * .string:字体列表,使用多个字体,使用','进行分割。 \n * .value[0].f32:文本尺寸 单位FP。 \n - * .value[1]?.i32:可选值,文本的字体粗细,参数类型{@link ArkUI_FontWeight}。 + * .value[1].i32:文本的字体粗细,参数类型{@link ArkUI_FontWeight}。 * 默认值为ARKUI_FONT_WEIGHT_NORMAL。 \n - * .value[2]?.i32:可选值,字体样式,参数类型{@link ArkUI_FontStyle}。 + * .value[2].i32:字体样式,参数类型{@link ArkUI_FontStyle}。 * 默认值为ARKUI_FONT_STYLE_NORMAL。 * * @code {.c} @@ -3307,8 +3306,8 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].u32:边框颜色, 类型为0xargb,如0xFF1122FF;\n - * .value[1]?.f32:可选,内部图标大小,单位vp;\n - * .value[2]?.f32:可选,内部图标粗细,单位vp,默认值2。\n + * .value[1].f32:内部图标大小,单位vp;\n + * .value[2].f32:内部图标粗细,单位vp,默认值2。\n * * @code {.c} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -3913,14 +3912,14 @@ typedef enum { * @brief 设置日历选择选中日期的参数,支持属性设置,属性重置和属性获取接口。 * * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[1].u32: 选中的年。\n - * .value[2].u32: 选中的月。\n - * .value[3].u32: 选中的日。\n + * .value[0].u32: 选中的年。\n + * .value[1].u32: 选中的月。\n + * .value[2].u32: 选中的日。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[1].u32: 选中的年。\n - * .value[2].u32: 选中的月。\n - * .value[3].u32: 选中的日。\n + * .value[0].u32: 选中的年。\n + * .value[1].u32: 选中的月。\n + * .value[2].u32: 选中的日。\n * * @code {.cpp} * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; @@ -3941,8 +3940,8 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 对齐方式类型,参数类型{@link ArkUI_CalendarAlignment}。\n - * .value[1]?.f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n - * .value[2]?.f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n + * .value[1].f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n + * .value[2].f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n * * @code {.cpp} * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGNMENT_END) }, 10.0f, 0.0f }; @@ -3962,9 +3961,9 @@ typedef enum { * .value[2]?.i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0]?.u32: 入口区的文本颜色。\n - * .value[1]?.f32: 入口区的文本字号,单位为fp。\n - * .value[2]?.i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n + * .value[0].u32: 入口区的文本颜色。\n + * .value[1].f32: 入口区的文本字号,单位为fp。\n + * .value[2].i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n * * @code {.cpp} * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = @@ -4395,7 +4394,7 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 边缘滑动效果,参数类型{@link ArkUI_EdgeEffect};\n - * .value[1]?.i32: 可选值,组件内容大小小于组件自身时,设置是否开启滑动效果,开启为1,关闭为0。\n + * .value[1].i32: 组件内容大小小于组件自身时,设置是否开启滑动效果,开启为1,关闭为0。\n * * @code {.cpp} * ArkUI_NumberValue value[] = { { .i32 = ARKUI_EDGE_EFFECT_NONE }, { .i32 = 1 } }; @@ -5051,11 +5050,11 @@ typedef enum { * .value[4]?.i32: 交叉轴中有额外的空间时,多行内容的对齐方式{@link ArkUI_FlexAlignment},默认值为ARKUI_FLEX_ALIGNMENT_START; \n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0]?.i32:子组件在Flex容器上排列的方向的枚举值; \n - * .value[1]?.i32:排列规则的枚举值; \n - * .value[2]?.i32:主轴上的对齐格式的枚举值; \n - * .value[3]?.i32:交叉轴上的对齐格式的枚举值; \n - * .value[4]?.i32: 交叉轴中有额外的空间时,多行内容的对齐方式的枚举值; \n + * .value[0].i32:子组件在Flex容器上排列的方向的枚举值; \n + * .value[1].i32:排列规则的枚举值; \n + * .value[2].i32:主轴上的对齐格式的枚举值; \n + * .value[3].i32:交叉轴上的对齐格式的枚举值; \n + * .value[4].i32: 交叉轴中有额外的空间时,多行内容的对齐方式的枚举值; \n * * @code {.cpp} * ArkUI_NativeNodeAPI_1* nativeNodeApi = @@ -5328,9 +5327,8 @@ typedef enum { * * 触发该事件的条件 :选择时间时触发该事件。\n * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n - * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n - * ArkUI_NodeComponentEvent.data[0].i32表示 选中时间的时,取值范围:[0-23]。\n - * ArkUI_NodeComponentEvent.data[1].i32表示 选中时间的分,取值范围:[0-59]。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0...11].i32表示选中数据的维度。\n */ NODE_TEXT_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index 24547229..e68677ab 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -1140,6 +1140,33 @@ typedef enum { /** 路径类型。 */ ARKUI_SHAPE_TYPE_PATH, } ArkUI_ShapeType; + +/** + * @brief 定义渐变方向结构。 + * + * @since 12 + */ +typedef enum { + /** 向左渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT = 0, + /** 向上渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_TOP, + /** 向右渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT, + /** 向下渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_BOTTOM, + /** 向左上渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT_TOP, + /** 向左下渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT_BOTTOM, + /** 向右上渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT_TOP, + /** 向右下渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT_BOTTOM, + /** 不渐变。 */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_NONE, +} ArkUI_LinearGridientDirection; + #ifdef __cplusplus }; #endif -- Gitee From c65ab887ba62269b05338163b52685f53d2fb227 Mon Sep 17 00:00:00 2001 From: 18721213663 Date: Tue, 20 Feb 2024 21:51:15 +0800 Subject: [PATCH 0283/2135] add_ndk Signed-off-by: 18721213663 --- .../environment/oh_environment.h | 22 +++++++++---------- .../filemanagement/fileio/error_code.h | 6 ++--- .../filemanagement/fileio/oh_fileio.h | 6 ++--- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/zh-cn/native_sdk/filemanagement/environment/oh_environment.h b/zh-cn/native_sdk/filemanagement/environment/oh_environment.h index 2f00ffab..b94e4258 100644 --- a/zh-cn/native_sdk/filemanagement/environment/oh_environment.h +++ b/zh-cn/native_sdk/filemanagement/environment/oh_environment.h @@ -27,8 +27,6 @@ * * @brief environment模块接口定义,使用environment提供的native接口,获取公共文件根目录的沙箱路径。 * - * 注意:使用environment模块需设备具有以下syscap:SystemCapability.FileManagement.File.Environment.FolderObtain。 - * * @library libohenvironment.so * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain * @since 12 @@ -42,9 +40,9 @@ extern "C" { /** * @brief 获取Download根目录沙箱路径。 * - * @permission 调用此接口需要请求权限:ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY。 - * @param result Download根目录路径指针。请使用free()进行资源释放。 - * @return 返回FileManageMent模块错误码。 + * @permission ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY。 + * @param result Download根目录路径指针。请引用头文件malloc.h并使用free()进行资源释放。 + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 * @since 12 */ FileManagement_ErrCode OH_Environment_GetUserDownloadDir(char **result); @@ -52,9 +50,9 @@ FileManagement_ErrCode OH_Environment_GetUserDownloadDir(char **result); /** * @brief 获取Desktop根目录沙箱路径。 * - * @permission 调用此接口需要请求权限:ohos.permission.READ_WRITE_DESKTOP_DIRECTORY。 - * @param result Desktop根目录路径指针。请使用free()进行资源释放。 - * @return 返回FileManageMent模块错误码。 + * @permission ohos.permission.READ_WRITE_DESKTOP_DIRECTORY。 + * @param result Desktop根目录路径指针。请引用头文件malloc.h并使用free()进行资源释放。 + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 * @since 12 */ FileManagement_ErrCode OH_Environment_GetUserDesktopDir(char **result); @@ -62,9 +60,9 @@ FileManagement_ErrCode OH_Environment_GetUserDesktopDir(char **result); /** * @brief 获取Document根目录沙箱路径。 * - * @permission 调用此接口需要请求权限:ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY - * @param result Document根目录路径指针。请使用free()进行资源释放。 - * @return 返回FileManageMent模块错误码。 + * @permission ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY + * @param result Document根目录路径指针。请引用头文件malloc.h并使用free()进行资源释放。 + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 * @since 12 */ FileManagement_ErrCode OH_Environment_GetUserDocumentDir(char **result); @@ -73,4 +71,4 @@ FileManagement_ErrCode OH_Environment_GetUserDocumentDir(char **result); }; #endif -#endif //FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H +#endif // FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H diff --git a/zh-cn/native_sdk/filemanagement/fileio/error_code.h b/zh-cn/native_sdk/filemanagement/fileio/error_code.h index 8b4c19c7..38d9b298 100644 --- a/zh-cn/native_sdk/filemanagement/fileio/error_code.h +++ b/zh-cn/native_sdk/filemanagement/fileio/error_code.h @@ -20,7 +20,7 @@ * @addtogroup FileIO * @{ * - * @brief 提供文件管理模块的错误码定义。 + * @brief 提供文件基础操作的能力。 * @since 12 */ @@ -50,7 +50,7 @@ typedef enum FileManagement_ErrCode { */ ERR_PERMISSION_ERROR = 201, /** - * 设备不具备此接口所需syscap。 + * 当前设备不支持此接口。 */ ERR_DEVICE_NOT_SUPPORTED = 801, /** @@ -62,7 +62,7 @@ typedef enum FileManagement_ErrCode { */ ERR_ENOENT = 13900002, /** - * 内存不足。 + * 内存溢出。 */ ERR_ENOMEM = 139000011, /** diff --git a/zh-cn/native_sdk/filemanagement/fileio/oh_fileio.h b/zh-cn/native_sdk/filemanagement/fileio/oh_fileio.h index 9a37f40a..8858b772 100644 --- a/zh-cn/native_sdk/filemanagement/fileio/oh_fileio.h +++ b/zh-cn/native_sdk/filemanagement/fileio/oh_fileio.h @@ -18,7 +18,7 @@ /** * @addtogroup FileIO * - * @brief 提供基础文件操作的能力。 + * @brief 提供文件基础操作的能力。 * @since 12 */ @@ -62,7 +62,7 @@ typedef enum FileIO_FileLocation { * @param uri 指向入参uri的指针。 * @param uriLength 入参uri字符串的长度。 * @param location 输出文件存储位置的指针。 - * @return 返回FileManageMent模块错误码。 + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 * @since 12 */ FileManagement_ErrCode OH_FileIO_GetFileLocation(char *uri, int uriLength, @@ -72,4 +72,4 @@ FileManagement_ErrCode OH_FileIO_GetFileLocation(char *uri, int uriLength, }; #endif -#endif //FILE_MANAGEMENT_FILEIO_OH_FILEIO_H +#endif // FILE_MANAGEMENT_FILEIO_OH_FILEIO_H -- Gitee From b8f6b0a9af1ec0347a4b04ee40be91b64e0b3fd2 Mon Sep 17 00:00:00 2001 From: han <2281542033@qq.com> Date: Thu, 18 Jan 2024 19:25:00 +0800 Subject: [PATCH 0284/2135] run evn Signed-off-by: anluohan --- .../ability/ability_runtime/native_rumtime.h | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 zh-cn/native_sdk/ability/ability_runtime/native_rumtime.h diff --git a/zh-cn/native_sdk/ability/ability_runtime/native_rumtime.h b/zh-cn/native_sdk/ability/ability_runtime/native_rumtime.h new file mode 100644 index 00000000..b22e4c6f --- /dev/null +++ b/zh-cn/native_sdk/ability/ability_runtime/native_rumtime.h @@ -0,0 +1,74 @@ +/* + * 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 Ability_Runtime + * @{ + * + * @brief 提供应用基础运行时环境。 + + * + * @since 12 + * @version 1.0 + */ + +/** + * @file native_rumtime.h + * + * @brief 提供应用创建和销毁运行时环境的接口 + * + * @library libruntime_ndk.z.so + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @since 12 + * @version 1.0 + */ +#ifndef ABILITY_ABILITY_RUNTIME_NATIVE_RUNTIME_H +#define ABILITY_ABILITY_RUNTIME_NATIVE_RUNTIME_H + +#include +#include "napi/native_api.h" +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief 创建基础运行时环境。 + * + * @param env: 基础运行时环境。 + * @return 0 - 成功。 + * 1 - 超出最大运行时环境数量上限。 + * 2 - 一个线程只允许创建一个运行时环境。 + * 3 - 内部错误。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeAbility_Create_NapiEnv(napi_env *env); + + +/** + * @brief 销毁基础运行时环境。 + * + * @param env: 基础运行时环境。 + * @return 0 - 成功。 + * 4 - 销毁失败。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeAbility_Destroy_NapiEnv(napi_env *env); + +#ifdef __cplusplus +}; +#endif +/** @} */ +#endif // ABILITY_ABILITY_RUNTIME_NATIVE_RUNTIME_H \ No newline at end of file -- Gitee From 80377395b06229afefb784b52b813a20e7f72b1e Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 22 Feb 2024 03:28:37 +0000 Subject: [PATCH 0285/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_font.h | 80 ++++++++-- .../native_drawing/drawing_text_typography.h | 151 +++++++++--------- 2 files changed, 140 insertions(+), 91 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index 707dedb5..69213a25 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -153,37 +153,85 @@ void OH_Drawing_FontDestroy(OH_Drawing_Font*); * @version 1.0 */ typedef struct OH_Drawing_Font_Metrics { - /** 指示哪些度量是有效的 */ + /** + * @brief 指示哪些度量是有效的 + * @since_2013 12 + */ uint32_t fFlags; - /** 字符最高点到基线的最大距离 */ + /** + * @brief 字符最高点到基线的最大距离 + * @since_2013 12 + */ float top; - /** 字符最高点到基线的推荐距离 */ + /** + * @brief 字符最高点到基线的推荐距离 + * @since_2013 12 + */ float ascent; - /** 字符最低点到基线的推荐距离 */ + /** + * @brief 字符最低点到基线的推荐距离 + * @since_2013 12 + */ float descent; - /** 字符最低点到基线的最大距离 */ + /** + * @brief 字符最低点到基线的最大距离 + * @since_2013 12 + */ float bottom; - /** 行间距 */ + /** + * @brief 行间距 + * @since_2013 12 + */ float leading; - /** 平均字符宽度,如果未知则为零 */ + /** + * @brief 平均字符宽度,如果未知则为零 + * @since_2013 12 + */ float avgCharWidth; - /** 最大字符宽度,如果未知则为零 */ + /** + * @brief 最大字符宽度,如果未知则为零 + * @since_2013 12 + */ float maxCharWidth; - /** 任何字形边界框原点左侧的最大范围,通常为负值;不推荐使用可变字体 */ + /** + * @brief 任何字形边界框原点左侧的最大范围,通常为负值;不推荐使用可变字体 + * @since_2013 12 + */ float xMin; - /** 任何字形边界框原点右侧的最大范围,通常为负值;不推荐使用可变字体 */ + /** + * @brief 任何字形边界框原点右侧的最大范围,通常为负值;不推荐使用可变字体 + * @since_2013 12 + */ float xMax; - /** 小写字母“x”的高度,如果未知则为零,通常为负数 */ + /** + * @brief 小写字母的高度,如果未知则为零,通常为负数 + * @since_2013 12 + */ float xHeight; - /** 大写字母的高度,如果未知则为零,通常为负数 */ + /** + * @brief 大写字母的高度,如果未知则为零,通常为负数 + * @since_2013 12 + */ float capHeight; - /** 下划线粗细 */ + /** + * @brief 下划线粗细 + * @since_2013 12 + */ float underlineThickness; - /** 表示下划线的位置,即从基线到文字下方笔画顶部的垂直距离,通常为正值。 */ + /** + * @brief 表示下划线的位置,即从基线到文字下方笔画顶部的垂直距离,通常为正值。 + * @since_2013 12 + */ float underlinePosition; - /** 删除线粗细 */ + /** + * @brief 删除线粗细 + * @since_2013 12 + */ float strikeoutThickness; - /** 表示删除线的位置,即从基线到文字上方笔画底部的垂直距离,通常为负值。 */ + /** + * @brief 表示删除线的位置,即从基线到文字上方笔画底部的垂直距离,通常为负值。 + * @since_2013 12 + */ float strikeoutPosition; } OH_Drawing_Font_Metrics; diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 6e5d2628..22c2c846 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -289,15 +289,15 @@ typedef enum OH_Drawing_RectWidthStyle { } OH_Drawing_RectWidthStyle; /** - * @brief 描述字体的详细信息。 + * @brief 描述系统字体详细信息的结构体。 * * @since 12 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_FontDescriptor { /** 系统字体的文件路径 */ char* path; - /** 系统字体的postScript名称 */ + /** 按PostScript页面描述语言(PDL)规则定义的系统字体名称 */ char* postScriptName; /** 系统字体的名称 */ char* fullName; @@ -318,15 +318,15 @@ typedef struct { } OH_Drawing_FontDescriptor; /** - * @brief 文字行位置信息 + * @brief 文字行位置信息。 * * @since 12 * @version 1.0 */ -typedef struct { - /** 文字ascender高度 */ +typedef struct OH_Drawing_LineMetrics { + /** 文字相对于基线以上的高度 */ double ascender; - /** 文字descender高度 */ + /** 文字相对于基线以下的高度 */ double descender; /** 大写字母的高度 */ double capHeight; @@ -394,7 +394,7 @@ void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Dr * @brief 获取文字对齐方式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @return 返回文字对齐方式。 * @since 12 * @version 1.0 @@ -426,8 +426,8 @@ OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); * @brief 获取字体风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 - * @return 返回文本类型。返回类型为{@link OH_Drawing_TextStyle}结构体 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_CreateTypographyStyle}对象的指针,由OH_Drawing_TypographyStyle获取。 + * @return 返回字体风格。返回类型为{@link OH_Drawing_TextStyle}结构体。 * @since 12 * @version 1.0 */ @@ -560,8 +560,8 @@ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); * @brief 设置前景色画刷。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Brush 指向OH_Drawing_Brush对象的指针,由{@link OH_Drawing_Brush}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由OH_Drawing_Brush获取。 * @since 12 * @version 1.0 */ @@ -571,8 +571,8 @@ void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * @brief 返回设置的前景色画刷。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Brush 指向OH_Drawing_Brush对象的指针,由{@link OH_Drawing_Brush}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由OH_Drawing_Brush获取。 * @since 12 * @version 1.0 */ @@ -582,8 +582,8 @@ void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * @brief 设置前景色画笔。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Pen 指向OH_Drawing_Pen对象的指针,由{@link OH_Drawing_Pen}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由OH_Drawing_Pen获取。 * @since 12 * @version 1.0 */ @@ -593,8 +593,8 @@ void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * @brief 返回设置的前景色画笔。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Pen 指向OH_Drawing_Pen对象的指针,由{@link OH_Drawing_Pen}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由OH_Drawing_Pen获取。 * @since 12 * @version 1.0 */ @@ -604,8 +604,8 @@ void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * @brief 设置背景色画刷。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Brush 指向OH_Drawing_Brush对象的指针,由{@link OH_Drawing_Brush}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由OH_Drawing_Brush获取。 * @since 12 * @version 1.0 */ @@ -615,8 +615,8 @@ void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * @brief 返回设置的背景色画刷。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Brush 指向OH_Drawing_Brush对象的指针,由{@link OH_Drawing_Brush}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由OH_Drawing_Brush获取。 * @since 12 * @version 1.0 */ @@ -626,8 +626,8 @@ void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * @brief 设置背景色画笔。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Pen 指向OH_Drawing_Pen对象的指针,由{@link OH_Drawing_Pen}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由OH_Drawing_Pen获取。 * @since 12 * @version 1.0 */ @@ -637,8 +637,8 @@ void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * @brief 返回设置的背景色画笔。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Pen 指向OH_Drawing_Pen对象的指针,由{@link OH_Drawing_Pen}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由OH_Drawing_Pen获取。 * @since 12 * @version 1.0 */ @@ -1162,7 +1162,7 @@ void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int) * @brief 设置省略号样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_CreateTypographyStyle}的指针,由OH_Drawing_TypographyStyle获取。 * @param char 省略号样式。 * @since 12 * @version 1.0 @@ -1197,7 +1197,7 @@ double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); * @brief 设置文本划分比率。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param float 文本划分比率。 * @since 12 * @version 1.0 @@ -1208,7 +1208,7 @@ void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle* style, f * @brief 获取文本是否有最大行数限制。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 * @return 返回文本是否有最大行数限制,true表示有最大行数限制,false表示无最大行数限制。 * @since 12 * @version 1.0 @@ -1219,7 +1219,7 @@ bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle* style); * @brief 获取文本是否有省略号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 * @return 返回文本是否有省略号,true表示有省略号,false表示无省略号。 * @since 12 * @version 1.0 @@ -1230,7 +1230,7 @@ bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle* style); * @brief 设置文本位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param char 文本位置。 * @since 12 * @version 1.0 @@ -1241,8 +1241,8 @@ void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const * @brief 获取文本字体属性。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Typography 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}的指针,由OH_Drawing_CreateTypography获取。 * @return 返回文本字体属性。 * @since 12 * @version 1.0 @@ -1253,8 +1253,8 @@ OH_Drawing_Font_Metrics* OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_TextStyle * @brief 设置文本类型。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 - * @param OH_Drawing_TextStyle 指向文本类型OH_Drawing_TextStyle的指针。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 * @since 12 * @version 1.0 */ @@ -1264,7 +1264,7 @@ void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*,OH_Drawing_Te * @brief 构造OH_Drawing_FontDescriptor对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 返回指向已创建的OH_Drawing_FontDescriptor对象的指针。 + * @return 返回指向已创建的字体描述{@link OH_Drawing_FontDescriptor}对象的指针。 * @since 12 * @version 1.0 */ @@ -1274,7 +1274,7 @@ OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); * @brief 释放OH_Drawing_FontDescriptor对象占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontDescriptor 指向OH_Drawing_FontDescriptor对象的指针。 +* @param OH_Drawing_FontDescriptor 指向{@link OH_Drawing_FontDescriptor}对象的指针,由OH_Drawing_FontDescriptor获取。 * @since 12 * @version 1.0 */ @@ -1284,7 +1284,7 @@ void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); * @brief 构造OH_Drawing_FontDescriptor对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 返回指向已创建的OH_Drawing_FontParser对象的指针。 + * @return 返回指向已创建的字体解析{@link OH_Drawing_FontParser}对象的指针。 * @since 12 * @version 1.0 */ @@ -1294,7 +1294,7 @@ OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void); * @brief 释放OH_Drawing_FontParser对象占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser 指向OH_Drawing_FontParser对象的指针。 + * @param OH_Drawing_FontParser 指向字体解析{@link OH_Drawing_FontParser}对象的指针,由OH_Drawing_FontParser获取。 * @since 12 * @version 1.0 */ @@ -1304,7 +1304,7 @@ void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser*); * @brief 获取系统字体名称列表。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser 指向OH_Drawing_FontParser对象的指针。 + * @param OH_Drawing_FontParser 指向字体解析{@link OH_Drawing_FontParser}对象的指针,由OH_Drawing_FontParser获取。 * @param size_t 返回获取到的系统字体名称数量。 * @return 返回获取到的系统字体列表。 * @since 12 @@ -1327,7 +1327,7 @@ void OH_Drawing_DestroySystemFontList(char**, size_t); * @brief 根据传入的系统字体名称获取系统字体的相关信息。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser 指向OH_Drawing_FontParser对象的指针。 + * @param OH_Drawing_FontParser 指向字体解析{@link OH_Drawing_FontParser}对象的指针,由OH_Drawing_FontParser获取。 * @param char* 系统字体名。 * @return Returns system fonts. * @since 12 @@ -1339,7 +1339,7 @@ OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontPar * @brief 获取行度量信息。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 * @return 返回指向OH_Drawing_LineMetrics对象的指针。 * @since 12 * @version 1.0 @@ -1350,7 +1350,7 @@ OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typograph * @brief 获取行数量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_LineMetrics 指向OH_Drawing_LineMetrics对象的指针。 + * @param OH_Drawing_LineMetrics 指向行度量{@link OH_Drawing_LineMetrics}对象的指针,由OH_Drawing_LineMetrics获取。 * @return 返回行数量。 * @since 12 * @version 1.0 @@ -1361,7 +1361,7 @@ size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics*); * @brief 释放行度量占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_LineMetrics 指向OH_Drawing_LineMetrics对象的指针。 + * @param OH_Drawing_LineMetrics 指向行度量{@link OH_Drawing_LineMetrics}对象的指针,由OH_Drawing_LineMetrics获取。 * @since 12 * @version 1.0 */ @@ -1371,7 +1371,7 @@ void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); * @brief 获取指定行度量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针。 + * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 * @param int 要获取的行数。 * @return 返回获取到的指定行度量信息。 * @since 12 @@ -1383,21 +1383,22 @@ OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typogra * @brief 获取指定行的位置信息或指定行第一个字符的位置信息 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @param int 行号 - * @param bool true为获取整行的位置信息,false为获取第一个字符的位置信息 - * @param bool 文字宽度是否包含空白符 + * @param OH_Drawing_Typography 指向文本OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param int 行号。 + * @param bool true为获取整行的位置信息,false为获取第一个字符的位置信息。 + * @param bool 文字宽度是否包含空白符。 * @param OH_Drawing_LineMetrics 指向OH_Drawing_LineMetrics对象的指针。 + * @return 信息是否成功获取。 * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, OH_Drawing_LineMetrics*); +bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, OH_Drawing_LineMetrics*); /** * @brief 设置文本排版字重。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param int 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, * 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见{@link OH_Drawing_FontWeight}枚举。 * @since 12 @@ -1409,7 +1410,7 @@ void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int); * @brief 设置文本排版风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param int 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见{@link OH_Drawing_FontStyle}枚举。 * @since 12 * @version 1.0 @@ -1420,7 +1421,7 @@ void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle*, int); * @brief 设置文本排版字体类型。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param char 字体类型,数据类型为指向char的指针。 * @since 12 * @version 1.0 @@ -1431,7 +1432,7 @@ void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle*, const c * @brief 设置文本排版字号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param double 字号。 * @since 12 * @version 1.0 @@ -1442,7 +1443,7 @@ void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); * @brief 设置文本排版字体高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param double 字体高度。 * @since 12 * @version 1.0 @@ -1453,7 +1454,7 @@ void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle*, double) * @brief 设置文本排版为一半行间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效。 * @since 12 * @version 1.0 @@ -1464,7 +1465,7 @@ void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle*, bool); * @brief 设置文本排版是否启用行样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param bool 设置行样式是否启用,true表示启用,false表示不启用 * @since 12 * @version 1.0 @@ -1475,7 +1476,7 @@ void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle*, bool) * @brief 设置文本排版行样式字重。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param int 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, * 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见{@link OH_Drawing_FontWeight}枚举。 * @since 12 @@ -1487,7 +1488,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle* * @brief 设置文本排版行样式风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param int 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见{@link OH_Drawing_FontStyle}枚举。 * @since 12 * @version 1.0 @@ -1498,7 +1499,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, * @brief 设置文本排版行样式字体类型。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param int 字体名称数量。 * @param char 指向字体类型的指针。 * @since 12 @@ -1511,7 +1512,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyl * @brief 设置文本排版行样式字号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param double 字号。 * @since 12 * @version 1.0 @@ -1522,7 +1523,7 @@ void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); * @brief 设置文本排版行样式字体高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param double 字体高度。 * @since 12 * @version 1.0 @@ -1533,7 +1534,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle* * @brief 设置文本排版行样式为一半行间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效。 * @since 12 * @version 1.0 @@ -1544,7 +1545,7 @@ void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle * @brief 设置文本排版行样式间距比例。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param double 间距比例。 * @since 12 * @version 1.0 @@ -1555,7 +1556,7 @@ void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyl * @brief 设置文本排版是否仅启用行样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向OH_Drawing_TypographyStyle对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 * @param bool 设置仅启用行样式是否生效,true表示生效,false表示不生效。 * @since 12 * @version 1.0 @@ -1576,7 +1577,7 @@ OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); * @brief 释放被OH_Drawing_TextShadow对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextShadow 指向OH_Drawing_TextShadow对象的指针,由{@link OH_Drawing_CreateTextShadow}获取。 + * @param OH_Drawing_TextShadow 指向字体阴影{@link OH_Drawing_CreateTextShadow}对象的指针,由OH_Drawing_TextShadow获取。 * @since 12 * @version 1.0 */ @@ -1586,7 +1587,7 @@ void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow*); * @brief 获取文本阴影容器。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 * @return 返回指向容器的指针,返回类型为{@link OH_Drawing_TextShadow}结构体。 * @since 12 * @version 1.0 @@ -1597,7 +1598,7 @@ OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*); * @brief 获取文本阴影容器的大小。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 * @return int 返回文本阴影容器的大小。 * @since 12 * @version 1.0 @@ -1608,8 +1609,8 @@ int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); * @brief 文本阴影容器中添加元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_TextShadow 指向OH_Drawing_TextShadow对象的指针,由{@link OH_Drawing_CreateTextShadow}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 + * @param OH_Drawing_TextShadow 指向字体阴影{@link OH_Drawing_CreateTextShadow}对象的指针,由OH_Drawing_TextShadow获取。 * @since 12 * @version 1.0 */ @@ -1619,7 +1620,7 @@ void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, OH_Drawing_TextShadow* * @brief 清除文本阴影容器中的所有元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 * @since 12 * @version 1.0 */ @@ -1629,7 +1630,7 @@ void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*); * @brief 根据下标获取文本阴影容器中的元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向OH_Drawing_TextStyle对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 * @param int 下标索引。 * @return 返回指向索引对应元素的指针,返回类型为{@link OH_Drawing_TextShadow}结构体。 * @since 12 @@ -1641,7 +1642,7 @@ OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextSty * @brief 设置排版缩进。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 * @param int 排版缩进数量。 * @param float 指向缩进类型的指针。 * @since 12 @@ -1653,7 +1654,7 @@ void OH_Drawing_TypographySetIndents(OH_Drawing_Typography*, int, const float in * @brief 根据下标获取排版缩进容器中的元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 * @param int 下标索引。 * @return float 返回索引对应的元素值。 * @since 12 @@ -1665,7 +1666,7 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); * @brief 获取行的边界。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 * @param int 行索引 * @param bool 设置返回的边界是否包含空格,true为包含空格,false为不包含空格。 * @return 返回行边界,返回类型为{@link OH_Drawing_Range}结构体。 -- Gitee From b6ca42d0f7f727649bb6cd8239e3c194687b39e9 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Thu, 22 Feb 2024 11:20:40 +0800 Subject: [PATCH 0286/2135] [NDK] remove code Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- zh-cn/native_sdk/ace/native_node.h | 2044 +--------------------------- 1 file changed, 39 insertions(+), 2005 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 92346ffa..f6516596 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -139,15 +139,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:宽度数值,单位为vp;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 1.2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_WIDTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_WIDTH); - * auto nodeWidth = item->value[0].f32; - * @endcode - * */ NODE_WIDTH = 0, /** @@ -159,15 +150,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:高度数值,单位为vp;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 1.2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_HEIGHT, &item);clang-tid - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HEIGHT); - * auto nodeHeight = item->value[0].f32; - * @endcode - * */ NODE_HEIGHT, /** @@ -179,15 +161,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:背景色数值,0xargb格式,形如 0xFFFF0000 表示红色;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); - * auto nodeBackgroundColor = item->value[0].u32; - * @endcode - * */ NODE_BACKGROUND_COLOR, /** @@ -201,16 +174,6 @@ typedef enum { * .string: 图片地址;\n * .value[0].i32:repeat参数,参数类型{@link ArkUI_ImageRepeat};\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_IMAGE_REPEAT_NONE} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); - * auto nodeBackgroundImageUrl = item->string; - * auto nodeBackgroundImageRepeat = item->value[0].i32; - * @endcode - * */ NODE_BACKGROUND_IMAGE, /** @@ -231,18 +194,6 @@ typedef enum { * .value[2].f32:下内间距数值,单位为vp;\n * .value[3].f32:左内间距数值,单位为vp;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value1[] = { 1, 2, 3, 4}; - * ArkUI_AttributeItem item1 = { value1, sizeof(value1)/sizeof(ArkUI_NumberValue) }; - * ArkUI_NumberValue value2[] = { 10 }; - * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item1); - * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item2); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PADDING); - * auto nodePaddingTop = item->value[0].f32; - * @endcode - * */ NODE_PADDING, /** @@ -254,14 +205,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string: ID的内容;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "test" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ID, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ID); - * auto nodeId = item->string; - * @endcode - * */ NODE_ID, /** @@ -273,14 +216,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:0表示不可交互,1表示可交互;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = false} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ENABLED, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ENABLED); - * auto nodeEnabled = item->value[0].i32; - * @endcode */ NODE_ENABLED, /** @@ -301,18 +236,6 @@ typedef enum { * .value[2].f32:下外间距数值,单位为vp;\n * .value[3].f32:左外间距数值,单位为vp;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value1[] = { 1, 2, 3, 4}; - * ArkUI_AttributeItem item1 = { value1, sizeof(value1)/sizeof(ArkUI_NumberValue) }; - * ArkUI_NumberValue value2[] = { 10 }; - * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item1); - * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item2); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARGIN); - * auto nodeMarginTop = item->value[0].f32; - * @endcode - * */ NODE_MARGIN, /** @@ -328,14 +251,6 @@ typedef enum { * .value[1].f32: y轴移动距离,单位vp;\n * .value[2].f32: z轴移动距离,单位vp。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 100, 20, 0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE); - * auto nodeTranslate = item->value[0].f32; - * @endcode - * */ NODE_TRANSLATE, /** @@ -349,14 +264,6 @@ typedef enum { * .value[0].f32: x轴的缩放系数;\n * .value[1].f32: y轴的缩放系数。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 1.0, 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE); - * auto nodeScale = item->value[0].f32; - * @endcode - * */ NODE_SCALE, /** @@ -376,14 +283,6 @@ typedef enum { * .value[3].f32: 旋转角度;\n * .value[4].f32: 视距,即视点到z=0平面的距离,单位vp。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 0, 0, 1, 300, 0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE); - * auto nodeRotate = item->value[0].f32; - * @endcode - * */ NODE_ROTATE, /** @@ -395,14 +294,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32: 亮度值。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 1.2 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BRIGHTNESS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BRIGHTNESS); - * auto nodeBrightness = item->value[0].f32; - * @endcode - * */ NODE_BRIGHTNESS, /** @@ -414,14 +305,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32: 饱和度值。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 1.0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SATURATION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SATURATION); - * auto nodeSaturate = item->value[0].f32; - * @endcode - * */ NODE_SATURATION, /** @@ -433,15 +316,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32: 模糊半径,模糊半径越大越模糊,为0时不模糊。单位vp。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 1.0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BLUR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLUR); - * auto nodeBlur = item->value[0].f32; - * @endcode - * */ NODE_BLUR, /** @@ -464,21 +338,6 @@ typedef enum { * colors:渐变色颜色颜色。 \n * stops:渐变位置。 \n * size:颜色个数。 \n - * @code {.cpp} - * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; - * float stops[] = { 0.0, 0.5 }; - * ArkUIColorStop colorStop = { colors, stops, 2 }; - * ArkUI_ColorStop* ptr = &colorStop; - * ArkUI_NumberValue value[] = {{ .f32 = 60 } , { .i32 = ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT } , { .i32 = true }}; - * ArkUI_AttributeItem item = - * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LINEAR_GRADIENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LINEAR_GRADIENT); - * auto nodeLinearGradientStartAngel = item->value[0]; - * auto nodeLinearGradientDirection = item->value[1]; - * auto nodeLinearGradientFill = item->value[2]; - * auto nodeLinearGradientColorStop = item->object; - * @endcode * */ NODE_LINEAR_GRADIENT, @@ -491,14 +350,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 对齐方式,数据类型{@link ArkUI_Alignment}。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGNMENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT); - * auto nodeAlign = item->value[0].i32; - * @endcode - * */ NODE_ALIGNMENT, /** @@ -510,16 +361,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:透明度数值,取值范围为0到1。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY); - * auto nodeOpacity = item->value[0].f32; - * @endcode - * */ NODE_OPACITY, /** @@ -538,19 +379,6 @@ typedef enum { * .value[2].f32:设置下边框的边框宽度。 \n * .value[3].f32:设置左边框的边框宽度。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); - * ArkUI_NumberValue value[] = { 5, 5, 10, 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_WIDTH); - * auto nodeBorderWitdh = item->value[0].f32; - * @endcode - * */ NODE_BORDER_WIDTH, /** @@ -569,19 +397,6 @@ typedef enum { * .value[2].f32:设置左下角圆角半径。 \n * .value[3].f32:设置右下角圆角半径。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); - * ArkUI_NumberValue value[] = { 5, 5, 10, 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_RADIUS); - * auto nodeBorderRadius = item->value[0].f32; - * @endcode - * */ NODE_BORDER_RADIUS, /** @@ -600,19 +415,6 @@ typedef enum { * .value[2].u32:设置下侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n * .value[3].u32:设置左侧边框颜色,使用0xargb表示,如0xFFFF11FF。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32 = 0xFFFF11FF} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); - * ArkUI_NumberValue value[] = { {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFFFFFF}, {.u32 = 0x000000} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_COLOR); - * auto nodeBorderColor = item->value[0].u32; - * @endcode - * */ NODE_BORDER_COLOR, /** @@ -631,20 +433,6 @@ typedef enum { * .value[2].i32:下侧边框线条样式对应的数值。 \n * .value[3].i32:左侧边框线条样式对应的数值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_BORDER_STYLE_DOTTED} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_BORDER_STYLE_DOTTED}, {.i32 = ARKUI_BORDER_STYLE_SOLID}, - * {.i32 = ARKUI_BORDER_STYLE_SOLID}, {.i32 = ARKUI_BORDER_STYLE_DOTTED} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_STYLE); - * auto nodeBorderStyle = item->value[0].i32; - * @endcode - * */ NODE_BORDER_STYLE, /** @@ -656,16 +444,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:堆叠顺序数值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_Z_INDEX, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_Z_INDEX); - * auto nodeZIndex = item->value[0].f32; - * @endcode - * */ NODE_Z_INDEX, /** @@ -677,16 +455,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:控制当前组件显示或隐藏,参数类型{@link ArkUI_Visibility},默认值为ARKUI_VISIBILITY_VISIBLE。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_VISIBILITY_NONE} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_VISIBILITY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_VISIBILITY); - * auto nodeVisibility = item->value[0].i32; - * @endcode - * */ NODE_VISIBILITY, /** @@ -698,16 +466,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:控制是否按照父容器边缘轮廓进行裁剪,0表示不裁切,1表示裁切。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 0} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); - * auto nodeClip = item->value[0].i32; - * @endcode - * */ NODE_CLIP, /** @@ -754,21 +512,6 @@ typedef enum { * .value[2].f32:路径高度; \n * .string:路径绘制的命令字符串; \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = - * { {.i32 = ARKUI_CLIP_TYPE_RECT}, 100, 100, 15, 15, { .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP_SHAPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP_SHAPE); - * auto nodeClipType = item->value[0].i32; - * auto nodeClipWidth = item->value[1].f32; - * auto nodeClipHeight = item->value[2].f32; - * auto nodeClipRadiusWidth = item->value[3].f32; - * auto nodeClipRadiusHeight = item->value[4].f32; - * @endcode - * */ NODE_CLIP_SHAPE, /** @@ -780,17 +523,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .data[0...15].f32: 16个浮点数字。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, - * {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM); - * auto nodeTransform = item[0].value; - * @endcode - * */ NODE_TRANSFORM, /** @@ -802,16 +534,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:控制当前组件的触摸测试类型,参数类型{@link ArkKUI_HitTestMode},默认值为ARKUI_HIT_TEST_MODE_DEFAULT。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_HIT_TEST_MODE_BLOCK} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR); - * auto nodeHitTestBehavior = item->value[0].i32; - * @endcode - * */ NODE_HIT_TEST_BEHAVIOR, /** @@ -825,17 +547,6 @@ typedef enum { * .value[0].f32:x轴坐标。 \n * .value[1].f32: y轴坐标。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 50, 50 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_POSITION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_POSITION); - * auto nodePositionX = item->value[0].f32; - * auto nodePositionY = item->value[1].f32; - * @endcode - * */ NODE_POSITION, /** @@ -847,16 +558,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:设置当前组件阴影效果,参数类型{@link ArkUI_ShadowStyle}。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SHADOW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SHADOW); - * auto nodePositionX = item->value[0].i32; - * @endcode - * */ NODE_SHADOW, /** @@ -881,20 +582,6 @@ typedef enum { * .value[5].u32:阴影颜色,0xargb格式,形如 0xFFFF0000 表示红色;\n * .value[6].u32:阴影是否内部填充,,0表示不填充,1表示填充;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = - * { 10, {.i32 = 1},10, 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, {.i32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); - * auto nodeCustomShadowRadius = item->value[0].f32; - * auto nodeCustomShadowOffsetX = item->value[1].f32; - * auto nodeCustomShadowOffsetY = item->value[2].f32; - * auto nodeCustomShadowType = item->value[3].i32; - * auto nodeCustomShadowColor = item->value[4].u32; - * @endcode - * */ NODE_CUSTOM_SHADOW, /** @@ -908,16 +595,6 @@ typedef enum { * .value[0].f32 表示图片的宽度值,单位为vp。\n * .value[1].f32 表示图片的高度值,单位为vp。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue sizeArray[] = { 20, 0 }; - * ArkUI_AttributeItem item = { .value = sizeArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE , &item); - * auto imageSizeItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); - * auto width = imageSizeItem->value[0].f32; - * @endcode - * */ NODE_BACKGROUND_IMAGE_SIZE, /** @@ -929,15 +606,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示背景图片的宽高样式,取{@link ArkUI_ImageSize}枚举值。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue imageSizeStyle[] = { {.i32 = static_cast(ARKUI_IMAGE_SIZE_COVER) } }; - * ArkUI_AttributeItem item = { .value = imageSizeStyle, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, &item); - * auto imageSizeStyleItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); - * auto blurStyleValue = imageSizeStyleItem->value[0].i32; - * @endcode */ NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, /** @@ -959,16 +627,6 @@ typedef enum { * .value[4].f32 表示灰阶模糊起始边界。\n * .value[5].f32 表示灰阶模糊终点边界。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue blurStyle[] = { { .i32 = static_cast(ARKUI_BLUR_STYLE_THICK)}}; - * ArkUI_AttributeItem item = { .value = blurStyle, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE , &item); - * auto blurStyleItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); - * auto blurStyleType = blurStyleItem->value[0].i32; - * @endcode - * */ NODE_BACKGROUND_BLUR_STYLE, /** @@ -988,15 +646,6 @@ typedef enum { * .value[2].f32 表示中心点Z轴坐标,单位为vp \n * 注:如果设置坐标百分比位置,属性获取方法返回计算后的vp为单位的值。 * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue centerPointArray[] = { 20 }; - * ArkUI_AttributeItem item = { .value = centerPointArray, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM_CENTER , &item); - * auto transformCenterItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM_CENTER); - * auto centerX = transformCenterItem->value[0].f32; - * @endcode */ NODE_TRANSFORM_CENTER, /** @@ -1020,16 +669,6 @@ typedef enum { * .value[5].i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值 \n * .value[6].f32 表示动画播放速度 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue opacityTransition[] = { 20, { .i32 = 3000}, - * { .i32 = static_cast(ARKUI_CURVE_EASE_IN_OUT)}}; - * ArkUI_AttributeItem item = { .value = opacityTransition, .size = 3}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY_TRANSITION , &item); - * auto opacityTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); - * auto opacity = opacityTransitionItem->value[0].f32; - * @endcode */ NODE_OPACITY_TRANSITION, /** @@ -1061,16 +700,6 @@ typedef enum { * .value[9].i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n * .value[10].f32 表示动画播放速度。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue rotateTransition[] = { 0.0f, 0.0f, 1.0f, 180, 0, { .i32 = 3000}, - * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; - * ArkUI_AttributeItem item = { .value = rotateTransition, .size = 7}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE_TRANSITION , &item); - * auto rotateTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); - * auto rotateX = rotateTransitionItem->value[0].f32; - * @endcode */ NODE_ROTATE_TRANSITION, /** @@ -1098,16 +727,6 @@ typedef enum { * .value[7].i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n * .value[8].f32 表示动画播放速度。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue scaleTransition[] = { 0.0f, 0.0f, 0.0f, { .i32 = 3000}, - * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; - * ArkUI_AttributeItem item = { .value = scaleTransition, .size = 5}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE_TRANSITION , &item); - * auto scaleTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); - * auto scaleX = scaleTransitionItem->value[0].f32; - * @endcode */ NODE_SCALE_TRANSITION, /** @@ -1135,16 +754,6 @@ typedef enum { * value[7].i32 表示动画播放模式,取{@link ArkUI_AnimationPlayMode}枚举值。\n * value[8].f32 表示动画播放速度。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue translateTransition[] = { 0.0f, 0.0f, 0.0f, - * { .i32 = 3000}, { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; - * ArkUI_AttributeItem item = { .value = translateTransition, .size = 5}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION , &item); - * auto translateTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); - * auto translateX = translateTransitionItem->value[0].f32; - * @endcode */ NODE_TRANSLATE_TRANSITION, @@ -1157,16 +766,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:参数类型为1或者0。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUSABLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUSABLE); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_FOCUSABLE, @@ -1179,16 +778,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * value[0].i32:参数类型为1或者0。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DEFAULT_FOCUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DEFAULT_FOCUS); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_DEFAULT_FOCUS, @@ -1209,23 +798,6 @@ typedef enum { * .data[3].f32:触摸热区的高度,单位为%。 \n * .data[4...].f32:可以设置多个手势响应区域,顺序和上述一致。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0, 0, 100, 100 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); - * - * ArkUI_NumberValue value[] = { 0, 0, 100, 100, 0, 0, 100, 100 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RESPONSE_REGION); - * auto x = item->value[0].f32; - * auto y = item->value[1].f32; - * auto width = item->value[2].f32; - * auto height = item->value[3].f32; - * @endcode - * */ NODE_RESPONSE_REGION, @@ -1246,15 +818,6 @@ typedef enum { * .value[1].f32:浮层基于自身左上角的偏移量X,单位为vp。 \n * .value[2].f32:浮层基于自身左上角的偏移量Y,单位为vp。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_TOP_START }, 1.2, 0.3 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_OVERLAY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OVERLAY); - * auto text = item->string; - * @endcode * */ NODE_OVERLAY, @@ -1285,27 +848,6 @@ typedef enum { * stops:渐变位置。 \n * size:颜色个数。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; - * float stops[] = { 0.0, 0.5 }; - * ArkUIColorStop colorStop = { colors, stops, 2 }; - * ArkUI_ColorStop* ptr = &colorStop; - * ArkUI_NumberValue value[] = { 50, 50, 60, 180, 180, {.i32 = 1}}; - * ArkUI_AttributeItem item = - * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); - * auto nodeSweepGradientCeneterX = item->value[0]; - * auto nodeSweepGradientCeneterY = item->value[1]; - * auto nodeSweepGradientStart = item->value[2]; - * auto nodeSweepGradientEnd = item->value[3]; - * auto nodeSweepGradientRotation = item->value[4]; - * auto nodeSweepGradientFill = item->value[5]; - * auto nodeSweepGradientColorStop = item->object; - * @endcode - * */ NODE_SWEEP_GRADIENT, /** @@ -1331,25 +873,6 @@ typedef enum { * stops:渐变位置。 \n * size:颜色个数。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; - * float stops[] = { 0.0, 0.5 }; - * ArkUIColorStop colorStop = { colors, stops, 2 }; - * ArkUI_ColorStop* ptr = &colorStop; - * ArkUI_NumberValue value[] = { 50, 50, 20, {.i32 = 1}}; - * ArkUI_AttributeItem item = - * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); - * auto nodeRadialGradientCeneterX = item->value[0]; - * auto nodeRadialGradientCeneterY = item->value[1]; - * auto nodeRadialGradientradius = item->value[2]; - * auto nodeRadialGradientFill = item->value[3]; - * auto nodeRadialGradientColorStop = item->object; - * @endcode - * */ NODE_RADIAL_GRADIENT, /** @@ -1357,40 +880,40 @@ typedef enum { * * 属性设置方法参数{@link ArkUI_AttributeItem}格式,共有5种类型: \n * 1.rect类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_RECT; \n * .value[4].f32:矩形宽度; \n * .value[5].f32:矩形高度; \n * .value[6].f32:矩形圆角宽度; \n * .value[7].f32:矩形圆角高度; \n * 2.circle类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_CIRCLE; \n * .value[4].f32:圆形宽度; \n * .value[5].f32:圆形高度; \n * 3.ellipse类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_ELLIPSE; \n * .value[4].f32:椭圆形宽度; \n * .value[5].f32:椭圆形高度; \n * 4.path类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_PATH; \n * .value[4].f32:路径宽度; \n * .value[5].f32:路径高度; \n * .string:路径绘制的命令字符串; \n * 4.progress类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_PROSGRESS; \n * .value[4].f32:进度遮罩的当前值; \n * .value[5].f32:进度遮罩的最大值; \n @@ -1398,32 +921,32 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式,共有5种类型: \n * 1.rect类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型; \n * .value[4].f32:矩形宽度; \n * .value[5].f32:矩形高度; \n * .value[6].f32:矩形圆角宽度; \n * .value[7].f32:矩形圆角高度; \n * 2.circle类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型; \n * .value[4].f32:圆形宽度; \n * .value[5].f32:圆形高度; \n * 3.ellipse类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型; \n * .value[4].f32:椭圆形宽度; \n * .value[5].f32:椭圆形高度; \n * 4.path类型: \n - * .value[0].u32:可选填充颜色,0xargb类型; \n - * .value[1].u32:可选描边颜色,0xargb类型; \n - * .value[2].f32:可选描边宽度,单位为vp; \n + * .value[0].u32:填充颜色,0xargb类型; \n + * .value[1].u32:描边颜色,0xargb类型; \n + * .value[2].f32:描边宽度,单位为vp; \n * .value[3].i32:遮罩类型; \n * .value[4].f32:路径宽度; \n * .value[5].f32:路径高度; \n @@ -1434,24 +957,6 @@ typedef enum { * .value[2].f32:进度遮罩的最大值; \n * .value[3].u32:进度遮罩的颜色; \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = - * {{ .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 , {.i32 = ARKUI_MASK_TYPE_RECT}, 100, 100, 15, 15 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_MASK, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MASK); - * auto nodeMaskFill = item->value[0].u32; - * auto nodeMaskStrokeColor = item->value[1].u32; - * auto nodeMaskStrokeWidth = item->value[2].f32; - * auto nodeMaskType = item->value[3].i32; - * auto nodeMaskWidth = item->value[4].f32; - * auto nodeMaskHeight = item->value[5].f32; - * auto nodeMaskRadiusWidth = item->value[6].f32; - * auto nodeMaskradiusHeight = item->value[7].f32; - * @endcode - * */ NODE_MASK, /** @@ -1463,16 +968,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:控制当前组件的混合模式类型,参数类型{@link ArkUI_BlendMode},默认值为ARKUI_BLEND_MODE_NONE。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_BLEND_MODE_NONE} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BLEND_MODE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLEND_MODE); - * auto nodeBlendMode = item->value[0].i32; - * @endcode - * */ NODE_BLEND_MODE, /** @@ -1486,16 +981,6 @@ typedef enum { * .value[0].i32:设置容器元素内主轴方向上的布局类型, \n * 参数类型{@link ArkUI_Direction},默认值为ARKUI_DIRECTION_AUTO。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_DIRECTION_RTL} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DIRECTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DIRECTION); - * auto nodeDirection = item->value[0].i32; - * @endcode - * */ NODE_DIRECTION, /** @@ -1513,18 +998,6 @@ typedef enum { * .value[2].f32:最小高度,单位vp; \n * .value[3].f32:最大高度,单位vp; \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0, 5, 0, 5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CONSTRAINT_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); - * auto nodeMinWidth = item->value[0].f32; - * auto nodeMaxWidth = item->value[1].f32; - * auto nodeMinHeight = item->value[2].f32; - * auto nodeMaxHeight = item->value[3].f32; - * @endcode - * */ NODE_CONSTRAINT_SIZE, /** @@ -1536,14 +1009,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:灰度转换比例,范围0-1之间; \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_GRAY_SCALE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_GRAY_SCALE); - * auto nodeGrayScale = item->value[0].f32; - * @endcode */ NODE_GRAY_SCALE, /** @@ -1555,14 +1020,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:图像反转比例,范围0-1之间; \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_INVERT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_INVERT); - * auto nodeInvert = item->value[0].f32; - * @endcode */ NODE_INVERT, /** @@ -1574,14 +1031,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:图像转换为深褐色比例,范围0-1之间; \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SEPIA, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SEPIA); - * auto nodeSepia = item->value[0].f32; - * @endcode */ NODE_SEPIA, /** @@ -1593,14 +1042,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:对比度,取值范围:[0, 10); \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CONTRAST, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CONTRAST); - * auto nodeContrast = item->value[0].f32; - * @endcode */ NODE_CONTRAST, /** @@ -1613,13 +1054,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:颜色数值,0xargb类型;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { {.u32=0xFFFF0000} }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FOREGROUND_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); - * auto nodeForegroundColor = item->value[0].u32; - * @endcode */ NODE_FOREGROUND_COLOR, @@ -1634,16 +1068,6 @@ typedef enum { * .value[0].f32 表示x轴方向的偏移值, 单位为vp。 \n * .value[1].f32 表示y轴方向的偏移值, 单位为vp。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue offsetArray[] = { 20, 0 }; - * ArkUI_AttributeItem item = { .value = offsetArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_OFFSET , &item); - * auto offsetItem = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); - * auto offsetX = offsetItem->value[0].f32; - * @endcode - * */ NODE_OFFSET, /** @@ -1657,16 +1081,6 @@ typedef enum { * .value[0].f32 表示锚点x坐标值, 单位为vp \n * .value[1].f32 表示锚点y坐标值, 单位为vp \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue pointArray[] = { 20, 0 }; - * ArkUI_AttributeItem item = { .value = pointArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_MARK_ANCHOR , &item); - * auto anchorItem = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); - * auto pointX = anchorItem->value[0].f32; - * @endcode - * */ NODE_MARK_ANCHOR, /** @@ -1679,15 +1093,7 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32 表示x轴方向的位置, 单位为vp。 \n * .value[1].f32 表示y轴方向的位置, 单位为vp。 \n - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue possitionArray[] = { 20, 0 }; - * ArkUI_AttributeItem item = { .value = possitionArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_POSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_POSITION); - * auto offsetX = item->value[0].f32; - * @endcode + * */ NODE_BACKGROUND_IMAGE_POSITION, /** @@ -1725,17 +1131,6 @@ typedef enum { * .value[12].f32 水平方向的bias值。\n * .value[13].f32 垂直方向的bias值。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue alignRulesArray[] = { { .i32 = 2000}, { .i32 = - * static_cast(ARKUI_HORIZONTAL_ALIGNMENT_START)}}; - * ArkUI_AttributeItem item = { .value = alignRulesArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGN_RULES , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT_RULES); - * auto id = item->value[0].i32; - * @endcode - * */ NODE_ALIGN_RULES, /** @@ -1749,16 +1144,6 @@ typedef enum { * .value[0].f32:设置子组件在父容器交叉轴的对齐格式类型, \n * 参数类型{@link ArkUI_ItemAlign},默认值为ARKUI_ITEM_ALIGN_AUTO。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_ITEM_ALIGN_STRETCH} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGN_SELF, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGN_SELF); - * auto nodeHitTestBehavior = item->value[0].f32; - * @endcode - * */ NODE_ALIGN_SELF, /** @@ -1770,16 +1155,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:组件的基准尺寸数值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_GROW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_GROW); - * auto nodeFlexGrow = item->value[0].f32; - * @endcode - * */ NODE_FLEX_GROW, /** @@ -1791,16 +1166,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:父容器压缩尺寸分配给此属性所在组件的比例数值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_SHRINK, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_SHRINK); - * auto nodeFlexShrink = item->value[0].f32; - * @endcode - * */ NODE_FLEX_SHRINK, /** @@ -1812,16 +1177,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:组件的基准尺寸数值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_BASIS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_BASIS); - * auto nodeFlexBasis = item->value[0].f32; - * @endcode - * */ NODE_FLEX_BASIS, /** @@ -1835,16 +1190,6 @@ typedef enum { * .value[0].i32:为1时表示该组件及其所有子组件为一整个可以选中的组件 * 无障碍服务将不再关注其子组件内容。参数类型为1或者0。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_GROUP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_GROUP); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_ACCESSIBILITY_GROUP, @@ -1856,15 +1201,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .string:无障碍文本。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = {.string = "test"}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_TEXT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_TEXT); - * auto value = item->string; - * @endcode * */ NODE_ACCESSIBILITY_TEXT, @@ -1877,16 +1213,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:障碍重要性,参数类型{@link ArkUI_AccessibilityLevel}。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ACCESSIBILITY_LEVEL_AUTO } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_LEVEL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_LEVEL); - * auto value = item->value[0].i32; - * @endcode * */ NODE_ACCESSIBILITY_LEVEL, @@ -1899,15 +1225,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .string:无障碍说明。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "test" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_DESCRIPTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_DESCRIPTION); - * auto value = item->string; - * @endcode * */ NODE_ACCESSIBILITY_DESCRIPTION, @@ -1920,16 +1237,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:参数类型为1或者0。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUS_STATUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUS_STATUS); - * auto value = item->data[0].i32; - * @endcode * */ NODE_FOCUS_STATUS, @@ -1942,15 +1249,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string 表示文本内容 \n - * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CONTENT , &item); - * auto textContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); - * auto content = textContentItem->string; - * @endcode */ NODE_TEXT_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT, /** @@ -1962,15 +1260,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:字体颜色数值,0xargb格式;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_COLOR); - * auto nodeFontColor = item->value[0].u32; - * @endcode - * */ NODE_FONT_COLOR, /** @@ -1982,15 +1271,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:字体大小数值,单位为fp;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_SIZE); - * auto nodeFontSize = item->value[0].f32; - * @endcode - * */ NODE_FONT_SIZE, /** @@ -2002,15 +1282,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:字体样式{@link ArkUI_FontStyle};\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_STYLE_NORMAL} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_STYLE); - * auto nodeFontStyle = item->value[0].i32; - * @endcode - * */ NODE_FONT_STYLE, /** @@ -2022,15 +1293,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:字体粗细样式{@link ArkUI_FontWeight};\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_WEIGHT_NORMAL} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_WEIGHT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_WEIGHT); - * auto nodeFontWeight = item->value[0].i32; - * @endcode - * */ NODE_FONT_WEIGHT, /** @@ -2042,15 +1304,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32 表示lineHeight值,单位为fp \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue lineHeight[] = { 20 }; - * ArkUI_AttributeItem item = { .value = lineHeight, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT , &item); - * auto lineHeightItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); - * auto pointX = lineHeightItem->value[0].f32; - * @endcode */ NODE_TEXT_LINE_HEIGHT, /** @@ -2064,16 +1317,6 @@ typedef enum { * .value[0].i32:文本装饰线样式{@link ArkUI_TextDecorationType};\n * .value[1].u32:装饰线颜色,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); - * auto decorationItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_DECORATION); - * auto nodeDecorationStyle = decorationItem->value[0].i32; - * auto nodeDecorationColor = decorationItem->value[1].u32; - * @endcode - * */ NODE_TEXT_DECORATION, /** @@ -2085,16 +1328,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示文本大小写类型 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue textCase[] = { {.i32 = static_cast(ARKUI_TEXT_CASE_LOWER) } }; - * ArkUI_AttributeItem item = { .value = textCase, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CASE, &item); - * auto textCaseItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); - * auto textCase = textCaseItem->value[0].i32; - * @endcode - * */ NODE_TEXT_CASE, /** @@ -2106,16 +1339,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32 表示字符间距值,单位为fp \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue letterSpacing[] = { 20 }; - * ArkUI_AttributeItem item = { .value = letterSpacing, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING , &item); - * auto letterSpacingItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); - * auto letterSpacing = letterSpacingItem->value[0].f32; - * @endcode - * */ NODE_TEXT_LETTER_SPACING, /** @@ -2126,16 +1349,7 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示最大行数 \n - - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue maxLine[] = { { .i32 = 2 } }; - * ArkUI_AttributeItem item = { .value = maxLine, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_LINES , &item); - * auto maxLinesItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); - * auto maxLines = maxLinesItem->value[0].i32; - * @endcode + * */ NODE_TEXT_MAX_LINES, /** @@ -2147,15 +1361,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:表示文本水平对齐方式,取{@link ArkUI_TextAlignment}枚举值。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue alignMent[] = {{.i32 = static_cast(ARKUI_TEXT_ALIGNMENT_CENTER)}}; - * ArkUI_AttributeItem item = { .value = alignMent, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_ALIGN , &item); - * auto alignmentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); - * auto alignMent = alignmentItem->value[0].i32; - * @endcode */ NODE_TEXT_ALIGN, /** @@ -2167,15 +1372,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:表示文本超长时的显示方式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue textOverFlow[] = { { .i32 = static_cast(ARKUI_TEXT_OVERFLOW_CLIP) } }; - * ArkUI_AttributeItem item = { .value = textOverFlow, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle,NODE_TEXT_OVERFLOW , &item); - * auto textOverFlowItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); - * auto textOverFlow = textOverFlowItem->value[0].i32; - * @endcode */ NODE_TEXT_OVERFLOW, /** @@ -2187,15 +1383,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .string:字体字符串,多个用,分隔。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = {.string = "HarmonyOS Sans"}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_FAMILY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_FAMILY); - * auto font = item->string; - * @endcode - * */ NODE_FONT_FAMILY, /** @@ -2207,15 +1394,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:复制粘贴方式{@link ArkUI_CopyOptions}。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_COPY_OPTIONS_NONE} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_COPY_OPTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); - * auto nodeTextCopyOption = item->value[0].i32; - * @endcode - * */ NODE_TEXT_COPY_OPTION, /** @@ -2227,15 +1405,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:偏移量数值,单位为fp。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); - * auto nodeTextBaselineOffset = item->value[0].f32; - * @endcode - * */ NODE_TEXT_BASELINE_OFFSET, /** @@ -2255,19 +1424,6 @@ typedef enum { * .value[3].f32:阴影X轴偏移量,单位为vp;\n * .value[4].f32:阴影Y轴偏移量,单位为vp;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, 10, 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); - * auto nodeTextShadowRadius = item->value[0].f32; - * auto nodeTextShadowType = item->value[1].i32; - * auto nodeTextShadowColor = item->value[2].u32; - * auto nodeTextShadowOffsetX = item->value[3].f32; - * auto nodeTextShadowOffsetY = item->value[4].f32; - * @endcode - * */ NODE_TEXT_TEXT_SHADOW, /** @@ -2279,16 +1435,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:文本最小显示字号,单位FP。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 20 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE); - * auto value = item->value[0].f32; - * @endcode - * */ NODE_TEXT_MIN_FONT_SIZE, @@ -2301,16 +1447,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:文本最大显示字号 单位FP。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 20 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE); - * auto value = item->value[0].f32; - * @endcode - * */ NODE_TEXT_MAX_FONT_SIZE, @@ -2333,17 +1469,6 @@ typedef enum { * .value[2].i32:字体样式,参数类型{@link ArkUI_FontStyle}。 * 默认值为ARKUI_FONT_STYLE_NORMAL。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 16, { .i32 = ARKUI_FONT_WEIGHT_NORMAL }, - * { .i32 = ARKUI_FONT_STYLE_NORMAL } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_FONT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_FONT); - * auto size = item->value[0].f32; - * @endcode - * */ NODE_TEXT_FONT, @@ -2356,16 +1481,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:参数类型{@link ArkUI_TextHeightAdaptivePolicy}。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY); - * auto size = item->value[0].i32; - * @endcode - * */ NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, /** @@ -2377,15 +1492,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32: 表示首行缩进值。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue textIndent[] = { 20 }; - * ArkUI_AttributeItem item = { .value = textIndent, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INDENT , &item); - * auto indentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); - * auto indentValue = indentItem->value[0].f32; - * @endcode */ NODE_TEXT_INDENT, /** @@ -2397,14 +1503,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string 表示span的文本内容。\n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SPAN_CONTENT , &item); - * auto spanContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_SPAN_CONTENT); - * auto spanContent = spanContentItem->string; - * @endcode */ NODE_SPAN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SPAN, /** @@ -2416,14 +1514,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string 表示imageSpan的图片地址 \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC , &item); - * auto srcItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC); - * auto spanScr = srcItem->string; - * @endcode */ NODE_IMAGE_SPAN_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE_SPAN, /** @@ -2435,15 +1525,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示图片基于文本的对齐方式,取{@link ArkUI_ImageSpanAlignment}枚举值。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue alignValue[] = { {.i32 = static_cast(ARKUI_IMAGE_SPAN_ALIGNMENT_TOP) } }; - * ArkUI_AttributeItem item = {.value = alignValue, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN , &item); - * auto verticalAlignItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN); - * auto verticalAlign = verticalAlignItem->value[0].i32; - * @endcode */ NODE_IMAGE_SPAN_VERTICAL_ALIGN, /** @@ -2455,14 +1536,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string 表示image组件地址 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SRC , &item); - * auto imageSrcItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); - * auto imageSrc = imageSrcItem->string; - * @endcode */ NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, /** @@ -2474,15 +1547,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示图片填充效果,取{@link ArkUI_ObjectFit}枚举值。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue objectFitValue[] = { { .i32 = static_cast(ARKUI_OBJECT_FIT_FILL) } }; - * ArkUI_AttributeItem item = { .value = objectFitValue, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT , &item); - * auto objectFitItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); - * auto objectFit = objectFitItem->value[0].i32; - * @endcode */ NODE_IMAGE_OBJECT_FIT, /** @@ -2494,15 +1558,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示插值效果效果,取{@link ArkUI_ImageInterpolation}枚举值。 \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue interpolationValue[] = { { .i32 = ARKUI_IMAGE_INTERPOLATION_LOW } }; - * ArkUI_AttributeItem item = { .value = interpolationValue, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION , &item); - * auto interpolationItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); - * auto interpolation = interpolationItem->value[0].i32; - * @endcode */ NODE_IMAGE_INTERPOLATION, /** @@ -2514,15 +1569,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示图片重复样式,取{@link ArkUI_ImageRepeat}枚举值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue repeatValue[] = { { .i32 = static_cast(ARKUI_IMAGE_REPEAT_X) } }; - * ArkUI_AttributeItem item = { .value = repeatValue, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT , &item); - * auto objectRepeatItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); - * auto repeat = objectRepeatItem->value[0].i32; - * @endcode */ NODE_IMAGE_OBJECT_REPEAT, /** @@ -2536,17 +1582,6 @@ typedef enum { * .value[0].i32 ~ .value[19].i32 表示滤镜矩阵数组。 \n * .size 表示滤镜数组大小 5*4。 \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue filterValue[] = { {.i32 = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 - * = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = - * 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0} }; - * ArkUI_AttributeItem item = { .value = filterValue, .size = sizeof(filterValue)/ sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER , &item); - * auto colorFilterItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); - * auto colorFilter = colorFilterItem->value; - * @endcode */ NODE_IMAGE_COLOR_FILTER, /** @@ -2558,15 +1593,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32 表示是否缩放布尔值。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue resizeValue[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { .value = resizeValue, .size = 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE , &item); - * auto autoResizeItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); - * auto autoResize = autoResizeItem->value[0].i32; - * @endcode */ NODE_IMAGE_AUTO_RESIZE, /** @@ -2578,14 +1604,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string 表示image组件占位图地址。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "/pages/loading.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_ALT , &item); - * auto altStrItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); - * auto altStr = altStrItem->string; - * @endcode */ NODE_IMAGE_ALT, /** @@ -2597,15 +1615,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:背景色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR); - * auto nodeToggleSelectedColor = item->value[0].u32; - * @endcode - * */ NODE_TOGGLE_SELECTED_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, /** @@ -2617,15 +1626,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:圆形滑块颜色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); - * auto nodeSwitchPointColor = item->value[0].u32; - * @endcode - * */ NODE_TOGGLE_SWITCH_POINT_COLOR, @@ -2638,15 +1638,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:前景颜色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0x99666666 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR); - * auto nodeLoadingProgressColor = item->value[0].u32; - * @endcode - * */ NODE_LOADING_PROGRESS_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LOADING_PROGRESS, /** @@ -2658,14 +1649,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:0时不显示动画,1时可以显示动画。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING); - * auto nodeLoadingProgressEnableLoading = item->value[0].i32; - * @endcode */ NODE_LOADING_PROGRESS_ENABLE_LOADING, @@ -2678,14 +1661,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string:默认提示文本的内容。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="input" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER); - * auto nodeTextInputPlaceholder = item->string; - * @endcode - * */ NODE_TEXT_INPUT_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, /** @@ -2697,14 +1672,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string:默认文本的内容。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="input" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT); - * auto nodeTextInputText = item->string; - * @endcode - * */ NODE_TEXT_INPUT_TEXT, /** @@ -2716,15 +1683,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:光标颜色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR); - * auto nodeTextInputCaretColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_INPUT_CARET_COLOR, /** @@ -2736,15 +1694,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:光标宽度数值,单位为vp。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE); - * auto nodeTextInputCaretStyle = item->value[0].f32; - * @endcode - * */ NODE_TEXT_INPUT_CARET_STYLE, /** @@ -2756,15 +1705,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:0表示不展示下划线,1表示展示下划线。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE); - * auto nodeTextInputUnderline = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_SHOW_UNDERLINE, /** @@ -2776,15 +1716,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:最大文本数的数字。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 50 } }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH); - * auto nodeTextInputMaxlength = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_MAX_LENGTH, /** @@ -2796,15 +1727,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:回车键类型枚举{@link ArkUI_EnterKeyType}。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_ENTER_KEY_TYPE_DONE} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE); - * auto nodeTextInputMaxlength = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_ENTER_KEY_TYPE, /** @@ -2816,15 +1738,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:颜色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR); - * auto nodeTextInputPlaceholderColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_INPUT_PLACEHOLDER_COLOR, /** @@ -2842,18 +1755,6 @@ typedef enum { * .value[2].i32:字体粗细样式{@link ArkUI_FontWeight};\n * .string: 字体族内容,多个字体族之间使用逗号分隔。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT); - * auto nodeTextInputPlaceholderFontSize = item->value[0].f32; - * auto nodeTextInputPlaceholderFontStyle = item->value[1].i32; - * auto nodeTextInputPlaceholderFontWeight = item->value[2].i32; - * auto nodeTextInputPlaceholderFontFamily = item->string; - * @endcode - * */ NODE_TEXT_INPUT_PLACEHOLDER_FONT, /** @@ -2865,15 +1766,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:0表示聚焦不拉起输入法,1表示拉起。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS); - * auto nodeTextInputFocusKeyboard = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, /** @@ -2885,15 +1777,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:输入框类型枚举{@link ArkUI_TextInputType}。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXTINPUT_TYPE_NORMAL} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE); - * auto nodeTextInputType = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_TYPE, /** @@ -2905,15 +1788,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:颜色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR); - * auto nodeTextInputSelectedColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, /** @@ -2925,15 +1799,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:0表示不显示图标,1表示显示图标。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON); - * auto nodeTextInputPasswordIcon = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, /** @@ -2945,13 +1810,6 @@ typedef enum { * 属性获取方法参数{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:false表示退出编辑态,true表示维持现状。 * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = false} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_EDITING, &item); - * @endcode - * */ NODE_TEXT_INPUT_EDITING, /** @@ -2969,18 +1827,6 @@ typedef enum { * .value[2].u32:按钮图标颜色数值,0xargb格式;\n * .string:按钮图标地址。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_CANCELBUTTON_STYLE_INPUT}, 10.0, {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON); - * auto nodeCancelButtonStyle = item->value[0].i32; - * auto nodeCancelButtonSize = item->value[1].f32; - * auto nodeCancelButtonColor = item->value[2].u32; - * auto nodeCancelButtonImage = item->string; - * @endcode - * */ NODE_TEXT_INPUT_CANCEL_BUTTON, @@ -2993,14 +1839,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string:默认提示文本的内容。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="input" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER); - * auto nodeTextAreaPlaceholder = item->string; - * @endcode - * */ NODE_TEXT_AREA_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, /** @@ -3012,14 +1850,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string:默认文本的内容。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="input" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_TEXT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_TEXT); - * auto nodeTextAreaText = item->string; - * @endcode - * */ NODE_TEXT_AREA_TEXT, /** @@ -3031,15 +1861,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:最大文本数的数字。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 50 } }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH); - * auto nodeTextAreaMaxlength = item->value[0].i32; - * @endcode - * */ NODE_TEXT_AREA_MAX_LENGTH, /** @@ -3051,15 +1872,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:颜色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR); - * auto nodeTextAreaPlaceholderColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_AREA_PLACEHOLDER_COLOR, /** @@ -3077,18 +1889,6 @@ typedef enum { * .value[2].i32:字体粗细样式{@link ArkUI_FontWeight};\n * .string: 字体族内容,多个字体族之间使用逗号分隔。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT); - * auto nodeTextAreaPlaceholderFontSize = item->value[0].f32; - * auto nodeTextAreaPlaceholderFontStyle = item->value[1].i32; - * auto nodeTextAreaPlaceholderFontWeight = item->value[2].i32; - * auto nodeTextAreaPlaceholderFontFamily = item->string; - * @endcode - * */ NODE_TEXT_AREA_PLACEHOLDER_FONT, /** @@ -3100,15 +1900,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:背景色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR); - * auto nodeTextAreaCaretColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_AREA_CARET_COLOR, /** @@ -3120,13 +1911,6 @@ typedef enum { * 属性获取方法参数{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:false表示退出编辑态,true表示维持现状。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = false} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_EDITING, &item); - * @endcode - * */ NODE_TEXT_AREA_EDITING, @@ -3139,14 +1923,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string:默认文本的内容。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="click" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BUTTON_LABEL); - * auto nodeButtonLabelr = item->string; - * @endcode - * */ NODE_BUTTON_LABEL = MAX_NODE_SCOPE_NUM * ARKUI_NODE_BUTTON, @@ -3159,15 +1935,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:进度条当前值。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_VALUE); - * auto nodeProgressValue = item->value[0].f32; - * @endcode - * */ NODE_PROGRESS_VALUE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_PROGRESS, /** @@ -3179,15 +1946,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:进度条总长。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TOTAL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_TOTAL); - * auto nodeProgressTotal = item->value[0].f32; - * @endcode - * */ NODE_PROGRESS_TOTAL, /** @@ -3199,15 +1957,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:颜色数值,0xargb格式。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_COLOR); - * auto nodeProgressColor = item->value[0].u32; - * @endcode - * */ NODE_PROGRESS_COLOR, /** @@ -3219,14 +1968,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:进度条类型枚举值{@link ArkUI_ProgressType}。\n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_PROGRESS_LINEAR} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TYPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_TYPE); - * auto nodeProgressType = item->value[0].i32; - * @endcode */ NODE_PROGRESS_TYPE, @@ -3239,16 +1980,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:1表示选中,0表示不选中。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 0 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SELECT); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_CHECKBOX_SELECT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, @@ -3259,17 +1990,7 @@ typedef enum { * .value[0].u32:多选框选中状态颜色, 类型为0xargb,如0xFF1122FF。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0].u32:多选框选中状态颜色, 类型为0xargb,如0xFF1122FF。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR); - * auto value = item->value[0].u32; - * @endcode + * .value[0].u32:多选框选中状态颜色, 类型为0xargb,如0xFF1122FF。 * */ NODE_CHECKBOX_SELECT_COLOR, @@ -3283,16 +2004,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].u32:边框颜色, 类型为0xargb,如0xFF1122FF。 * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR); - * auto value = item->value[0].u32; - * @endcode - * */ NODE_CHECKBOX_UNSELECT_COLOR, @@ -3308,16 +2019,6 @@ typedef enum { * .value[0].u32:边框颜色, 类型为0xargb,如0xFF1122FF;\n * .value[1].f32:内部图标大小,单位vp;\n * .value[2].f32:内部图标粗细,单位vp,默认值2。\n - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF }, 20.0f, 2.0f }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_MARK, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_MARK); - * auto value = item->value[0].u32; - * @endcode * */ NODE_CHECKBOX_MARK, @@ -3330,16 +2031,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:组件形状,参数类型{@link ArkUI_CheckboxShape}。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ArkUI_CHECKBOX_SHAPE_CIRCLE } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SHAPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SHAPE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_CHECKBOX_SHAPE, @@ -3353,14 +2044,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string: ID的内容。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "test" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_ID, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_ID); - * auto nodeXcomponentId = item->string; - * @endcode - * */ NODE_XCOMPONENT_ID = MAX_NODE_SCOPE_NUM * ARKUI_NODE_XCOMPONENT, /** @@ -3372,15 +2055,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:字体样式{@link ArkUI_XComponentType}。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_XCOMPONENT_TYPE_SURFACE} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_TYPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_TYPE); - * auto nodeXcomponentType = item->value[0].i32; - * @endcode - * */ NODE_XCOMPONENT_TYPE, /** @@ -3394,16 +2068,6 @@ typedef enum { * .value[0].u32:宽数值,单位为px;\n * .value[1].u32:高数值,单位为px;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=300}, {.u32=50} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); - * auto nodeXcomponentSurfaceWidth = item->value[0].u32; - * auto nodeXcomponentSurfaceHeight = item->value[1].u32; - * @endcode - * */ NODE_XCOMPONENT_SURFACE_SIZE, @@ -3416,13 +2080,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 是否显示农历。 * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR); - * auto nodeDatePickerLunar = item->value[0].i32; - * @endcode */ NODE_DATE_PICKER_LUNAR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_DATE_PICKER, /** @@ -3434,12 +2091,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string: 日期。\n * - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "1970-1-1" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_START, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_START); - * auto nodeDatePickerStart = item->string; - * @endcode */ NODE_DATE_PICKER_START, /** @@ -3451,12 +2102,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string: 日期。\n * - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "2100-12-31" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_END, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_END); - * auto nodeDatePickerEnd = item->string; - * @endcode */ NODE_DATE_PICKER_END, /** @@ -3468,12 +2113,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string: 日期。 * - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "2024-01-22" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED); - * auto nodeDatePickerSelected = item->string; - * @endcode */ NODE_DATE_PICKER_SELECTED, /** @@ -3496,12 +2135,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割\n * 参数5: 文本样式,字符串枚举("normal", "italic")\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); - * auto nodeDatePickerDisappearTextStyle = item->string; - * @endcode + * */ NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, /** @@ -3524,12 +2158,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割\n * 参数5: 文本样式,字符串枚举("normal", "italic")\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE); - * auto nodeDatePickerTextStyle = item->string; - * @endcode + * */ NODE_DATE_PICKER_TEXT_STYLE, /** @@ -3552,12 +2181,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割\n * 参数5: 文本样式,字符串枚举("normal", "italic")\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE); - * auto nodeDatePickerSelectedTextStyle = item->string; - * @endcode + * */ NODE_DATE_PICKER_SELECTED_TEXT_STYLE, /** @@ -3569,12 +2193,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string: 时间。 * - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "17-11" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED); - * auto nodeTimePickerSelected = item->string; - * @endcode */ NODE_TIME_PICKER_SELECTED = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TIME_PICKER, @@ -3587,13 +2205,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 是否为24小时制。 * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME); - * auto nodeTimePickerUseMilitaryTime = item->value[0].i32; - * @endcode */ NODE_TIME_PICKER_USE_MILITARY_TIME, /** @@ -3616,12 +2227,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割\n * 参数5: 文本样式,字符串枚举("normal", "italic")\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); - * auto nodeDatePickerDisappearTextStyle = item->string; - * @endcode + * */ NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, /** @@ -3644,12 +2250,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割\n * 参数5: 文本样式,字符串枚举("normal", "italic")\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE); - * auto nodeTimePickerTextStyle = item->string; - * @endcode + * */ NODE_TIME_PICKER_TEXT_STYLE, /** @@ -3672,12 +2273,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割\n * 参数5: 文本样式,字符串枚举("normal", "italic")\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.c} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE); - * auto nodeDatePickerSelectedTextStyle = item->string; - * @endcode + * */ NODE_TIME_PICKER_SELECTED_TEXT_STYLE, @@ -3702,16 +2298,6 @@ typedef enum { * 1:单列支持图片的选择器,输出结构体为{@link ARKUI_TextPickerRangeContent};\n * 2:多列联动选择器,输出结构体为{@link ARKUI_TextPickerCascadeRangeContent};\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_TEXTPICKER_RANGETYPE_MULTI} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "1,2,3;A,B,C" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE); - * auto nodeTextPickerRangeType = item->value[0].i32; - * auto nodeTextPickerMultiRange = item->string; - * @endcode - * */ NODE_TEXT_PICKER_OPTION_RANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, /** @@ -3723,15 +2309,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].u32:索引值,如存在多个索引值则逐个添加;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32 = 1}, {.u32 = 2} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED); - * auto nodeTextPickerSelected = item->value[0].u32; - * @endcode - * */ NODE_TEXT_PICKER_OPTION_SELECTED, /** @@ -3743,14 +2320,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .string:选中项的值,如存在多个值则逐个添加,用分号分隔;\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "A;B" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE); - * auto nodeTextPickerValue = item->string; - * @endcode - * */ NODE_TEXT_PICKER_OPTION_VALUE, /** @@ -3773,12 +2342,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割\n * 参数5: 文本样式,字符串枚举("normal", "italic")\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.c} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE); - * auto nodeDatePickerDisappearTextStyle = item->string; - * @endcode + * */ NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, /** @@ -3801,12 +2365,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割\n * 参数5: 文本样式,字符串枚举("normal", "italic")\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.c} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE); - * auto nodeDatePickerTextStyle = item->string; - * @endcode + * */ NODE_TEXT_PICKER_TEXT_STYLE, /** @@ -3829,12 +2388,7 @@ typedef enum { * 参数4: 文本字体列表,使用 ',' 进行分割;\n * 参数5: 文本样式,字符串枚举("normal", "italic");\n * 如 "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" 。\n - * @code {.c} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE); - * auto nodeTextPickerSelectedTextStyle = item->string; - * @endcode + * */ NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, /** @@ -3843,11 +2397,6 @@ typedef enum { * {@link ArkUI_AttributeItem}参数类型:\n * .value[0...].i32:默认选中项在数组中的索引值数组。 * - * @code {.c} - * ArkUI_NumberValue value[] = { { .i32 = 0 }, { .i32 = 1 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_INDEX, &item); - * @endcode */ NODE_TEXT_PICKER_SELECTED_INDEX, /** @@ -3859,14 +2408,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * value[0].i32:0表示不可循环,1表示可循环。\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=true} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP); - * auto nodePickerCanLoop = item->value[0].i32; - * @endcode */ NODE_TEXT_PICKER_CAN_LOOP, /** @@ -3878,14 +2419,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * value[0].f32:子项高度属性,单位为vp。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT); - * auto nodePickerItemHeight = item->value[0].f32; - * @endcode */ NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, /** @@ -3899,13 +2432,6 @@ typedef enum { * .value[0].f32: 日历选中态底板圆角半径,取值范围[0,+∞),其中取值为0表示底板样式为直角矩形; * 取值范围为(0, 16)时,底板样式为圆角矩形;取值范围为[16,+∞)时,底板样式为圆形。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 16.0f }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); - * auto borderRadius = item->value[0].f32; - * @endcode */ NODE_CALENDAR_PICKER_HINT_RADIUS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, /** @@ -3921,13 +2447,6 @@ typedef enum { * .value[1].u32: 选中的月。\n * .value[2].u32: 选中的日。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE); - * auto selectYear = item->value[0].u32; - * @endcode */ NODE_CALENDAR_PICKER_SELECTED_DATE, /** @@ -3943,13 +2462,6 @@ typedef enum { * .value[1].f32: 按照对齐方式对齐后,选择器相对入口组件的x轴方向相对偏移。\n * .value[2].f32: 按照对齐方式对齐后,选择器相对入口组件的y轴方向相对偏移。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGNMENT_END) }, 10.0f, 0.0f }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT); - * auto alignType = item->value[0].i32; - * @endcode */ NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, /** @@ -3965,14 +2477,6 @@ typedef enum { * .value[1].f32: 入口区的文本字号,单位为fp。\n * .value[2].i32: 入口区的文本字体粗细,参数类型{@link ArkUI_FontWeight}。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = - * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); - * auto textColor = item->value[0].u32; - * @endcode */ NODE_CALENDAR_PICKER_TEXT_STYLE, /** @@ -3983,16 +2487,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].u32:滑块的颜色, 类型为0xargb,如0xFF1122FF。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_COLOR); - * auto value = item->value[0].u32; - * @endcode * */ NODE_SLIDER_BLOCK_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, @@ -4005,16 +2499,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].u32:背景颜色, 类型为0xargb,如0xFF1122FF。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_TRACK_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_TRACK_COLOR); - * auto value = item->value[0].u32; - * @endcode * */ NODE_SLIDER_TRACK_COLOR, @@ -4027,16 +2511,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].u32:已滑动部分颜色, 类型为0xargb,如0xFF1122FF。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR); - * auto value = item->value[0].u32; - * @endcode * */ NODE_SLIDER_SELECTED_COLOR, @@ -4049,16 +2523,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:是否显示步长刻度值,1表示显示,0表示不显示,默认值为0。\n - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SHOW_STEPS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SHOW_STEPS); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_SHOW_STEPS, @@ -4117,21 +2581,6 @@ typedef enum { * .value[2].f32:路径宽度; \n * .value[3].f32:路径高度; \n * .string:路径绘制的命令字符串; \n - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_DEFAULT}}; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); - * - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, - * {.i32 = ARKUI_CLIP_TYPE_RECT}, 100, 100, 15, 15 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_BLOCK_STYLE, @@ -4144,16 +2593,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:进度值。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_VALUE); - * auto value = item->value[0].f32; - * @endcode * */ NODE_SLIDER_VALUE, @@ -4166,16 +2605,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:进度值的最小值。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE); - * auto value = item->value[0].f32; - * @endcode * */ NODE_SLIDER_MIN_VALUE, @@ -4188,16 +2617,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:进度值的最大值。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE); - * auto value = item->value[0].f32; - * @endcode * */ NODE_SLIDER_MAX_VALUE, @@ -4210,16 +2629,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:滑动步长,取值范围:[0.01, 100]。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_STEP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_STEP); - * auto value = item->value[0].f32; - * @endcode * */ NODE_SLIDER_STEP, @@ -4232,16 +2641,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:显示样式,参数类型{@link ArkUI_SliderDirection}。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SLIDER_DIRECTION_VERTICAL } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_DIRECTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_DIRECTION); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_DIRECTION, @@ -4254,16 +2653,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:是否反向,1表示反向,0表示不反向。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 0} }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_REVERSE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_REVERSE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_REVERSE, @@ -4276,16 +2665,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:显示样式,参数类型{@link ArkUI_SliderStyle}。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SLIDER_STYLE_OUT_SET } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_STYLE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_STYLE, @@ -4299,13 +2678,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 对齐方式,数据类型{@link ArkUI_Alignment}。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT, &item); - * auto alignContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); - * auto alignContent = alignContentItem->value[0].i32; - * @endcode */ NODE_STACK_ALIGN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_STACK, @@ -4318,14 +2690,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 滚动条状态,数据类型{@link ArkUI_ScrollBarDisplayMode}。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); - * auto nodeScrollBarDisplayMode = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_BAR_DISPLAY_MODE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, /** @@ -4337,14 +2701,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32: 滚动条宽度,单位vp。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 20 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); - * auto nodeScrollBarWidth = item->value[0].f32; - * @endcode - * */ NODE_SCROLL_BAR_WIDTH, /** @@ -4356,14 +2712,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .data[0].u32: 滚动条颜色,0xargb类型。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); - * auto nodeScrollBarColor = item->value[0].u32; - * @endcode - * */ NODE_SCROLL_BAR_COLOR, /** @@ -4375,14 +2723,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:滚动方向,数据类型{@link ArkUI_ScrollDirection}。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_DIRECTION_VERTICAL } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); - * auto nodeScrollBarDirection = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_SCROLL_DIRECTION, /** @@ -4396,14 +2736,6 @@ typedef enum { * .value[0].i32: 边缘滑动效果,参数类型{@link ArkUI_EdgeEffect};\n * .value[1].i32: 组件内容大小小于组件自身时,设置是否开启滑动效果,开启为1,关闭为0。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_EDGE_EFFECT_NONE }, { .i32 = 1 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); - * auto nodeScrollEdgeEffect = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_EDGE_EFFECT, /** @@ -4415,14 +2747,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 是否支持滚动手势。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); - * auto nodeScrollEnableScroll = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_ENABLE_SCROLL_INTERACTION, /** @@ -4434,14 +2758,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32: 摩擦系数。 * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 0.6 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_FRICTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_FRICTION); - * auto nodeScrollFriction = item->value[0].f32; - * @endcode - * */ NODE_SCROLL_FRICTION, /** @@ -4459,17 +2775,6 @@ typedef enum { * .value[2].i32: 在Scroll组件限位滚动模式下,该属性设置为false后,运行Scroll在最后一个限位点和末尾间自由滑动;\n * .value[3...].f32: Scroll组件限位滚动时的限位点,限位点即为Scroll组件能滑动停靠的偏移量。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { - * { .i32=ARKUI_SCROLL_SNAP_ALIGN_NONE }, { .i32=true }, { .i32=true }, - * { .f32=0 }, { .f32=500 }, { .f32=1000 }, { .f32=1500 } - * }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SNAP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_SNAP); - * auto nodeScrollSnap = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_SNAP, @@ -4483,18 +2788,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:可滚动组件往末尾端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。\n * .value[1].i32:可滚动组件往起始端滚动时的嵌套滚动,参数类型{@link ArkUI_ScrollNestedMode}。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY }, - * { .i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL); - * auto first = item->value[0].i32; - * auto second = item->value[1].i32; - * @endcode * */ NODE_SCROLL_NESTED_SCROLL, @@ -4511,17 +2804,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32:水平滑动偏移,单位为vp。\n * .value[1].f32:垂直滑动偏移,单位为vp。\n - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10, 100, { .i32 = 1000 }, { .i32 = ARKUI_CURVE_EASE }, { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_OFFSET, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_OFFSET); - * auto x = item->value[0].f32; - * auto y = item->value[1].f32; - * @endcode * */ NODE_SCROLL_OFFSET, @@ -4534,16 +2816,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:容器是否位于边缘,-1:表示未处于边缘,如果处于边缘状态参数类型{@link ArkUI_ScrollEdge}。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_EDGE_TOP } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SCROLL_EDGE, @@ -4559,14 +2831,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32: 是否支持划动翻页。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); - * auto nodeScrollEnablePaging = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_ENABLE_PAGING, @@ -4579,14 +2843,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:List组件排列方向,数据类型{@link ArkUI_Axis}。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_DIRECTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_DIRECTION); - * auto nodeListDirection = item->value[0].i32; - * @endcode - * */ NODE_LIST_DIRECTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST, /** @@ -4598,14 +2854,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:配合ListItemGroup组件使用,设置ListItemGroup中header和footer是否要吸顶或吸底。数据类型{@link ArkUI_StickyStyle}。 * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_STICKY_STYLE_NONE } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_STICKY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_STICKY); - * auto nodeListSticky = item->value[0].i32; - * @endcode - * */ NODE_LIST_STICKY, /** @@ -4617,14 +2865,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].f32: 子组件主轴方向的间隔。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_SPACE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_SPACE); - * auto nodeListSpace = item->value[0].f32; - * @endcode - * */ NODE_LIST_SPACE, @@ -4637,14 +2877,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:控制是否开启循环,0表示不循环,1表示循环,默认值为1。 \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { {.i32 = 0} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_LOOP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_LOOP); - * auto nodeSwiperLoop = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_LOOP = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SWIPER, /** @@ -4656,16 +2888,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:控制子组件是否自动播放,0表示不自动播放,1表示自动播放,默认值为0。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY); - * auto nodeSwiperAutoPlay = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_AUTO_PLAY, /** @@ -4677,16 +2899,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:是否显示导航点指示器,0表示不显示导航点指示器,1表示显示导航点指示器,默认值为1。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 0} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR); - * auto nodeSwiperShowIndicator = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_SHOW_INDICATOR, /** @@ -4698,16 +2910,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:使用自动播放时播放的时间间隔,单位为毫秒。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 3000 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INTERVAL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_INTERVAL); - * auto nodeSwiperInterval = item->value[0].f32; - * @endcode - * */ NODE_SWIPER_INTERVAL, /** @@ -4719,16 +2921,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:是否为纵向滑动,0表示横向滑动,1表示纵向滑动,默认值为0。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_VERTICAL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_VERTICAL); - * auto nodeSwiperVertical = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_VERTICAL, @@ -4741,16 +2933,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:子组件切换的动画时长,单位为毫秒, 默认值为400。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10000 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DURATION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DURATION); - * auto nodeSwiperDuration = item->value[0].f32; - * @endcode - * */ NODE_SWIPER_DURATION, @@ -4763,16 +2945,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:设置动画曲线参数,参数类型{@link ArkUI_AnimationCurve},默认值为ARKUI_CURVE_LINEAR。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_CURVE_SHARP} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_CURVE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_CURVE); - * auto nodeSwiperCurve = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_CURVE, @@ -4785,16 +2957,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].f32:子组件与子组件之间间隙数值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); - * auto nodeSwiperItemSpace = item->value[0].f32; - * @endcode - * */ NODE_SWIPER_ITEM_SPACE, @@ -4807,16 +2969,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:子组件的索引值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {i32 = 3} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INDEX, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); - * auto nodeSwiperIndex = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_INDEX, @@ -4829,16 +2981,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:子组件的索引值。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {i32 = 3} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISPLAY_COUNT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); - * auto nodeSwiperDisplayCount = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_DISPLAY_COUNT, @@ -4851,16 +2993,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:是否禁用组件滑动切换功能,0表示不禁用滑动切换功能,1表示禁用滑动切换功能,默认值为0。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE); - * auto nodeSwiperDisableSwipe = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_DISABLE_SWIPE, @@ -4875,16 +3007,6 @@ typedef enum { * .value[0].i32:设置是否显示导航点箭头,参数类型{@link ArkUI_SwiperArrow}, \n * 默认值为ARKUI_SWIPER_ARROW_HIDE。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SWIPER_ARROW_SHOW_ON_HOVER} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW); - * auto nodeSwiperShowDisplayArrow = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_SHOW_DISPLAY_ARROW, @@ -4897,13 +3019,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .object:使用{@link ArkUI_NodeHandle}对象作为ListItemGroup头部组件。\n * - * @code {.cpp} - * auto header = nodeAPI->createNode(ARKUI_NODE_TEXT); - * ArkUI_AttributeItem item = { .object = header }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); - * auto nodeListItemGroupSetHeader = item->object; - * @endcode */ NODE_LIST_ITEM_GROUP_SET_HEADER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST_ITEM_GROUP, /** @@ -4915,13 +3030,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .object:使用{@link ArkUI_NodeHandle}对象作为ListItemGroup尾部组件。\n * - * @code {.cpp} - * auto footer = nodeAPI->createNode(ARKUI_NODE_TEXT); - * ArkUI_AttributeItem item = { .object = footer }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); - * auto nodeListItemGroupSetFooter = item->value[0].object; - * @endcode */ NODE_LIST_ITEM_GROUP_SET_FOOTER, /** @@ -4939,13 +3047,6 @@ typedef enum { * .value[2].f32: 分割线距离列表侧边起始端的距离,单位vp;\n * .value[3].f32: 分割线距离列表侧边结束端的距离,单位vp。\n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF }, 1, 0, 0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_DIVIDER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_DIVIDER); - * auto nodeListItemDividerColor = item->value[0].u32; - * @endcode */ NODE_LIST_ITEM_GROUP_SET_DIVIDER, @@ -4959,16 +3060,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:子组件在水平方向上的对齐格式,数据类型{@link ArkUI_HorizontalAlignment}。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_HORIZONTAL_ALIGNMENT_START } }; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS); - * auto nodeColumnAlignItems = item->value[0].i32; - * @endcode - * */ NODE_COLUMN_ALIGN_ITEMS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_COLUMN, /** @@ -4981,16 +3072,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:子组件在垂直方向上的对齐格式,数据类型{@link ArkUI_FlexAlignment}。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT); - * auto nodeColumnJustifyContent = item->value[0].i32; - * @endcode - * */ NODE_COLUMN_JUSTIFY_CONTENT, @@ -5004,16 +3085,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:子组件在垂直方向上的对齐格式,数据类型{@link ArkUI_VerticalAlignment}。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_VERTICAL_ALIGNMENT_TOP } }; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS); - * auto nodeRowAlignItems = item->value[0].i32; - * @endcode - * */ NODE_ROW_ALIGN_ITEMS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_ROW, /** @@ -5026,16 +3097,6 @@ typedef enum { * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:子组件在水平方向上的对齐格式,数据类型{@link ArkUI_FlexAlignment}。 \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT); - * auto nodeRowAlignItems = item->value[0].i32; - * @endcode - * */ NODE_ROW_JUSTIFY_CONTENT, @@ -5056,23 +3117,6 @@ typedef enum { * .value[3].i32:交叉轴上的对齐格式的枚举值; \n * .value[4].i32: 交叉轴中有额外的空间时,多行内容的对齐方式的枚举值; \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FLEX_DIRECTION_COLUMN}, {.i32 = ARKUI_FLEX_WRAP_WRAP}, - * {.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}, {.i32 = ARKUI_ITEM_ALIGNMENT_CENTER}, - * {.i32 = ARKUI_FLEX_ALIGNMENT_END}}; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_OPTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_OPTION); - * auto nodeFlexDirection = item->value[1].i32; - * auto nodeFlexWrap = item->value[2].i32; - * auto nodeFlexJustifyContent = item->value[3].i32; - * auto nodeFlexAlignItems = item->value[4].i32; - * auto nodeFlexAlignContent = item->value[5].i32; - * - * @endcode - * */ NODE_FLEX_OPTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_FLEX, @@ -5084,16 +3128,6 @@ typedef enum { * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n * .value[0].i32:参数类型为1或者0。 - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 0 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_REFRESH_REFRESHING, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_REFRESH_REFRESHING); - * auto value = item->data[0].i32; - * @endcode * */ NODE_REFRESH_REFRESHING = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, -- Gitee From db90045b714ecae9cd892879064d0e102017e4e4 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 22 Feb 2024 06:23:44 +0000 Subject: [PATCH 0287/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 22c2c846..bfad79df 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1261,7 +1261,7 @@ OH_Drawing_Font_Metrics* OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_TextStyle void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*,OH_Drawing_TextStyle*); /** - * @brief 构造OH_Drawing_FontDescriptor对象。 + * @brief 构造字体解析对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 返回指向已创建的字体描述{@link OH_Drawing_FontDescriptor}对象的指针。 @@ -1271,17 +1271,17 @@ void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*,OH_Drawing_Te OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); /** - * @brief 释放OH_Drawing_FontDescriptor对象占用的内存。 + * @brief 释放字体描述对象占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -* @param OH_Drawing_FontDescriptor 指向{@link OH_Drawing_FontDescriptor}对象的指针,由OH_Drawing_FontDescriptor获取。 +* @param OH_Drawing_FontDescriptor 指向字体描述{@link OH_Drawing_FontDescriptor}对象的指针,由OH_Drawing_FontDescriptor获取。 * @since 12 * @version 1.0 */ void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); /** - * @brief 构造OH_Drawing_FontDescriptor对象。 + * @brief 构造字体描述对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 返回指向已创建的字体解析{@link OH_Drawing_FontParser}对象的指针。 @@ -1291,7 +1291,7 @@ void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void); /** - * @brief 释放OH_Drawing_FontParser对象占用的内存。 + * @brief 释放字体解析对象占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontParser 指向字体解析{@link OH_Drawing_FontParser}对象的指针,由OH_Drawing_FontParser获取。 @@ -1329,7 +1329,7 @@ void OH_Drawing_DestroySystemFontList(char**, size_t); * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontParser 指向字体解析{@link OH_Drawing_FontParser}对象的指针,由OH_Drawing_FontParser获取。 * @param char* 系统字体名。 - * @return Returns system fonts. + * @return 返回系统字体。 * @since 12 * @version 1.0 */ @@ -1380,14 +1380,14 @@ void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int); /** - * @brief 获取指定行的位置信息或指定行第一个字符的位置信息 + * @brief 获取指定行的位置信息或指定行第一个字符的位置信息。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向文本OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 行号。 * @param bool true为获取整行的位置信息,false为获取第一个字符的位置信息。 * @param bool 文字宽度是否包含空白符。 - * @param OH_Drawing_LineMetrics 指向OH_Drawing_LineMetrics对象的指针。 + * @param OH_Drawing_LineMetrics 指向行度量{@link OH_Drawing_LineMetrics}对象的指针。 * @return 信息是否成功获取。 * @since 12 * @version 1.0 @@ -1407,7 +1407,7 @@ bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, O void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int); /** - * @brief 设置文本排版风格。 + * @brief 设置字体风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 @@ -1418,11 +1418,11 @@ void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int); void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle*, int); /** - * @brief 设置文本排版字体类型。 + * @brief 设置字体家族的名称。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 - * @param char 字体类型,数据类型为指向char的指针。 + * @param char 字体家族的名称,数据类型为指向char的指针。 * @since 12 * @version 1.0 */ @@ -1451,7 +1451,7 @@ void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle*, double); /** - * @brief 设置文本排版为一半行间距。 + * @brief 设置文本排版是否为一半行间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 @@ -1531,7 +1531,7 @@ void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle*, double /* fontHeight */); /** - * @brief 设置文本排版行样式为一半行间距。 + * @brief 设置文本排版行样式是否为一半行间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 -- Gitee From 160d56a147130ca17adaa8281c7e1bea9250a1ac Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 22 Feb 2024 06:59:21 +0000 Subject: [PATCH 0288/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_text_typography.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index bfad79df..fd610339 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1564,17 +1564,17 @@ void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyl void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle*, bool); /** - * @brief 创建指向OH_Drawing_TextShadow对象的指针。 + * @brief 创建指向文本阴影对象的指针。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 指向创建的OH_Drawing_TextShadow对象的指针。 + * @return 指向创建的文本阴影对象。 * @since 12 * @version 1.0 */ OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); /** - * @brief 释放被OH_Drawing_TextShadow对象占据的内存。 + * @brief 释放被文本阴影对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextShadow 指向字体阴影{@link OH_Drawing_CreateTextShadow}对象的指针,由OH_Drawing_TextShadow获取。 @@ -1606,7 +1606,7 @@ OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*); int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); /** - * @brief 文本阴影容器中添加元素。 + * @brief 文本阴影容器中添加文本阴影元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 @@ -1639,7 +1639,7 @@ void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*); OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextStyle*, int); /** - * @brief 设置排版缩进。 + * @brief 设置文本的排版缩进。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 -- Gitee From 87a874f23f90ba556c4b269f015df238f8958621 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 22 Feb 2024 07:25:10 +0000 Subject: [PATCH 0289/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 105 ++++++++++++++---- 1 file changed, 84 insertions(+), 21 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index fd610339..c821c619 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -295,25 +295,55 @@ typedef enum OH_Drawing_RectWidthStyle { * @version 1.0 */ typedef struct OH_Drawing_FontDescriptor { - /** 系统字体的文件路径 */ + /** + * @brief 系统字体的文件路径 + * @since_2013 12 + */ char* path; - /** 按PostScript页面描述语言(PDL)规则定义的系统字体名称 */ + /** + * @brief 按PostScript页面描述语言(PDL)规则定义的系统字体名称 + * @since_2013 12 + */ char* postScriptName; - /** 系统字体的名称 */ + /** + * @brief 系统字体的名称 + * @since_2013 12 + */ char* fullName; - /** 系统字体的字体家族 */ + /** + * @brief 系统字体的字体家族 + * @since_2013 12 + */ char* fontFamily; - /** 系统字体的子字体家族 */ + /** + * @brief 系统字体的子字体家族 + * @since_2013 12 + */ char* fontSubfamily; - /** 系统字体的粗细程度 */ + /** + * @brief 系统字体的粗细程度 + * @since_2013 12 + */ int weight; - /** 系统字体的宽窄风格属性 */ + /** + * @brief 系统字体的宽窄风格属性 + * @since_2013 12 + */ int width; - /** 系统字体是否倾斜 */ + /** + * @brief 系统字体是否倾斜 + * @since_2013 12 + */ int italic; - /** 系统字体是否紧凑 */ + /** + * @brief 系统字体是否紧凑 + * @since_2013 12 + */ bool monoSpace; - /** 系统字体是否支持符号字体 */ + /** + * @brief 系统字体是否支持符号字体 + * @since_2013 12 + */ bool symbolic; } OH_Drawing_FontDescriptor; @@ -324,27 +354,60 @@ typedef struct OH_Drawing_FontDescriptor { * @version 1.0 */ typedef struct OH_Drawing_LineMetrics { - /** 文字相对于基线以上的高度 */ + /** + * @brief 文字相对于基线以上的高度 + * @since_2013 12 + */ double ascender; - /** 文字相对于基线以下的高度 */ + /** + * @brief 文字相对于基线以下的高度 + * @since_2013 12 + */ double descender; - /** 大写字母的高度 */ + /** + * @brief 大写字母的高度 + * @since_2013 12 + */ double capHeight; - /** 小写字母的高度 */ + /** + * @brief 小写字母的高度 + * @since_2013 12 + */ double xHeight; - /** 文字宽度 */ + /** + * @brief 文字宽度 + * @since_2013 12 + */ double width; - /** 行高 */ + /** + * @brief 行高 + * @since_2013 12 + */ double height; - /** 文字左端到容器左端距离,左对齐为0,右对齐为容器宽度减去行文字宽度 */ + /** + * @brief 文字左端到容器左端距离,左对齐为0,右对齐为容器宽度减去行文字宽度 + * @since_2013 12 + */ double x; - /** 文字上端到容器上端高度,第一行为0,第二行为第一行高度 */ + /** + * @brief 文字上端到容器上端高度,第一行为0,第二行为第一行高度 + * @since_2013 12 + */ double y; - /** 行起始位置字符索引 */ + /** + * @brief 行起始位置字符索引 + * @since_2013 12 + */ size_t startIndex; - /** 行结束位置字符索引 */ + /** + * @brief 行结束位置字符索引 + * @since_2013 12 + */ size_t endIndex; - /** 第一个字的度量信息 */ + /** + * @brief 第一个字的度量信息 + * @since_2013 12 + */ OH_Drawing_Font_Metrics firstCharMetrics; } OH_Drawing_LineMetrics; -- Gitee From 097232e3d13c415d984d98dd8d104e716cae29a0 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 22 Feb 2024 08:27:49 +0000 Subject: [PATCH 0290/2135] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_sdk/graphic/native_drawing/drawing_text_typography.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index c821c619..a7a3830e 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -301,7 +301,7 @@ typedef struct OH_Drawing_FontDescriptor { */ char* path; /** - * @brief 按PostScript页面描述语言(PDL)规则定义的系统字体名称 + * @brief 唯一标识字体的名称 * @since_2013 12 */ char* postScriptName; -- Gitee From 5ed25da5fa3745d45f02ce61d029f381d87546c3 Mon Sep 17 00:00:00 2001 From: m00472246 Date: Thu, 22 Feb 2024 17:02:42 +0800 Subject: [PATCH 0291/2135] =?UTF-8?q?=E9=80=9A=E8=BF=87surfaceId=E5=88=9B?= =?UTF-8?q?=E5=BB=BAnativeWindow=E7=9A=84=E8=B5=84=E6=96=99=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20Signed-off-by:=20m00472246=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: m00472246 --- zh-cn/native_sdk/graphic/external_window.h | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index 051a71d5..d940e423 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -493,6 +493,30 @@ int32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint3 */ int32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, const OHExtDataHandle *handle); +/** + * @brief 通过OHNativeWindow获取对应的surfaceId。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param surfaceId 一个surface对应ID的指针。 + * @return 返回值为0表示执行成功。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_GetSurfaceId(OHNativeWindow *window, uint64_t *surfaceId); + +/** + * @brief 通过surfaceId创建对应的OHNativeWindow。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param surfaceId 一个surface对应的ID。 + * @param window 一个OHNativeWindow的结构体实例的二级指针。 + * @return 返回值为0表示执行成功。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_CreateNativeWindowFromSurfaceId(uint64_t surfaceId, OHNativeWindow **window); + #ifdef __cplusplus } #endif -- Gitee From 712d1700e0383625528f7a3c9e8cb7388d96e0f5 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Thu, 22 Feb 2024 16:47:41 +0800 Subject: [PATCH 0292/2135] Update docs (0222) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_interface.h | 5 +- en/native_sdk/ace/native_node.h | 2260 ++------------------------ en/native_sdk/ace/native_type.h | 27 + 3 files changed, 189 insertions(+), 2103 deletions(-) diff --git a/en/native_sdk/ace/native_interface.h b/en/native_sdk/ace/native_interface.h index 72982ef8..98484108 100644 --- a/en/native_sdk/ace/native_interface.h +++ b/en/native_sdk/ace/native_interface.h @@ -93,7 +93,8 @@ typedef enum { * auto basicNodeApi = reinterpret_cast(anyNativeAPI); * } * @endcode - * + * @deprecated This API is deprecated since API version 10. + * You are advised to use {@link OH_ArkUI_QueryModuleInterface} instead. * @since 12 */ ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32_t version); @@ -105,7 +106,7 @@ ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32 * (API type related to UI components). * @param version Indicates the version of the native API structure, which is obtained through the version enums * supported by the structure. For example, the available version of ARKUI_NATIVE_NODE is - * {@link ARKUI_NATIVE_NODE_VERSION_1}. + * {@link ARKUI_NATIVE_NODE_VERSION}. * @return Returns the pointer to the native API abstract object that carries the version. * @code {.cpp} * #include diff --git a/en/native_sdk/ace/native_node.h b/en/native_sdk/ace/native_node.h index 5b29789c..b44eb0dd 100644 --- a/en/native_sdk/ace/native_node.h +++ b/en/native_sdk/ace/native_node.h @@ -140,15 +140,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].f32: width, in vp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 1.2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_WIDTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_WIDTH); - * auto nodeWidth = item->value[0].f32; - * @endcode - * */ NODE_WIDTH = 0, /** @@ -160,15 +151,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].f32: height, in vp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 1.2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_HEIGHT, &item);clang-tid - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HEIGHT); - * auto nodeHeight = item->value[0].f32; - * @endcode - * */ NODE_HEIGHT, /** @@ -180,15 +162,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].u32: background color. The value is in 0xARGB format. For example, 0xFFFF0000 indicates red.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); - * auto nodeBackgroundColor = item->value[0].u32; - * @endcode - * */ NODE_BACKGROUND_COLOR, /** @@ -197,22 +170,12 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n *.string: image address;\n *.value[0]? .i32: whether to repeat the image. Optional. The parameter type is {@link ArkUI_ImageRepeat}. - * The default value is ARKUI_IMAGE_REPEAT_NONE.\n + * The default value is ARKUI_IMAGE_REPEAT_NONE.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n *.string: image address;\n *.value[0].i32: whether to repeat the image. The parameter type is {@link ArkUI_ImageRepeat}.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_IMAGE_REPEAT_NONE} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); - * auto nodeBackgroundImageUrl = item->string; - * auto nodeBackgroundImageRepeat = item->value[0].i32; - * @endcode - * */ NODE_BACKGROUND_IMAGE, /** @@ -233,18 +196,6 @@ typedef enum { *.value[2].f32: bottom padding, in vp.\n *.value[3].f32: left padding, in vp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value1[] = { 1, 2, 3, 4}; - * ArkUI_AttributeItem item1 = { value1, sizeof(value1)/sizeof(ArkUI_NumberValue) }; - * ArkUI_NumberValue value2[] = { 10 }; - * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item1); - * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item2); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PADDING); - * auto nodePaddingTop = item->value[0].f32; - * @endcode - * */ NODE_PADDING, /** @@ -256,14 +207,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.string: component ID.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "test" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ID, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ID); - * auto nodeId = item->string; - * @endcode - * */ NODE_ID, /** @@ -275,14 +218,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].i32: The value 1 means that the component can interact with users, and 0 means the opposite. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = false} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ENABLED, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ENABLED); - * auto nodeEnabled = item->value[0].i32; - * @endcode */ NODE_ENABLED, /** @@ -303,18 +238,6 @@ typedef enum { *.value[2].f32: bottom margin, in vp.\n *.value[3].f32: left margin, in vp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value1[] = { 1, 2, 3, 4}; - * ArkUI_AttributeItem item1 = { value1, sizeof(value1)/sizeof(ArkUI_NumberValue) }; - * ArkUI_NumberValue value2[] = { 10 }; - * ArkUI_AttributeItem item2 = { value2, sizeof(value2)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item1); - * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item2); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARGIN); - * auto nodeMarginTop = item->value[0].f32; - * @endcode - * */ NODE_MARGIN, /** @@ -330,14 +253,6 @@ typedef enum { *.value[1].f32: distance to translate along the y-axis, in vp.\n *.value[2].f32: distance to translate along the z-axis, in vp. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 100, 20, 0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE); - * auto nodeTranslate = item->value[0].f32; - * @endcode - * */ NODE_TRANSLATE, /** @@ -351,14 +266,6 @@ typedef enum { *.value[0].f32: scale factor along the x-axis.\n *.value[1].f32: scale factor along the y-axis. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 1.0, 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE); - * auto nodeScale = item->value[0].f32; - * @endcode - * */ NODE_SCALE, /** @@ -379,14 +286,6 @@ typedef enum { *.value[3].f32: rotation angle.\n *.value[4].f32: line of sight, that is, the distance from the viewpoint to the z=0 plane, in vp. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 0, 0, 1, 300, 0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE); - * auto nodeRotate = item->value[0].f32; - * @endcode - * */ NODE_ROTATE, /** @@ -398,14 +297,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].f32: brightness value. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 1.2 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BRIGHTNESS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BRIGHTNESS); - * auto nodeBrightness = item->value[0].f32; - * @endcode - * */ NODE_BRIGHTNESS, /** @@ -417,14 +308,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}: \n *.value[0].f32: saturation value. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 1.0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SATURATION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SATURATION); - * auto nodeSaturate = item->value[0].f32; - * @endcode - * */ NODE_SATURATION, /** @@ -438,15 +321,6 @@ typedef enum { *.value[0].f32: blur radius. The larger the fuzzy radius, the more blurred the image. If the value is 0, * the image is not blurred. The unit is vp. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 1.0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BLUR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLUR); - * auto nodeBlur = item->value[0].f32; - * @endcode - * */ NODE_BLUR, /** @@ -454,43 +328,25 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].f32: start angle of the linear gradient. A positive value indicates a clockwise rotation from the - * origin, (0, 0). The default value is 180. \n + * origin, (0, 0). The default value is 180.\n * .value[1].i32: direction of the linear gradient. It does not take effect when angle is set. - * Value: ("left","top","right","bottom","left-top","left-bottom","right-top",\n - * "right-bottom","none",default value "bottom";\n - * .value[2].u32: whether the colors are repeated. The default value is false. - * Example: "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true". \n + * The parameter type is {@link ArkUI_LinearGridientDirection}. \n + *.value[2].i32: whether the colors are repeated. The default value is false. \n * .object: array of color stops, each of which consists of a color and its stop position. * Invalid colors are automatically skipped. \n * colors: colors of the color stops. \n * stops: stop positions of the color stops. \n * size: number of colors. \n * \n - * Format of the return value {@link ArkUI_AttributeItem}: \n - * .value[0].f32: start angle of the linear gradient. A positive value indicates a clockwise rotation from the - * origin, (0, 0). The default value is 180.\n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: start angle of the linear gradient. \n * .value[1].i32: direction of the linear gradient. It does not take effect when angle is set. \n - *.value[0].u32: whether the colors are repeated. The default value is false. \n + * .value[0].i32: whether the colors are repeated. \n * .object: array of color stops, each of which consists of a color and its stop position. * Invalid colors are automatically skipped. \n * colors: colors of the color stops. \n * stops: stop positions of the color stops. \n * size: number of colors. \n - * @code {.cpp} - * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; - * float stops[] = { 0.0, 0.5 }; - * ArkUIColorStop colorStop = { colors, stops, 2 }; - * ArkUI_ColorStop* ptr = &colorStop; - * ArkUI_NumberValue value[] = {{ .f32 = 60 } , { .i32 = left } , { .i32 = true }}; - * ArkUI_AttributeItem item = - * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LINEAR_GRADIENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LINEAR_GRADIENT); - * auto nodeLinearGradientStartAngel = item->value[0]; - * auto nodeLinearGradientDirection = item->value[1]; - * auto nodeLinearGradientFill = item->value[2]; - * auto nodeLinearGradientColorStop = item->object; - * @endcode * */ NODE_LINEAR_GRADIENT, @@ -504,14 +360,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: alignment mode. The data type is {@link ArkUI_Alignment}. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGNMENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT); - * auto nodeAlign = item->value[0].i32; - * @endcode - * */ NODE_ALIGNMENT, /** @@ -523,16 +371,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: opacity value. The value ranges from 0 to 1. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY); - * auto nodeOpacity = item->value[0].f32; - * @endcode - * */ NODE_OPACITY, /** @@ -551,19 +389,6 @@ typedef enum { * .value[2].f32: width of the bottom border. \n * .value[3].f32: width of the left border. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); - * ArkUI_NumberValue value[] = { 5, 5, 10, 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_WIDTH); - * auto nodeBorderWitdh = item->value[0].f32; - * @endcode - * */ NODE_BORDER_WIDTH, /** @@ -582,19 +407,6 @@ typedef enum { *.value[2].f32: radius of the lower left corner. \n *.value[3].f32: radius of the lower right corner. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); - * ArkUI_NumberValue value[] = { 5, 5, 10, 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_RADIUS); - * auto nodeBorderRadius = item->value[0].f32; - * @endcode - * */ NODE_BORDER_RADIUS, /** @@ -613,19 +425,6 @@ typedef enum { * .value[2].u32: color of the lower border, in 0xARGB format, for example, 0xFFFF11FF. \n * .value[3].u32: color of the left border, in 0xARGB format, for example, 0xFFFF11FF. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32 = 0xFFFF11FF} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); - * ArkUI_NumberValue value[] = { {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFFFFFF}, {.u32 = 0x000000} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_COLOR); - * auto nodeBorderColor = item->value[0].u32; - * @endcode - * */ NODE_BORDER_COLOR, /** @@ -649,20 +448,6 @@ typedef enum { * .value[2].i32: line style of the bottom border. \n * .value[3].i32: line style of the left border. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_BORDER_STYLE_DOTTED} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_BORDER_STYLE_DOTTED}, {.i32 = ARKUI_BORDER_STYLE_SOLID}, - * {.i32 = ARKUI_BORDER_STYLE_SOLID}, {.i32 = ARKUI_BORDER_STYLE_DOTTED} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_STYLE); - * auto nodeBorderStyle = item->value[0].i32; - * @endcode - * */ NODE_BORDER_STYLE, /** @@ -675,16 +460,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: z-index value. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_Z_INDEX, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_Z_INDEX); - * auto nodeZIndex = item->value[0].f32; - * @endcode - * */ NODE_Z_INDEX, /** @@ -698,16 +473,6 @@ typedef enum { * .value[0].i32: whether to show or hide the component. The parameter type is {@link ArkUI_Visibility}. * The default value is ARKUI_VISIBILITY_VISIBLE. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_VISIBILITY_NONE} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_VISIBILITY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_VISIBILITY); - * auto nodeVisibility = item->value[0].i32; - * @endcode - * */ NODE_VISIBILITY, /** @@ -721,16 +486,6 @@ typedef enum { * .value[0].i32: whether to clip the component based on the parent container bounds. * The value 0 means to clip the component, and 1 means the opposite. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 0} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); - * auto nodeClip = item->value[0].i32; - * @endcode - * */ NODE_CLIP, /** @@ -787,21 +542,6 @@ typedef enum { * .value[2].f32: height of the path.\n * .string: command for drawing the path.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = - * { {.i32 = ARKUI_CLIP_TYPE_RECT}, 100, 100, 15, 15, { .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP_SHAPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP_SHAPE); - * auto nodeClipType = item->value[0].i32; - * auto nodeClipWidth = item->value[1].f32; - * auto nodeClipHeight = item->value[2].f32; - * auto nodeClipRadiusWidth = item->value[3].f32; - * auto nodeClipRadiusHeight = item->value[4].f32; - * @endcode - * */ NODE_CLIP_SHAPE, /** @@ -814,17 +554,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .data[0...15].f32: 16 floating-point numbers. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, - * {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM); - * auto nodeTransform = item[0].value; - * @endcode - * */ NODE_TRANSFORM, /** @@ -838,16 +567,6 @@ typedef enum { * .value[0].i32: hit test mode. The parameter type is {@link ArkUI_HitTestMode}. * The default value is ARKUI_HIT_TEST_MODE_DEFAULT. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_HIT_TEST_MODE_BLOCK} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR); - * auto nodeHitTestBehavior = item->value[0].i32; - * @endcode - * */ NODE_HIT_TEST_BEHAVIOR, /** @@ -862,17 +581,6 @@ typedef enum { * .value[0].f32: X coordinate. \n * .value[1].f32: Y coordinate. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 50, 50 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_POSITION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_POSITION); - * auto nodePositionX = item->value[0].f32; - * auto nodePositionY = item->value[1].f32; - * @endcode - * */ NODE_POSITION, /** @@ -884,16 +592,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].i32: shadow effect. The parameter type is {@link ArkUI_ShadowStyle}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SHADOW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SHADOW); - * auto nodePositionX = item->value[0].i32; - * @endcode - * */ NODE_SHADOW, /** @@ -913,7 +611,7 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: blur radius of the shadow, in vp.\n - * .value[1]?.i32: whether to enable the coloring strategy.\n + * .value[1].i32: whether to enable the coloring strategy. \n * .value[2].f32: offset of the shadow along the x-axis, in vp.\n * .value[3].f32: offset of the shadow along the y-axis, in vp.\n * .value[4].i32: shadow type {@link ArkUI_ShadowType}. The default value is ARKUI_SHADOW_TYPE_COLOR.\n @@ -921,20 +619,6 @@ typedef enum { * .value[6].u32: whether to fill the shadow. The value 1 means to fill the shadow, and 0 * means the opposite.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = - * { 10, {.i32 = 1},10, 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, {.i32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); - * auto nodeCustomShadowRadius = item->value[0].f32; - * auto nodeCustomShadowOffsetX = item->value[1].f32; - * auto nodeCustomShadowOffsetY = item->value[2].f32; - * auto nodeCustomShadowType = item->value[3].i32; - * auto nodeCustomShadowColor = item->value[4].u32; - * @endcode - * */ NODE_CUSTOM_SHADOW, /** @@ -949,16 +633,6 @@ typedef enum { * .value[0].f32: width of the image, in vp. \n * .value[1].f32: height of the image, in vp. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue sizeArray[] = { 20, 0 }; - * ArkUI_AttributeItem item = { .value = sizeArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE , &item); - * auto imageSizeItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); - * auto width = imageSizeItem->value[0].f32; - * @endcode - * */ NODE_BACKGROUND_IMAGE_SIZE, /** @@ -971,15 +645,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: size of the background image. The value is an enum of {@link ArkUI_ImageSize}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue imageSizeStyle[] = { {.i32 = static_cast(ARKUI_IMAGE_SIZE_COVER) } }; - * ArkUI_AttributeItem item = { .value = imageSizeStyle, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, &item); - * auto imageSizeStyleItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); - * auto blurStyleValue = imageSizeStyleItem->value[0].i32; - * @endcode */ NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, /** @@ -995,21 +660,11 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: blue type. The value is an enum of {@link ArkUI_BlurStyle}. \n - * .value[1]? .i32: color mode. The value is an enum of {@link ArkUI_ColorMode}. \n - * .value[2]? .i32: adaptive color mode. The value is an enum of {@link ArkUI_AdaptiveColor}. \n - * .value[3]? .f32: blur degree. The value range is [0.0, 1.0]. \n - * .value[4]? .f32: start boundary of grayscale blur. \n - * .value[5]? .f32: end boundary of grayscale blur. \n - * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue blurStyle[] = { { .i32 = static_cast(ARKUI_BLUR_STYLE_THICK)}}; - * ArkUI_AttributeItem item = { .value = blurStyle, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE , &item); - * auto blurStyleItem = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); - * auto blurStyleType = blurStyleItem->value[0].i32; - * @endcode + * .value[1].i32: color mode. The value is an enum of {@link ArkUI_ColorMode}. \n + * .value[2].i32: adaptive color mode. The value is an enum of {@link ArkUI_AdaptiveColor}. \n + * .value[3].f32: blur degree. The value range is [0.0, 1.0]. \n + * .value[4].f32: start boundary of grayscale blur. \n + * .value[5].f32: end boundary of grayscale blur. \n * */ NODE_BACKGROUND_BLUR_STYLE, @@ -1020,29 +675,20 @@ typedef enum { * .value[0]? .f32: X coordinate of the center point, in vp.\n * .value[1]? .f32: Y coordinate of the center point, in vp.\n * .value[2]? .f32: Z coordinate of the center point, in vp.\n - * .value[3]? .f32 : X coordinate of the center point, expressed in a number that represents a percentage. + * .value[3]?.f32 : X coordinate of the center point, expressed in a number that represents a percentage. * For example, 0.2 indicates 20%. This attribute overwrites value[0].f32. The default value is 0.5f. \n - * .value[4]? .f32 : Y coordinate of the center point, expressed in a number that represents a percentage. + * .value[4]?.f32 : Y coordinate of the center point, expressed in a number that represents a percentage. * For example, 0.2 indicates 20%. This attribute overwrites value[1].f32. The default value is 0.5f. \n - * .value[5]? .f32 : Z coordinate of the center point, expressed in a number that represents a percentage. + * .value[5]?.f32 : Z coordinate of the center point, expressed in a number that represents a percentage. * For example, 0.2 indicates 20%. This attribute overwrites value[2].f32. The default value is 0.0f. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0]? .f32: X coordinate of the center point, in vp.\n - * .value[1]? .f32: Y coordinate of the center point, in vp.\n - * .value[2]? .f32: Z coordinate of the center point, in vp.\n + * .value[0].f32: X coordinate of the center point, in vp.\n + * .value[1].f32: Y coordinate of the center point, in vp.\n + * .value[2].f32: Z coordinate of the center point, in vp.\n * Note: If the coordinate is expressed in a number that represents a percentage, the attribute obtaining API * returns the calculated value in vp. * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue centerPointArray[] = { 20 }; - * ArkUI_AttributeItem item = { .value = centerPointArray, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM_CENTER , &item); - * auto transformCenterItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM_CENTER); - * auto centerX = transformCenterItem->value[0].f32; - * @endcode */ NODE_TRANSFORM_CENTER, /** @@ -1061,21 +707,11 @@ typedef enum { * .value[0].f32: opacity values of the start and end points.\n * .value[1].i32: animation duration, in milliseconds.\n * .value[2].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n - * .value[3]? .i32: animation delay duration, in milliseconds.\n - * .value[4]? .i32: number of times that the animation is played.\n - * .value[5]? .i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}.\n - * .value[6]? .f32: animation playback speed.\n + * .value[3].i32: animation delay duration, in milliseconds. \n + * .value[4].i32: number of times that the animation is played. \n + * .value[5].i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * .value[6].f32: animation playback speed. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue opacityTransition[] = { 20, { .i32 = 3000}, - * { .i32 = static_cast(ARKUI_CURVE_EASE_IN_OUT)}}; - * ArkUI_AttributeItem item = { .value = opacityTransition, .size = 3}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY_TRANSITION , &item); - * auto opacityTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); - * auto opacity = opacityTransitionItem->value[0].f32; - * @endcode */ NODE_OPACITY_TRANSITION, /** @@ -1102,21 +738,11 @@ typedef enum { * .value[4].f32: line of sight. \n * .value[5].i32: animation duration, in milliseconds. \n * .value[6].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n - * .value[7]? .i32: animation delay duration, in milliseconds. \n - * .value[8]? .i32: number of times that the animation is played. \n - * .value[9]? .i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n - * .value[10]? .f32: animation playback speed. \n + * .value[7].i32: animation delay duration, in milliseconds. \n + * .value[8].i32: number of times that the animation is played. \n + * .value[9].i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * .value[10].f32: animation playback speed. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue rotateTransition[] = { 0.0f, 0.0f, 1.0f, 180, 0, { .i32 = 3000}, - * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; - * ArkUI_AttributeItem item = { .value = rotateTransition, .size = 7}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE_TRANSITION , &item); - * auto rotateTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); - * auto rotateX = rotateTransitionItem->value[0].f32; - * @endcode */ NODE_ROTATE_TRANSITION, /** @@ -1139,21 +765,11 @@ typedef enum { * .value[2].f32: scale factor along the z-axis. \n * .value[3].i32: animation duration, in milliseconds. \n * .value[4].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n - * .value[5]?.i32: animation delay duration, in milliseconds. \n - * .value[6]?.i32: number of times that the animation is played. \n - * .value[7]?.i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n - * .value[8]?.f32: animation playback speed. \n + * .value[5].i32: animation delay duration, in milliseconds. \n + * .value[6].i32: number of times that the animation is played. \n + * .value[7].i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * .value[8].f32: animation playback speed. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue scaleTransition[] = { 0.0f, 0.0f, 0.0f, { .i32 = 3000}, - * { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; - * ArkUI_AttributeItem item = { .value = scaleTransition, .size = 5}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE_TRANSITION , &item); - * auto scaleTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); - * auto scaleX = scaleTransitionItem->value[0].f32; - * @endcode */ NODE_SCALE_TRANSITION, /** @@ -1177,21 +793,11 @@ typedef enum { * value[2].f32: translation distance along the z-axis, in vp.\n * value[3].i32: animation duration, in milliseconds. \n * value[4].i32: animation curve type. The value is an enum of {@link ArkUI_AnimationCurve}.\n \n - * value[5]?.i32: animation delay duration, in milliseconds. \n - * value[6]?.i32: number of times that the animation is played. \n - * value[7]?.i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n - * value[8]?.f32: animation playback speed. \n + * value[5].i32: animation delay duration, in milliseconds. \n + * value[6].i32: number of times that the animation is played. \n + * value[7].i32: animation playback mode. The value is an enum of {@link ArkUI_AnimationPlayMode}. \n + * value[8].f32: animation playback speed. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue translateTransition[] = { 0.0f, 0.0f, 0.0f, - * { .i32 = 3000}, { .i32 = static_cast(ARKUI_CURVE_SHARP)}}; - * ArkUI_AttributeItem item = { .value = translateTransition, .size = 5}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION , &item); - * auto translateTransitionItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); - * auto translateX = translateTransitionItem->value[0].f32; - * @endcode */ NODE_TRANSLATE_TRANSITION, @@ -1204,16 +810,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: The parameter type is 1 or 0. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUSABLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUSABLE); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_FOCUSABLE, @@ -1226,16 +822,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * value[0].i32: The parameter type is 1 or 0. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DEFAULT_FOCUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DEFAULT_FOCUS); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_DEFAULT_FOCUS, @@ -1256,23 +842,6 @@ typedef enum { * .data[3].f32: height of the touch target, in %. \n * .data[4...].f32: Multiple touch targets can be set. The sequence of the parameters is the same as the preceding. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0, 0, 100, 100 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); - * - * ArkUI_NumberValue value[] = { 0, 0, 100, 100, 0, 0, 100, 100 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RESPONSE_REGION); - * auto x = item->value[0].f32; - * auto y = item->value[1].f32; - * auto width = item->value[2].f32; - * auto height = item->value[3].f32; - * @endcode - * */ NODE_RESPONSE_REGION, @@ -1289,21 +858,12 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: mask text.\n - * .value[0]?.i32: position of the overlay relative to the component. Optional. + * .value[0].i32: position of the overlay relative to the component. * The value is an enum of {@link ArkUI_Alignment}. * The default value is ARKUI_ALIGNMENT_TOP_START. \n - * .value[1]?.f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. Optional. \n - * .value[2]?.f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. Optional. + * .value[1].f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. \n + * .value[2].f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_TOP_START }, 1.2, 0.3 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_OVERLAY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OVERLAY); - * auto text = item->string; - * @endcode * */ NODE_OVERLAY, @@ -1326,12 +886,12 @@ typedef enum { * size: number of colors. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0]?.f32: X coordinate of the sweep gradient center relative to the upper left corner of the component.\n - * .value[1]?.f32: Y coordinate of the sweep gradient center relative to the upper left corner of the component.\n - * .value[2]?.f32: start point of the sweep gradient. The default value is 0. \n - * .value[3]?.f32: end point of the sweep gradient. The default value is 0. \n - * .value[4]?.f32: rotation angle of the sweep gradient. The default value is 0. \n - * .value[5]?.i32: whether the colors are repeated. The value 1 means that the colors are repeated, + * .value[0].f32: X coordinate of the sweep gradient center relative to the upper left corner of the component. \n + * .value[1].f32: Y coordinate of the sweep gradient center relative to the upper left corner of the component. \n + * .value[2].f32: start point of the sweep gradient. The default value is 0. \n + * .value[3].f32: end point of the sweep gradient. The default value is 0. \n + * .value[4].f32: rotation angle of the sweep gradient. The default value is 0. \n + * .value[5].i32: whether the colors are repeated. The value 1 means that the colors are repeated, * and 0 means the opposite.\n * .object: array of color stops, each of which consists of a color and its stop position. Invalid colors are * automatically skipped.\n @@ -1339,27 +899,6 @@ typedef enum { * stops: stop positions of the color stops. \n * size: number of colors. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; - * float stops[] = { 0.0, 0.5 }; - * ArkUIColorStop colorStop = { colors, stops, 2 }; - * ArkUI_ColorStop* ptr = &colorStop; - * ArkUI_NumberValue value[] = { 50, 50, 60, 180, 180, {.i32 = 1}}; - * ArkUI_AttributeItem item = - * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); - * auto nodeSweepGradientCeneterX = item->value[0]; - * auto nodeSweepGradientCeneterY = item->value[1]; - * auto nodeSweepGradientStart = item->value[2]; - * auto nodeSweepGradientEnd = item->value[3]; - * auto nodeSweepGradientRotation = item->value[4]; - * auto nodeSweepGradientFill = item->value[5]; - * auto nodeSweepGradientColorStop = item->object; - * @endcode - * */ NODE_SWEEP_GRADIENT, /** @@ -1379,10 +918,10 @@ typedef enum { * size: number of colors. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0]?.f32: X coordinate of the radial gradient center relative to the upper left corner of the component. \n - * .value[1]?.f32: Y coordinate of the radial gradient center relative to the upper left corner of the component. \n - * .value[2]?.f32: radius of the radial gradient. The default value is 0. \n - * .value[3]?.i32: whether the colors are repeated. The value 1 means that the colors are repeated, + * .value[0].f32: X coordinate of the radial gradient center relative to the upper left corner of the component. \n + * .value[1].f32: Y coordinate of the radial gradient center relative to the upper left corner of the component. \n + * .value[2].f32: radius of the radial gradient. The default value is 0. \n + * .value[3].i32: whether the colors are repeated. The value 1 means that the colors are repeated, * and 0 means the opposite.\n * .object: array of color stops, each of which consists of a color and its stop position. Invalid colors are * automatically skipped. \n @@ -1390,25 +929,6 @@ typedef enum { * stops: stop positions of the color stops. \n * size: number of colors. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * unsigned int colors[] = { 0xFFFFFFFF,0xFF0000FF }; - * float stops[] = { 0.0, 0.5 }; - * ArkUIColorStop colorStop = { colors, stops, 2 }; - * ArkUI_ColorStop* ptr = &colorStop; - * ArkUI_NumberValue value[] = { 50, 50, 20, {.i32 = 1}}; - * ArkUI_AttributeItem item = - * { value, sizeof(value)/sizeof(ArkUI_NumberValue), .object = reinterpret_cast(ptr) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); - * auto nodeRadialGradientCeneterX = item->value[0]; - * auto nodeRadialGradientCeneterY = item->value[1]; - * auto nodeRadialGradientradius = item->value[2]; - * auto nodeRadialGradientFill = item->value[3]; - * auto nodeRadialGradientColorStop = item->object; - * @endcode - * */ NODE_RADIAL_GRADIENT, /** @@ -1418,9 +938,9 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute, which supports five types of * shapes:\n * 1. Rectangle:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. * The value is ARKUI_MASK_TYPE_RECT for the rectangle shape.\n * .value[4].f32: width of the rectangle.\n @@ -1428,34 +948,34 @@ typedef enum { * .value[6].f32: width of the rounded corner of the rectangle.\n * .value[7].f32: height of the rounded corner of the rectangle.\n * 2. Circle:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. * The value is ARKUI_MASK_TYPE_CIRCLE for the circle shape.\n * .value[4].f32: width of the circle.\n * .value[5].f32: height of the circle.\n * 3.Ellipse:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. * The value is ARKUI_MASK_TYPE_ELLIPSE for the ellipse shape.\n * .value[4].f32: width of the ellipse.\n * .value[5].f32: height of the ellipse.\n * 4. Path:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. * The value is ARKUI_MASK_TYPE_PATH for the path shape.\n * .value[4].f32: width of the path.\n * .value[5].f32: height of the path.\n * .string: command for drawing the path.\n * 4. Progress:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. * The value is ARKUI_MASK_TYPE_PROSGRESS for the progress shape.\n * .value[4].f32: current value of the progress indicator.\n @@ -1464,32 +984,32 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}, which supports five types of shapes:\n * 1. Rectangle:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n * .value[3].i32: mask type.\n * .value[4].f32: width of the rectangle.\n * .value[5].f32: height of the rectangle.\n * .value[6].f32: width of the rounded corner of the rectangle.\n * .value[7].f32: height of the rounded corner of the rectangle.\n * 2. Circle:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n * .value[3].i32: mask type.\n * .value[4].f32: width of the circle.\n * .value[5].f32: height of the circle.\n * 3.Ellipse:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n * .value[3].i32: mask type.\n * .value[4].f32: width of the ellipse.\n * .value[5].f32: height of the ellipse.\n * 4. Path:\n - * .value[0].u32: fill color, in 0xARGB format. Optional.\n - * .value[1].u32: stroke color, in 0xARGB format. Optional.\n - * .value[2].f32: stroke width, in vp. Optional.\n + * .value[0].u32 fill color, in 0xARGB format. \n + * .value[1].u32: stroke color, in 0xARGB format. \n + * .value[2].f32: stroke width, in vp. \n * .value[3].i32: mask type.\n * .value[4].f32: width of the path.\n * .value[5].f32: height of the path.\n @@ -1500,24 +1020,6 @@ typedef enum { * .value[2].f32: maximum value of the progress indicator.\n * .value[3].u32: color of the progress indicator.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = - * {{ .u32 = 0xFFFF0000 }, { .u32 = 0xFFFF0000 }, 2 , {.i32 = ARKUI_MASK_TYPE_RECT}, 100, 100, 15, 15 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_MASK, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MASK); - * auto nodeMaskFill = item->value[0].u32; - * auto nodeMaskStrokeColor = item->value[1].u32; - * auto nodeMaskStrokeWidth = item->value[2].f32; - * auto nodeMaskType = item->value[3].i32; - * auto nodeMaskWidth = item->value[4].f32; - * auto nodeMaskHeight = item->value[5].f32; - * auto nodeMaskRadiusWidth = item->value[6].f32; - * auto nodeMaskradiusHeight = item->value[7].f32; - * @endcode - * */ NODE_MASK, /** @@ -1532,16 +1034,6 @@ typedef enum { * .value[0].i32: blend mode. The parameter type is {@link ArkUI_BlendMode}. * The default value is ARKUI_BLEND_MODE_NONE. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_BLEND_MODE_NONE} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BLEND_MODE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLEND_MODE); - * auto nodeBlendMode = item->value[0].i32; - * @endcode - * */ NODE_BLEND_MODE, /** @@ -1556,16 +1048,6 @@ typedef enum { * .value[0].i32: direction of the main axis.\n * The parameter type is {@link ArkUI_Direction}. The default value is ARKUI_DIRECTION_AUTO. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_DIRECTION_RTL} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DIRECTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DIRECTION); - * auto nodeDirection = item->value[0].i32; - * @endcode - * */ NODE_DIRECTION, /** @@ -1584,18 +1066,6 @@ typedef enum { * .value[2].f32: minimum height, in vp.\n * .value[3].f32: maximum height, in vp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0, 5, 0, 5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CONSTRAINT_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); - * auto nodeMinWidth = item->value[0].f32; - * auto nodeMaxWidth = item->value[1].f32; - * auto nodeMinHeight = item->value[2].f32; - * auto nodeMaxHeight = item->value[3].f32; - * @endcode - * */ NODE_CONSTRAINT_SIZE, /** @@ -1604,19 +1074,11 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].f32: grayscale conversion ratio. The value ranges from 0 to 1. - * For example, 0.5 indicates a 50% grayscale conversion ratio.\n + * For example, 0.5 indicates a 50% grayscale conversion ratio. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: grayscale conversion ratio. The value ranges from 0 to 1.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_GRAY_SCALE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_GRAY_SCALE); - * auto nodeGrayScale = item->value[0].f32; - * @endcode */ NODE_GRAY_SCALE, /** @@ -1630,14 +1092,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: image inversion ratio. The value ranges from 0 to 1.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_INVERT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_INVERT); - * auto nodeInvert = item->value[0].f32; - * @endcode */ NODE_INVERT, /** @@ -1651,14 +1105,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: sepia conversion ratio. The value ranges from 0 to 1.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0.5 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SEPIA, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SEPIA); - * auto nodeSepia = item->value[0].f32; - * @endcode */ NODE_SEPIA, /** @@ -1671,14 +1117,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: contrast. Value range: [0, 10).\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CONTRAST, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CONTRAST); - * auto nodeContrast = item->value[0].f32; - * @endcode */ NODE_CONTRAST, /** @@ -1691,13 +1129,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: color value, in 0xARGB format.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { {.u32=0xFFFF0000} }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FOREGROUND_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); - * auto nodeForegroundColor = item->value[0].u32; - * @endcode */ NODE_FOREGROUND_COLOR, @@ -1713,16 +1144,6 @@ typedef enum { * .value[0].f32 : offset along the x-axis, in vp. \n * .value[1].f32 : offset along the y-axis, in vp. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue offsetArray[] = { 20, 0 }; - * ArkUI_AttributeItem item = { .value = offsetArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_OFFSET , &item); - * auto offsetItem = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); - * auto offsetX = offsetItem->value[0].f32; - * @endcode - * */ NODE_OFFSET, /** @@ -1737,16 +1158,6 @@ typedef enum { * .value[0].f32: X coordinate of the anchor, in vp.\n * .value[1].f32: Y coordinate of the anchor, in vp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue pointArray[] = { 20, 0 }; - * ArkUI_AttributeItem item = { .value = pointArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_MARK_ANCHOR , &item); - * auto anchorItem = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); - * auto pointX = anchorItem->value[0].f32; - * @endcode - * */ NODE_MARK_ANCHOR, /** @@ -1760,15 +1171,7 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: position along the x-axis, in vp. \n * .value[1].f32: position along the y-axis, in vp. \n - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue possitionArray[] = { 20, 0 }; - * ArkUI_AttributeItem item = { .value = possitionArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_POSITION , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_POSITION); - * auto offsetX = item->value[0].f32; - * @endcode + * */ NODE_BACKGROUND_IMAGE_POSITION, /** @@ -1799,38 +1202,27 @@ typedef enum { * .value[13]?.f32: bias value in the vertical direction. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0]?.i32: ID of the component that functions as the anchor point for left alignment. \n - * .value[1]?.i32: alignment mode relative to the anchor component for left alignment. + * .value[0].i32: ID of the component that functions as the anchor point for left alignment. \n + * .value[1].i32: alignment mode relative to the anchor component for left alignment. * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n - * .value[2]?.i32: ID of the component that functions as the anchor point for center alignment. \n - * .value[3]?.i32: alignment mode relative to the anchor component for center alignment. + * .value[2].i32: ID of the component that functions as the anchor point for center alignment. \n + * .value[3].i32: alignment mode relative to the anchor component for center alignment. * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n - * .value[4]?.i32: ID of the component that functions as the anchor point for right alignment. \n - * .value[5]?.i32: alignment mode relative to the anchor component for right alignment. + * .value[4].i32: ID of the component that functions as the anchor point for right alignment. \n + * .value[5].i32: alignment mode relative to the anchor component for right alignment. * The value is an enum of {@link ArkUI_HorizontalAlignment}. \n - * .value[6]?.i32: ID of the component that functions as the anchor point for top alignment. \n - * .value[7]?.i32: alignment mode relative to the anchor component for top alignment. + * .value[6].i32: ID of the component that functions as the anchor point for top alignment. \n + * .value[7].i32: alignment mode relative to the anchor component for top alignment. * The value is an enum of {@link ArkUI_VerticalAlignment}. \n - * .value[8]?.i32: ID of the component that functions as the anchor point for center alignment in the + * .value[8].i32: ID of the component that functions as the anchor point for center alignment in the * vertical direction. \n - * .value[9]?.i32: alignment mode relative to the anchor component forcenter alignment in the vertical direction. + * .value[9].i32: alignment mode relative to the anchor component forcenter alignment in the vertical direction. * The value is an enum of {@link ArkUI_VerticalAlignment}. \n - * .value[10]?.i32: ID of the component that functions as the anchor point for bottom alignment. \n - * .value[11]?.i32: alignment mode relative to the anchor component for bottom alignment. + * .value[10].i32: ID of the component that functions as the anchor point for bottom alignment. \n + * .value[11].i32: alignment mode relative to the anchor component for bottom alignment. * The value is an enum of {@link ArkUI_VerticalAlignment}. \n - * .value[12]?.f32: bias value in the horizontal direction. \n - * .value[13]?.f32: bias value in the vertical direction. \n - * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue alignRulesArray[] = { { .i32 = 2000}, { .i32 = - * static_cast(ARKUI_HORIZONTAL_ALIGNMENT_START)}}; - * ArkUI_AttributeItem item = { .value = alignRulesArray, .size = 2}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGN_RULES , &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT_RULES); - * auto id = item->value[0].i32; - * @endcode + * .value[12].f32: bias value in the horizontal direction. \n + * .value[13].f32: bias value in the vertical direction. \n * */ NODE_ALIGN_RULES, @@ -1846,16 +1238,6 @@ typedef enum { * .value[0].f32: alignment mode of the child components along the cross axis of the parent container.\n * The parameter type is {@link ArkUI_ItemAlign}. The default value is ARKUI_ITEM_ALIGN_AUTO. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_ITEM_ALIGN_STRETCH} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ALIGN_SELF, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ALIGN_SELF); - * auto nodeHitTestBehavior = item->value[0].f32; - * @endcode - * */ NODE_ALIGN_SELF, /** @@ -1868,16 +1250,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: percentage of the parent container's remaining space that is allocated to the component. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_GROW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_GROW); - * auto nodeFlexGrow = item->value[0].f32; - * @endcode - * */ NODE_FLEX_GROW, /** @@ -1890,16 +1262,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: percentage of the parent container's shrink size that is allocated to the component. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_SHRINK, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_SHRINK); - * auto nodeFlexShrink = item->value[0].f32; - * @endcode - * */ NODE_FLEX_SHRINK, /** @@ -1912,16 +1274,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: percentage of the parent container's remaining space that is allocated to the component. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 2 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_BASIS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_BASIS); - * auto nodeFlexBasis = item->value[0].f32; - * @endcode - * */ NODE_FLEX_BASIS, /** @@ -1939,16 +1291,6 @@ typedef enum { * In this case, the accessibility service will no longer be available for the content of its child components. * The value is 1 or 0. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_GROUP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_GROUP); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_ACCESSIBILITY_GROUP, @@ -1960,15 +1302,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: accessibility text. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = {.string = "test"}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_TEXT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_TEXT); - * auto value = item->string; - * @endcode * */ NODE_ACCESSIBILITY_TEXT, @@ -1981,16 +1314,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: accessibility level. The parameter type is {@link ArkUI_AccessibilityLevel}. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ACCESSIBILITY_LEVEL_AUTO } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_LEVEL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_LEVEL); - * auto value = item->value[0].i32; - * @endcode * */ NODE_ACCESSIBILITY_LEVEL, @@ -2004,15 +1327,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: accessibility description. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "test" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ACCESSIBILITY_DESCRIPTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ACCESSIBILITY_DESCRIPTION); - * auto value = item->string; - * @endcode * */ NODE_ACCESSIBILITY_DESCRIPTION, @@ -2025,16 +1339,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: The parameter type is 1 or 0. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUS_STATUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUS_STATUS); - * auto value = item->data[0].i32; - * @endcode * */ NODE_FOCUS_STATUS, @@ -2047,15 +1351,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: text content.\n - * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CONTENT , &item); - * auto textContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); - * auto content = textContentItem->string; - * @endcode */ NODE_TEXT_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT, /** @@ -2067,15 +1362,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].u32: font color value, in 0xARGB format.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_COLOR); - * auto nodeFontColor = item->value[0].u32; - * @endcode - * */ NODE_FONT_COLOR, /** @@ -2087,15 +1373,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: font size, in fp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_SIZE); - * auto nodeFontSize = item->value[0].f32; - * @endcode - * */ NODE_FONT_SIZE, /** @@ -2107,15 +1384,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: font style {@link ArkUI_FontStyle}.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_STYLE_NORMAL} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_STYLE); - * auto nodeFontStyle = item->value[0].i32; - * @endcode - * */ NODE_FONT_STYLE, /** @@ -2127,15 +1395,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: font weight {@link ArkUI_FontWeight}.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FONT_WEIGHT_NORMAL} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_WEIGHT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_WEIGHT); - * auto nodeFontWeight = item->value[0].i32; - * @endcode - * */ NODE_FONT_WEIGHT, /** @@ -2147,15 +1406,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: line height, in fp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue lineHeight[] = { 20 }; - * ArkUI_AttributeItem item = { .value = lineHeight, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT , &item); - * auto lineHeightItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); - * auto pointX = lineHeightItem->value[0].f32; - * @endcode */ NODE_TEXT_LINE_HEIGHT, /** @@ -2171,16 +1421,6 @@ typedef enum { * .value[0].i32: text decoration style {@link ArkUI_TextDecorationType}.\n * .value[1].u32: text decoration color, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); - * auto decorationItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_DECORATION); - * auto nodeDecorationStyle = decorationItem->value[0].i32; - * auto nodeDecorationColor = decorationItem->value[1].u32; - * @endcode - * */ NODE_TEXT_DECORATION, /** @@ -2192,16 +1432,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: text case.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue textCase[] = { {.i32 = static_cast(ARKUI_TEXT_CASE_LOWER) } }; - * ArkUI_AttributeItem item = { .value = textCase, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CASE, &item); - * auto textCaseItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); - * auto textCase = textCaseItem->value[0].i32; - * @endcode - * */ NODE_TEXT_CASE, /** @@ -2213,16 +1443,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: letter spacing, in fp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue letterSpacing[] = { 20 }; - * ArkUI_AttributeItem item = { .value = letterSpacing, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING , &item); - * auto letterSpacingItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); - * auto letterSpacing = letterSpacingItem->value[0].f32; - * @endcode - * */ NODE_TEXT_LETTER_SPACING, /** @@ -2234,16 +1454,7 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: maximum number of lines in the text.\n - - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue maxLine[] = { { .i32 = 2 } }; - * ArkUI_AttributeItem item = { .value = maxLine, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_LINES , &item); - * auto maxLinesItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); - * auto maxLines = maxLinesItem->value[0].i32; - * @endcode + * */ NODE_TEXT_MAX_LINES, /** @@ -2256,15 +1467,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: horizontal alignment mode of the text. The value is an enum of {@link ArkUI_TextAlignment}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue alignMent[] = {{.i32 = static_cast(ARKUI_TEXT_ALIGNMENT_CENTER)}}; - * ArkUI_AttributeItem item = { .value = alignMent, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_ALIGN , &item); - * auto alignmentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); - * auto alignMent = alignmentItem->value[0].i32; - * @endcode */ NODE_TEXT_ALIGN, /** @@ -2276,15 +1478,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: display mode when the text is too long. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue textOverFlow[] = { { .i32 = static_cast(ARKUI_TEXT_OVERFLOW_CLIP) } }; - * ArkUI_AttributeItem item = { .value = textOverFlow, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle,NODE_TEXT_OVERFLOW , &item); - * auto textOverFlowItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); - * auto textOverFlow = textOverFlowItem->value[0].i32; - * @endcode */ NODE_TEXT_OVERFLOW, /** @@ -2296,15 +1489,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: fonts, separated by commas (,). * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = {.string = "HarmonyOS Sans"}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_FAMILY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_FAMILY); - * auto font = item->string; - * @endcode - * */ NODE_FONT_FAMILY, /** @@ -2316,15 +1500,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: copy option {@link ArkUI_CopyOptions. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_COPY_OPTIONS_NONE} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_COPY_OPTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); - * auto nodeTextCopyOption = item->value[0].i32; - * @endcode - * */ NODE_TEXT_COPY_OPTION, /** @@ -2337,15 +1512,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: baseline offset, in fp. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); - * auto nodeTextBaselineOffset = item->value[0].f32; - * @endcode - * */ NODE_TEXT_BASELINE_OFFSET, /** @@ -2365,19 +1531,6 @@ typedef enum { * .value[3].f32: offset of the shadow along the x-axis, in vp.\n * .value[4].f32: offset of the shadow along the y-axis, in vp.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, 10, 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); - * auto nodeTextShadowRadius = item->value[0].f32; - * auto nodeTextShadowType = item->value[1].i32; - * auto nodeTextShadowColor = item->value[2].u32; - * auto nodeTextShadowOffsetX = item->value[3].f32; - * auto nodeTextShadowOffsetY = item->value[4].f32; - * @endcode - * */ NODE_TEXT_TEXT_SHADOW, /** @@ -2389,16 +1542,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: minimum font size, in fp. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 20 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE); - * auto value = item->value[0].f32; - * @endcode - * */ NODE_TEXT_MIN_FONT_SIZE, @@ -2411,16 +1554,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: maximum font size, in fp. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 20 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE); - * auto value = item->value[0].f32; - * @endcode - * */ NODE_TEXT_MAX_FONT_SIZE, @@ -2436,24 +1569,13 @@ typedef enum { * The default value is ARKUI_FONT_STYLE_NORMAL. * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .string?: font family. Optional. Use commas (,) to separate multiple fonts. \n + * .string: font family. Use commas (,) to separate multiple fonts. \n * .value[0].f32: font size, in fp. \n - * .value[1]? .i32: font weight. Optional. The parameter type is {@link ArkUI_FontWeight}. + * .value[1].i32: font weight. The parameter type is {@link ArkUI_FontWeight}. * The default value is ARKUI_FONT_WEIGHT_NORMAL. \n - * .value[2]? .i32: font style. Optional. The parameter type is {@link ArkUI_FontStyle}. + * .value[2].i32: font style. The parameter type is {@link ArkUI_FontStyle}. * The default value is ARKUI_FONT_STYLE_NORMAL. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 16, { .i32 = ARKUI_FONT_STYLE_NORMAL }, - * { .i32 = ARKUI_FONT_STYLE_NORMAL } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_FONT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_FONT); - * auto size = item->value[0].f32; - * @endcode - * */ NODE_TEXT_FONT, @@ -2469,16 +1591,6 @@ typedef enum { * .value[0].i32: how the adaptive height is determined for the text. * The parameter type is {@link ArkUI_TextHeightAdaptivePolicy} * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY); - * auto size = item->value[0].i32; - * @endcode - * */ NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, /** @@ -2491,15 +1603,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: indentation of the first line. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue textIndent[] = { 20 }; - * ArkUI_AttributeItem item = { .value = textIndent, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INDENT , &item); - * auto indentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); - * auto indentValue = indentItem->value[0].f32; - * @endcode */ NODE_TEXT_INDENT, /** @@ -2511,14 +1614,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: content of the text span. \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SPAN_CONTENT , &item); - * auto spanContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_SPAN_CONTENT); - * auto spanContent = spanContentItem->string; - * @endcode */ NODE_SPAN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SPAN, /** @@ -2531,14 +1626,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: image address of the image span.\n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC , &item); - * auto srcItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC); - * auto spanScr = srcItem->string; - * @endcode */ NODE_IMAGE_SPAN_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE_SPAN, /** @@ -2553,15 +1640,6 @@ typedef enum { * .value[0].i32: alignment mode of the image with the text. * The value is an enum of {@link ArkUI_ImageSpanAlignment}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue alignValue[] = { {.i32 = static_cast(ARKUI_IMAGE_SPAN_ALIGNMENT_TOP) } }; - * ArkUI_AttributeItem item = {.value = alignValue, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN , &item); - * auto verticalAlignItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGN); - * auto verticalAlign = verticalAlignItem->value[0].i32; - * @endcode */ NODE_IMAGE_SPAN_VERTICAL_ALIGN, /** @@ -2574,14 +1652,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: image source.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "https://www.example.com/xxx.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SRC , &item); - * auto imageSrcItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); - * auto imageSrc = imageSrcItem->string; - * @endcode */ NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, /** @@ -2594,15 +1664,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: how the image is resized to fit its container. The value is an enum of {@link ArkUI_ObjectFit}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue objectFitValue[] = { { .i32 = static_cast(ARKUI_OBJECT_FIT_FILL) } }; - * ArkUI_AttributeItem item = { .value = objectFitValue, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT , &item); - * auto objectFitItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); - * auto objectFit = objectFitItem->value[0].i32; - * @endcode */ NODE_IMAGE_OBJECT_FIT, /** @@ -2615,15 +1676,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: interpolation effect of the image. The value is an enum of {@link ArkUI_ImageInterpolation}. \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue interpolationValue[] = { { .i32 = ARKUI_IMAGE_INTERPOLATION_LOW } }; - * ArkUI_AttributeItem item = { .value = interpolationValue, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION , &item); - * auto interpolationItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); - * auto interpolation = interpolationItem->value[0].i32; - * @endcode */ NODE_IMAGE_INTERPOLATION, /** @@ -2636,15 +1688,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: how the image is repeated. The value is an enum of {@link ArkUI_ImageRepeat}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue repeatValue[] = { { .i32 = static_cast(ARKUI_IMAGE_REPEAT_X) } }; - * ArkUI_AttributeItem item = { .value = repeatValue, .size = 1}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT , &item); - * auto objectRepeatItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); - * auto repeat = objectRepeatItem->value[0].i32; - * @endcode */ NODE_IMAGE_OBJECT_REPEAT, /** @@ -2659,17 +1702,6 @@ typedef enum { * .value[0].i32 to .value[19].i32: filter matrix array. \n * .size: 5 x 4 filter array size. \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue filterValue[] = { {.i32 = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 - * = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0}, {.i32 = 0}, {.i32 = - * 0}, {.i32 = 0}, {.i32 = 0}, {.i32 = 1}, {.i32 = 0} }; - * ArkUI_AttributeItem item = { .value = filterValue, .size = sizeof(filterValue)/ sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER , &item); - * auto colorFilterItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); - * auto colorFilter = colorFilterItem->value; - * @endcode */ NODE_IMAGE_COLOR_FILTER, /** @@ -2681,15 +1713,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32 : whether to resize the image source. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue resizeValue[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { .value = resizeValue, .size = 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE , &item); - * auto autoResizeItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); - * auto autoResize = autoResizeItem->value[0].i32; - * @endcode */ NODE_IMAGE_AUTO_RESIZE, /** @@ -2702,14 +1725,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: placeholder image source. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "/pages/loading.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_ALT , &item); - * auto altStrItem = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); - * auto altStr = altStrItem->string; - * @endcode */ NODE_IMAGE_ALT, /** @@ -2722,15 +1737,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: background color, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR); - * auto nodeToggleSelectedColor = item->value[0].u32; - * @endcode - * */ NODE_TOGGLE_SELECTED_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, /** @@ -2743,15 +1749,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: color of the circular slider, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); - * auto nodeSwitchPointColor = item->value[0].u32; - * @endcode - * */ NODE_TOGGLE_SWITCH_POINT_COLOR, @@ -2765,15 +1762,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: foreground color, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0x99666666 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LOADING_PROGRESS_COLOR); - * auto nodeLoadingProgressColor = item->value[0].u32; - * @endcode - * */ NODE_LOADING_PROGRESS_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LOADING_PROGRESS, /** @@ -2787,14 +1775,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: The value 1 means to show the loading animation, and 0 means the opposite. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LOADING_PROGRESS_ENABLE_LOADING); - * auto nodeLoadingProgressEnableLoading = item->value[0].i32; - * @endcode */ NODE_LOADING_PROGRESS_ENABLE_LOADING, @@ -2808,14 +1788,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: default placeholder text. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="input" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER); - * auto nodeTextInputPlaceholder = item->string; - * @endcode - * */ NODE_TEXT_INPUT_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_INPUT, /** @@ -2828,14 +1800,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: default text content. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="input" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT); - * auto nodeTextInputText = item->string; - * @endcode - * */ NODE_TEXT_INPUT_TEXT, /** @@ -2848,15 +1812,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: caret color, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_COLOR); - * auto nodeTextInputCaretColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_INPUT_CARET_COLOR, /** @@ -2869,15 +1824,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: caret width, in vp. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CARET_STYLE); - * auto nodeTextInputCaretStyle = item->value[0].f32; - * @endcode - * */ NODE_TEXT_INPUT_CARET_STYLE, /** @@ -2891,15 +1837,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: The value 1 means to show an underline, and 0 means the opposite. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_UNDERLINE); - * auto nodeTextInputUnderline = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_SHOW_UNDERLINE, /** @@ -2912,15 +1849,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: maximum number of characters in the text input. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 50 } }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_MAX_LENGTH); - * auto nodeTextInputMaxlength = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_MAX_LENGTH, /** @@ -2933,15 +1861,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: type of the Enter key{@link ArkUI_EnterKeyType}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_ENTER_KEY_TYPE_DONE} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE); - * auto nodeTextInputMaxlength = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_ENTER_KEY_TYPE, /** @@ -2954,15 +1873,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: color value, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_COLOR); - * auto nodeTextInputPlaceholderColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_INPUT_PLACEHOLDER_COLOR, /** @@ -2972,9 +1882,9 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0]? .f32: font size, in fp. Optional. The default value is 16.0.\n * .value[1]? .i32: font style {@link ArkUI_FontStyle}. Optional. - * The default value is ARKUI_FONT_STYLE_NORMAL.\n + * The default value is ARKUI_FONT_STYLE_NORMAL. \n * .value[2]?.i32: font weight {@link ArkUI_FontWeight}. Optional. - * The default value is ARKUI_FONT_WEIGHT_NORMAL.\n + * The default value is ARKUI_FONT_WEIGHT_NORMAL. \n * ?.string: font family. Multiple font families are separated by commas (,). * Example: "font weight; font family 1, font family 2". \n * \n @@ -2984,18 +1894,6 @@ typedef enum { * .value[2].i32: font weight {@link ArkUI_FontWeight}.\n * .string: font family. Multiple font families are separated by commas (,). \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_PLACEHOLDER_FONT); - * auto nodeTextInputPlaceholderFontSize = item->value[0].f32; - * auto nodeTextInputPlaceholderFontStyle = item->value[1].i32; - * auto nodeTextInputPlaceholderFontWeight = item->value[2].i32; - * auto nodeTextInputPlaceholderFontFamily = item->string; - * @endcode - * */ NODE_TEXT_INPUT_PLACEHOLDER_FONT, /** @@ -3010,15 +1908,6 @@ typedef enum { *.value[0].i32: The value 1 means to enable the input method when the component obtains focus, * and 0 means the opposite. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS); - * auto nodeTextInputFocusKeyboard = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, /** @@ -3031,15 +1920,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: text box type {@link ArkUI_TextInputType}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_TEXTINPUT_TYPE_NORMAL} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE); - * auto nodeTextInputType = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_TYPE, /** @@ -3052,15 +1932,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: color value, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR); - * auto nodeTextInputSelectedColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, /** @@ -3075,15 +1946,6 @@ typedef enum { * .value[0].i32: The value 1 means to display the password icon at the end of the password text box, * and 0 means the opposite. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = true} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON); - * auto nodeTextInputPasswordIcon = item->value[0].i32; - * @endcode - * */ NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, /** @@ -3098,13 +1960,6 @@ typedef enum { * .value[0].i32: whether to remain in the editable state. The value true means to remain in the editable * state, and false means to exit the editable state. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = false} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_EDITING, &item); - * @endcode - * */ NODE_TEXT_INPUT_EDITING, /** @@ -3124,18 +1979,6 @@ typedef enum { * .value[2].u32: button icon color, in 0xARGB format.\n * .string: button icon image source. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_CANCELBUTTON_STYLE_INPUT}, 10.0, {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INPUT_CANCEL_BUTTON); - * auto nodeCancelButtonStyle = item->value[0].i32; - * auto nodeCancelButtonSize = item->value[1].f32; - * auto nodeCancelButtonColor = item->value[2].u32; - * auto nodeCancelButtonImage = item->string; - * @endcode - * */ NODE_TEXT_INPUT_CANCEL_BUTTON, @@ -3149,14 +1992,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: default placeholder text. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="input" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER); - * auto nodeTextAreaPlaceholder = item->string; - * @endcode - * */ NODE_TEXT_AREA_PLACEHOLDER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, /** @@ -3169,14 +2004,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: default text content. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="input" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_TEXT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_TEXT); - * auto nodeTextAreaText = item->string; - * @endcode - * */ NODE_TEXT_AREA_TEXT, /** @@ -3189,15 +2016,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: maximum number of characters in the text input. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 50 } }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_MAX_LENGTH); - * auto nodeTextAreaMaxlength = item->value[0].i32; - * @endcode - * */ NODE_TEXT_AREA_MAX_LENGTH, /** @@ -3210,15 +2028,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: color value, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_COLOR); - * auto nodeTextAreaPlaceholderColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_AREA_PLACEHOLDER_COLOR, /** @@ -3237,18 +2046,6 @@ typedef enum { * .value[2].i32: font weight {@link ArkUI_FontWeight}.\n * .string: font family. Multiple font families are separated by commas (,). \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 16.0, {.i32=ARKUI_FONT_STYLE_NORMAL}, {.i32=ARKUI_FONT_WEIGHT_NORMAL} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "Arial" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_PLACEHOLDER_FONT); - * auto nodeTextAreaPlaceholderFontSize = item->value[0].f32; - * auto nodeTextAreaPlaceholderFontStyle = item->value[1].i32; - * auto nodeTextAreaPlaceholderFontWeight = item->value[2].i32; - * auto nodeTextAreaPlaceholderFontFamily = item->string; - * @endcode - * */ NODE_TEXT_AREA_PLACEHOLDER_FONT, /** @@ -3261,15 +2058,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: background color, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_AREA_CARET_COLOR); - * auto nodeTextAreaCaretColor = item->value[0].u32; - * @endcode - * */ NODE_TEXT_AREA_CARET_COLOR, /** @@ -3284,13 +2072,6 @@ typedef enum { * .value[0].i32: whether to remain in the editable state. The value true means to remain in the editable * state, and false means to exit the editable state.\n \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = false} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_AREA_EDITING, &item); - * @endcode - * */ NODE_TEXT_AREA_EDITING, @@ -3303,14 +2084,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: default text content. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string="click" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BUTTON_LABEL); - * auto nodeButtonLabelr = item->string; - * @endcode - * */ NODE_BUTTON_LABEL = MAX_NODE_SCOPE_NUM * ARKUI_NODE_BUTTON, @@ -3324,15 +2097,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: current value of the progress indicator. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_VALUE); - * auto nodeProgressValue = item->value[0].f32; - * @endcode - * */ NODE_PROGRESS_VALUE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_PROGRESS, /** @@ -3345,15 +2109,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: total value of the progress indicator. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TOTAL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_TOTAL); - * auto nodeProgressTotal = item->value[0].f32; - * @endcode - * */ NODE_PROGRESS_TOTAL, /** @@ -3366,15 +2121,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: color value, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=0xFFFF0000} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_COLOR); - * auto nodeProgressColor = item->value[0].u32; - * @endcode - * */ NODE_PROGRESS_COLOR, /** @@ -3388,14 +2134,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: type of the progress indicator {@link ArkUI_ProgressType}. \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_PROGRESS_LINEAR} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_PROGRESS_TYPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_PROGRESS_TYPE); - * auto nodeProgressType = item->value[0].i32; - * @endcode */ NODE_PROGRESS_TYPE, @@ -3410,16 +2148,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: The value 1 means that the check box is selected, and 0 means the opposite. \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 0 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SELECT); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_CHECKBOX_SELECT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, @@ -3431,17 +2159,7 @@ typedef enum { *.value[0].u32: color of the check box 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 check box when it is selected, in 0xARGB format, for example, 0xFF1122FF. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR); - * auto value = item->value[0].u32; - * @endcode + *.value[0].u32: color of the check box when it is selected, in 0xARGB format, for example, 0xFF1122FF. * */ NODE_CHECKBOX_SELECT_COLOR, @@ -3456,16 +2174,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: border color, in 0xARGB format, for example, 0xFF1122FF. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR); - * auto value = item->value[0].u32; - * @endcode - * */ NODE_CHECKBOX_UNSELECT_COLOR, @@ -3474,24 +2182,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: border color, in 0xARGB format, for example, 0xFF1122FF.\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. Optional.\n - * .value[2]? .f32: stroke width of the internal mark, in vp. Optional. The default value is 2. \n - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 0xFF1122FF }, 20.0f, 2.0f }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_MARK, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_MARK); - * auto value = item->value[0].i32; - * @endcode + * .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 * */ NODE_CHECKBOX_MARK, @@ -3505,16 +2203,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: component shape. The parameter type is {@link ArkUI_CheckboxShape}. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ArkUI_CHECKBOX_SHAPE_CIRCLE } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CHECKBOX_SHAPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CHECKBOX_SHAPE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_CHECKBOX_SHAPE, @@ -3529,14 +2217,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: component ID. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "test" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_ID, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_ID); - * auto nodeXcomponentId = item->string; - * @endcode - * */ NODE_XCOMPONENT_ID = MAX_NODE_SCOPE_NUM * ARKUI_NODE_XCOMPONENT, /** @@ -3549,15 +2229,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: type {@link ArkUI_XComponentType}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_XCOMPONENT_TYPE_SURFACE} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_TYPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_TYPE); - * auto nodeXcomponentType = item->value[0].i32; - * @endcode - * */ NODE_XCOMPONENT_TYPE, /** @@ -3572,16 +2243,6 @@ typedef enum { * .value[0].u32: width, in px. \n * .value[1].u32: height, in px. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32=300}, {.u32=50} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); - * auto nodeXcomponentSurfaceWidth = item->value[0].u32; - * auto nodeXcomponentSurfaceHeight = item->value[1].u32; - * @endcode - * */ NODE_XCOMPONENT_SURFACE_SIZE, @@ -3595,13 +2256,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: whether to display the lunar calendar in the date picker. * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_LUNAR); - * auto nodeDatePickerLunar = item->value[0].i32; - * @endcode */ NODE_DATE_PICKER_LUNAR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_DATE_PICKER, /** @@ -3614,12 +2268,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: date. \n * - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "1970-1-1" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_START, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_START); - * auto nodeDatePickerStart = item->string; - * @endcode */ NODE_DATE_PICKER_START, /** @@ -3632,12 +2280,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: date. \n * - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "2100-12-31" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_END, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_END); - * auto nodeDatePickerEnd = item->string; - * @endcode */ NODE_DATE_PICKER_END, /** @@ -3650,12 +2292,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: date. * - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "2024-01-22" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED); - * auto nodeDatePickerSelected = item->string; - * @endcode */ NODE_DATE_PICKER_SELECTED, /** @@ -3679,12 +2315,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); - * auto nodeDatePickerDisappearTextStyle = item->string; - * @endcode + * */ NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, /** @@ -3708,12 +2339,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_TEXT_STYLE); - * auto nodeDatePickerTextStyle = item->string; - * @endcode + * */ NODE_DATE_PICKER_TEXT_STYLE, /** @@ -3737,12 +2363,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED_TEXT_STYLE); - * auto nodeDatePickerSelectedTextStyle = item->string; - * @endcode + * */ NODE_DATE_PICKER_SELECTED_TEXT_STYLE, /** @@ -3755,12 +2376,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: time. * - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "17-11" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED); - * auto nodeTimePickerSelected = item->string; - * @endcode */ NODE_TIME_PICKER_SELECTED = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TIME_PICKER, @@ -3774,13 +2389,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].i32: whether the display time is in 24-hour format. * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_USE_MILITARY_TIME); - * auto nodeTimePickerUseMilitaryTime = item->value[0].i32; - * @endcode */ NODE_TIME_PICKER_USE_MILITARY_TIME, /** @@ -3804,12 +2412,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE); - * auto nodeDatePickerDisappearTextStyle = item->string; - * @endcode + * */ NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, /** @@ -3833,12 +2436,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.cpp} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_TEXT_STYLE); - * auto nodeTimePickerTextStyle = item->string; - * @endcode + * */ NODE_TIME_PICKER_TEXT_STYLE, /** @@ -3862,12 +2460,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.c} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TIME_PICKER_SELECTED_TEXT_STYLE); - * auto nodeDatePickerSelectedTextStyle = item->string; - * @endcode + * */ NODE_TIME_PICKER_SELECTED_TEXT_STYLE, @@ -3877,11 +2470,11 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: type of the text picker {@link ArkUI_TextPickerRangeType}. - * The default value is ARKUI_TEXTPICKER_RANGETYPE_SINGLE.\n + * The default value is ARKUI_TEXTPICKER_RANGETYPE_SINGLE. \n * ?.string: string input, whose format varies by picker type.\n * 1: single-column picker. The input format is a group of strings separated by semicolons (;).\n * 2: multi-column picker. Multiple pairs of plain text strings are supported. The pairs are separated by - * semicolons (;), and strings within each pair are separated by commas (,).\n + * semicolons (;), and strings within each pair are separated by commas (,). \n * ?.object: Object input, whose format varies by picker type.\n * 1: single-column picker with image support. The input structure is {@link ARKUI_TextPickerRangeContent}.\n * 2: multi-column interconnected picker. The input structure is {@link ARKUI_TextPickerCascadeRangeContent}.\n @@ -3891,21 +2484,11 @@ typedef enum { * ?.string: string output, whose format varies by picker type.\n * 1: single-column picker. The output format is a group of strings separated by semicolons (;).\n * 2: multi-column picker. Multiple pairs of plain text strings are supported. The pairs are separated by - * semicolons (;), and strings within each pair are separated by commas (,).\n + * semicolons (;), and strings within each pair are separated by commas (,). \n * ?.string: Object output, whose format varies by picker type.\n * 1: single-column picker with image support. The output structure is {@link ARKUI_TextPickerRangeContent}.\n * 2: multi-column interconnected picker. The output structure is {@link ARKUI_TextPickerCascadeRangeContent}.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=ARKUI_TEXTPICKER_RANGETYPE_MULTI} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue), "1,2,3;A,B,C" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_RANGE); - * auto nodeTextPickerRangeType = item->value[0].i32; - * auto nodeTextPickerMultiRange = item->string; - * @endcode - * */ NODE_TEXT_PICKER_OPTION_RANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, /** @@ -3918,15 +2501,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: index. If there are multiple index values, add them one by one.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.u32 = 1}, {.u32 = 2} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_SELECTED); - * auto nodeTextPickerSelected = item->value[0].u32; - * @endcode - * */ NODE_TEXT_PICKER_OPTION_SELECTED, /** @@ -3941,14 +2515,6 @@ typedef enum { * .string: value of the selected item. If there are multiple values, add them one by one and * separate them with semicolons (;).\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_AttributeItem item = { .string = "A;B" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_OPTION_VALUE); - * auto nodeTextPickerValue = item->string; - * @endcode - * */ NODE_TEXT_PICKER_OPTION_VALUE, /** @@ -3972,12 +2538,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.c} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE); - * auto nodeDatePickerDisappearTextStyle = item->string; - * @endcode + * */ NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, /** @@ -4001,12 +2562,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.c} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_TEXT_STYLE); - * auto nodeDatePickerTextStyle = item->string; - * @endcode + * */ NODE_TEXT_PICKER_TEXT_STYLE, /** @@ -4030,12 +2586,7 @@ typedef enum { * Parameter 4: fonts, separated by commas (,).\n * Parameter 5: font style. Available options are ("normal", "italic").\n * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n - * @code {.c} - * ArkUI_AttributeItem item = { .string = "#ff182431;14;normal;Arial,HarmonyOS Sans;normal" }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE); - * auto nodeTextPickerSelectedTextStyle = item->string; - * @endcode + * */ NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, /** @@ -4045,11 +2596,6 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n *.value[0...].i32: index of the default item in the data selection range. * - * @code {.c} - * ArkUI_NumberValue value[] = { { .i32 = 0 }, { .i32 = 1 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_SELECTED_INDEX, &item); - * @endcode */ NODE_TEXT_PICKER_SELECTED_INDEX, /** @@ -4063,14 +2609,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * value[0].i32: The value 1 means to support scroll looping, and 0 means the opposite. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32=true} }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_CAN_LOOP); - * auto nodePickerCanLoop = item->value[0].i32; - * @endcode */ NODE_TEXT_PICKER_CAN_LOOP, /** @@ -4083,14 +2621,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * value[0].f32: item height, in vp. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = { value, 1 }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT); - * auto nodePickerItemHeight = item->value[0].f32; - * @endcode */ NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, /** @@ -4109,13 +2639,6 @@ typedef enum { 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 * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 16.0f }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_HINT_RADIUS); - * auto borderRadius = item->value[0].f32; - * @endcode */ NODE_CALENDAR_PICKER_HINT_RADIUS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CALENDAR_PICKER, /** @@ -4123,22 +2646,15 @@ 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[1].u32: selected year. \n - * .value[2].u32: selected month. \n - * .value[3].u32: selected day. \n + * .value[0].u32: year of the selected date. \n + * .value[1].u32: month of the selected date. \n + * .value[2].u32: day of the selected date. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[1].u32: selected year. \n - * .value[2].u32: selected month. \n - * .value[3].u32: selected day. \n + * .value[0].u32: year of the selected date. \n + * .value[1].u32: month of the selected date. \n + * .value[2].u32: day of the selected date. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 2028 }, { .u32 = 1 }, { .u32 = 1 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE); - * auto selectYear = item->value[0].u32; - * @endcode */ NODE_CALENDAR_PICKER_SELECTED_DATE, /** @@ -4159,13 +2675,6 @@ typedef enum { * .value[2]? .f32: offset of the picker relative to the entry component along the y-axis after alignment based on * the specified alignment mode. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = static_cast(ARKUI_CALENDAR_ALIGNMENT_END) }, 10.0f, 0.0f }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT); - * auto alignType = item->value[0].i32; - * @endcode */ NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, /** @@ -4177,18 +2686,10 @@ typedef enum { * .value[2]? .i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0]? .u32: font color of the entry area. \n - * .value[1]? .f32: font size of the entry area, in fp. \n - * .value[2]? .i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n + * .value[0].u32: font color of the entry area. \n + * .value[1].f32: font size of the entry area, in fp. \n + * .value[2].i32: font weight of the entry area. The parameter type is {@link ArkUI_FontWeight}. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 0xff00ffff }, 16.0f, { .i32 = - * static_cast(ARKUI_FONT_WEIGHT_NORMAL)} }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CALENDAR_PICKER_TEXT_STYLE); - * auto textColor = item->value[0].u32; - * @endcode */ NODE_CALENDAR_PICKER_TEXT_STYLE, /** @@ -4199,16 +2700,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].u32: color of the slider, in 0xARGB format, for example, 0xFF1122FF. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_COLOR); - * auto value = item->value[0].u32; - * @endcode * */ NODE_SLIDER_BLOCK_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, @@ -4222,16 +2713,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: background color, in 0xARGB format, for example, 0xFF1122FF. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_TRACK_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_TRACK_COLOR); - * auto value = item->value[0].u32; - * @endcode * */ NODE_SLIDER_TRACK_COLOR, @@ -4245,16 +2726,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: color of the selected part of the slider track, in 0xARGB format, for example, 0xFF1122FF. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .u32 = 0xFF1122FF } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SELECTED_COLOR); - * auto value = item->value[0].u32; - * @endcode * */ NODE_SLIDER_SELECTED_COLOR, @@ -4271,16 +2742,6 @@ typedef enum { * .value[0].i32: whether to display the stepping value. The value 1 means to display the stepping value, * and 0 (default value) means the opposite. \n * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_SHOW_STEPS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_SHOW_STEPS); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_SLIDER_SHOW_STEPS, @@ -4346,21 +2807,6 @@ typedef enum { * .value[2].f32: width of the path.\n *.value[3].f32: height of the path.\n * .string: command for drawing the path.\n - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_DEFAULT}}; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); - * - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, - * {.i32 = ARKUI_CLIP_TYPE_RECT}, 100, 100, 15, 15 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_BLOCK_STYLE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_BLOCK_STYLE, @@ -4374,16 +2820,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: current value. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_VALUE); - * auto value = item->value[0].f32; - * @endcode * */ NODE_SLIDER_VALUE, @@ -4397,16 +2833,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: minimum value. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 0 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MIN_VALUE); - * auto value = item->value[0].f32; - * @endcode * */ NODE_SLIDER_MIN_VALUE, @@ -4420,16 +2846,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: maximum value. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_MAX_VALUE); - * auto value = item->value[0].f32; - * @endcode * */ NODE_SLIDER_MAX_VALUE, @@ -4442,16 +2858,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: step. The value range is [0.01, 100]. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 100 }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_STEP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_STEP); - * auto value = item->value[0].f32; - * @endcode * */ NODE_SLIDER_STEP, @@ -4466,17 +2872,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: whether the slider moves horizontally or vertically. - * The parameter type is {@link ArkUI_SliderDirection}. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SLIDER_DIRECTION_VERTICAL } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_DIRECTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_DIRECTION); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_DIRECTION, @@ -4492,16 +2887,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: whether the slider values are reversed. The value 1 means that the slider values are * reversed, and 0 means the opposite. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 0} }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_REVERSE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_REVERSE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_REVERSE, @@ -4515,16 +2900,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: style of the slider thumb and track. The parameter type is {@link ArkUI_SliderStyle}. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SLIDER_STYLE_OUT_SET } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SLIDER_STYLE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SLIDER_STYLE); - * auto value = item->value[0].i32; - * @endcode * */ NODE_SLIDER_STYLE, @@ -4540,13 +2915,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: alignment mode. The data type is {@link ArkUI_Alignment}. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_ALIGNMENT_CENTER } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT, &item); - * auto alignContentItem = nativeNodeApi->getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); - * auto alignContent = alignContentItem->value[0].i32; - * @endcode */ NODE_STACK_ALIGN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_STACK, @@ -4560,14 +2928,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: scrollbar status. The parameter type is {@link ArkUI_ScrollBarDisplayMode}. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); - * auto nodeScrollBarDisplayMode = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_BAR_DISPLAY_MODE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, /** @@ -4580,14 +2940,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n *.value[0].f32: width of the scrollbar, in vp. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 20 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); - * auto nodeScrollBarWidth = item->value[0].f32; - * @endcode - * */ NODE_SCROLL_BAR_WIDTH, /** @@ -4600,14 +2952,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .data[0].u32: color of the scrollbar, in 0xARGB format. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); - * auto nodeScrollBarColor = item->value[0].u32; - * @endcode - * */ NODE_SCROLL_BAR_COLOR, /** @@ -4620,14 +2964,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: scroll direction. The parameter type is {@link ArkUI_ScrollDirection}. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_DIRECTION_VERTICAL } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); - * auto nodeScrollBarDirection = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_SCROLL_DIRECTION, /** @@ -4643,18 +2979,10 @@ typedef enum { * \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 + * 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 * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_EDGE_EFFECT_NONE }, { .i32 = 1 } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); - * auto nodeScrollEdgeEffect = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_EDGE_EFFECT, /** @@ -4667,14 +2995,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: whether to support scroll gestures. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); - * auto nodeScrollEnableScroll = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_ENABLE_SCROLL_INTERACTION, /** @@ -4688,14 +3008,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: friction coefficient. * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 0.6 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_FRICTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_FRICTION); - * auto nodeScrollFriction = item->value[0].f32; - * @endcode - * */ NODE_SCROLL_FRICTION, /** @@ -4726,17 +3038,6 @@ typedef enum { * .value[3...].f32: snap points for the component. Each snap point defines the offset from an edge * to which the component can scroll. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { - * { .i32=ARKUI_SCROLL_SNAP_ALIGN_NONE }, { .i32=true }, { .i32=true }, - * { .f32=0 }, { .f32=500 }, { .f32=1000 }, { .f32=1500 } - * }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SNAP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_SNAP); - * auto nodeScrollSnap = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_SNAP, @@ -4756,18 +3057,6 @@ typedef enum { * .value[1].i32: nested scrolling option when the component scrolls backward. * The parameter type is {@link ArkUI_ScrollNestedMode}. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY }, - * { .i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL); - * auto first = item->value[0].i32; - * auto second = item->value[1].i32; - * @endcode - * */ NODE_SCROLL_NESTED_SCROLL, /** @@ -4786,17 +3075,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: horizontal scrolling offset, in vp. \n * .value[1].f32: vertical scrolling offset, in vp. \n - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10, 100, { .i32 = 1000 }, { .i32 = ARKUI_CURVE_EASE }, { .i32 = 1 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_OFFSET, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_OFFSET); - * auto x = item->value[0].f32; - * auto y = item->value[1].f32; - * @endcode * */ NODE_SCROLL_OFFSET, @@ -4811,16 +3089,6 @@ typedef enum { * .value[0].i32: whether the container at the edge position. The value -1 means that the container is not * at the edge position. If the container is at the edge position, the parameter type is {@link ArkUI_ScrollEdge}. * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_SCROLL_EDGE_TOP } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE); - * auto value = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_EDGE, @@ -4837,14 +3105,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: whether to enable the swipe-to-turn-pages feature. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = true } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); - * auto nodeScrollEnablePaging = item->value[0].i32; - * @endcode - * */ NODE_SCROLL_ENABLE_PAGING, @@ -4859,14 +3119,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: direction in which the list items are arranged. The parameter type is {@link ArkUI_Axis}. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_AXIS_VERTICAL } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_DIRECTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_DIRECTION); - * auto nodeListDirection = item->value[0].i32; - * @endcode - * */ NODE_LIST_DIRECTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST, /** @@ -4883,14 +3135,6 @@ typedef enum { * component. It is used together with the component. The parameter type is * {@link ArkUI_StickyStyle}. * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_STICKY_STYLE_NONE } }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_STICKY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_STICKY); - * auto nodeListSticky = item->value[0].i32; - * @endcode - * */ NODE_LIST_STICKY, /** @@ -4903,14 +3147,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: spacing between list items along the main axis. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_SPACE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_SPACE); - * auto nodeListSpace = item->value[0].f32; - * @endcode - * */ NODE_LIST_SPACE, @@ -4926,14 +3162,6 @@ typedef enum { * .value[0].i32: whether to enable loop playback. The value 1 means to enable loop playback, and 0 * means the opposite. The default value is 1. \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { {.i32 = 0} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_LOOP, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_LOOP); - * auto nodeSwiperLoop = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_LOOP = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SWIPER, /** @@ -4948,16 +3176,6 @@ 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 * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY); - * auto nodeSwiperAutoPlay = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_AUTO_PLAY, /** @@ -4972,16 +3190,6 @@ typedef enum { * .value[0].i32: whether to enable the navigation point indicator. The value 1 means to enable the * navigation point indicator, and 0 means the opposite. The default value is 1. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 0} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR); - * auto nodeSwiperShowIndicator = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_SHOW_INDICATOR, /** @@ -4994,16 +3202,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: interval for automatic playback, in milliseconds. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 3000 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INTERVAL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_INTERVAL); - * auto nodeSwiperInterval = item->value[0].f32; - * @endcode - * */ NODE_SWIPER_INTERVAL, /** @@ -5018,16 +3216,6 @@ typedef enum { * .value[0].i32: whether vertical swiping is used. The value 1 means that vertical swiping is used, and * 0 means the opposite. The default value is 0. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_VERTICAL, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_VERTICAL); - * auto nodeSwiperVertical = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_VERTICAL, @@ -5043,16 +3231,6 @@ typedef enum { * .value[0].f32: duration of the animation for switching child components, in milliseconds. The default value is * 400. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10000 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DURATION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DURATION); - * auto nodeSwiperDuration = item->value[0].f32; - * @endcode - * */ NODE_SWIPER_DURATION, @@ -5068,16 +3246,6 @@ typedef enum { * .value[0].i32: animation curve. The parameter type is {@link ArkUI_AnimationCurve}. * The default value is ARKUI_CURVE_LINEAR. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_CURVE_SHARP} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_CURVE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_CURVE); - * auto nodeSwiperCurve = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_CURVE, @@ -5091,16 +3259,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: spacing between child components. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { 10 }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); - * auto nodeSwiperItemSpace = item->value[0].f32; - * @endcode - * */ NODE_SWIPER_ITEM_SPACE, @@ -5114,16 +3272,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: index value of the child component. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {i32 = 3} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INDEX, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); - * auto nodeSwiperIndex = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_INDEX, @@ -5137,16 +3285,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: index value of the child component. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {i32 = 3} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISPLAY_COUNT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); - * auto nodeSwiperDisplayCount = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_DISPLAY_COUNT, @@ -5162,16 +3300,6 @@ typedef enum { * .value[0].i32: whether to disable the swipe feature. The value 1 means to disable the swipe * feature, and 0 means the opposite. The default value is 0. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = 1} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE); - * auto nodeSwiperDisableSwipe = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_DISABLE_SWIPE, @@ -5189,16 +3317,6 @@ typedef enum { * The parameter type is {@link ArkUI_SwiperArrow}.\n * The default value is ARKUI_SWIPER_ARROW_HIDE. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_SWIPER_ARROW_SHOW_ON_HOVER} }; - * ArkUI_AttributeItem item = { value, sizeof(value)/sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW); - * auto nodeSwiperShowDisplayArrow = item->value[0].i32; - * @endcode - * */ NODE_SWIPER_SHOW_DISPLAY_ARROW, @@ -5212,13 +3330,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .object: {@link ArkUI_NodeHandle} object to be used as the header of the list item group. \n * - * @code {.cpp} - * auto header = nodeAPI->createNode(ARKUI_NODE_TEXT); - * ArkUI_AttributeItem item = { .object = header }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); - * auto nodeListItemGroupSetHeader = item->object; - * @endcode */ NODE_LIST_ITEM_GROUP_SET_HEADER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST_ITEM_GROUP, /** @@ -5231,13 +3342,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .object: {@link ArkUI_NodeHandle} object to be used as the footer of the list item group. \n * - * @code {.cpp} - * auto footer = nodeAPI->createNode(ARKUI_NODE_TEXT); - * ArkUI_AttributeItem item = { .object = footer }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); - * auto nodeListItemGroupSetFooter = item->value[0].object; - * @endcode */ NODE_LIST_ITEM_GROUP_SET_FOOTER, /** @@ -5256,13 +3360,6 @@ typedef enum { * .value[2].f32: distance between the divider and the start of the list, in vp.\n * .value[3].f32: distance between the divider and the end of the list, in vp.\n \n * - * @code {.cpp} - * ArkUI_NumberValue value[] = { { .u32 = 0xFFFFFFFF }, 1, 0, 0 }; - * ArkUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_DIVIDER, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_DIVIDER); - * auto nodeListItemDividerColor = item->value[0].u32; - * @endcode */ NODE_LIST_ITEM_GROUP_SET_DIVIDER, @@ -5279,16 +3376,6 @@ typedef enum { * .value[0].i32: horizontal alignment mode of child components. * The parameter type is {@link ArkUI_HorizontalAlignment}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_HORIZONTAL_ALIGNMENT_START } }; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_COLUMN_ALIGN_ITEMS); - * auto nodeColumnAlignItems = item->value[0].i32; - * @endcode - * */ NODE_COLUMN_ALIGN_ITEMS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_COLUMN, /** @@ -5302,16 +3389,6 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: vertical alignment mode of child components. The parameter type is {@link ArkUI_FlexAlignment}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_COLUMN_JUSTIFY_CONTENT); - * auto nodeColumnJustifyContent = item->value[0].i32; - * @endcode - * */ NODE_COLUMN_JUSTIFY_CONTENT, @@ -5328,16 +3405,6 @@ typedef enum { * .value[0].i32: vertical alignment mode of child components. * The parameter type is {@link ArkUI_VerticalAlignment}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_VERTICAL_ALIGNMENT_TOP } }; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROW_ALIGN_ITEMS); - * auto nodeRowAlignItems = item->value[0].i32; - * @endcode - * */ NODE_ROW_ALIGN_ITEMS = MAX_NODE_SCOPE_NUM * ARKUI_NODE_ROW, /** @@ -5353,16 +3420,6 @@ typedef enum { * .value[0].i32: horizontal alignment mode of child components. * The parameter type is {@link ArkUI_FlexAlignment}. \n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = ARKUI_FLEX_ALIGNMENT_END } }; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROW_JUSTIFY_CONTENT); - * auto nodeRowAlignItems = item->value[0].i32; - * @endcode - * */ NODE_ROW_JUSTIFY_CONTENT, @@ -5382,29 +3439,12 @@ typedef enum { * {@link ArkUI_FlexAlignment}. The default value is ARKUI_FLEX_ALIGNMENT_START.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0]? .i32: direction in which flex items are arranged.\n - * .value[1]?.i32: how the flex items are wrapped.\n - * .value[2]?.i32: alignment mode along the main axis.\n - * .value[3]?.i32: alignment mode along the cross axis.\n + * .value[0].i32: direction in which flex items are arranged. \n + * .value[1].i32: how the flex items are wrapped. \n + * .value[2].i32: alignment mode along the main axis. \n + * .value[3].i32: alignment mode along the cross axis. \n * .value[4]?.i32: alignment mode along the cross axis for multi-line content.\n * - * @code {.cpp} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { {.i32 = ARKUI_FLEX_DIRECTION_COLUMN}, {.i32 = ARKUI_FLEX_WRAP_WRAP}, - * {.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}, {.i32 = ARKUI_ITEM_ALIGNMENT_CENTER}, - * {.i32 = ARKUI_FLEX_ALIGNMENT_END}}; - * ARKUI_AttributeItem item = { value, sizeof(value) / sizeof(ArkUI_NumberValue) }; - * nativeNodeApi->setAttribute(nodeHandle, NODE_FLEX_OPTION, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FLEX_OPTION); - * auto nodeFlexDirection = item->value[1].i32; - * auto nodeFlexWrap = item->value[2].i32; - * auto nodeFlexJustifyContent = item->value[3].i32; - * auto nodeFlexAlignItems = item->value[4].i32; - * auto nodeFlexAlignContent = item->value[5].i32; - * - * @endcode - * */ NODE_FLEX_OPTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_FLEX, @@ -5417,16 +3457,6 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: The parameter type is 1 or 0. - * - * @code {.c} - * ArkUI_NativeNodeAPI_1* nativeNodeApi = - * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); - * ArkUI_NumberValue value[] = { { .i32 = 0 } }; - * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; - * nativeNodeApi->setAttribute(nodeHandle, NODE_REFRESH_REFRESHING, &item); - * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_REFRESH_REFRESHING); - * auto value = item->data[0].i32; - * @endcode * */ NODE_REFRESH_REFRESHING = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, @@ -5702,9 +3732,8 @@ typedef enum { \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: hour of the selected time. Value range: [0-23]. \n - * ArkUI_NodeComponentEvent.data[1].i32: minute of the selected time. Value range: [0-59]. \n + * {@link ArkUI_NodeComponentEvent} contains one parameter:\n + * ArkUI_NodeComponentEvent.data[0...11].i32: value of the selected item. \n */ NODE_TEXT_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, @@ -5853,6 +3882,13 @@ typedef struct { /** The universal component event uses callback parameters of the string type. */ ArkUI_StringAsyncEvent stringEvent; }; + /** + * @brief Defines the custom parameter of the event. + * + * This parameter is passed in {@link registerNodeEvent} and can be applied to the service logic when the event + * is triggered. + */ + void* extraParam; } ArkUI_NodeEvent; /** @@ -5895,6 +3931,8 @@ typedef struct { /** * @brief Destroys the component to which the specified pointer points. * + * When the component is being displayed, this API must be called in the main thread. + * * @param node Indicates the pointer. */ void (*disposeNode)(ArkUI_NodeHandle node); @@ -5902,6 +3940,8 @@ typedef struct { /** * @brief Adds a component to a parent node. * + * When the component is being displayed, this API must be called in the main thread. + * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @return Returns 0 if success. @@ -5912,6 +3952,8 @@ typedef struct { /** * @brief Removes a component from its parent node. * + * When the component is being displayed, this API must be called in the main thread. + * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @return Returns 0 if success. @@ -5922,6 +3964,8 @@ typedef struct { /** * @brief Inserts a component to a parent node after the specified sibling node. * + * When the component is being displayed, this API must be called in the main thread. + * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @param sibling Indicates the pointer to the sibling node after which the target node is to be inserted. @@ -5934,6 +3978,8 @@ typedef struct { /** * @brief Inserts a component to a parent node before the specified sibling node. * + * When the component is being displayed, this API must be called in the main thread. + * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @param sibling Indicates the pointer to the sibling node before which the target node is to be inserted. @@ -5946,6 +3992,8 @@ typedef struct { /** * @brief Inserts a component to the specified position in a parent node. * + * When the component is being displayed, this API must be called in the main thread. + * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. * @param position Indicates the position to which the target child node is to be inserted. If the value is a @@ -5958,6 +4006,8 @@ typedef struct { /** * @brief Sets the attribute of a node. * + * When the component is being displayed, this API must be called in the main thread. + * * @param node Indicates the node whose attribute needs to be set. * @param attribute Indicates the type of attribute to set. * @param value Indicates the attribute value. @@ -5973,6 +4023,7 @@ typedef struct { * The pointer returned by this API is an internal buffer pointer of the ArkUI framework. As such, you do not need * to call delete to release the memory. However, the pointer must be used before this API is called next * time. Otherwise, the pointer may be overwritten by other values. + * When the component is being displayed, this API must be called in the main thread. * * @param node Indicates the node whose attribute needs to be obtained. * @param attribute Indicates the type of attribute to obtain. @@ -5983,6 +4034,8 @@ typedef struct { /** * @brief Resets an attribute. * + * When the component is being displayed, this API must be called in the main thread. + * * @param node Indicates the node whose attribute needs to be reset. * @param attribute Indicates the type of attribute to reset. * @return Returns 0 if success. @@ -5994,6 +4047,8 @@ typedef struct { /** * @brief Registers an event for the specified node. * + * When the component is being displayed, this API must be called in the main thread. + * * @param node Indicates the target node. * @param eventType Indicates the type of event to register. * @param eventId Indicates the custom event ID, which is passed in the callback of {@link ArkUI_NodeEvent} @@ -6007,6 +4062,8 @@ typedef struct { /** * @brief Unregisters an event for the specified node. * + * When the component is being displayed, this API must be called in the main thread. + * * @param node Indicates the target node. * @param eventType Indicates the type of event to unregister. */ @@ -6034,6 +4091,7 @@ typedef struct { * * Regarding updates to system attributes, the ArkUI framework automatically marks the dirty area and performs * measuring, layout, or rendering again. In this case, you do not need to call this API. + * When the component is being displayed, this API must be called in the main thread. * * @param node Indicates the node for which you want to mark as dirty area. * @param dirtyFlag Indicates type of dirty area. diff --git a/en/native_sdk/ace/native_type.h b/en/native_sdk/ace/native_type.h index 862136d7..402e1a8f 100644 --- a/en/native_sdk/ace/native_type.h +++ b/en/native_sdk/ace/native_type.h @@ -1176,6 +1176,33 @@ typedef enum { /** Path. */ ARKUI_SHAPE_TYPE_PATH, } ArkUI_ShapeType; + +/** + * @brief Enumerates the gradient directions. + * + * @since 12 + */ +typedef enum { + /** From right to left. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT = 0, + /** From bottom to top. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_TOP, + /** From left to right. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT, + /** From top to bottom. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_BOTTOM, + /** From lower right to upper left. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT_TOP, + /** From upper right to lower left. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT_BOTTOM, + /** From lower left to upper right. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT_TOP, + /** From upper left to lower right. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT_BOTTOM, + /** No gradient. */ + ARKUI_LINEAR_GRIDIENT_DIRECTION_NONE, +} ArkUI_LinearGridientDirection; + #ifdef __cplusplus }; #endif -- Gitee From f2bd17c2ae986e6ce1aae33810326d1b2049146d Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 22 Feb 2024 09:35:56 +0000 Subject: [PATCH 0293/2135] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_text_typography.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index a7a3830e..8bce9358 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1436,11 +1436,12 @@ void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 * @param int 要获取的行数。 - * @return 返回获取到的指定行度量信息。 + * @param OH_Drawing_LineMetrics 指向行度量{@link OH_Drawing_LineMetrics}对象的指针。 + * @return 行度量是否成功获取。 * @since 12 * @version 1.0 */ -OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int); +bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int, OH_Drawing_LineMetrics*); /** * @brief 获取指定行的位置信息或指定行第一个字符的位置信息。 -- Gitee From 0e41c224b1bc23dc1f438c2c7433b74976f085a9 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 22 Feb 2024 11:08:48 +0000 Subject: [PATCH 0294/2135] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_text_typography.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 8bce9358..bdbfa9ef 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1306,11 +1306,12 @@ void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}的指针,由OH_Drawing_CreateTypography获取。 - * @return 返回文本字体属性。 + * @param OH_Drawing_Font_Metrics 指向字体属性{@link OH_Drawing_Font_Metrics}的指针,由OH_Drawing_Font_Metrics获取。 + * @return 是否获取到字体属性。 * @since 12 * @version 1.0 */ -OH_Drawing_Font_Metrics* OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_TextStyle*, OH_Drawing_Typography*); +bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_TextStyle*, OH_Drawing_Typography*, OH_Drawing_Font_Metrics*); /** * @brief 设置文本类型。 -- Gitee From 7a4cd44e2df5e59885f83c91483e2b2247c0f5f3 Mon Sep 17 00:00:00 2001 From: yan-shuifeng Date: Thu, 22 Feb 2024 20:05:49 +0800 Subject: [PATCH 0295/2135] update arkui ndk interface defines Signed-off-by: yan-shuifeng --- zh-cn/native_sdk/ace/native_interface.h | 4 ++-- zh-cn/native_sdk/ace/native_node.h | 32 ++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_interface.h b/zh-cn/native_sdk/ace/native_interface.h index 321db3ef..9be224b3 100644 --- a/zh-cn/native_sdk/ace/native_interface.h +++ b/zh-cn/native_sdk/ace/native_interface.h @@ -90,7 +90,7 @@ typedef enum { * auto basicNodeApi = reinterpret_cast(anyNativeAPI); * } * @endcode - * + * @deprecated 从12版本开始废弃,使用{@link OH_ArkUI_QueryModuleInterface}接口替代。 * @since 12 */ ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32_t version); @@ -99,7 +99,7 @@ ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32 * @brief 获取指定版本的Native模块接口集合。 * * @param type ArkUI提供的Native接口集合大类,例如UI组件接口类:ARKUI_NATIVE_NODE。 - * @param version native接口结构体的版本信息,通过结构体支持的版本枚举获得,如ARKUI_NATIVE_NODE的可用版本{@link ARKUI_NATIVE_NODE_VERSION_1}。 + * @param version native接口结构体的版本信息,通过结构体支持的版本枚举获得,如ARKUI_NATIVE_NODE的可用版本{@link ArkUI_NativeNodeAPIVersion}。 * @return ArkUI_AnyNativeAPI* 返回携带版本的Native接口抽象对象。 * @code {.cpp} * #include diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index f6516596..58039a08 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -3495,6 +3495,12 @@ typedef struct { /** 通用组件事件使用字符串类型回调参数。*/ ArkUI_StringAsyncEvent stringEvent; }; + /** + * @brief 事件自定义参数。 + * + * 该自定义参数在调用{@link registerNodeEvent}函数时作为参数传递进来,可应用于事件触发时的业务逻辑处理。 + */ + void* extraParam; } ArkUI_NodeEvent; /** @@ -3537,6 +3543,8 @@ typedef struct { /** * @brief 销毁组件指针指向的组件对象。 * + * 当组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param node 组件指针对象。 */ void (*disposeNode)(ArkUI_NodeHandle node); @@ -3544,6 +3552,8 @@ typedef struct { /** * @brief 将组件挂载到某个父节点之下。 * + * 当父组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param parent 父节点指针。 * @param child 子节点指针。 * @return 0 - 成功。 @@ -3554,6 +3564,8 @@ typedef struct { /** * @brief 将组件从父节点中移除。 * + * 当组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param parent 父节点指针。 * @param child 子节点指针。 * @return 0 - 成功。 @@ -3564,6 +3576,8 @@ typedef struct { /** * @brief 将组件挂载到某个父节点之下,挂载位置在sibling节点之后。 * + * 当父组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param parent 父节点指针。 * @param child 子节点指针。 * @param sibling 前一个兄弟节点指针,如果为空则插入位置在最前面。 @@ -3575,6 +3589,8 @@ typedef struct { /** * @brief 将组件挂载到某个父节点之下,挂载位置在sibling节点之前。 * + * 当父组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param parent 父节点指针。 * @param child 子节点指针。 * @param sibling 后一个兄弟节点指针,如果为空则插入位置在最后面。 @@ -3586,6 +3602,8 @@ typedef struct { /** * @brief 将组件挂载到某个父节点之下,挂载位置由position指定。 * + * 当父组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param parent 父节点指针。 * @param child 子节点指针。 * @param postion 插入位置,如果插入位置为负数或者不存在,则默认插入位置在最后面。 @@ -3597,6 +3615,8 @@ typedef struct { /** * @brief 属性设置函数。 * + * 当组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param node 需要设置属性的节点对象。 * @param attribute 需要设置的属性类型。 * @param item 需要设置的属性值。 @@ -3610,6 +3630,7 @@ typedef struct { * @brief 属性获取函数。 * * 该接口返回的指针是ArkUI框架内部的缓冲区指针,不需要开发者主动调用delete释放内存,但是需要在该函数下一次被调用前使用,否则可能会被其他值所覆盖。 + * 当组件已经挂载在窗口上显示时,必须在主线程上调用。 * * @param node 需要获取属性的节点对象。 * @param attribute 需要获取的属性类型。 @@ -3620,6 +3641,8 @@ typedef struct { /** * @brief 重置属性函数。 * + * 当组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param node 需要重置属性的节点对象。 * @param attribute 需要重置的属性类型。 * @return 0 - 成功。 @@ -3631,18 +3654,24 @@ typedef struct { /** * @brief 注册节点事件函数。 * + * 当组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param node 需要注册事件的节点对象。 * @param eventType 需要注册的事件类型。 * @param eventId 自定义事件ID,当事件触发时在回调参数<@link ArkUI_NodeEvent>中携带回来。 + * @param extraParam 自定义事件参数,当事件触发时在回调参数<@link ArkUI_NodeEvent>中携带回来。 * @return 0 - 成功。 * 401 - 函数参数异常。 * 106102 - 系统中未找到Native接口的动态实现库。 */ - int32_t (*registerNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, int32_t eventId); + int32_t (*registerNodeEvent)( + ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, int32_t eventId, void* extraParam); /** * @brief 反注册节点事件函数。 * + * 当组件已经挂载在窗口上显示时,必须在主线程上调用。 + * * @param node 需要反注册事件的节点对象。 * @param eventType 需要反注册的事件类型。 */ @@ -3668,6 +3697,7 @@ typedef struct { * @brief 强制标记当前节点需要重新测算,布局或者绘制。 * * 系统属性设置更新场景下ArkUI框架会自动标记藏区并重新执行测算,布局或者绘制,不需要开发者主动调用该函数。 + * 当组件已经挂载在窗口上显示时,必须在主线程上调用。 * * @param node 需要标记藏区的节点对象。 * @param dirtyFlag 藏区类型。 -- Gitee From f1e976a87ef6d6f66271267ebfd4412ff76799b6 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 22 Feb 2024 12:20:25 +0000 Subject: [PATCH 0296/2135] 1 Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_text_typography.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index bdbfa9ef..9e6700db 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1740,6 +1740,16 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); */ OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, int, bool); +/** + * @brief 释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextShadow 指向{@link OH_Drawing_CreateTextShadow}对象的指针,由OH_Drawing_TextShadow获取。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); + #ifdef __cplusplus } #endif -- Gitee From 6b9f847ea03c8f9ee8d24b7a7db655ad7e85b595 Mon Sep 17 00:00:00 2001 From: zoulinken Date: Fri, 23 Feb 2024 09:56:20 +0800 Subject: [PATCH 0297/2135] fix spell error Signed-off-by: zoulinken --- zh-cn/native_sdk/ace/native_node.h | 2 +- zh-cn/native_sdk/ace/native_type.h | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 58039a08..b8bc7996 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -323,7 +323,7 @@ typedef enum { * * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n * .value[0].f32: 线性渐变的起始角度。0点方向顺时针旋转为正向角度,默认值:180; \n - * .value[1].i32:线性渐变的方向,设置angle后不生效。数据类型{@link ArkUI_LinearGridientDirection} \n + * .value[1].i32:线性渐变的方向,设置angle后不生效。数据类型{@link ArkUI_LinearGradientDirection} \n * .value[2].i32: 为渐变的颜色重复着色,默认值 false。 \n * .object: 指定某百分比位置处的渐变色颜色,设置非法颜色直接跳过: \n * colors:渐变色颜色颜色。 \n diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index e68677ab..2fe4d0dd 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -1148,24 +1148,24 @@ typedef enum { */ typedef enum { /** 向左渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT = 0, + ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT = 0, /** 向上渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_TOP, + ARKUI_LINEAR_GRADIENT_DIRECTION_TOP, /** 向右渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT, + ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT, /** 向下渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_BOTTOM, + ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM, /** 向左上渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT_TOP, + ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP, /** 向左下渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT_BOTTOM, + ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM, /** 向右上渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT_TOP, + ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP, /** 向右下渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT_BOTTOM, + ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM, /** 不渐变。 */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_NONE, -} ArkUI_LinearGridientDirection; + ARKUI_LINEAR_GRADIENT_DIRECTION_NONE, +} ArkUI_LinearGradientDirection; #ifdef __cplusplus }; -- Gitee From c74f2d62d7754d7bec2d93c279a8192e6165e560 Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Fri, 23 Feb 2024 10:32:45 +0800 Subject: [PATCH 0298/2135] =?UTF-8?q?fix=20NDK=20C-API=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=AD=97=E7=AC=A6=E9=97=AE=E9=A2=98=20Signed-off-by:?= =?UTF-8?q?=20liyi0309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_node.h | 12 ++++++------ zh-cn/native_sdk/ace/native_type.h | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index b8bc7996..2d9f8f76 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -473,7 +473,7 @@ typedef enum { * * 属性设置方法参数{@link ArkUI_AttributeItem}格式,共有5种类型: \n * 1.rect类型: \n - * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_RECT; \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_RECTANGLE; \n * .value[1].f32:矩形宽度; \n * .value[2].f32:矩形高度; \n * .value[3].f32:矩形圆角宽度; \n @@ -493,7 +493,7 @@ typedef enum { * .string:路径绘制的命令字符串; \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式,共有5种类型: \n * 1.rect类型: \n - * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_RECT; \n + * .value[0].i32:裁剪类型,参数类型{@link ArkUI_ClipType},ARKUI_CLIP_TYPE_RECTANGLE; \n * .value[1].f32:矩形宽度; \n * .value[2].f32:矩形高度; \n * .value[3].f32:矩形圆角宽度; \n @@ -883,7 +883,7 @@ typedef enum { * .value[0].u32:填充颜色,0xargb类型; \n * .value[1].u32:描边颜色,0xargb类型; \n * .value[2].f32:描边宽度,单位为vp; \n - * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_RECT; \n + * .value[3].i32:遮罩类型,参数类型{@link ArkUI_MaskType},ARKUI_MASK_TYPE_RECTANGLE; \n * .value[4].f32:矩形宽度; \n * .value[5].f32:矩形高度; \n * .value[6].f32:矩形圆角宽度; \n @@ -1963,7 +1963,7 @@ typedef enum { * @brief 进度条的类型属性,支持属性设置,属性重置和属性获取接口。 * * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32:进度条类型枚举值{@link ArkUI_ProgressType},默认值为ARKUI_PROGRESS_LINEAR。\n + * .value[0].i32:进度条类型枚举值{@link ArkUI_ProgressType},默认值为ARKUI_PROGRESS_TYPE_LINEAR。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n * .value[0].i32:进度条类型枚举值{@link ArkUI_ProgressType}。\n @@ -2537,7 +2537,7 @@ typedef enum { * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: 滑块使用的自定义形状。\n * 共有5种类型: \n * 1.rect类型: \n - * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_RECT; \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_RECTANGLE; \n * .value[2].f32:矩形宽度; \n * .value[3].f32:矩形高度; \n * .value[4].f32:矩形圆角宽度; \n @@ -2563,7 +2563,7 @@ typedef enum { * ARKUI_SLIDER_BLOCK_STYLE_SHAPE: 滑块使用的自定义形状。\n * 共有5种类型: \n * 1.rect类型: \n - * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_RECT; \n + * .value[1].i32:裁剪类型,参数类型{@link ArkUI_ShapeType},ARKUI_SHAPE_TYPE_RECTANGLE; \n * .value[2].f32:矩形宽度; \n * .value[3].f32:矩形高度; \n * .value[4].f32:矩形圆角宽度; \n diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index 2fe4d0dd..dcddbcab 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -260,15 +260,15 @@ typedef enum { */ typedef enum { /** 线性样式。*/ - ARKUI_PROGRESS_LINEAR = 0, + ARKUI_PROGRESS_TYPE_LINEAR = 0, /** 环形无刻度样式。*/ - ARKUI_PROGRESS_RING, + ARKUI_PROGRESS_TYPE_RING, /** 圆形样式。*/ - ARKUI_PROGRESS_ECLIPSE, + ARKUI_PROGRESS_TYPE_ECLIPSE, /** 唤醒有刻度样式。*/ - ARKUI_PROGRESS_SCALERING, + ARKUI_PROGRESS_TYPE_SCALE_RING, /** 胶囊样式。*/ - ARKUI_PROGRESS_CAPSULE, + ARKUI_PROGRESS_TYPE_CAPSULE, }ArkUI_ProgressType; /** @@ -340,7 +340,7 @@ typedef enum { /** 多列数据选择器。*/ ARKUI_TEXTPICKER_RANGETYPE_MULTI, /** 支持图片资源的单列数据选择器。*/ - ARKUI_TEXTPICKER_RANGETYPE_RANGE_C0NTENT, + ARKUI_TEXTPICKER_RANGETYPE_RANGE_CONTENT, /** 支持联动的多列数据选择器。*/ ARKUI_TEXTPICKER_RANGETYPE_CASCADE_RANGE_CONTENT, } ArkUI_TextPickerRangeType; @@ -1084,7 +1084,7 @@ typedef enum { */ typedef enum { /** 矩形类型。 */ - ARKUI_MASK_TYPE_RECT = 0, + ARKUI_MASK_TYPE_RECTANGLE = 0, /** 圆形类型。 */ ARKUI_MASK_TYPE_CIRCLE, /** 椭圆形类型。 */ @@ -1102,7 +1102,7 @@ typedef enum { */ typedef enum { /** 矩形类型。 */ - ARKUI_CLIP_TYPE_RECT = 0, + ARKUI_CLIP_TYPE_RECTANGLE = 0, /** 圆形类型。 */ ARKUI_CLIP_TYPE_CIRCLE, /** 椭圆形类型。 */ @@ -1132,7 +1132,7 @@ typedef struct { */ typedef enum { /** 矩形类型。 */ - ARKUI_SHAPE_TYPE_RECT = 0, + ARKUI_SHAPE_TYPE_RECTANGLE = 0, /** 圆形类型。 */ ARKUI_SHAPE_TYPE_CIRCLE, /** 椭圆形类型。 */ -- Gitee From 583aa0e768deaebe4013a9f560eaf4d2c2494ede Mon Sep 17 00:00:00 2001 From: changleipeng Date: Fri, 23 Feb 2024 03:12:05 +0000 Subject: [PATCH 0299/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_font.h | 80 ++---- .../native_drawing/drawing_text_typography.h | 243 +++++++----------- 2 files changed, 106 insertions(+), 217 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h index 69213a25..acde8577 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font.h @@ -153,85 +153,37 @@ void OH_Drawing_FontDestroy(OH_Drawing_Font*); * @version 1.0 */ typedef struct OH_Drawing_Font_Metrics { - /** - * @brief 指示哪些度量是有效的 - * @since_2013 12 - */ + /** 指示哪些度量是有效的 */ uint32_t fFlags; - /** - * @brief 字符最高点到基线的最大距离 - * @since_2013 12 - */ + /** 字符最高点到基线的最大距离 */ float top; - /** - * @brief 字符最高点到基线的推荐距离 - * @since_2013 12 - */ + /** 字符最高点到基线的推荐距离 */ float ascent; - /** - * @brief 字符最低点到基线的推荐距离 - * @since_2013 12 - */ + /** 字符最低点到基线的推荐距离 */ float descent; - /** - * @brief 字符最低点到基线的最大距离 - * @since_2013 12 - */ + /** 字符最低点到基线的最大距离 */ float bottom; - /** - * @brief 行间距 - * @since_2013 12 - */ + /** 行间距 */ float leading; - /** - * @brief 平均字符宽度,如果未知则为零 - * @since_2013 12 - */ + /** 平均字符宽度,如果未知则为零 */ float avgCharWidth; - /** - * @brief 最大字符宽度,如果未知则为零 - * @since_2013 12 - */ + /** 最大字符宽度,如果未知则为零 */ float maxCharWidth; - /** - * @brief 任何字形边界框原点左侧的最大范围,通常为负值;不推荐使用可变字体 - * @since_2013 12 - */ + /** 任何字形边界框原点左侧的最大范围,通常为负值;不推荐使用可变字体 */ float xMin; - /** - * @brief 任何字形边界框原点右侧的最大范围,通常为负值;不推荐使用可变字体 - * @since_2013 12 - */ + /** 任何字形边界框原点右侧的最大范围,通常为负值;不推荐使用可变字体 */ float xMax; - /** - * @brief 小写字母的高度,如果未知则为零,通常为负数 - * @since_2013 12 - */ + /** 小写字母的高度,如果未知则为零,通常为负数 */ float xHeight; - /** - * @brief 大写字母的高度,如果未知则为零,通常为负数 - * @since_2013 12 - */ + /** 大写字母的高度,如果未知则为零,通常为负数 */ float capHeight; - /** - * @brief 下划线粗细 - * @since_2013 12 - */ + /** 下划线粗细 */ float underlineThickness; - /** - * @brief 表示下划线的位置,即从基线到文字下方笔画顶部的垂直距离,通常为正值。 - * @since_2013 12 - */ + /** 表示下划线的位置,即从基线到文字下方笔画顶部的垂直距离,通常为正值 */ float underlinePosition; - /** - * @brief 删除线粗细 - * @since_2013 12 - */ + /** 删除线粗细 */ float strikeoutThickness; - /** - * @brief 表示删除线的位置,即从基线到文字上方笔画底部的垂直距离,通常为负值。 - * @since_2013 12 - */ + /** 表示删除线的位置,即从基线到文字上方笔画底部的垂直距离,通常为负值 */ float strikeoutPosition; } OH_Drawing_Font_Metrics; diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 9e6700db..b36d69d2 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -295,55 +295,25 @@ typedef enum OH_Drawing_RectWidthStyle { * @version 1.0 */ typedef struct OH_Drawing_FontDescriptor { - /** - * @brief 系统字体的文件路径 - * @since_2013 12 - */ + /** 系统字体的文件路径 */ char* path; - /** - * @brief 唯一标识字体的名称 - * @since_2013 12 - */ + /** 唯一标识字体的名称 */ char* postScriptName; - /** - * @brief 系统字体的名称 - * @since_2013 12 - */ + /** 系统字体的名称 */ char* fullName; - /** - * @brief 系统字体的字体家族 - * @since_2013 12 - */ + /** 系统字体的字体家族 */ char* fontFamily; - /** - * @brief 系统字体的子字体家族 - * @since_2013 12 - */ + /** 系统字体的子字体家族 */ char* fontSubfamily; - /** - * @brief 系统字体的粗细程度 - * @since_2013 12 - */ + /** 系统字体的粗细程度 */ int weight; - /** - * @brief 系统字体的宽窄风格属性 - * @since_2013 12 - */ + /** 系统字体的宽窄风格属性 */ int width; - /** - * @brief 系统字体是否倾斜 - * @since_2013 12 - */ + /** 系统字体是否倾斜 */ int italic; - /** - * @brief 系统字体是否紧凑 - * @since_2013 12 - */ + /** 系统字体是否紧凑 */ bool monoSpace; - /** - * @brief 系统字体是否支持符号字体 - * @since_2013 12 - */ + /** 系统字体是否支持符号字体 */ bool symbolic; } OH_Drawing_FontDescriptor; @@ -354,60 +324,27 @@ typedef struct OH_Drawing_FontDescriptor { * @version 1.0 */ typedef struct OH_Drawing_LineMetrics { - /** - * @brief 文字相对于基线以上的高度 - * @since_2013 12 - */ + /** 文字相对于基线以上的高度 */ double ascender; - /** - * @brief 文字相对于基线以下的高度 - * @since_2013 12 - */ + /** 文字相对于基线以下的高度 */ double descender; - /** - * @brief 大写字母的高度 - * @since_2013 12 - */ + /** 大写字母的高度 */ double capHeight; - /** - * @brief 小写字母的高度 - * @since_2013 12 - */ + /** 小写字母的高度 */ double xHeight; - /** - * @brief 文字宽度 - * @since_2013 12 - */ + /** 文字宽度 */ double width; - /** - * @brief 行高 - * @since_2013 12 - */ + /** 行高 */ double height; - /** - * @brief 文字左端到容器左端距离,左对齐为0,右对齐为容器宽度减去行文字宽度 - * @since_2013 12 - */ + /** 文字左端到容器左端距离,左对齐为0,右对齐为容器宽度减去行文字宽度 */ double x; - /** - * @brief 文字上端到容器上端高度,第一行为0,第二行为第一行高度 - * @since_2013 12 - */ + /** 文字上端到容器上端高度,第一行为0,第二行为第一行高度 */ double y; - /** - * @brief 行起始位置字符索引 - * @since_2013 12 - */ + /** 行起始位置字符索引 */ size_t startIndex; - /** - * @brief 行结束位置字符索引 - * @since_2013 12 - */ + /** 行结束位置字符索引 */ size_t endIndex; - /** - * @brief 第一个字的度量信息 - * @since_2013 12 - */ + /** 第一个字的度量信息 */ OH_Drawing_Font_Metrics firstCharMetrics; } OH_Drawing_LineMetrics; @@ -457,7 +394,7 @@ void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Dr * @brief 获取文字对齐方式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @return 返回文字对齐方式。 * @since 12 * @version 1.0 @@ -489,7 +426,7 @@ OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); * @brief 获取字体风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_CreateTypographyStyle}对象的指针,由OH_Drawing_TypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @return 返回字体风格。返回类型为{@link OH_Drawing_TextStyle}结构体。 * @since 12 * @version 1.0 @@ -623,8 +560,8 @@ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); * @brief 设置前景色画刷。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由OH_Drawing_Brush获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_Brush}获取。 * @since 12 * @version 1.0 */ @@ -634,8 +571,8 @@ void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * @brief 返回设置的前景色画刷。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由OH_Drawing_Brush获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_Brush}获取。 * @since 12 * @version 1.0 */ @@ -645,8 +582,8 @@ void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * @brief 设置前景色画笔。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由OH_Drawing_Pen获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_Pen}获取。 * @since 12 * @version 1.0 */ @@ -656,8 +593,8 @@ void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * @brief 返回设置的前景色画笔。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由OH_Drawing_Pen获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_Pen}获取。 * @since 12 * @version 1.0 */ @@ -667,8 +604,8 @@ void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * @brief 设置背景色画刷。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由OH_Drawing_Brush获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_Brush}获取。 * @since 12 * @version 1.0 */ @@ -678,8 +615,8 @@ void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * @brief 返回设置的背景色画刷。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由OH_Drawing_Brush获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_Brush}获取。 * @since 12 * @version 1.0 */ @@ -689,8 +626,8 @@ void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * @brief 设置背景色画笔。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由OH_Drawing_Pen获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_Pen}获取。 * @since 12 * @version 1.0 */ @@ -700,8 +637,8 @@ void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * @brief 返回设置的背景色画笔。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由OH_Drawing_Pen获取。 + * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_Pen}获取。 * @since 12 * @version 1.0 */ @@ -1225,7 +1162,7 @@ void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int) * @brief 设置省略号样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_CreateTypographyStyle}的指针,由OH_Drawing_TypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param char 省略号样式。 * @since 12 * @version 1.0 @@ -1260,7 +1197,7 @@ double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); * @brief 设置文本划分比率。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param float 文本划分比率。 * @since 12 * @version 1.0 @@ -1271,7 +1208,7 @@ void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle* style, f * @brief 获取文本是否有最大行数限制。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @return 返回文本是否有最大行数限制,true表示有最大行数限制,false表示无最大行数限制。 * @since 12 * @version 1.0 @@ -1282,7 +1219,7 @@ bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle* style); * @brief 获取文本是否有省略号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @return 返回文本是否有省略号,true表示有省略号,false表示无省略号。 * @since 12 * @version 1.0 @@ -1293,7 +1230,7 @@ bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle* style); * @brief 设置文本位置。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param char 文本位置。 * @since 12 * @version 1.0 @@ -1304,9 +1241,9 @@ void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const * @brief 获取文本字体属性。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 - * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}的指针,由OH_Drawing_CreateTypography获取。 - * @param OH_Drawing_Font_Metrics 指向字体属性{@link OH_Drawing_Font_Metrics}的指针,由OH_Drawing_Font_Metrics获取。 + * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param OH_Drawing_Font_Metrics 指向字体属性对象{@link OH_Drawing_Font_Metrics}的指针,由{@link OH_Drawing_Font_Metrics}获取。 * @return 是否获取到字体属性。 * @since 12 * @version 1.0 @@ -1317,8 +1254,8 @@ bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_TextStyle*, OH_Drawing_Typogr * @brief 设置文本类型。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}的指针,由OH_Drawing_CreateTypographyStyle获取。 - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_CreateTextStyle}对象的指针,由OH_Drawing_TextStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @since 12 * @version 1.0 */ @@ -1328,7 +1265,7 @@ void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*,OH_Drawing_Te * @brief 构造字体解析对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 返回指向已创建的字体描述{@link OH_Drawing_FontDescriptor}对象的指针。 + * @return 返回指向已创建的字体描述对象{@link OH_Drawing_FontDescriptor}的指针。 * @since 12 * @version 1.0 */ @@ -1338,7 +1275,7 @@ OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); * @brief 释放字体描述对象占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -* @param OH_Drawing_FontDescriptor 指向字体描述{@link OH_Drawing_FontDescriptor}对象的指针,由OH_Drawing_FontDescriptor获取。 +* @param OH_Drawing_FontDescriptor 指向字体描述对象{@link OH_Drawing_FontDescriptor}的指针,由{@link OH_Drawing_CreateFontDescriptor}获取。 * @since 12 * @version 1.0 */ @@ -1348,7 +1285,7 @@ void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); * @brief 构造字体描述对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 返回指向已创建的字体解析{@link OH_Drawing_FontParser}对象的指针。 + * @return 返回指向已创建的字体解析对象{@link OH_Drawing_FontParser}的指针。 * @since 12 * @version 1.0 */ @@ -1358,7 +1295,7 @@ OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void); * @brief 释放字体解析对象占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser 指向字体解析{@link OH_Drawing_FontParser}对象的指针,由OH_Drawing_FontParser获取。 + * @param OH_Drawing_FontParser 指向字体解析对象{@link OH_Drawing_FontParser}的指针,由{@link OH_Drawing_CreateFontParser}获取。 * @since 12 * @version 1.0 */ @@ -1368,7 +1305,7 @@ void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser*); * @brief 获取系统字体名称列表。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser 指向字体解析{@link OH_Drawing_FontParser}对象的指针,由OH_Drawing_FontParser获取。 + * @param OH_Drawing_FontParser 指向字体解析对象{@link OH_Drawing_FontParser}的指针,由{@link OH_Drawing_CreateFontParser}获取。 * @param size_t 返回获取到的系统字体名称数量。 * @return 返回获取到的系统字体列表。 * @since 12 @@ -1391,7 +1328,7 @@ void OH_Drawing_DestroySystemFontList(char**, size_t); * @brief 根据传入的系统字体名称获取系统字体的相关信息。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser 指向字体解析{@link OH_Drawing_FontParser}对象的指针,由OH_Drawing_FontParser获取。 + * @param OH_Drawing_FontParser 指向字体解析对象{@link OH_Drawing_FontParser}的指针,由{@link OH_Drawing_CreateFontParser}获取。 * @param char* 系统字体名。 * @return 返回系统字体。 * @since 12 @@ -1403,7 +1340,7 @@ OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontPar * @brief 获取行度量信息。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 + * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @return 返回指向OH_Drawing_LineMetrics对象的指针。 * @since 12 * @version 1.0 @@ -1414,7 +1351,7 @@ OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typograph * @brief 获取行数量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_LineMetrics 指向行度量{@link OH_Drawing_LineMetrics}对象的指针,由OH_Drawing_LineMetrics获取。 + * @param OH_Drawing_LineMetrics 指向行度量对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 * @return 返回行数量。 * @since 12 * @version 1.0 @@ -1425,7 +1362,7 @@ size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics*); * @brief 释放行度量占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_LineMetrics 指向行度量{@link OH_Drawing_LineMetrics}对象的指针,由OH_Drawing_LineMetrics获取。 + * @param OH_Drawing_LineMetrics 指向行度量对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 * @since 12 * @version 1.0 */ @@ -1435,9 +1372,9 @@ void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); * @brief 获取指定行度量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 + * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 要获取的行数。 - * @param OH_Drawing_LineMetrics 指向行度量{@link OH_Drawing_LineMetrics}对象的指针。 + * @param OH_Drawing_LineMetrics 指向行度量对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 * @return 行度量是否成功获取。 * @since 12 * @version 1.0 @@ -1448,11 +1385,11 @@ bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int, OH_Drawi * @brief 获取指定行的位置信息或指定行第一个字符的位置信息。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向文本OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 行号。 * @param bool true为获取整行的位置信息,false为获取第一个字符的位置信息。 * @param bool 文字宽度是否包含空白符。 - * @param OH_Drawing_LineMetrics 指向行度量{@link OH_Drawing_LineMetrics}对象的指针。 + * @param OH_Drawing_LineMetrics 指向行度量对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 * @return 信息是否成功获取。 * @since 12 * @version 1.0 @@ -1463,7 +1400,7 @@ bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, O * @brief 设置文本排版字重。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param int 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, * 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见{@link OH_Drawing_FontWeight}枚举。 * @since 12 @@ -1475,7 +1412,7 @@ void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int); * @brief 设置字体风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param int 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见{@link OH_Drawing_FontStyle}枚举。 * @since 12 * @version 1.0 @@ -1486,7 +1423,7 @@ void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle*, int); * @brief 设置字体家族的名称。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param char 字体家族的名称,数据类型为指向char的指针。 * @since 12 * @version 1.0 @@ -1497,8 +1434,8 @@ void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle*, const c * @brief 设置文本排版字号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 - * @param double 字号。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param double 字号(大于0)。 * @since 12 * @version 1.0 */ @@ -1508,7 +1445,7 @@ void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); * @brief 设置文本排版字体高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param double 字体高度。 * @since 12 * @version 1.0 @@ -1519,7 +1456,7 @@ void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle*, double) * @brief 设置文本排版是否为一半行间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效。 * @since 12 * @version 1.0 @@ -1530,7 +1467,7 @@ void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle*, bool); * @brief 设置文本排版是否启用行样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param bool 设置行样式是否启用,true表示启用,false表示不启用 * @since 12 * @version 1.0 @@ -1541,7 +1478,7 @@ void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle*, bool) * @brief 设置文本排版行样式字重。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param int 设置字重,设置0字重为thin,设置1字重为extra-light,设置2字重为light,设置4字重为medium,设置5字重为semi-bold, * 设置6字重为bold,设置7字重为extra-bold,设置8字重为black,设置3或其它字重为normal/regular,具体可见{@link OH_Drawing_FontWeight}枚举。 * @since 12 @@ -1553,7 +1490,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle* * @brief 设置文本排版行样式风格。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param int 设置字体风格,设置1为斜体,设置0或其它为非斜体,具体可见{@link OH_Drawing_FontStyle}枚举。 * @since 12 * @version 1.0 @@ -1564,7 +1501,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, * @brief 设置文本排版行样式字体类型。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param int 字体名称数量。 * @param char 指向字体类型的指针。 * @since 12 @@ -1577,8 +1514,8 @@ void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyl * @brief 设置文本排版行样式字号。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 - * @param double 字号。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 + * @param double 字号(大于0)。 * @since 12 * @version 1.0 */ @@ -1588,7 +1525,7 @@ void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); * @brief 设置文本排版行样式字体高度。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param double 字体高度。 * @since 12 * @version 1.0 @@ -1599,7 +1536,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle* * @brief 设置文本排版行样式是否为一半行间距。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param bool 设置一半行间距是否生效,true表示生效,false表示不生效。 * @since 12 * @version 1.0 @@ -1610,7 +1547,7 @@ void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle * @brief 设置文本排版行样式间距比例。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param double 间距比例。 * @since 12 * @version 1.0 @@ -1621,7 +1558,7 @@ void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyl * @brief 设置文本排版是否仅启用行样式。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由OH_Drawing_CreateTypographyStyle获取。 + * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 * @param bool 设置仅启用行样式是否生效,true表示生效,false表示不生效。 * @since 12 * @version 1.0 @@ -1642,7 +1579,7 @@ OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); * @brief 释放被文本阴影对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextShadow 指向字体阴影{@link OH_Drawing_CreateTextShadow}对象的指针,由OH_Drawing_TextShadow获取。 + * @param OH_Drawing_TextShadow 指向字体阴影对象{@link OH_Drawing_TextShadow}的指针,由{@link OH_Drawing_CreateTextShadow}获取。 * @since 12 * @version 1.0 */ @@ -1652,7 +1589,7 @@ void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow*); * @brief 获取文本阴影容器。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 + * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @return 返回指向容器的指针,返回类型为{@link OH_Drawing_TextShadow}结构体。 * @since 12 * @version 1.0 @@ -1663,7 +1600,7 @@ OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*); * @brief 获取文本阴影容器的大小。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 + * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @return int 返回文本阴影容器的大小。 * @since 12 * @version 1.0 @@ -1674,8 +1611,8 @@ int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); * @brief 文本阴影容器中添加文本阴影元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 - * @param OH_Drawing_TextShadow 指向字体阴影{@link OH_Drawing_CreateTextShadow}对象的指针,由OH_Drawing_TextShadow获取。 + * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 + * @param OH_Drawing_TextShadow 指向字体阴影对象{@link OH_Drawing_TextShadow}的指针,由{@link OH_Drawing_CreateTextShadow}获取。 * @since 12 * @version 1.0 */ @@ -1685,7 +1622,7 @@ void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, OH_Drawing_TextShadow* * @brief 清除文本阴影容器中的所有元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 + * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @since 12 * @version 1.0 */ @@ -1695,7 +1632,7 @@ void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*); * @brief 根据下标获取文本阴影容器中的元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由OH_Drawing_CreateTextStyle获取。 + * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param int 下标索引。 * @return 返回指向索引对应元素的指针,返回类型为{@link OH_Drawing_TextShadow}结构体。 * @since 12 @@ -1707,7 +1644,7 @@ OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextSty * @brief 设置文本的排版缩进。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 + * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 排版缩进数量。 * @param float 指向缩进类型的指针。 * @since 12 @@ -1719,7 +1656,7 @@ void OH_Drawing_TypographySetIndents(OH_Drawing_Typography*, int, const float in * @brief 根据下标获取排版缩进容器中的元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 + * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 下标索引。 * @return float 返回索引对应的元素值。 * @since 12 @@ -1731,7 +1668,7 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); * @brief 获取行的边界。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography 指向文本{@link OH_Drawing_Typography}对象的指针,由OH_Drawing_CreateTypography获取。 + * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 行索引 * @param bool 设置返回的边界是否包含空格,true为包含空格,false为不包含空格。 * @return 返回行边界,返回类型为{@link OH_Drawing_Range}结构体。 @@ -1744,7 +1681,7 @@ OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, * @brief 释放由被字体阴影对象OH_Drawing_TextShadow构成的vector占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextShadow 指向{@link OH_Drawing_CreateTextShadow}对象的指针,由OH_Drawing_TextShadow获取。 + * @param OH_Drawing_TextShadow 指向字体阴影对象{@link OH_Drawing_TextShadow}的指针,由{@link OH_Drawing_CreateTextShadow}获取。 * @since 12 * @version 1.0 */ -- Gitee From 29ce9b8c1e43c98dfa779ce7f16ee15ad64dbefb Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Fri, 23 Feb 2024 16:09:24 +0800 Subject: [PATCH 0300/2135] =?UTF-8?q?fix=20NDK=20C-API=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=AD=97=E7=AC=A6=E9=97=AE=E9=A2=98=20Signed-off-by:?= =?UTF-8?q?=20liyi0309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 2d9f8f76..f19faeee 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -1526,7 +1526,7 @@ typedef enum { * .value[0].i32 表示图片基于文本的对齐方式,取{@link ArkUI_ImageSpanAlignment}枚举值。\n * */ - NODE_IMAGE_SPAN_VERTICAL_ALIGN, + NODE_IMAGE_SPAN_VERTICAL_ALIGNMENT, /** * @brief image组件设置图片地址属性,支持属性设置,属性重置,属性获取接口。 * -- Gitee From ebfa81ab47f21efaca3f2b3d22c067806e5802a8 Mon Sep 17 00:00:00 2001 From: wind Date: Fri, 23 Feb 2024 18:31:04 +0800 Subject: [PATCH 0301/2135] add ndk doc of asset Signed-off-by: wind --- zh-cn/native_sdk/security/asset/asset_api.h | 144 ++++++ zh-cn/native_sdk/security/asset/asset_type.h | 441 +++++++++++++++++++ 2 files changed, 585 insertions(+) create mode 100755 zh-cn/native_sdk/security/asset/asset_api.h create mode 100755 zh-cn/native_sdk/security/asset/asset_type.h diff --git a/zh-cn/native_sdk/security/asset/asset_api.h b/zh-cn/native_sdk/security/asset/asset_api.h new file mode 100755 index 00000000..98dd3d8d --- /dev/null +++ b/zh-cn/native_sdk/security/asset/asset_api.h @@ -0,0 +1,144 @@ +/* + * 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 ASSET_API_H +#define ASSET_API_H + +#include +#include + +#include "asset_type.h" + +/** + * @addtogroup AssetApi + * @{ + * + * @brief 提供用户短敏感数据的安全存储及管理能力,包括新增、删除、更新、查询等。 + * 其中,短敏感数据可以是密码类(账号/密码)、Token类(应用凭据)、其他关键明文(如银行卡号)等长度较短的用户敏感数据。 + * + * @since 11 + */ + +/** + * @file asset_api.h + * + * @brief 声明用于访问关键资产的接口。 + * + * @library libasset_ndk.z.so + * @kit Asset Store Kit + * @syscap SystemCapability.Security.Asset + * @since 11 + */ + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief 新增一条关键资产。 + * + * @param attributes 待新增关键资产的属性集合。 + * @param attrCnt 待新增关键资产的属性数量。 + * @return 如果操作成功,则返回ASSET_SUCCESS;否则返回错误码。 + * @since 11 + */ +int32_t OH_Asset_Add(const Asset_Attr *attributes, uint32_t attrCnt); + +/** + * @brief 删除符合条件的一条或多条关键资产。 + * + * @param query 待删除关键资产的搜索条件。 + * @param queryCnt 待删除关键资产搜索条件的个数。 + * @return 如果操作成功,则返回ASSET_SUCCESS;否则返回错误码。 + * @since 11 + */ +int32_t OH_Asset_Remove(const Asset_Attr *query, uint32_t queryCnt); + +/** + * @brief 更新符合条件的一条关键资产。 + * + * @param query 待更新关键资产的搜索条件。 + * @param queryCnt 待更新关键资产搜索条件的个数。 + * @param attributesToUpdate 待更新关键资产的属性集合。 + * @param updateCnt 待更新关键资产的属性数量。 + * @return 如果操作成功,则返回ASSET_SUCCESS;否则返回错误码。 + * @since 11 + */ +int32_t OH_Asset_Update(const Asset_Attr *query, uint32_t queryCnt, + const Asset_Attr *attributesToUpdate, uint32_t updateCnt); + +/** + * @brief 查询的预处理,用于需要用户认证的关键资产。 + * + * @param query 关键资产的查询条件。 + * @param queryCnt 关键资产查询条件的个数。 + * @param challenge 挑战值,在后续调用OH_Asset_Query时使用。 + * @return 如果操作成功,则返回ASSET_SUCCESS;否则返回错误码。 + * @since 11 + */ +int32_t OH_Asset_PreQuery(const Asset_Attr *query, uint32_t queryCnt, Asset_Blob *challenge); + +/** + * @brief 查询一条或多条符合条件的关键资产。 + * + * @param query 关键资产的查询条件。 + * @param queryCnt 关键资产查询条件的个数。 + * @param resultSet 查询结果列表。 + * @return 如果操作成功,则返回ASSET_SUCCESS;否则返回错误码。 + * @since 11 + */ +int32_t OH_Asset_Query(const Asset_Attr *query, uint32_t queryCnt, Asset_ResultSet *resultSet); + +/** + * @brief 查询的后置处理,用于需要用户认证的关键资产。 + * + * @param handle 待处理的查询句柄,当前包含OH_Asset_PreQuery执行成功返回的挑战值。 + * @param handleCnt 句柄属性集合中元素的个数。 + * @return 如果操作成功,则返回ASSET_SUCCESS;否则返回错误码。 + * @since 11 + */ +int32_t OH_Asset_PostQuery(const Asset_Attr *handle, uint32_t handleCnt); + +/** + * @brief 解析查询结果,并获取指定的属性值。 + * + * @param result 从OH_Asset_Query中获取的查询结果。 + * @param tag 待获取的属性标签。 + * @return 如果操作成功,则以Asset_Attr的形式返回属性,该属性不需要业务进行释放;否则返回NULL。 + * @since 11 + */ +Asset_Attr *OH_Asset_ParseAttr(const Asset_Result *result, Asset_Tag tag); + +/** + * @brief 释放挑战值所占用的内存。 + * + * @param blob 从OH_Asset_PreQuery获取的挑战值。 + * @since 11 + */ +void OH_Asset_FreeBlob(Asset_Blob *blob); + +/** + * @brief 释放查询结果所占用的内存。 + * + * @param resultSet 从OH_Asset_Query得到的查询结果列表。 + * @since 11 + */ +void OH_Asset_FreeResultSet(Asset_ResultSet *resultSet); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif // ASSET_API_H diff --git a/zh-cn/native_sdk/security/asset/asset_type.h b/zh-cn/native_sdk/security/asset/asset_type.h new file mode 100755 index 00000000..d5b1a39e --- /dev/null +++ b/zh-cn/native_sdk/security/asset/asset_type.h @@ -0,0 +1,441 @@ +/* + * 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 ASSET_TYPE_H +#define ASSET_TYPE_H + +/** + * @addtogroup AssetType + * @{ + * + * @brief 提供关键资产存储服务中通用的枚举值、数据结构和错误码。 + * + * @since 11 + */ + +/** + * @file asset_type.h + * + * @brief 定义关键资产存储服务中通用的枚举值、数据结构和错误码。 + * + * @library libasset_ndk.z.so + * @kit Asset Store Kit + * @syscap SystemCapability.Security.Asset + * @since 11 + */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 关键资产属性的类型定义。 + * + * @since 11 + */ +typedef enum { + /** + * 标识关键资产属性的类型是布尔类型。 + */ + ASSET_TYPE_BOOL = 0x1 << 28, + /** + * 标识关键资产属性的类型是整型。 + */ + ASSET_TYPE_NUMBER = 0x2 << 28, + /** + * 标识关键资产属性的类型是字节数组类型。 + */ + ASSET_TYPE_BYTES = 0x3 << 28, +} Asset_TagType; + +/** + * @brief 用于获取关键资产属性类型的掩码。 + * + * @since 11 + */ +#define ASSET_TAG_TYPE_MASK (0xF << 28) + +/** + * @brief 关键资产属性的名称。 + * + * @since 11 + */ +typedef enum { + /** + * 表示用户敏感数据,如口令、令牌等,其值为bytes类型。 + */ + ASSET_TAG_SECRET = ASSET_TYPE_BYTES | 0x01, + /** + * 表示一个关键资产的标识,其值为bytes类型。 + */ + ASSET_TAG_ALIAS = ASSET_TYPE_BYTES | 0x02, + /** + * 表示关键资产何时可访问,其值为uint32类型。 + */ + ASSET_TAG_ACCESSIBILITY = ASSET_TYPE_NUMBER | 0x03, + /** + * 表示关键资产是否在设备是否设置了锁屏密码时可用,其值为bool类型。 + */ + ASSET_TAG_REQUIRE_PASSWORD_SET = ASSET_TYPE_BOOL | 0x04, + /** + * 表示关键资产需要的用户认证类型,其值为uint32类型。 + */ + ASSET_TAG_AUTH_TYPE = ASSET_TYPE_NUMBER | 0x05, + /** + * 表示用户认证的有效时间,其值为uint32类型,单位为秒。 + */ + ASSET_TAG_AUTH_VALIDITY_PERIOD = ASSET_TYPE_NUMBER | 0x06, + /** + * 表示认证时防重放用的挑战值,其值为bytes类型。 + */ + ASSET_TAG_AUTH_CHALLENGE = ASSET_TYPE_BYTES | 0x07, + /** + * 表示用户认证后获取到的认证令牌,其值为bytes类型。 + */ + ASSET_TAG_AUTH_TOKEN = ASSET_TYPE_BYTES | 0x08, + /** + * 表示关键资产的同步类型,其值为uint32类型。 + */ + ASSET_TAG_SYNC_TYPE = ASSET_TYPE_NUMBER | 0x10, + /** + * 表示关键资产是否需持久化存储,其值为bool类型。 + * 仅在调用OH_Asset_Add函数时传入该属性需要校验权限。 + * + * @permission ohos.permission.STORE_PERSISTENT_DATA + */ + ASSET_TAG_IS_PERSISTENT = ASSET_TYPE_BOOL | 0x11, + /** + * 表示一个用户可自定义传入的字段,该字段不可被更新,其值为bytes类型。 + */ + ASSET_TAG_DATA_LABEL_CRITICAL_1 = ASSET_TYPE_BYTES | 0x20, + /** + * 表示一个用户可自定义传入的字段,该字段不可被更新,其值为bytes类型。 + */ + ASSET_TAG_DATA_LABEL_CRITICAL_2 = ASSET_TYPE_BYTES | 0x21, + /** + * 表示一个用户可自定义传入的字段,该字段不可被更新,其值为bytes类型。 + */ + ASSET_TAG_DATA_LABEL_CRITICAL_3 = ASSET_TYPE_BYTES | 0x22, + /** + * 表示一个用户可自定义传入的字段,该字段不可被更新,其值为bytes类型。 + */ + ASSET_TAG_DATA_LABEL_CRITICAL_4 = ASSET_TYPE_BYTES | 0x23, + /** + * 表示一个用户可自定义传入的字段,该字段可被更新,其值为bytes类型。 + */ + ASSET_TAG_DATA_LABEL_NORMAL_1 = ASSET_TYPE_BYTES | 0x30, + /** + * 表示一个用户可自定义传入的字段,该字段可被更新,其值为bytes类型。 + */ + ASSET_TAG_DATA_LABEL_NORMAL_2 = ASSET_TYPE_BYTES | 0x31, + /** + * 表示一个用户可自定义传入的字段,该字段可被更新,其值为bytes类型。 + */ + ASSET_TAG_DATA_LABEL_NORMAL_3 = ASSET_TYPE_BYTES | 0x32, + /** + * 表示一个用户可自定义传入的字段,该字段可被更新,其值为bytes类型。 + */ + ASSET_TAG_DATA_LABEL_NORMAL_4 = ASSET_TYPE_BYTES | 0x33, + /** + * 表示查询关键资产时的返回类型,其值为uint32类型。 + */ + ASSET_TAG_RETURN_TYPE = ASSET_TYPE_NUMBER | 0x40, + /** + * 表示查询关键资产时的最大返回数量,其值为uint32类型。 + */ + ASSET_TAG_RETURN_LIMIT = ASSET_TYPE_NUMBER | 0x41, + /** + * 表示查询关键资产时的偏移量,其值为uint32类型。 + */ + ASSET_TAG_RETURN_OFFSET = ASSET_TYPE_NUMBER | 0x42, + /** + * 表示查询关键资产时的排序依据,其值为uint32类型。 + */ + ASSET_TAG_RETURN_ORDERED_BY = ASSET_TYPE_NUMBER | 0x43, + /** + * 表示新增关键资产时的冲突处理策略,其值为uint32类型。 + */ + ASSET_TAG_CONFLICT_RESOLUTION = ASSET_TYPE_NUMBER | 0x44, +} Asset_Tag; + +/** + * @brief 调用ASSET返回的结果码。 + * + * @since 11 + */ +typedef enum { + /** + * 表示操作成功。 + */ + ASSET_SUCCESS = 0, + /** + * 表示调用者没有权限。 + */ + ASSET_PERMISSION_DENIED = 201, + /** + * 表示参数错误。 + */ + ASSET_INVALID_ARGUMENT = 401, + /** + * 表示关键资产服务不可用。 + */ + ASSET_SERVICE_UNAVAILABLE = 24000001, + /** + * 表示未找到关键资产。 + */ + ASSET_NOT_FOUND = 24000002, + /** + * 表示关键资产已存在。 + */ + ASSET_DUPLICATED = 24000003, + /** + * 表示拒绝访问关键资产。 + */ + ASSET_ACCESS_DENIED = 24000004, + /** + * 表示锁屏状态不匹配。 + */ + ASSET_STATUS_MISMATCH = 24000005, + /** + * 表示系统内存不足。 + */ + ASSET_OUT_OF_MEMORY = 24000006, + /** + * 表示关键资产损坏。 + */ + ASSET_DATA_CORRUPTED = 24000007, + /** + * 表示数据库操作失败。 + */ + ASSET_DATABASE_ERROR = 24000008, + /** + * 表示算法库操作失败。 + */ + ASSET_CRYPTO_ERROR = 24000009, + /** + * 表示进程通信错误。 + */ + ASSET_IPC_ERROR = 24000010, + /** + * 表示包管理服务异常。 + */ + ASSET_BMS_ERROR = 24000011, + /** + * 表示账号系统异常。 + */ + ASSET_ACCOUNT_ERROR = 24000012, + /** + * 表示访问控制服务异常。 + */ + ASSET_ACCESS_TOKEN_ERROR = 24000013, + /** + * 表示文件操作失败。 + */ + ASSET_FILE_OPERATION_ERROR = 24000014, + /** + * 表示获取系统时间失败。 + */ + ASSET_GET_SYSTEM_TIME_ERROR = 24000015, + /** + * 表示缓存数量超限。 + */ + ASSET_LIMIT_EXCEEDED = 24000016, + /** + * 表示该子功能不支持。 + */ + ASSET_UNSUPPORTED = 24000017, +} Asset_ResultCode; + +/** + * @brief 基于锁屏状态的访问控制类型。 + * + * @since 11 + */ +typedef enum { + /** + * 开机后可访问。 + */ + ASSET_ACCESSIBILITY_DEVICE_POWERED_ON = 0, + /** + * 首次解锁后可访问。 + */ + ASSET_ACCESSIBILITY_DEVICE_FIRST_UNLOCKED = 1, + /** + * 解锁时可访问。 + */ + ASSET_ACCESSIBILITY_DEVICE_UNLOCKED = 2, +} Asset_Accessibility; + +/** + * @brief 关键资产支持的用户认证类型。 + * + * @since 11 + */ +typedef enum { + /** + * 访问关键资产前无需用户认证。 + */ + ASSET_AUTH_TYPE_NONE = 0x00, + /** + * 任意一种用户认证方式(PIN码、人脸、指纹等)通过后,均可访问关键资产。 + */ + ASSET_AUTH_TYPE_ANY = 0xFF, +} Asset_AuthType; + +/** + * @brief 关键资产支持的同步类型。 + * + * @since 11 + */ +typedef enum { + /** + * 不允许同步关键资产。 + */ + ASSET_SYNC_TYPE_NEVER = 0, + /** + * 只在本设备进行同步,如仅在本设备还原的备份场景。 + */ + ASSET_SYNC_TYPE_THIS_DEVICE = 1 << 0, + /** + * 只在可信设备间进行同步,如克隆场景。 + */ + ASSET_SYNC_TYPE_TRUSTED_DEVICE = 1 << 1, +} Asset_SyncType; + +/** + * @brief 新增关键资产时的冲突(如:别名相同)处理策略。 + * + * @since 11 + */ +typedef enum { + /** + * 覆盖原本的关键资产。 + */ + ASSET_CONFLICT_OVERWRITE = 0, + /** + * 抛出异常,由业务进行后续处理。 + */ + ASSET_CONFLICT_THROW_ERROR = 1, +} Asset_ConflictResolution; + +/** + * @brief 关键资产查询返回的结果类型。 + * + * @since 11 + */ +typedef enum { + /** + * 返回关键资产明文及属性。 + */ + ASSET_RETURN_ALL = 0, + /** + * 返回关键资产属性,不含关键资产明文。 + */ + ASSET_RETURN_ATTRIBUTES = 1, +} Asset_ReturnType; + +/** + * @brief 二进制数组类型,即不定长的字节数组。 + * + * @since 11 + */ +typedef struct { + /** + * 表示字节数组的大小。 + */ + uint32_t size; + /** + * 指向字节数组的指针。 + */ + uint8_t *data; +} Asset_Blob; + +/** + * @brief 关键资产属性内容。 + * + * @since 11 + */ +typedef union { + /** + * 该字段用于传入bool类型的关键资产。 + */ + bool boolean; + /** + * 该字段用于传入uint32类型的关键资产。 + */ + uint32_t u32; + /** + * 该字段用于传入bytes类型的关键资产。 + */ + Asset_Blob blob; +} Asset_Value; + +/** + * @brief 关键资产属性。 + * + * @since 11 + */ +typedef struct { + /** + * 关键资产属性名称。 + */ + uint32_t tag; + /** + * 关键资产属性内容。 + */ + Asset_Value value; +} Asset_Attr; + +/** + * @brief 关键资产查询结果,用于定义一条关键资产。 + * + * @since 11 + */ +typedef struct { + /** + * 关键资产属性的个数。 + */ + uint32_t count; + /** + * 指向关键资产属性数组的指针。 + */ + Asset_Attr *attrs; +} Asset_Result; + +/** + * @brief 关键资产查询结果集合,用于定义多条关键资产。 + * + * @since 11 + */ +typedef struct { + /** + * 关键资产的条数。 + */ + uint32_t count; + /** + * 指向关键资产数组的指针。 + */ + Asset_Result *results; +} Asset_ResultSet; + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif // ASSET_TYPE_H \ No newline at end of file -- Gitee From a60663d6b086255ee9a03eb945ef032b1fe56bb4 Mon Sep 17 00:00:00 2001 From: wind Date: Fri, 23 Feb 2024 18:34:35 +0800 Subject: [PATCH 0302/2135] add ndk doc of asset Signed-off-by: wind --- en/native_sdk/security/asset/asset_api.h | 148 ++++++++ en/native_sdk/security/asset/asset_type.h | 444 ++++++++++++++++++++++ 2 files changed, 592 insertions(+) create mode 100755 en/native_sdk/security/asset/asset_api.h create mode 100755 en/native_sdk/security/asset/asset_type.h diff --git a/en/native_sdk/security/asset/asset_api.h b/en/native_sdk/security/asset/asset_api.h new file mode 100755 index 00000000..87b2652d --- /dev/null +++ b/en/native_sdk/security/asset/asset_api.h @@ -0,0 +1,148 @@ +/* + * 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 ASSET_API_H +#define ASSET_API_H + +#include +#include + +#include "asset_type.h" + +/** + * @addtogroup AssetApi + * @{ + * + * @brief Provides APIs for storing and managing short sensitive data of users, including adding, deleting, updating, + * and querying the data. + * The short sensitive data refers to sensitive data shorter than 1024 bytes, including the user passwords + * (accounts/passwords), token data (application credentials), and critical data in plaintext (bank card numbers). + * + * @since 11 + */ + +/** + * @file asset_api.h + * + * @brief Declares the APIs for accessing assets. + * + * @library libasset_ndk.z.so + * @kit Asset Store Kit + * @syscap SystemCapability.Security.Asset + * @since 11 + */ + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief Adds an asset. + * + * @param attributes Pointer to the attributes of the asset to add. + * @param attributes Number of the attributes of the asset to add. + * @return Returns ASSET_SUCCESS if the operation is successful; returns an error code otherwise. + * @since 11 + */ +int32_t OH_Asset_Add(const Asset_Attr *attributes, uint32_t attrCnt); + +/** + * @brief Removes one or more assets. + * + * @param query Pointer to the conditions for removing the assets. + * @param queryCnt Number of conditions for removing the assets. + * @return Returns ASSET_SUCCESS if the operation is successful; returns an error code otherwise. + * @since 11 + */ +int32_t OH_Asset_Remove(const Asset_Attr *query, uint32_t queryCnt); + +/** + * @brief Updates an asset. + * + * @param query Pointer to the conditions for updating the asset. + * @param queryCnt Number of conditions for updating the asset. + * @param attributes Pointer to the attributes of the asset to update. + * @param attributes Number of the attributes of the asset to update. + * @return Returns ASSET_SUCCESS if the operation is successful; returns an error code otherwise. + * @since 11 + */ +int32_t OH_Asset_Update(const Asset_Attr *query, uint32_t queryCnt, + const Asset_Attr *attributesToUpdate, uint32_t updateCnt); + +/** + * @brief Preprocesses data before querying the asset that can be accessed only after a successful user authentication. + * + * @param query Pointer to the search criteria of the asset. + * @param queryCnt Number of the search criteria. + * @param challenge Pointer to the challenge value to be used when OH_Asset_Query is called. + * @return Returns ASSET_SUCCESS if the operation is successful; returns an error code otherwise. + * @since 11 + */ +int32_t OH_Asset_PreQuery(const Asset_Attr *query, uint32_t queryCnt, Asset_Blob *challenge); + +/** + * @brief Queries assets. + * + * @param query Pointer to the search criteria. + * @param queryCnt Number of the search criteria. + * @param resultSet Pointer to the query result obtained. + * @return Returns ASSET_SUCCESS if the operation is successful; returns an error code otherwise. + * @since 11 + */ +int32_t OH_Asset_Query(const Asset_Attr *query, uint32_t queryCnt, Asset_ResultSet *resultSet); + +/** + * @brief Processes data after the query of the asset that requires user authentication. + * + * @param handle Pointer to the handle of the data to process, which includes the challenge value returned by + * OH_Asset_PreQuery. + * @param handleCnt Number of the elements in the handle attribute set. + * @return Returns ASSET_SUCCESS if the operation is successful; returns an error code otherwise. + * @since 11 + */ +int32_t OH_Asset_PostQuery(const Asset_Attr *handle, uint32_t handleCnt); + +/** + * @brief Parses the query result to obtain the specified attribute value. + * + * @param result Pointer to the query result to parse, which is obtained by OH_Asset_Query. + * @param tag Tag of the attribute to obtain. + * @return Returns Asset_Attr obtained if the operation is successful; returns NULL otherwise. + * The attribute does not need to be released by the service. + * @since 11 + */ +Asset_Attr *OH_Asset_ParseAttr(const Asset_Result *result, Asset_Tag tag); + +/** + * @brief Releases the memory occupied by the challenge value. + * + * @param blob Pointer to the challenge value (obtained by OH_Asset_PreQuery) to release. + * @since 11 + */ +void OH_Asset_FreeBlob(Asset_Blob *blob); + +/** + * @brief Releases the memory occupied by the query result. + * + * @param resultSet Pointer to the query result (obtained by OH_Asset_Query) to release. + * @since 11 + */ +void OH_Asset_FreeResultSet(Asset_ResultSet *resultSet); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif // ASSET_API_H diff --git a/en/native_sdk/security/asset/asset_type.h b/en/native_sdk/security/asset/asset_type.h new file mode 100755 index 00000000..3649dfa8 --- /dev/null +++ b/en/native_sdk/security/asset/asset_type.h @@ -0,0 +1,444 @@ +/* + * 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 ASSET_TYPE_H +#define ASSET_TYPE_H + +/** + * @addtogroup AssetType + * @{ + * + * @brief Provides the enums, structs, and error codes used in the Asset APIs. + * + * @since 11 + */ + +/** + * @file asset_type.h + * + * @brief Defines the enums, structs, and error codes used in the Asset APIs. + * + * @library libasset_ndk.z.so + * @kit Asset Store Kit + * @syscap SystemCapability.Security.Asset + * @since 11 + */ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the types of the asset attribute tags. + * + * @since 11 + */ +typedef enum { + /** + * The asset attribute tag is a Boolean value. + */ + ASSET_TYPE_BOOL = 0x1 << 28, + /** + * The asset attribute tag is a number. + */ + ASSET_TYPE_NUMBER = 0x2 << 28, + /** + * The asset attribute tag is an array of bytes. + */ + ASSET_TYPE_BYTES = 0x3 << 28, +} Asset_TagType; + +/** + * @brief Defines the mask used to obtain the type of the asset attribute tag. + * + * @since 11 + */ +#define ASSET_TAG_TYPE_MASK (0xF << 28) + +/** + * @brief Enumerates the asset attribute tags. + * + * @since 11 + */ +typedef enum { + /** + * Sensitive user data in the form of bytes, such as passwords and tokens. + */ + ASSET_TAG_SECRET = ASSET_TYPE_BYTES | 0x01, + /** + * Asset alias (identifier) in the form of bytes. + */ + ASSET_TAG_ALIAS = ASSET_TYPE_BYTES | 0x02, + /** + * Time when the asset is accessible. The value is of the uint32 type, which is a 32-bit unsigned integer. + */ + ASSET_TAG_ACCESSIBILITY = ASSET_TYPE_NUMBER | 0x03, + /** + * A Boolean value indicating whether the asset is available only with a lock screen password. + */ + ASSET_TAG_REQUIRE_PASSWORD_SET = ASSET_TYPE_BOOL | 0x04, + /** + * User authentication type for the asset. The value is of the uint32 type. + */ + ASSET_TAG_AUTH_TYPE = ASSET_TYPE_NUMBER | 0x05, + /** + * Validity period of the user authentication, in seconds. The value is of the uint32 type. + */ + ASSET_TAG_AUTH_VALIDITY_PERIOD = ASSET_TYPE_NUMBER | 0x06, + /** + * Challenge value, in the form of bytes, used for anti-replay during the authentication. + */ + ASSET_TAG_AUTH_CHALLENGE = ASSET_TYPE_BYTES | 0x07, + /** + * Authentication token, in the form of bytes, obtained after a successful user authentication. + */ + ASSET_TAG_AUTH_TOKEN = ASSET_TYPE_BYTES | 0x08, + /** + * Asset synchronization type. The value is of the uint32 type. + */ + ASSET_TAG_SYNC_TYPE = ASSET_TYPE_NUMBER | 0x10, + /** + * A Boolean value indicating whether the asset needs to be stored persistently. + * The ohos.permission.STORE_PERSISTENT_DATA permission is required if OH_Asset_Add is called with this tag. + * + * @permission ohos.permission.STORE_PERSISTENT_DATA + */ + ASSET_TAG_IS_PERSISTENT = ASSET_TYPE_BOOL | 0x11, + /** + * An immutable custom field, in the form of bytes. + */ + ASSET_TAG_DATA_LABEL_CRITICAL_1 = ASSET_TYPE_BYTES | 0x20, + /** + * An immutable custom field, in the form of bytes. + */ + ASSET_TAG_DATA_LABEL_CRITICAL_2 = ASSET_TYPE_BYTES | 0x21, + /** + * An immutable custom field, in the form of bytes. + */ + ASSET_TAG_DATA_LABEL_CRITICAL_3 = ASSET_TYPE_BYTES | 0x22, + /** + * An immutable custom field, in the form of bytes. + */ + ASSET_TAG_DATA_LABEL_CRITICAL_4 = ASSET_TYPE_BYTES | 0x23, + /** + * A mutable custom field, in the form of bytes. + */ + ASSET_TAG_DATA_LABEL_NORMAL_1 = ASSET_TYPE_BYTES | 0x30, + /** + * A mutable custom field, in the form of bytes. + */ + ASSET_TAG_DATA_LABEL_NORMAL_2 = ASSET_TYPE_BYTES | 0x31, + /** + * A mutable custom field, in the form of bytes. + */ + ASSET_TAG_DATA_LABEL_NORMAL_3 = ASSET_TYPE_BYTES | 0x32, + /** + * A mutable custom field, in the form of bytes. + */ + ASSET_TAG_DATA_LABEL_NORMAL_4 = ASSET_TYPE_BYTES | 0x33, + /** + * Return type of the queried asset. The value is of the uint32 type. + */ + ASSET_TAG_RETURN_TYPE = ASSET_TYPE_NUMBER | 0x40, + /** + * Maximum number of assets that can be returned at a time if multiple asset records match the specified conditions. + * The value is of the uint32 type. + */ + ASSET_TAG_RETURN_LIMIT = ASSET_TYPE_NUMBER | 0x41, + /** + * Offset that indicates the start asset when multiple asset records are returned. The value is of the uint32 type. + */ + ASSET_TAG_RETURN_OFFSET = ASSET_TYPE_NUMBER | 0x42, + /** + * Sorting order of the assets in the query result. The value is of the uint32 type. + */ + ASSET_TAG_RETURN_ORDERED_BY = ASSET_TYPE_NUMBER | 0x43, + /** + * Policy used to resolve the conflict occurred when an asset is added. The value is of the uint32 type. + */ + ASSET_TAG_CONFLICT_RESOLUTION = ASSET_TYPE_NUMBER | 0x44, +} Asset_Tag; + +/** + * @brief Enumerates the result codes used in the ASSET APIs. + * + * @since 11 + */ +typedef enum { + /** + * The operation is successful. + */ + ASSET_SUCCESS = 0, + /** + * The caller does not have the required permission. + */ + ASSET_PERMISSION_DENIED = 201, + /** + * The parameter is invalid. + */ + ASSET_INVALID_ARGUMENT = 401, + /** + * The asset service is unavailable. + */ + ASSET_SERVICE_UNAVAILABLE = 24000001, + /** + * The asset is not found. + */ + ASSET_NOT_FOUND = 24000002, + /** + * The asset already exists. + */ + ASSET_DUPLICATED = 24000003, + /** + * The access to the asset is denied. + */ + ASSET_ACCESS_DENIED = 24000004, + /** + * The lock screen status does not match the access control type specified. + */ + ASSET_STATUS_MISMATCH = 24000005, + /** + * The system memory is insufficient. + */ + ASSET_OUT_OF_MEMORY = 24000006, + /** + * The asset is corrupted. + */ + ASSET_DATA_CORRUPTED = 24000007, + /** + * The database operation failed. + */ + ASSET_DATABASE_ERROR = 24000008, + /** + * The cryptography operation failed. + */ + ASSET_CRYPTO_ERROR = 24000009, + /** + * The inter-process communication (IPC) failed. + */ + ASSET_IPC_ERROR = 24000010, + /** + * The Bundle Manager service is abnormal. + */ + ASSET_BMS_ERROR = 24000011, + /** + * The Account service is abnormal. + */ + ASSET_ACCOUNT_ERROR = 24000012, + /** + * The Access Token service is abnormal. + */ + ASSET_ACCESS_TOKEN_ERROR = 24000013, + /** + * The file operation failed. + */ + ASSET_FILE_OPERATION_ERROR = 24000014, + /** + * The operation for obtaining the system time failed. + */ + ASSET_GET_SYSTEM_TIME_ERROR = 24000015, + /** + * The number of cached assets exceeds the limit. + */ + ASSET_LIMIT_EXCEEDED = 24000016, + /** + * The function is not supported. + */ + ASSET_UNSUPPORTED = 24000017, +} Asset_ResultCode; + +/** + * @brief Enumerates the types of the access control based on the lock screen status. + * + * @since 11 + */ +typedef enum { + /** + * The asset can be accessed after the device is powered on. + */ + ASSET_ACCESSIBILITY_DEVICE_POWERED_ON = 0, + /** + * The asset can be accessed only after the device is unlocked for the first time. + */ + ASSET_ACCESSIBILITY_DEVICE_FIRST_UNLOCKED = 1, + /** + * The asset can be accessed only after the device is unlocked. + */ + ASSET_ACCESSIBILITY_DEVICE_UNLOCKED = 2, +} Asset_Accessibility; + +/** + * @brief Enumerates the user authentication types supported for assets. + * + * @since 11 + */ +typedef enum { + /** + * No user authentication is required before the asset is accessed. + */ + ASSET_AUTH_TYPE_NONE = 0x00, + /** + * The asset can be accessed if any user authentication (such as PIN, facial, or fingerprint authentication) is + * successful. + */ + ASSET_AUTH_TYPE_ANY = 0xFF, +} Asset_AuthType; + +/** + * @brief Enumerates the asset synchronization types. + * + * @since 11 + */ +typedef enum { + /** + * Asset synchronization is not allowed. + */ + ASSET_SYNC_TYPE_NEVER = 0, + /** + * Asset synchronization is allowed only on the local device, for example, in data restoration on the local device. + */ + ASSET_SYNC_TYPE_THIS_DEVICE = 1 << 0, + /** + * Asset synchronization is allowed only between trusted devices, for example, in the case of cloning. + */ + ASSET_SYNC_TYPE_TRUSTED_DEVICE = 1 << 1, +} Asset_SyncType; + +/** + * @brief Enumerates the policies for resolving the conflict (for example, duplicate alias) occurred when + * an asset is added. + * + * @since 11 + */ +typedef enum { + /** + * Overwrite the existing asset. + */ + ASSET_CONFLICT_OVERWRITE = 0, + /** + * Throw an exception for the service to perform subsequent processing. + */ + ASSET_CONFLICT_THROW_ERROR = 1, +} Asset_ConflictResolution; + +/** + * @brief Enumerates the types of the asset query result. + * + * @since 11 + */ +typedef enum { + /** + * The query result contains the asset in plaintext and its attributes. + */ + ASSET_RETURN_ALL = 0, + /** + * The query result contains only the asset attributes. + */ + ASSET_RETURN_ATTRIBUTES = 1, +} Asset_ReturnType; + +/** + * @brief Defines an asset value in the forma of a binary array, that is, a variable-length byte array. + * + * @since 11 + */ +typedef struct { + /** + * Size of the byte array. + */ + uint32_t size; + /** + * Pointer to the byte array. + */ + uint8_t *data; +} Asset_Blob; + +/** + * @brief Defines the value (content) of an asset attribute. + * + * @since 11 + */ +typedef union { + /** + * Asset of the Boolean type. + */ + bool boolean; + /** + * Asset of the uint32 type. + */ + uint32_t u32; + /** + * Asset of the bytes type. + */ + Asset_Blob blob; +} Asset_Value; + +/** + * @brief Defines an asset attribute. + * + * @since 11 + */ +typedef struct { + /** + * Tag of the asset attribute. + */ + uint32_t tag; + /** + * Value of the asset attribute. + */ + Asset_Value value; +} Asset_Attr; + +/** + * @brief Represents information about an asset. + * + * @since 11 + */ +typedef struct { + /** + * Number of asset attributes. + */ + uint32_t count; + /** + * Pointer to the array of the asset attributes. + */ + Asset_Attr *attrs; +} Asset_Result; + +/** + * @brief Represents information about a set of assets. + * + * @since 11 + */ +typedef struct { + /** + * Number of assets. + */ + uint32_t count; + /** + * Pointer to the array of the assets. + */ + Asset_Result *results; +} Asset_ResultSet; + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif // ASSET_TYPE_H \ No newline at end of file -- Gitee From fb5a5cfa584fb83df6dd6f5befd40625236e5ac6 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Fri, 23 Feb 2024 11:12:39 +0800 Subject: [PATCH 0303/2135] [NDK] fix accessibility level Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- zh-cn/native_sdk/ace/native_node.h | 8 ++++---- zh-cn/native_sdk/ace/native_type.h | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index b8bc7996..507cb4ed 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -1206,16 +1206,16 @@ typedef enum { NODE_ACCESSIBILITY_TEXT, /** - * @brief 无障碍重要性属性,支持属性设置,属性重置和属性获取。 + * @brief 无障碍辅助服务模式,支持属性设置,属性重置和属性获取。 * * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n - * .value[0].i32:障碍重要性,参数类型{@link ArkUI_AccessibilityLevel}。 + * .value[0].i32:辅助服务模式,参数类型{@link ArkUI_AccessibilityMode}。 * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n - * .value[0].i32:障碍重要性,参数类型{@link ArkUI_AccessibilityLevel}。 + * .value[0].i32:辅助服务模式,参数类型{@link ArkUI_AccessibilityMode}。 * */ - NODE_ACCESSIBILITY_LEVEL, + NODE_ACCESSIBILITY_MODE, /** * @brief 无障碍说明属性,支持属性设置,属性重置和属性获取。 diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index 2fe4d0dd..9f028004 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -558,20 +558,20 @@ typedef enum { /** - * @brief 定义无障碍重要性。 + * @brief 定义无障碍辅助服务模式。 * * @since 12 */ typedef enum { - /** 根据组件不同会转换为“yes”或者“no”。 */ - ARKUI_ACCESSIBILITY_LEVEL_AUTO = 0, + /** 根据组件不同会转换为“enabled”或者“disabled”。 */ + ARKUI_ACCESSIBILITY_MODE_AUTO = 0, /** 当前组件可被无障碍辅助服务所识别。*/ - ARKUI_ACCESSIBILITY_LEVEL_YES, + ARKUI_ACCESSIBILITY_MODE_ENABLED, /** 当前组件不可被无障碍辅助服务所识别。*/ - ARKUI_ACCESSIBILITY_LEVEL_NO, + ARKUI_ACCESSIBILITY_MODE_DISABLED, /** 当前组件及其所有子组件不可被无障碍辅助服务所识别。*/ - ARKUI_ACCESSIBILITY_LEVEL_NO_HIDE_DESCENDANTS, -} ArkUI_AccessibilityLevel; + ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS, +} ArkUI_AccessibilityMode; /** * @brief 定义组件支持设置文本是否可复制粘贴。 -- Gitee From 7fef1e80e247d479685a8fec73a3c74937e29214 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 26 Feb 2024 02:42:29 +0000 Subject: [PATCH 0304/2135] =?UTF-8?q?0226=E4=BF=AE=E6=94=B9=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_font_collection.h | 4 +- .../native_drawing/drawing_text_typography.h | 82 +++++++++---------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 701ada98..c108cff4 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -69,7 +69,7 @@ void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection*); * @brief 禁用备用字体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection 指向字体集对象的指针。 + * @param OH_Drawing_FontCollection 指向字体集对象{@Link OH_Drawing_FontCollection}的指针。 * @since 12 * @version 1.0 */ @@ -79,7 +79,7 @@ void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection* fontCol * @brief 禁用系统字体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection 指向字体集对象的指针。 + * @param OH_Drawing_FontCollection 指向字体集对象{@Link OH_Drawing_FontCollection}的指针。 * @since 12 * @version 1.0 */ diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index b36d69d2..db4cc58c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -309,11 +309,11 @@ typedef struct OH_Drawing_FontDescriptor { int weight; /** 系统字体的宽窄风格属性 */ int width; - /** 系统字体是否倾斜 */ + /** 系统字体倾斜度 */ int italic; - /** 系统字体是否紧凑 */ + /** 系统字体是否紧凑,true表示字体紧凑,false表示字体非紧凑 */ bool monoSpace; - /** 系统字体是否支持符号字体 */ + /** 系统字体是否支持符号字体,true表示支持符号字体,false表示不支持符号字体 */ bool symbolic; } OH_Drawing_FontDescriptor; @@ -427,7 +427,7 @@ OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向文本风格{@link OH_Drawing_TypographyStyle}对象的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 - * @return 返回字体风格。返回类型为{@link OH_Drawing_TextStyle}结构体。 + * @return 返回指向字体风格对象{@link OH_Drawing_TextStyle}的指针。 * @since 12 * @version 1.0 */ @@ -561,7 +561,7 @@ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_Brush}获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_BrushCreate}获取。 * @since 12 * @version 1.0 */ @@ -572,7 +572,7 @@ void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_Brush}获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_BrushCreate}获取。 * @since 12 * @version 1.0 */ @@ -583,7 +583,7 @@ void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_Pen}获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_PenCreate}获取。 * @since 12 * @version 1.0 */ @@ -594,7 +594,7 @@ void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_Pen}获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_PenCreate}获取。 * @since 12 * @version 1.0 */ @@ -605,7 +605,7 @@ void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_Brush}获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_BrushCreate}获取。 * @since 12 * @version 1.0 */ @@ -616,7 +616,7 @@ void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_Brush}获取。 + * @param OH_Drawing_Brush 指向画刷{@link OH_Drawing_Brush}对象的指针,由{@link OH_Drawing_BrushCreate}获取。 * @since 12 * @version 1.0 */ @@ -627,7 +627,7 @@ void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Br * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_Pen}获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_PenCreate}获取。 * @since 12 * @version 1.0 */ @@ -638,7 +638,7 @@ void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen* * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格{@link OH_Drawing_TextStyle}对象的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_Pen}获取。 + * @param OH_Drawing_Pen 指向画笔{@link OH_Drawing_Pen}对象的指针,由{@link OH_Drawing_PenCreate}获取。 * @since 12 * @version 1.0 */ @@ -854,7 +854,7 @@ bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); * @param size_t 设置结束位置。 * @param OH_Drawing_RectHeightStyle 设置高度样式,支持可选的高度样式具体可见{@link OH_Drawing_RectHeightStyle}枚举。 * @param OH_Drawing_RectWidthStyle 设置宽度样式,支持可选的宽度样式具体可见{@link OH_Drawing_RectWidthStyle}枚举。 - * @return 返回指定范围内的文本框,具体可见{@link OH_Drawing_TextBox}结构体。 + * @return 返回指向指定范围内的文本框对象{@link OH_Drawing_TextBox}的指针。 * @since 11 * @version 1.0 */ @@ -866,7 +866,7 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回占位符的文本框,返回类型为{@link OH_Drawing_TextBox}结构体。 + * @return 返回指向占位符的文本框对象{@link OH_Drawing_TextBox}的指针。 * @since 11 * @version 1.0 */ @@ -1244,7 +1244,7 @@ void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param OH_Drawing_Font_Metrics 指向字体属性对象{@link OH_Drawing_Font_Metrics}的指针,由{@link OH_Drawing_Font_Metrics}获取。 - * @return 是否获取到字体属性。 + * @return 是否获取到字体属性,true表示获取到字体属性,false表示未获取到字体属性。 * @since 12 * @version 1.0 */ @@ -1262,7 +1262,7 @@ bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_TextStyle*, OH_Drawing_Typogr void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*,OH_Drawing_TextStyle*); /** - * @brief 构造字体解析对象。 + * @brief 构造字体描述对象,用于描述系统字体详细信息。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 返回指向已创建的字体描述对象{@link OH_Drawing_FontDescriptor}的指针。 @@ -1282,7 +1282,7 @@ OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); /** - * @brief 构造字体描述对象。 + * @brief 构造字体解析对象,用于解析系统字体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @return 返回指向已创建的字体解析对象{@link OH_Drawing_FontParser}的指针。 @@ -1337,11 +1337,11 @@ void OH_Drawing_DestroySystemFontList(char**, size_t); OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontParser*, const char*); /** - * @brief 获取行度量信息。 + * @brief 获取行位置信息。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回指向OH_Drawing_LineMetrics对象的指针。 + * @return 返回指向行位置信息对象{@link OH_Drawing_LineMetrics}的指针。 * @since 12 * @version 1.0 */ @@ -1351,7 +1351,7 @@ OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typograph * @brief 获取行数量。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_LineMetrics 指向行度量对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 + * @param OH_Drawing_LineMetrics 指向行位置信息对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 * @return 返回行数量。 * @since 12 * @version 1.0 @@ -1359,23 +1359,23 @@ OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typograph size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics*); /** - * @brief 释放行度量占用的内存。 + * @brief 释放行位置信息对象占用的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_LineMetrics 指向行度量对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 + * @param OH_Drawing_LineMetrics 指向行位置信息对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 * @since 12 * @version 1.0 */ void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); /** - * @brief 获取指定行度量。 + * @brief 获取指定行位置信息对象。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 要获取的行数。 - * @param OH_Drawing_LineMetrics 指向行度量对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 - * @return 行度量是否成功获取。 + * @param OH_Drawing_LineMetrics 指向行位置信息对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 + * @return 行位置信息对象是否成功获取,true表示成功获取,false表示未成功获取。 * @since 12 * @version 1.0 */ @@ -1388,9 +1388,9 @@ bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int, OH_Drawi * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 行号。 * @param bool true为获取整行的位置信息,false为获取第一个字符的位置信息。 - * @param bool 文字宽度是否包含空白符。 - * @param OH_Drawing_LineMetrics 指向行度量对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 - * @return 信息是否成功获取。 + * @param bool 文字宽度是否包含空白符,true表示不包含空白符,false表示包含空白符。 + * @param OH_Drawing_LineMetrics 指向行位置信息对象{@link OH_Drawing_LineMetrics}的指针,由{@link OH_Drawing_LineMetrics}获取。 + * @return 指定行的行位置信息或第一个字符的位置信息是否成功获取,true表示成功获取,false表示未成功获取。 * @since 12 * @version 1.0 */ @@ -1468,7 +1468,7 @@ void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle*, bool); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle 指向文本风格对象{@link OH_Drawing_TypographyStyle}的指针,由{@link OH_Drawing_CreateTypographyStyle}获取。 - * @param bool 设置行样式是否启用,true表示启用,false表示不启用 + * @param bool 设置行样式是否启用,true表示启用,false表示不启用。 * @since 12 * @version 1.0 */ @@ -1566,17 +1566,17 @@ void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyl void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle*, bool); /** - * @brief 创建指向文本阴影对象的指针。 + * @brief 创建指向字体阴影对象的指针。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return 指向创建的文本阴影对象。 + * @return 指向创建的字体阴影对象。 * @since 12 * @version 1.0 */ OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); /** - * @brief 释放被文本阴影对象占据的内存。 + * @brief 释放被字体阴影对象占据的内存。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextShadow 指向字体阴影对象{@link OH_Drawing_TextShadow}的指针,由{@link OH_Drawing_CreateTextShadow}获取。 @@ -1586,29 +1586,29 @@ OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow*); /** - * @brief 获取文本阴影容器。 + * @brief 获取字体阴影容器。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @return 返回指向容器的指针,返回类型为{@link OH_Drawing_TextShadow}结构体。 + * @return 返回指向字体阴影容器{@link OH_Drawing_TextShadow}的指针。 * @since 12 * @version 1.0 */ OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*); /** - * @brief 获取文本阴影容器的大小。 + * @brief 获取字体阴影容器的大小。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 - * @return int 返回文本阴影容器的大小。 + * @return int 返回字体阴影容器的大小。 * @since 12 * @version 1.0 */ int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); /** - * @brief 文本阴影容器中添加文本阴影元素。 + * @brief 字体阴影容器中添加字体阴影元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 @@ -1619,7 +1619,7 @@ int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, OH_Drawing_TextShadow*); /** - * @brief 清除文本阴影容器中的所有元素。 + * @brief 清除字体阴影容器中的所有元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 @@ -1629,12 +1629,12 @@ void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, OH_Drawing_TextShadow* void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*); /** - * @brief 根据下标获取文本阴影容器中的元素。 + * @brief 根据下标获取字体阴影容器中的元素。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param int 下标索引。 - * @return 返回指向索引对应元素的指针,返回类型为{@link OH_Drawing_TextShadow}结构体。 + * @return 返回指向字体阴影对象{@link OH_Drawing_TextShadow}的指针。 * @since 12 * @version 1.0 */ @@ -1671,7 +1671,7 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 * @param int 行索引 * @param bool 设置返回的边界是否包含空格,true为包含空格,false为不包含空格。 - * @return 返回行边界,返回类型为{@link OH_Drawing_Range}结构体。 + * @return 返回指向行边界对象的指针{@link OH_Drawing_Range}。 * @since 12 * @version 1.0 */ -- Gitee From 69a3a25238fc47383988057bc2c7d95cc83248e2 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 26 Feb 2024 02:47:02 +0000 Subject: [PATCH 0305/2135] =?UTF-8?q?=E8=AF=AF=E6=94=B9=E4=B8=A4=E4=B8=AAs?= =?UTF-8?q?ince=2011=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=AD=A4=E5=A4=84?= =?UTF-8?q?=E6=94=B9=E5=9B=9E=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_text_typography.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index db4cc58c..73e4a21d 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -854,7 +854,7 @@ bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); * @param size_t 设置结束位置。 * @param OH_Drawing_RectHeightStyle 设置高度样式,支持可选的高度样式具体可见{@link OH_Drawing_RectHeightStyle}枚举。 * @param OH_Drawing_RectWidthStyle 设置宽度样式,支持可选的宽度样式具体可见{@link OH_Drawing_RectWidthStyle}枚举。 - * @return 返回指向指定范围内的文本框对象{@link OH_Drawing_TextBox}的指针。 + * @return 返回占位符的文本框,返回类型为{@link OH_Drawing_TextBox}结构体。 * @since 11 * @version 1.0 */ @@ -866,7 +866,7 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回指向占位符的文本框对象{@link OH_Drawing_TextBox}的指针。 + * @return 返回指定范围内的文本框,具体可见{@link OH_Drawing_TextBox}结构体。 * @since 11 * @version 1.0 */ -- Gitee From a02125c8956cc7390057dd8fed9e6e21c6b04bf4 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 26 Feb 2024 02:49:10 +0000 Subject: [PATCH 0306/2135] =?UTF-8?q?=E8=AF=AF=E6=94=B9=E4=B8=A4=E4=B8=AAs?= =?UTF-8?q?ince=2011=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=AD=A4=E5=A4=84?= =?UTF-8?q?=E6=94=B9=E5=9B=9E=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_text_typography.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 73e4a21d..5a24c31c 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -854,7 +854,7 @@ bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); * @param size_t 设置结束位置。 * @param OH_Drawing_RectHeightStyle 设置高度样式,支持可选的高度样式具体可见{@link OH_Drawing_RectHeightStyle}枚举。 * @param OH_Drawing_RectWidthStyle 设置宽度样式,支持可选的宽度样式具体可见{@link OH_Drawing_RectWidthStyle}枚举。 - * @return 返回占位符的文本框,返回类型为{@link OH_Drawing_TextBox}结构体。 + * @return 返回指定范围内的文本框,具体可见{@link OH_Drawing_TextBox}结构体。 * @since 11 * @version 1.0 */ @@ -866,7 +866,7 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography 指向OH_Drawing_Typography对象的指针,由{@link OH_Drawing_CreateTypography}获取。 - * @return 返回指定范围内的文本框,具体可见{@link OH_Drawing_TextBox}结构体。 + * @return 返回占位符的文本框,返回类型为{@link OH_Drawing_TextBox}结构体。 * @since 11 * @version 1.0 */ -- Gitee From e602f8dd8b7a7d43abdfa725cca1be3532d99c6d Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 26 Feb 2024 03:18:06 +0000 Subject: [PATCH 0307/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=A2=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_text_typography.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 5a24c31c..85432ab9 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1508,7 +1508,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, * @version 1.0 */ void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle*, - int /* fontFamiliesNumber */, const char* fontFamilies[]); + int, const char* fontFamilies[]); /** * @brief 设置文本排版行样式字号。 @@ -1530,7 +1530,7 @@ void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle*, double /* fontHeight */); +void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle*, double); /** * @brief 设置文本排版行样式是否为一半行间距。 -- Gitee From 5c5a8c6e58893a66e8583045103c8d268cc3fbc6 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 26 Feb 2024 03:58:44 +0000 Subject: [PATCH 0308/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=A7=E5=86=99L?= =?UTF-8?q?ink=E4=B8=BA=E5=B0=8F=E5=86=99link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_font_collection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index c108cff4..5f7fe035 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -69,7 +69,7 @@ void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection*); * @brief 禁用备用字体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection 指向字体集对象{@Link OH_Drawing_FontCollection}的指针。 + * @param OH_Drawing_FontCollection 指向字体集对象{@link OH_Drawing_FontCollection}的指针。 * @since 12 * @version 1.0 */ @@ -79,7 +79,7 @@ void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection* fontCol * @brief 禁用系统字体。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection 指向字体集对象{@Link OH_Drawing_FontCollection}的指针。 + * @param OH_Drawing_FontCollection 指向字体集对象{@link OH_Drawing_FontCollection}的指针。 * @since 12 * @version 1.0 */ -- Gitee From de89f3f782f2d11c1fc72745b816b9470b37b14f Mon Sep 17 00:00:00 2001 From: m00472246 Date: Mon, 26 Feb 2024 11:17:38 +0800 Subject: [PATCH 0309/2135] =?UTF-8?q?=E8=A1=A5=E5=85=85nativeWindow?= =?UTF-8?q?=E4=B8=AD=E7=9A=84format=E3=80=81ColorGamut=E3=80=81TransformTy?= =?UTF-8?q?pe=20Signed-off-by:=20m00472246=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: m00472246 --- zh-cn/native_sdk/graphic/native_buffer.h | 156 +++++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/zh-cn/native_sdk/graphic/native_buffer.h b/zh-cn/native_sdk/graphic/native_buffer.h index a9c10cdd..105f9857 100644 --- a/zh-cn/native_sdk/graphic/native_buffer.h +++ b/zh-cn/native_sdk/graphic/native_buffer.h @@ -87,6 +87,21 @@ enum OH_NativeBuffer_Usage { * @version 1.0 */ enum OH_NativeBuffer_Format { + /** + * CLUT8格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_CLUT8 = 0, + /** + * CLUT1格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_CLUT1, + /** + * CLUT4格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_CLUT4, /** * RGB565格式 */ @@ -159,6 +174,81 @@ enum OH_NativeBuffer_Format { * BGRA8888格式 */ NATIVEBUFFER_PIXEL_FMT_BGRA_8888, + /** + * YUV422 interleaved 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YUV_422_T, + /** + * YCBCR422 semi-plannar 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_422_SP, + /** + * YCRCR422 semi-plannar 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCR_422_SP, + /** + * YCBCR420 semi-plannar 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_420_SP, + /** + * YCRCR420 semi-plannar 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCR_420_SP, + /** + * YCBCR422 plannar 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_422_P, + /** + * YCRCR422 plannar 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCR_422_P, + /** + * YCBCR420 plannar 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_420_P, + /** + * YCRCR420 plannar 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCR_420_P, + /** + * YUYV422 packed 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YUYV_422_PKG, + /** + * UYVY422 packed 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_UYVY_422_PKG, + /** + * YVYU422 packed 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YVYU_422_PKG, + /** + * VYUY422 packed 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_VYUY_422_PKG, + /** + * RGBA_1010102 packed 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_1010102, + /** + * vender mask 格式 + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_VENDER_MASK = 0X7FFF0000, /** * 无效格式 */ @@ -239,6 +329,72 @@ enum OH_NativeBuffer_ColorSpace { OH_COLORSPACE_DISPLAY_BT2020_PQ, }; +/** + * @brief OH_NativeBuffer的转换类型。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 12 + * @version 1.0 + */ +enum OH_NativeBuffer_TransformType { + /** 不旋转 */ + NATIVEBUFFER_ROTATE_NONE = 0, + /** 旋转90度 */ + NATIVEBUFFER_ROTATE_90, + /** 旋转180度 */ + NATIVEBUFFER_ROTATE_180, + /** 旋转270度 */ + NATIVEBUFFER_ROTATE_270, + /** 水平翻转 */ + NATIVEBUFFER_FLIP_H, + /** 垂直翻转 */ + NATIVEBUFFER_FLIP_V, + /** 水平翻转并旋转90度 */ + NATIVEBUFFER_FLIP_H_ROT90, + /** 垂直翻转并旋转90度 */ + NATIVEBUFFER_FLIP_V_ROT90, + /** 水平翻转并旋转180度 */ + NATIVEBUFFER_FLIP_H_ROT180, + /** 垂直翻转并旋转180度 */ + NATIVEBUFFER_FLIP_V_ROT180, + /** 水平翻转并旋转270度 */ + NATIVEBUFFER_FLIP_H_ROT270, + /** 垂直翻转并旋转270度 */ + NATIVEBUFFER_FLIP_V_ROT270, +}; + +/** + * @brief OH_NativeBuffer的色域。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 12 + * @version 1.0 + */ +enum OH_NativeBuffer_ColorGamut { + /** 默认色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_NATIVE = 0, + /** Standard BT601 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT601 = 1, + /** Standard BT709 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT709 = 2, + /** DCI P3 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_DCI_P3 = 3, + /** SRGB 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_SRGB = 4, + /** Adobe RGB 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_ADOBE_RGB = 5, + /** Display P3 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_DISPLAY_P3 = 6, + /** BT2020 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_BT2020 = 7, + /** BT2100 PQ 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_BT2100_PQ = 8, + /** BT2100 HLG 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_BT2100_HLG = 9, + /** Display BT2020 色域格式 */ + NATIVEBUFFER_COLOR_GAMUT_DISPLAY_BT2020 = 10, +}; + /** * @brief OH_NativeBuffer的属性配置,用于申请新的OH_NativeBuffer实例或查询现有实例的相关属性 * -- Gitee From 228bf1421be18f383fbdc494e502ed07430af596 Mon Sep 17 00:00:00 2001 From: zhouchaobo Date: Mon, 26 Feb 2024 19:14:00 +0800 Subject: [PATCH 0310/2135] interface_native_header: XComponent add axis event Signed-off-by: zhouchaobo --- .../ace/native_interface_xcomponent.h | 16 +++ zh-cn/native_sdk/ace/ui_input_event.h | 130 ++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 zh-cn/native_sdk/ace/ui_input_event.h diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index 89967d3b..11a74906 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -40,6 +40,7 @@ #include #include "arkui/native_type.h" +#include "arkui/ui_input_event.h" #include "native_xcomponent_key_event.h" @@ -604,6 +605,21 @@ int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, */ int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); +/** + * @brief 为此OH_NativeXComponent实例注册UI输入事件回调,并使能收到UI输入事件时回调此函数。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param callback 指示指向UI输入事件回调的指针。 + * @param type 指示当前UI输入事件的类型。 + * @return 返回执行的状态代码。 + * @since 12 + */ +int32_t OH_NativeXComponent_RegisterUIInputEventCallback( + OH_NativeXComponent *component, + void (*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event, + ArkUI_UIInputEvent_Type type), + ArkUI_UIInputEvent_Type type); + #ifdef __cplusplus }; #endif diff --git a/zh-cn/native_sdk/ace/ui_input_event.h b/zh-cn/native_sdk/ace/ui_input_event.h new file mode 100644 index 00000000..47c49a11 --- /dev/null +++ b/zh-cn/native_sdk/ace/ui_input_event.h @@ -0,0 +1,130 @@ +/* + * 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_EventModule + * @{ + * + * @brief 在Native端提供ArkUI的UI输入事件能力。 + * + * @since 12 + */ + +/** + * @file ui_input_event.h + * + * @brief 提供ArkUI在Native侧的事件定义。 + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef UI_INPUT_EVENT +#define UI_INPUT_EVENT + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief UI输入事件定义。 + * + * @since 12 + */ +typedef struct ArkUI_UIInputEvent ArkUI_UIInputEvent; + +/** + * @brief UI输入事件类型定义。 + * + * @since 12 + */ +enum ArkUI_UIInputEvent_Type { + ArkUI_UIINPUTEVENT_TYPE_UNKNOWN = 0, + ArkUI_UIINPUTEVENT_TYPE_TOUCH = 1, + ArkUI_UIINPUTEVENT_TYPE_AXIS = 2, +}; + +/** + * @brief 获取UI输入事件的类型。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前UI输入事件的类型。 + * @since 12 + */ +int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); + +/** + * @brief 获取当前轴事件的垂直滚动轴的值。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的垂直滚动轴的值. + * @since 12 + */ +double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); + +/** + * @brief 获取当前轴事件的水平滚动轴的值。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的水平滚动轴的值。 + * @since 12 + */ +double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); + +/** + * @brief 获取当前轴事件的相对于窗口的X坐标。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的相对于窗口的X坐标。 + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetWindowX(const ArkUI_UIInputEvent *event); + +/** + * @brief 获取当前轴事件的相对于窗口的Y坐标。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的相对于窗口的Y坐标。 + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetWindowY(const ArkUI_UIInputEvent *event); + +/** + * @brief 获取当前轴事件的相对于屏幕的X坐标。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的相对于屏幕的X坐标。 + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetDisplayX(const ArkUI_UIInputEvent *event); + +/** + * @brief 获取当前轴事件的相对于屏幕的Y坐标。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的相对于屏幕的Y坐标。 + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetDisplayY(const ArkUI_UIInputEvent *event); + +#ifdef __cplusplus +}; +#endif + +#endif // UI_INPUT_EVENT +/** @} */ -- Gitee From e376fbe3c8e70189e02c33f1427480549c05d6c2 Mon Sep 17 00:00:00 2001 From: shaoshuai Date: Tue, 27 Feb 2024 10:00:58 +0800 Subject: [PATCH 0311/2135] =?UTF-8?q?=E3=80=90V8=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E3=80=91DOC=E5=A2=9E=E5=8A=A0=E6=80=A7?= =?UTF-8?q?=E8=83=BD=E5=88=86=E6=9E=90=E5=8F=8A=E8=B0=83=E8=AF=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=8E=A5=E5=8F=A3=E4=B8=AD=E6=96=87=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shaoshuai --- zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h | 99 +++++++++++++++++++ .../native_sdk/ark_runtime/jsvm/jsvm_types.h | 51 ++++++++++ 2 files changed, 150 insertions(+) diff --git a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h index 3081db56..139348d4 100644 --- a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h +++ b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h @@ -208,6 +208,17 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenEnvScope(JSVM_Env env, JSVM_EXTERN JSVM_Status OH_JSVM_CloseEnvScope(JSVM_Env env, JSVM_EnvScope scope); +/** + * @brief 将检索给定环境的虚拟机实例。 + * + * @param env 目标环境,JSVM-API接口将在该环境下调用。 + * @param result 给定环境的虚拟机实例。 + * @return 成功则返回JSVM_OK。 + * @since 12 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetVM(JSVM_Env env, + JSVM_VM* result); + /** * @brief 编译一串JavaScript代码,并返回编译后的脚本。 * @@ -1990,6 +2001,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_RejectDeferred(JSVM_Env env, /** * @brief 查询Promise是否为原生Promise对象。 + * * @param env 调用JSVM-API的环境。 * @param value 待检查的值。 * @param isPromise 表示是否为原生Promise对象(即底层引擎创建的promise对象)的标志。 @@ -2002,6 +2014,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsPromise(JSVM_Env env, /** * @brief 解析JSON字符串,并返回成功解析的值。 + * * @param env 调用JSVM-API的环境。 * @param jsonString 待解析的字符串。 * @param result 成功解析的值。 @@ -2014,6 +2027,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_JsonParse(JSVM_Env env, /** * @brief 将对象字符串化,并返回成功转换后的字符串。 + * * @param env 调用JSVM-API的环境。 * @param jsonObject 待字符串化的对象。 * @param result 成功转换后返回的字符串。 @@ -2026,6 +2040,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_JsonStringify(JSVM_Env env, /** * @brief 创建虚拟机的启动快照。 + * * @param vm 目标环境,API接口将在该环境下调用。 * @param contextCount 上下文个数。 * @param contexts 要添加到快照的上下文数组。 @@ -2040,6 +2055,90 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateSnapshot(JSVM_VM vm, const char** blobData, size_t* blobSize); +/** + * @brief 返回一组虚拟机堆的统计数据。 + * + * @param vm 返回堆统计信息的虚拟机。 + * @param result 堆统计数据。 + * @return 成功则返回JSVM_OK。 + * @since 12 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetHeapStatistics(JSVM_VM vm, + JSVM_HeapStatistics* result); + +/** + * @brief 创建并启动一个CPU分析器。 + * + * @param vm 启动CPU profiler的虚拟机。 + * @param result 指向CPU分析器的指针。 + * @return 成功则返回JSVM_OK。 + * @since 12 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_StartCpuProfiler(JSVM_VM vm, + JSVM_CpuProfiler* result); + +/** + * @brief 停止CPU分析器并将结果输出到流。 + * + * @param vm 启动CPU profiler的虚拟机。 + * @param profiler 要停止的CPU分析器。 + * @param stream 接收数据的输出流回调。 + * @param streamData 可选的数据传递到流回调。 + * @return 成功则返回JSVM_OK。 + * @since 12 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_StopCpuProfiler(JSVM_VM vm, + JSVM_CpuProfiler profiler, + JSVM_OutputStream stream, + void* streamData); + +/** + * @brief 获取当前堆快照并将其输出到流。 + * + * @param vm 已创建堆快照的虚拟机。 + * @param stream 接收数据的输出流回调。 + * @param streamData 可选的数据传递到流回调。 + * @return 成功则返回JSVM_OK。 + * @since 12 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_TakeHeapSnapshot(JSVM_VM vm, + JSVM_OutputStream stream, + void* streamData); + +/** + * @brief 在主机和端口上激活检测器。 + * + * @param env 调用JSVM-API的环境。 + * @param host 要监听检查器连接的主机。 + * @param port 要监听检查器连接的端口。 + * @return 成功则返回JSVM_OK。 + * @since 12 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_OpenInspector(JSVM_Env env, + const char* host, + uint16_t port); + +/** + * @brief 试图关闭所有剩余的检查器连接。 + * + * @param env 调用JSVM-API的环境。 + * @return 成功则返回JSVM_OK。 + * @since 12 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CloseInspector(JSVM_Env env); + +/** + * @brief 将阻塞,直到客户端(已存在或稍后连接) + * 发送Runtime.runIfWaitingForDebugger命令。 + * + * @param env 调用JSVM-API的环境。 + * @param breakNextLine 是否在下一行JavaScript代码中中断。 + * @return 成功则返回JSVM_OK。 + * @since 12 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_WaitForDebugger(JSVM_Env env, + bool breakNextLine); + EXTERN_C_END /** @} */ diff --git a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h index 2d56667a..2fd18bd7 100644 --- a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h +++ b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h @@ -93,6 +93,13 @@ typedef struct JSVM_Script__* JSVM_Script; */ typedef struct JSVM_Env__* JSVM_Env; +/** + * @brief 表示一个JavaScript分析器。 + * + * @since 12 + */ +typedef struct JSVM_CpuProfiler__* JSVM_CpuProfiler; + /** * @brief 表示JavaScript值。 * @@ -170,6 +177,15 @@ typedef void(JSVM_CDECL* JSVM_Finalize)(JSVM_Env env, void* finalizeData, void* finalizeHint); +/** + * @brief ASCII输出流回调的函数指针类型。 + * + * @since 12 + */ +typedef bool(JSVM_CDECL* JSVM_OutputStream)(const char* data, + int size, + void* streamData); + /** * @brief 用于控制JavaScript对象属性的行为。 * @@ -364,6 +380,41 @@ typedef enum { JSVM_MEMORY_PRESSURE_LEVEL_CRITICAL, } JSVM_MemoryPressureLevel; +/** + * @brief Heapstatisics对象。用于获取有关JavaScript + * 堆内存使用情况的统计信息。 + * + * @since 12 + */ +typedef struct { + /** 堆的总大小。 */ + size_t totalHeapSize; + /** 堆的总可执行大小。 */ + size_t totalHeapSizeExecutable; + /** 堆的总物理大小。 */ + size_t totalPhysicalSize; + /** 堆的总可用大小。 */ + size_t totalAvailableSize; + /** 已使用的堆大小。 */ + size_t usedHeapSize; + /** 堆大小限制。 */ + size_t heapSizeLimit; + /** 堆请求的内存。 */ + size_t mallocedMemory; + /** 堆请求的外部内存。 */ + size_t externalMemory; + /** 堆请求的峰值内存。 */ + size_t peakMallocedMemory; + /** 本机上下文的数量。 */ + size_t numberOfNativeContexts; + /** 分离上下文的数量。 */ + size_t numberOfDetachedContexts; + /** 总全局句柄的大小。 */ + size_t totalGlobalHandlesSize; + /** 使用的全局句柄的大小。 */ + size_t usedGlobalHandlesSize; +} JSVM_HeapStatistics; + /** * @brief 初始化选项,用于初始化JavaScript虚拟机。 * -- Gitee From 779b1cc85996956eb4272b1f945d411c03322fd7 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 27 Feb 2024 02:17:38 +0000 Subject: [PATCH 0312/2135] =?UTF-8?q?=E4=BF=AE=E5=A4=8DOH=5FDrawing=5FSetT?= =?UTF-8?q?ypographyTextFontSize=E9=87=8D=E5=A4=8D=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BAOH=5FDrawing=5FSetTypographyTextLineStyleFontSize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_sdk/graphic/native_drawing/drawing_text_typography.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index 85432ab9..bb908788 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1519,7 +1519,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyl * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); +void OH_Drawing_SetTypographyTextLineStyleFontSize(OH_Drawing_TypographyStyle*, double); /** * @brief 设置文本排版行样式字体高度。 -- Gitee From a26db332d6a27265be6b97ebe0bc86634b1d6799 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 27 Feb 2024 04:29:42 +0000 Subject: [PATCH 0313/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9OH=5FDrawing=5FText?= =?UTF-8?q?StyleGetFontMetrics=20OH=5FDrawing=5FTextStyleAddShadow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic/native_drawing/drawing_text_typography.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index bb908788..e42a6289 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1248,7 +1248,7 @@ void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const * @since 12 * @version 1.0 */ -bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_TextStyle*, OH_Drawing_Typography*, OH_Drawing_Font_Metrics*); +bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_Typography*, OH_Drawing_TextStyle*, OH_Drawing_Font_Metrics*); /** * @brief 设置文本类型。 @@ -1616,7 +1616,7 @@ int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, OH_Drawing_TextShadow*); +void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, const OH_Drawing_TextShadow*); /** * @brief 清除字体阴影容器中的所有元素。 -- Gitee From d31059bb193accdf15bc6dace2839523bd534da7 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 27 Feb 2024 07:14:55 +0000 Subject: [PATCH 0314/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_sdk/graphic/native_drawing/drawing_text_typography.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index e42a6289..eb4c740b 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -1241,8 +1241,8 @@ void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const * @brief 获取文本字体属性。 * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param OH_Drawing_Typography 指向文本对象{@link OH_Drawing_Typography}的指针,由{@link OH_Drawing_CreateTypography}获取。 + * @param OH_Drawing_TextStyle 指向字体风格对象{@link OH_Drawing_TextStyle}的指针,由{@link OH_Drawing_CreateTextStyle}获取。 * @param OH_Drawing_Font_Metrics 指向字体属性对象{@link OH_Drawing_Font_Metrics}的指针,由{@link OH_Drawing_Font_Metrics}获取。 * @return 是否获取到字体属性,true表示获取到字体属性,false表示未获取到字体属性。 * @since 12 -- Gitee From a13954c4fa8729f3971e5a5025c9ff4c9a2616f5 Mon Sep 17 00:00:00 2001 From: weishaoxiong Date: Tue, 27 Feb 2024 13:51:13 +0800 Subject: [PATCH 0315/2135] fix: Signed-off-by: weishaoxiong --- .../filemanagement/fileshare/oh_file_share.h | 210 ++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h diff --git a/zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h b/zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h new file mode 100644 index 00000000..4fb81834 --- /dev/null +++ b/zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h @@ -0,0 +1,210 @@ +/* + * 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 FILE_MANAGEMENT_OH_FILE_SHARE_H +#define FILE_MANAGEMENT_OH_FILE_SHARE_H + +#include "error_code.h" + +/** + * @addtogroup fileShare + * @{ + * + * @brief 此模块提供文件分享功能,并为系统应用程序提供接口,以授权对其他应用程序具有读写权限的公共目录文件的统一资源标识符(URI)。 + * @since 12 + */ + +/** + * @file oh_file_share.h + * + * @brief 提供基于URI的文件及目录授于持久化权限、权限激活、权限查询等方法。 + * @library libohfileshare.so + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 12 + */ +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief URI操作模式枚举值。 + * + * @since 12 + */ +typedef enum FileShare_OperationMode { + /** + * @brief 读取权限。 + */ + READ_MODE = 1 << 0, + + /** + * @brief 写入权限。 + */ + WRITE_MODE = 1 << 1 +} FileShare_OperationMode; + +/** + * @brief 授予或使能权限策略失败的URI对应的错误码枚举值。 + * + * @since 12 + */ +typedef enum FileShare_PolicyErrorCode { + /** + * @brief URI禁止被持久化。 + */ + PERSISTENCE_FORBIDDEN = 1, + + /** + * @brief 无效的模式。 + */ + INVALID_MODE = 2, + + /** + * @brief 无效的路径。 + */ + INVALID_PATH = 3, + + /** + * @brief 权限没有被持久化。 + */ + PERMISSION_NOT_PERSISTED = 4 +} FileShare_PolicyErrorCode; + +/** + * @brief 授予或使能权限失败的URI策略结果。 + * + * @since 12 + */ +typedef struct FileShare_PolicyErrorResult { + /** + * 授予或使能策略失败的URI。 + */ + char *uri; + + /** + * 授予或使能策略失败的URI对应的错误码。 + */ + FileShare_PolicyErrorCode code; + + /** + * 授予或使能策略失败的URI对应的原因。 + */ + char *message; +} FileShare_PolicyErrorResult; + +/** + * @brief 需要授予或使能权限URI的策略信息。 + * + * @since 12 + */ +typedef struct FileShare_PolicyInfo { + /** + * 需要授予或使能权限的URI。 + */ + char *uri; + + /** + * URI的长度。 + */ + unsigned int length; + + /** + * 授予或使能权限的URI访问模式。 + */ + unsigned int operationMode; +} FileShare_PolicyInfo; + +/** + * @brief 对所选择的多个文件或目录URI持久化授权。 + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param policies 一个指向FileShare_PolicyInfo实例的指针。 + * @param policyNum FileShare_PolicyInfo实例数组的大小。 + * @param result FileShare_PolicyErrorResult数组指针. 请使用OH_FileShare_ReleasePolicyErrorResult()进行资源释放。 + * @param resultNum FileShare_PolicyErrorResult数组大小。 + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 + * @since 12 + */ +FileManagement_ErrCode OH_FileShare_PersistPermission(const FileShare_PolicyInfo *policies, unsigned int policyNum, + FileShare_PolicyErrorResult **result, unsigned int *resultNum); + +/** + * @brief 对所选择的多个文件或目录uri取消持久化授权。 + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param policies 一个指向FileShare_PolicyInfo实例的指针。 + * @param policyNum FileShare_PolicyInfo实例数组的大小。 + * @param result FileShare_PolicyErrorResult数组指针. 请使用OH_FileShare_ReleasePolicyErrorResult()进行资源释放。 + * @param resultNum FileShare_PolicyErrorResult数组大小。 + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 + * @since 12 + */ +FileManagement_ErrCode OH_FileShare_RevokePermission(const FileShare_PolicyInfo *policies, unsigned int policyNum, + FileShare_PolicyErrorResult **result, unsigned int *resultNum); + +/** + * @brief 使能多个已经持久化授权的文件或目录。 + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param policies 一个指向FileShare_PolicyInfo实例的指针。 + * @param policyNum FileShare_PolicyInfo实例数组的大小。 + * @param result FileShare_PolicyErrorResult数组指针. 请使用OH_FileShare_ReleasePolicyErrorResult()进行资源释放。 + * @param resultNum FileShare_PolicyErrorResult数组大小。 + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 + * @since 12 + */ +FileManagement_ErrCode OH_FileShare_ActivatePermission(const FileShare_PolicyInfo *policies, unsigned int policyNum, + FileShare_PolicyErrorResult **result, unsigned int *resultNum); + +/** + * @brief 取消使能持久化授权过的多个文件或目录。 + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param policies 一个指向FileShare_PolicyInfo实例的指针。 + * @param policyNum FileShare_PolicyInfo实例数组的大小。 + * @param result FileShare_PolicyErrorResult数组指针. 请使用OH_FileShare_ReleasePolicyErrorResult()进行资源释放。 + * @param resultNum FileShare_PolicyErrorResult数组大小。 + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 + * @since 12 + */ +FileManagement_ErrCode OH_FileShare_DeactivatePermission(const FileShare_PolicyInfo *policies, unsigned int policyNum, + FileShare_PolicyErrorResult **result, unsigned int *resultNum); + +/** + * @brief 校验所选择的多个文件或目录URI的持久化授权。 + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param policies 一个指向FileShare_PolicyInfo实例的指针。 + * @param policyNum FileShare_PolicyInfo实例数组的大小。 + * @param result 授权校验结果指针。请引用头文件malloc.h并使用free()进行资源释放。 + * @param resultNum 校验结果数组的大小. + * @return 返回FileManageMent模块错误码{@link FileManagement_ErrCode}。 + * @since 12 + */ +FileManagement_ErrCode OH_FileShare_CheckPersistentPermission( + const FileShare_PolicyInfo *policies, unsigned int policyNum, bool **result, unsigned int *resultNum); + +/** + * @brief 释放FileShare_PolicyErrorResult指针指向的内存资源。 + * + * @param errorResult 一个指向FileShare_PolicyErrorResult实例的指针。 + * @param resultNum FileShare_PolicyErrorResult实例数组的大小。 + * @since 12 + */ +void OH_FileShare_ReleasePolicyErrorResult(FileShare_PolicyErrorResult *errorResult, unsigned int resultNum); +#ifdef __cplusplus +}; +#endif +/** @} */ +#endif // FILE_MANAGEMENT_OH_FILE_SHARE_H -- Gitee From f6c808cf86153f0b843b8876c017a1ca93770ac9 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Tue, 27 Feb 2024 16:01:20 +0800 Subject: [PATCH 0316/2135] Update docs (0227) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_interface.h | 4 +- en/native_sdk/ace/native_node.h | 97 +++++++++++++++------------- en/native_sdk/ace/native_type.h | 52 +++++++-------- 3 files changed, 80 insertions(+), 73 deletions(-) diff --git a/en/native_sdk/ace/native_interface.h b/en/native_sdk/ace/native_interface.h index 98484108..98a39fc1 100644 --- a/en/native_sdk/ace/native_interface.h +++ b/en/native_sdk/ace/native_interface.h @@ -93,7 +93,7 @@ typedef enum { * auto basicNodeApi = reinterpret_cast(anyNativeAPI); * } * @endcode - * @deprecated This API is deprecated since API version 10. + * @deprecated This API is deprecated since API version 12. * You are advised to use {@link OH_ArkUI_QueryModuleInterface} instead. * @since 12 */ @@ -106,7 +106,7 @@ ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32 * (API type related to UI components). * @param version Indicates the version of the native API structure, which is obtained through the version enums * supported by the structure. For example, the available version of ARKUI_NATIVE_NODE is - * {@link ARKUI_NATIVE_NODE_VERSION}. + * {@link ArkUI_NativeNodeAPIVersion}. * @return Returns the pointer to the native API abstract object that carries the version. * @code {.cpp} * #include diff --git a/en/native_sdk/ace/native_node.h b/en/native_sdk/ace/native_node.h index b44eb0dd..c68c6476 100644 --- a/en/native_sdk/ace/native_node.h +++ b/en/native_sdk/ace/native_node.h @@ -330,7 +330,7 @@ typedef enum { * .value[0].f32: start angle of the linear gradient. A positive value indicates a clockwise rotation from the * origin, (0, 0). The default value is 180.\n * .value[1].i32: direction of the linear gradient. It does not take effect when angle is set. - * The parameter type is {@link ArkUI_LinearGridientDirection}. \n + * The parameter type is {@link ArkUI_LinearGradientDirection}. \n *.value[2].i32: whether the colors are repeated. The default value is false. \n * .object: array of color stops, each of which consists of a color and its stop position. * Invalid colors are automatically skipped. \n @@ -496,7 +496,7 @@ typedef enum { * which supports five types of shapes:\n * 1. Rectangle:\n * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. - * The value is ARKUI_CLIP_TYPE_RECT for the rectangle shape.\n + * The value is ARKUI_CLIP_TYPE_RECTANGLE for the rectangle shape.\n * .value[1].f32: width of the rectangle.\n * .value[2].f32: height of rectangle.\n * .value[3].f32: width of the rounded corner of the rectangle.\n @@ -520,7 +520,7 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}, which supports five types of shapes:\n * 1. Rectangle:\n * .value[0].i32: type of shape. The parameter type is {@link ArkUI_ClipType}. - * The value is ARKUI_CLIP_TYPE_RECT for the rectangle shape.\n + * The value is ARKUI_CLIP_TYPE_RECTANGLE for the rectangle shape.\n * .value[1].f32: width of the rectangle.\n * .value[2].f32: height of rectangle.\n * .value[3].f32: width of the rounded corner of the rectangle.\n @@ -851,7 +851,7 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .string: mask text.\n * .value[0]?.i32: position of the overlay relative to the component. Optional. - * The value is an enum of {@link ArkUI_Alignment}. + * The parameter type is {@link ArkUI_Alignment}. * The default value is ARKUI_ALIGNMENT_TOP_START. \n * .value[1]?.f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. Optional. \n * .value[2]?.f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. Optional. @@ -859,7 +859,7 @@ typedef enum { * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: mask text.\n * .value[0].i32: position of the overlay relative to the component. - * The value is an enum of {@link ArkUI_Alignment}. + * The parameter type is {@link ArkUI_Alignment}. * The default value is ARKUI_ALIGNMENT_TOP_START. \n * .value[1].f32: offset of the overlay relative to the upper left corner of itself on the x-axis, in vp. \n * .value[2].f32: offset of the overlay relative to the upper left corner of itself on the y-axis, in vp. @@ -941,8 +941,8 @@ typedef enum { * .value[0].u32 fill color, in 0xARGB format. \n * .value[1].u32: stroke color, in 0xARGB format. \n * .value[2].f32: stroke width, in vp. \n - *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. - * The value is ARKUI_MASK_TYPE_RECT for the rectangle shape.\n + * .value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_RECTANGLE for the rectangle shape.\n * .value[4].f32: width of the rectangle.\n * .value[5].f32: height of the rectangle.\n * .value[6].f32: width of the rounded corner of the rectangle.\n @@ -951,11 +951,11 @@ typedef enum { * .value[0].u32 fill color, in 0xARGB format. \n * .value[1].u32: stroke color, in 0xARGB format. \n * .value[2].f32: stroke width, in vp. \n - *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. - * The value is ARKUI_MASK_TYPE_CIRCLE for the circle shape.\n + * .value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_CIRCLE for the circle shape.\n * .value[4].f32: width of the circle.\n * .value[5].f32: height of the circle.\n - * 3.Ellipse:\n + * 3. Ellipse:\n * .value[0].u32 fill color, in 0xARGB format. \n * .value[1].u32: stroke color, in 0xARGB format. \n * .value[2].f32: stroke width, in vp. \n @@ -967,17 +967,17 @@ typedef enum { * .value[0].u32 fill color, in 0xARGB format. \n * .value[1].u32: stroke color, in 0xARGB format. \n * .value[2].f32: stroke width, in vp. \n - *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. - * The value is ARKUI_MASK_TYPE_PATH for the path shape.\n + * .value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_PATH for the path shape.\n * .value[4].f32: width of the path.\n * .value[5].f32: height of the path.\n * .string: command for drawing the path.\n - * 4. Progress:\n + * 5. Progress:\n * .value[0].u32 fill color, in 0xARGB format. \n * .value[1].u32: stroke color, in 0xARGB format. \n * .value[2].f32: stroke width, in vp. \n - *.value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. - * The value is ARKUI_MASK_TYPE_PROSGRESS for the progress shape.\n + * .value[3].i32: mask type. The parameter type is {@link ArkUI_MaskType}. + * The value is ARKUI_MASK_TYPE_PROSGRESS for the progress shape.\n * .value[4].f32: current value of the progress indicator.\n * .value[5].f32: maximum value of the progress indicator.\n * .value[6].u32: color of the progress indicator.\n @@ -999,7 +999,7 @@ typedef enum { * .value[3].i32: mask type.\n * .value[4].f32: width of the circle.\n * .value[5].f32: height of the circle.\n - * 3.Ellipse:\n + * 3. Ellipse:\n * .value[0].u32 fill color, in 0xARGB format. \n * .value[1].u32: stroke color, in 0xARGB format. \n * .value[2].f32: stroke width, in vp. \n @@ -1014,7 +1014,7 @@ typedef enum { * .value[4].f32: width of the path.\n * .value[5].f32: height of the path.\n * .string: command for drawing the path.\n - * 4. Progress:\n + * 5. Progress:\n * .value[0].i32: mask type.\n * .value[1].f32: current value of the progress indicator.\n * .value[2].f32: maximum value of the progress indicator.\n @@ -1307,16 +1307,16 @@ typedef enum { NODE_ACCESSIBILITY_TEXT, /** - * @brief Sets the accessibility level. This attribute can be set, reset, and obtained as required through APIs. + * @brief Sets the accessibility 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: accessibility level. The parameter type is {@link ArkUI_AccessibilityLevel}. + * .value[0].i32: accessibility mode. The parameter type is {@link ArkUI_AccessibilityMode}. * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: accessibility level. The parameter type is {@link ArkUI_AccessibilityLevel}. + * .value[0].i32: accessibility mode. The parameter type is {@link ArkUI_AccessibilityMode}. * */ - NODE_ACCESSIBILITY_LEVEL, + NODE_ACCESSIBILITY_MODE, /** * @brief Sets the accessibility description. @@ -1641,7 +1641,7 @@ typedef enum { * The value is an enum of {@link ArkUI_ImageSpanAlignment}. \n * */ - NODE_IMAGE_SPAN_VERTICAL_ALIGN, + NODE_IMAGE_SPAN_VERTICAL_ALIGNMENT, /** * @brief Defines the image source of the component. * This attribute can be set, reset, and obtained as required through APIs. @@ -1856,7 +1856,8 @@ 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: type of the Enter key{@link ArkUI_EnterKeyType}. The default value is ARKUI_ENTER_KEY_TYPE_DONE. \n + * .value[0].i32: type of the Enter key{@link ArkUI_EnterKeyType}. The default value is + * ARKUI_ENTER_KEY_TYPE_DONE. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: type of the Enter key{@link ArkUI_EnterKeyType}. \n @@ -2036,9 +2037,12 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0]? .f32: font size, in fp. Optional. The default value is 16.0.\n - * .value[1]? .i32: font style {@link ArkUI_FontStyle}. Optional. The default value is ARKUI_FONT_STYLE_NORMAL.\n - * .value[2]?.i32: font weight {@link ArkUI_FontWeight}. Optional. The default value is ARKUI_FONT_WEIGHT_NORMAL.\n - * ?.string: font family. Multiple font families are separated by commas (,). For example, "font weight; font family 1, font family 2". \n + * .value[1]? .i32: font style {@link ArkUI_FontStyle}. Optional. The default value is + * ARKUI_FONT_STYLE_NORMAL.\n + * .value[2]?.i32: font weight {@link ArkUI_FontWeight}. Optional. The default value is + * ARKUI_FONT_WEIGHT_NORMAL.\n + * ?.string: font family. Multiple font families are separated by commas (,). + * For example, "font weight; font family 1, font family 2". \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: font size, in fp.\n @@ -2129,7 +2133,7 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: type of the progress indicator {@link ArkUI_ProgressType}. - * The default value is ARKUI_PROGRESS_LINEAR. \n + * The default value is ARKUI_PROGRESS_TYPE_LINEAR. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: type of the progress indicator {@link ArkUI_ProgressType}. \n @@ -2756,7 +2760,7 @@ typedef enum { * There are five types:\n * 1. Rectangle:\n * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. - * The value is ARKUI_SHAPE_TYPE_RECT for the rectangle shape.\n + * The value is ARKUI_SHAPE_TYPE_RECTANGLE for the rectangle shape.\n * .value[2].f32: width of the rectangle.\n * .value[3].f32: height of the rectangle.\n * .value[4].f32: width of the rounded corner of the rectangle.\n @@ -2786,7 +2790,7 @@ typedef enum { * There are five types:\n * 1. Rectangle:\n * .value[1].i32: type of shape. The parameter type is {@link ArkUI_ShapeType}. - * The value is ARKUI_SHAPE_TYPE_RECT for the rectangle shape.\n + * The value is ARKUI_SHAPE_TYPE_RECTANGLE for the rectangle shape.\n * .value[2].f32: width of the rectangle.\n * .value[3].f32: height of the rectangle.\n * .value[4].f32: width of the rounded corner of the rectangle.\n @@ -3515,27 +3519,27 @@ typedef enum { * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} contains 12 parameters:\n * ArkUI_NodeComponentEvent.data[0].f32: original width of the target element, in vp. - * The value type is number. \n + * The value is a number. \n * ArkUI_NodeComponentEvent.data[1].f32: original height of the target element, in vp. - * The value type is number. \n + * The value is a number. \n * ArkUI_NodeComponentEvent.data[2].f32: original X coordinate of the target element's upper left corner - * relative to the parent element's, in vp. The value type is number. \n + * relative to the parent element's, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[3].f32: original Y coordinate of the target element's upper left corner - * relative to the parent element's, in vp. The value type is number. \n + * relative to the parent element's, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[4].f32: original X coordinate of the target element's upper left corner - * relative to the page's, in vp. The value type is number. \n + * relative to the page's, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[5].f32: original Y coordinate of the target element's upper left corner - * relative to the page's, in vp. The value type is number. \n + * relative to the page's, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[6].f32: new width of the target element, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[7].f32: new height of the target element, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[8].f32: new X coordinate of the target element's upper left corner relative - * to the parent element's, in vp. The value type is number. \n + * to the parent element's, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[9].f32: new Y coordinate of the target element's upper left corner relative - * to the parent element's, in vp. The value type is number. \n + * to the parent element's, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[10].f32: new X coordinate of the target element's upper left corner relative - * to the page's, in vp. The value type is number. \n + * to the page's, in vp. The value is a number. \n * ArkUI_NodeComponentEvent.data[11].f32: new Y coordinate of the target element's upper left corner relative - * to the page's, in vp. The value type is number. \n + * to the page's, in vp. The value is a number. \n */ NODE_EVENT_ON_AREA_CHANGE, /** @@ -3940,7 +3944,7 @@ typedef struct { /** * @brief Adds a component to a parent node. * - * When the component is being displayed, this API must be called in the main thread. + * When the parent component is being displayed, this API must be called in the main thread. * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. @@ -3964,7 +3968,7 @@ typedef struct { /** * @brief Inserts a component to a parent node after the specified sibling node. * - * When the component is being displayed, this API must be called in the main thread. + * When the parent component is being displayed, this API must be called in the main thread. * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. @@ -3978,7 +3982,7 @@ typedef struct { /** * @brief Inserts a component to a parent node before the specified sibling node. * - * When the component is being displayed, this API must be called in the main thread. + * When the parent component is being displayed, this API must be called in the main thread. * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. @@ -3992,7 +3996,7 @@ typedef struct { /** * @brief Inserts a component to the specified position in a parent node. * - * When the component is being displayed, this API must be called in the main thread. + * When the parent component is being displayed, this API must be called in the main thread. * * @param parent Indicates the pointer to the parent node. * @param child Indicates the pointer to the child node. @@ -4051,13 +4055,16 @@ typedef struct { * * @param node Indicates the target node. * @param eventType Indicates the type of event to register. - * @param eventId Indicates the custom event ID, which is passed in the callback of {@link ArkUI_NodeEvent} + * @param eventId Indicates the custom event ID, which is passed in the callback of <@link ArkUI_NodeEvent> * when the event is triggered. + * @param extraParam Indicates the custom event parameter, which is passed in the callback of + * <@link ArkUI_NodeEvent> when the event is triggered. * @return Returns 0 if success. * Returns 401 if a parameter exception occurs. * Returns 106102 if the dynamic implementation library of the native API was not found. */ - int32_t (*registerNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, int32_t eventId); + int32_t (*registerNodeEvent)( + ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, int32_t eventId, void* extraParam); /** * @brief Unregisters an event for the specified node. diff --git a/en/native_sdk/ace/native_type.h b/en/native_sdk/ace/native_type.h index 402e1a8f..24b6a61d 100644 --- a/en/native_sdk/ace/native_type.h +++ b/en/native_sdk/ace/native_type.h @@ -263,15 +263,15 @@ typedef enum { */ typedef enum { /** Linear style. */ - ARKUI_PROGRESS_LINEAR = 0, + ARKUI_PROGRESS_TYPE_LINEAR = 0, /** Indeterminate ring style. */ - ARKUI_PROGRESS_RING, + ARKUI_PROGRESS_TYPE_RING, /** Eclipse style. */ - ARKUI_PROGRESS_ECLIPSE, + ARKUI_PROGRESS_TYPE_ECLIPSE, /** Determinate ring style. */ - ARKUI_PROGRESS_SCALERING, + ARKUI_PROGRESS_TYPE_SCALE_RING, /** Capsule style. */ - ARKUI_PROGRESS_CAPSULE, + ARKUI_PROGRESS_TYPE_CAPSULE, }ArkUI_ProgressType; /** @@ -343,7 +343,7 @@ typedef enum { /** Multi-column text picker. */ ARKUI_TEXTPICKER_RANGETYPE_MULTI, /** Single-column text picker with image resources. */ - ARKUI_TEXTPICKER_RANGETYPE_RANGE_C0NTENT, + ARKUI_TEXTPICKER_RANGETYPE_RANGE_CONTENT, /** Interconnected multi-column text picker. */ ARKUI_TEXTPICKER_RANGETYPE_CASCADE_RANGE_CONTENT, } ArkUI_TextPickerRangeType; @@ -566,20 +566,20 @@ typedef enum { /** - * @brief Defines the accessibility level. + * @brief Enumerates the accessibility modes. * * @since 12 */ typedef enum { - /** The value can be changed to yes or no based on the component. */ - ARKUI_ACCESSIBILITY_LEVEL_AUTO = 0, + /** Whether the component can be identified by the accessibility service is dependent on the component. */ + ARKUI_ACCESSIBILITY_MODE_AUTO = 0, /** The component can be identified by the accessibility service. */ - ARKUI_ACCESSIBILITY_LEVEL_YES, + ARKUI_ACCESSIBILITY_MODE_ENABLED, /** The component cannot be identified by the accessibility service. */ - ARKUI_ACCESSIBILITY_LEVEL_NO, + ARKUI_ACCESSIBILITY_MODE_DISABLED, /** The component and all its child components cannot be identified by the accessibility service. */ - ARKUI_ACCESSIBILITY_LEVEL_NO_HIDE_DESCENDANTS, -} ArkUI_AccessibilityLevel; + ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS, +} ArkUI_AccessibilityMode; /** * @brief Defines whether copy and paste is allowed for text content. @@ -1120,7 +1120,7 @@ typedef enum { */ typedef enum { /** Rectangle. */ - ARKUI_MASK_TYPE_RECT = 0, + ARKUI_MASK_TYPE_RECTANGLE = 0, /** Circle. */ ARKUI_MASK_TYPE_CIRCLE, /** Ellipse. */ @@ -1138,7 +1138,7 @@ typedef enum { */ typedef enum { /** Rectangle. */ - ARKUI_CLIP_TYPE_RECT = 0, + ARKUI_CLIP_TYPE_RECTANGLE = 0, /** Circle. */ ARKUI_CLIP_TYPE_CIRCLE, /** Ellipse. */ @@ -1168,7 +1168,7 @@ typedef struct { */ typedef enum { /** Rectangle. */ - ARKUI_SHAPE_TYPE_RECT = 0, + ARKUI_SHAPE_TYPE_RECTANGLE = 0, /** Circle. */ ARKUI_SHAPE_TYPE_CIRCLE, /** Ellipse. */ @@ -1184,24 +1184,24 @@ typedef enum { */ typedef enum { /** From right to left. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT = 0, + ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT = 0, /** From bottom to top. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_TOP, + ARKUI_LINEAR_GRADIENT_DIRECTION_TOP, /** From left to right. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT, + ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT, /** From top to bottom. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_BOTTOM, + ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM, /** From lower right to upper left. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT_TOP, + ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP, /** From upper right to lower left. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_LEFT_BOTTOM, + ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM, /** From lower left to upper right. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT_TOP, + ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP, /** From upper left to lower right. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_RIGHT_BOTTOM, + ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM, /** No gradient. */ - ARKUI_LINEAR_GRIDIENT_DIRECTION_NONE, -} ArkUI_LinearGridientDirection; + ARKUI_LINEAR_GRADIENT_DIRECTION_NONE, +} ArkUI_LinearGradientDirection; #ifdef __cplusplus }; -- Gitee From 8b57f4c19dee7bca98bd058617fe5d0f8bf587a5 Mon Sep 17 00:00:00 2001 From: zhouchaobo Date: Tue, 27 Feb 2024 15:17:11 +0800 Subject: [PATCH 0317/2135] interface_native_header: XComponent add axis event time Signed-off-by: zhouchaobo --- zh-cn/native_sdk/ace/ui_input_event.h | 29 ++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/ace/ui_input_event.h b/zh-cn/native_sdk/ace/ui_input_event.h index 47c49a11..02c4370f 100644 --- a/zh-cn/native_sdk/ace/ui_input_event.h +++ b/zh-cn/native_sdk/ace/ui_input_event.h @@ -68,11 +68,20 @@ enum ArkUI_UIInputEvent_Type { */ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); +/** + * @brief 获取UI输入事件发生的时间。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回UI输入事件发生的时间。 + * @since 12 + */ +int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); + /** * @brief 获取当前轴事件的垂直滚动轴的值。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的垂直滚动轴的值. + * @return 返回当前轴事件的垂直滚动轴的值。 * @since 12 */ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); @@ -86,6 +95,24 @@ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); */ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); +/** + * @brief 获取当前轴事件的相对于当前组件左上角的X坐标。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的相对于当前组件左上角的X坐标。 + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetX(const ArkUI_UIInputEvent *event); + +/** + * @brief 获取当前轴事件的相对于当前组件左上角的Y坐标。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的相对于当前组件左上角的Y坐标。 + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetY(const ArkUI_UIInputEvent *event); + /** * @brief 获取当前轴事件的相对于窗口的X坐标。 * -- Gitee From bfd697f176a2de0c6c584f07ca35b50901bdd24d Mon Sep 17 00:00:00 2001 From: weishaoxiong Date: Wed, 28 Feb 2024 14:00:50 +0800 Subject: [PATCH 0318/2135] fix: Signed-off-by: weishaoxiong --- zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h b/zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h index 4fb81834..6fadd093 100644 --- a/zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h +++ b/zh-cn/native_sdk/filemanagement/fileshare/oh_file_share.h @@ -22,7 +22,7 @@ * @addtogroup fileShare * @{ * - * @brief 此模块提供文件分享功能,并为系统应用程序提供接口,以授权对其他应用程序具有读写权限的公共目录文件的统一资源标识符(URI)。 + * @brief 此模块提供文件分享功能,以授权对其他应用程序具有读写权限的公共目录文件的统一资源标识符(URI)。 * @since 12 */ @@ -71,7 +71,7 @@ typedef enum FileShare_PolicyErrorCode { INVALID_MODE = 2, /** - * @brief 无效的路径。 + * @brief 无效路径。 */ INVALID_PATH = 3, @@ -115,12 +115,14 @@ typedef struct FileShare_PolicyInfo { char *uri; /** - * URI的长度。 + * URI的字节长度。 */ unsigned int length; /** * 授予或使能权限的URI访问模式。 + * 示例:FileShare_OperationMode.READ_MODE 、 FileShare_OperationMode.WRITE_MODE + * 或者 FileShare_OperationMode.READ_MODE|FileShare_OperationMode.WRITE_MODE。 */ unsigned int operationMode; } FileShare_PolicyInfo; -- Gitee From 190e6ec745208d32036683346d493b52c683055d Mon Sep 17 00:00:00 2001 From: zhouchaobo Date: Wed, 28 Feb 2024 09:28:55 +0800 Subject: [PATCH 0319/2135] add pinch axis and rotate axis value Signed-off-by: zhouchaobo --- zh-cn/native_sdk/ace/ui_input_event.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zh-cn/native_sdk/ace/ui_input_event.h b/zh-cn/native_sdk/ace/ui_input_event.h index 02c4370f..842d391e 100644 --- a/zh-cn/native_sdk/ace/ui_input_event.h +++ b/zh-cn/native_sdk/ace/ui_input_event.h @@ -95,6 +95,15 @@ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); */ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); +/** + * @brief 获取当前轴事件的捏合轴缩放的值。 + * + * @param event 表示指向当前UI输入事件的指针。 + * @return 返回当前轴事件的捏合轴缩放的值。 + * @since 12 + */ +double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); + /** * @brief 获取当前轴事件的相对于当前组件左上角的X坐标。 * -- Gitee From 5b2aff679594ed12636ef7961f8b861422c902a0 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Wed, 28 Feb 2024 17:30:08 +0800 Subject: [PATCH 0320/2135] Update docs (0228) Signed-off-by: ester.zhou --- .../ace/native_interface_xcomponent.h | 22 ++- en/native_sdk/ace/ui_input_event.h | 166 ++++++++++++++++++ 2 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 en/native_sdk/ace/ui_input_event.h diff --git a/en/native_sdk/ace/native_interface_xcomponent.h b/en/native_sdk/ace/native_interface_xcomponent.h index 4bc802d0..a23b752b 100644 --- a/en/native_sdk/ace/native_interface_xcomponent.h +++ b/en/native_sdk/ace/native_interface_xcomponent.h @@ -41,6 +41,7 @@ #include #include "arkui/native_type.h" +#include "arkui/ui_input_event.h" #include "native_xcomponent_key_event.h" @@ -325,7 +326,8 @@ typedef struct { * * @param component Indicates the pointer to the OH_NativeXComponent instance. * @param id Indicates the pointer to the character buffer for storing the ID of the OH_NativeXComponent instance. - * Note that null terminators will be attached to the character buffer, so the size of the character buffer should be at least one unit greater than the length of the real ID. + * Note that null terminators will be attached to the character buffer, so the size of the character buffer should be + * at least one unit greater than the length of the real ID. * The recommended size is [OH_XCOMPONENT_ID_LEN_MAX + 1]. * @param size Indicates the pointer to the length of the ID. * @return Returns the status code of the execution. @@ -353,7 +355,7 @@ int32_t OH_NativeXComponent_GetXComponentSize( * * @param component Indicates the pointer to the OH_NativeXComponent instance. * @param window Indicates the handle to the NativeWindow instance. - * @param x Indicates the pointer to the x coordinate of the current surface. + * @param x Indicates the pointer to the x coordinate of the current surface. * @param y Indicates the pointer to the y coordinate of the current surface. * @return Returns the status code of the execution. * @since 8 @@ -611,6 +613,22 @@ int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, */ int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); +/** + * @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. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param callback Indicates the pointer to the UI input event callback. + * @param type Indicates the type of the current UI input event. + * @return Returns the status code of the execution. + * @since 12 + */ +int32_t OH_NativeXComponent_RegisterUIInputEventCallback( + OH_NativeXComponent *component, + void (*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event, + ArkUI_UIInputEvent_Type type), + ArkUI_UIInputEvent_Type type); + #ifdef __cplusplus }; #endif diff --git a/en/native_sdk/ace/ui_input_event.h b/en/native_sdk/ace/ui_input_event.h new file mode 100644 index 00000000..fa7e9e83 --- /dev/null +++ b/en/native_sdk/ace/ui_input_event.h @@ -0,0 +1,166 @@ +/* + * 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_EventModule + * @{ + * + * @brief Declares the UI input event capabilities provided by ArkUI on the native side. + * + * @since 12 + */ + +/** + * @file ui_input_event.h + * + * @brief Provides ArkUI event definitions on the native side. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef UI_INPUT_EVENT +#define UI_INPUT_EVENT + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines the UI input event. + * + * @since 12 + */ +typedef struct ArkUI_UIInputEvent ArkUI_UIInputEvent; + +/** + * @brief Enumerates the UI input event types. + * + * @since 12 + */ +enum ArkUI_UIInputEvent_Type { + ArkUI_UIINPUTEVENT_TYPE_UNKNOWN = 0, + ArkUI_UIINPUTEVENT_TYPE_TOUCH = 1, + ArkUI_UIINPUTEVENT_TYPE_AXIS = 2, +}; + +/** + * @brief Obtains the type of this UI input event. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the type of the current UI input event. + * @since 12 + */ +int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the time when this UI input event occurs. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the time when the UI input event occurs. + * @since 12 + */ +int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the value of the vertical scroll axis for this axis event. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the value of the vertical scroll axis of the current axis event. + * @since 12 + */ +double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the value of the horizontal scroll axis for this axis event. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the value of the horizontal scroll axis of the current axis event. + * @since 12 + */ +double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the scale value of the pinch axis for this axis event. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the scale value of the pinch axis of the current axis event. + * @since 12 + */ +double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the X coordinate of this axis event relative to the upper left corner of this component. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the X coordinate of the current axis event relative to the upper left corner of the component. + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetX(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the Y coordinate of this axis event relative to the upper left corner of this component. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the Y coordinate of the current axis event relative to the upper left corner of the component. + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetY(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the X coordinate of this axis event relative to the window. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the X coordinate of the current axis event relative to the window. + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetWindowX(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the Y coordinate of this axis event relative to the window. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the Y coordinate of the current axis event relative to the window. + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetWindowY(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the X coordinate of this axis event relative to the screen. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the X coordinate of the current axis event relative to the screen. + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetDisplayX(const ArkUI_UIInputEvent *event); + +/** + * @brief Obtains the Y coordinate of this axis event relative to the screen. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the Y coordinate of the current axis event relative to the screen. + * @since 12 + */ +float OH_ArkUI_AxisEvent_GetDisplayY(const ArkUI_UIInputEvent *event); + +#ifdef __cplusplus +}; +#endif + +#endif // UI_INPUT_EVENT +/** @} */ -- Gitee From 16895efb2fb20ebf3338c7d2beaceff2cc248235 Mon Sep 17 00:00:00 2001 From: zhouchaobo Date: Thu, 29 Feb 2024 10:32:19 +0800 Subject: [PATCH 0321/2135] location interface name modify Signed-off-by: zhouchaobo --- zh-cn/native_sdk/ace/ui_input_event.h | 54 +++++++++++++-------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/zh-cn/native_sdk/ace/ui_input_event.h b/zh-cn/native_sdk/ace/ui_input_event.h index 842d391e..3e2970a4 100644 --- a/zh-cn/native_sdk/ace/ui_input_event.h +++ b/zh-cn/native_sdk/ace/ui_input_event.h @@ -78,85 +78,85 @@ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的垂直滚动轴的值。 + * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前组件左上角的X坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的垂直滚动轴的值。 + * @return 返回当前带有指向性的输入事件相对于当前组件左上角的X坐标。 * @since 12 */ -double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的水平滚动轴的值。 + * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前组件左上角的Y坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的水平滚动轴的值。 + * @return 返回当前带有指向性的输入事件相对于当前组件左上角的Y坐标。 * @since 12 */ -double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的捏合轴缩放的值。 + * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前应用窗口左上角的X坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的捏合轴缩放的值。 + * @return 返回当前带有指向性的输入事件相对于当前应用窗口左上角的X坐标。 * @since 12 */ -double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的相对于当前组件左上角的X坐标。 + * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前应用窗口左上角的Y坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的相对于当前组件左上角的X坐标。 + * @return 返回当前带有指向性的输入事件相对于当前应用窗口左上角的Y坐标。 * @since 12 */ -float OH_ArkUI_AxisEvent_GetX(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的相对于当前组件左上角的Y坐标。 + * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前屏幕左上角的X坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的相对于当前组件左上角的Y坐标。 + * @return 返回当前带有指向性的输入事件相对于当前屏幕左上角的X坐标。 * @since 12 */ -float OH_ArkUI_AxisEvent_GetY(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的相对于窗口的X坐标。 + * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前屏幕左上角的Y坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的相对于窗口的X坐标。 + * @return 返回当前带有指向性的输入事件相对于当前屏幕左上角的Y坐标。 * @since 12 */ -float OH_ArkUI_AxisEvent_GetWindowX(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的相对于窗口的Y坐标。 + * @brief 获取当前轴事件的垂直滚动轴的值。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的相对于窗口的Y坐标。 + * @return 返回当前轴事件的垂直滚动轴的值。 * @since 12 */ -float OH_ArkUI_AxisEvent_GetWindowY(const ArkUI_UIInputEvent *event); +double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的相对于屏幕的X坐标。 + * @brief 获取当前轴事件的水平滚动轴的值。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的相对于屏幕的X坐标。 + * @return 返回当前轴事件的水平滚动轴的值。 * @since 12 */ -float OH_ArkUI_AxisEvent_GetDisplayX(const ArkUI_UIInputEvent *event); +double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); /** - * @brief 获取当前轴事件的相对于屏幕的Y坐标。 + * @brief 获取当前轴事件的捏合轴缩放的值。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的相对于屏幕的Y坐标。 + * @return 返回当前轴事件的捏合轴缩放的值。 * @since 12 */ -float OH_ArkUI_AxisEvent_GetDisplayY(const ArkUI_UIInputEvent *event); +double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); #ifdef __cplusplus }; -- Gitee From e653ac26906f81d63229c983eb1c4821000f3aac Mon Sep 17 00:00:00 2001 From: 18721213663 Date: Thu, 29 Feb 2024 16:11:37 +0800 Subject: [PATCH 0322/2135] fix_errorcodes Signed-off-by: 18721213663 --- zh-cn/native_sdk/filemanagement/fileio/error_code.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/filemanagement/fileio/error_code.h b/zh-cn/native_sdk/filemanagement/fileio/error_code.h index 38d9b298..4fa09cca 100644 --- a/zh-cn/native_sdk/filemanagement/fileio/error_code.h +++ b/zh-cn/native_sdk/filemanagement/fileio/error_code.h @@ -49,6 +49,10 @@ typedef enum FileManagement_ErrCode { * 接口权限校验失败。 */ ERR_PERMISSION_ERROR = 201, + /** + * 无效入参。 + */ + ERR_INVALID_PARAMETER = 401, /** * 当前设备不支持此接口。 */ @@ -64,7 +68,7 @@ typedef enum FileManagement_ErrCode { /** * 内存溢出。 */ - ERR_ENOMEM = 139000011, + ERR_ENOMEM = 13900011, /** * 内部未知错误。 */ -- Gitee From 09af049e9d0c16e63fb5fce0fbc79e413f0766bc Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Thu, 29 Feb 2024 16:34:09 +0800 Subject: [PATCH 0323/2135] Update docs (0229) Signed-off-by: ester.zhou --- en/native_sdk/ace/ui_input_event.h | 78 ++++++++++++++++-------------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/en/native_sdk/ace/ui_input_event.h b/en/native_sdk/ace/ui_input_event.h index fa7e9e83..537dbf9a 100644 --- a/en/native_sdk/ace/ui_input_event.h +++ b/en/native_sdk/ace/ui_input_event.h @@ -78,85 +78,91 @@ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the value of the vertical scroll axis for this axis event. + * @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). * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the value of the vertical scroll axis of the current axis event. + * @param event Indicates the pointer to the directional input event. + * @return Returns the X coordinate relative to the upper left corner of the current component. * @since 12 */ -double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the value of the horizontal scroll axis for this axis event. + * @brief Obtains the Y 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). * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the value of the horizontal scroll axis of the current axis event. + * @param event Indicates the pointer to the UI input event. + * @return Returns the Y coordinate relative to the upper left corner of the current component. * @since 12 */ -double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the scale value of the pinch axis for this axis event. + * @brief Obtains the X coordinate relative to the upper left corner of the current application window from a + * directional input event (such as a touch event, mouse event, or axis event). * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the scale value of the pinch axis of the current axis event. + * @param event Indicates the pointer to the UI input event. + * @return Returns the X coordinate relative to the upper left corner of the current application window. * @since 12 */ -double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the X coordinate of this axis event relative to the upper left corner of this component. + * @brief Obtains the Y coordinate relative to the upper left corner of the current application window from a + * directional input event (such as a touch event, mouse event, or axis event). * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the X coordinate of the current axis event relative to the upper left corner of the component. + * @param event Indicates the pointer to the UI input event. + * @return Returns the Y coordinate relative to the upper left corner of the current application window. * @since 12 */ -float OH_ArkUI_AxisEvent_GetX(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the Y coordinate of this axis event relative to the upper left corner of this component. + * @brief Obtains the X coordinate relative to the upper left corner of the current screen from a directional input + * event (such as a touch event, mouse event, or axis event). * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the Y coordinate of the current axis event relative to the upper left corner of the component. + * @param event Indicates the pointer to the UI input event. + * @return Returns the X coordinate relative to the upper left corner of the current screen. * @since 12 */ -float OH_ArkUI_AxisEvent_GetY(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the X coordinate of this axis event relative to the window. + * @brief Obtains the Y coordinate relative to the upper left corner of the current screen from a directional input + * event (such as a touch event, mouse event, or axis event). * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the X coordinate of the current axis event relative to the window. + * @param event Indicates the pointer to the UI input event. + * @return Returns the Y coordinate relative to the upper left corner of the current screen. * @since 12 */ -float OH_ArkUI_AxisEvent_GetWindowX(const ArkUI_UIInputEvent *event); +float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the Y coordinate of this axis event relative to the window. + * @brief Obtains the value of the vertical scroll axis for this axis event. * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the Y coordinate of the current axis event relative to the window. + * @param event Indicates the pointer to the UI input event. + * @return Returns the value of the vertical scroll axis of the current axis event. * @since 12 */ -float OH_ArkUI_AxisEvent_GetWindowY(const ArkUI_UIInputEvent *event); +double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the X coordinate of this axis event relative to the screen. + * @brief Obtains the value of the horizontal scroll axis for this axis event. * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the X coordinate of the current axis event relative to the screen. + * @param event Indicates the pointer to the UI input event. + * @return Returns the value of the horizontal scroll axis of the current axis event. * @since 12 */ -float OH_ArkUI_AxisEvent_GetDisplayX(const ArkUI_UIInputEvent *event); +double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); /** - * @brief Obtains the Y coordinate of this axis event relative to the screen. + * @brief Obtains the scale value of the pinch axis for this axis event. * - * @param event Indicates the pointer to the current UI input event. - * @return Returns the Y coordinate of the current axis event relative to the screen. + * @param event Indicates the pointer to the UI input event. + * @return Returns the scale value of the pinch axis of the current axis event. * @since 12 */ -float OH_ArkUI_AxisEvent_GetDisplayY(const ArkUI_UIInputEvent *event); +double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); #ifdef __cplusplus }; -- Gitee From 4d15a0b4fe47f52b39423b7c2f1f6eacefa38cf8 Mon Sep 17 00:00:00 2001 From: p30054102 Date: Thu, 29 Feb 2024 19:47:53 +0800 Subject: [PATCH 0324/2135] 1 Signed-off-by: p30054102 --- zh-cn/native_sdk/dfx/hidebug.h | 136 +++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 zh-cn/native_sdk/dfx/hidebug.h diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h new file mode 100644 index 00000000..f1f19ab7 --- /dev/null +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIDEBUG_H +#define HIVIEWDFX_HIDEBUG_H +/** + * @addtogroup HiDebug + * @{ + * + * @brief 提供调试功能。 + * + * 开发者可以使用这些函数来获取 cpu uage、memory、heap、capture trace等。 + * + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * + * @since 12 + */ + +/** + * @file hideug.h + * + * @brief 定义 HiDebug 模块的调试功能。 + * + * @since 12 + */ + +#include +#include "hidebug_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 获取系统的CPU使用率。 + * + * @return 返回系统的CPU使用率。 + * + * @since 12 + */ +double OH_HiDebug_GetSystemCpuUsage(); + +/** + * @brief 获取进程的CPU使用率百分比。 + * + * @return 返回进程的CPU使用率百分比。 + * + * @since 12 + */ +double OH_HiDebug_GetAppCpuUsage(); + +/** + * @brief 获取应用程序所有线程的CPU使用率。 + * + * @return 返回所有线程CPU使用率。 + * + * @since 12 + */ +HiDebug_ThreadCpuUsagePtr OH_HiDebug_GetAppThreadCpuUsage(); + +/** + * @brief 获取应用程序所有线程的可用CPU使用缓冲区。 + * + * @param threadCpuUsage 应用的所有线程可用CPU使用缓冲区指针。 + * + * @since 12 + */ +void OH_HiDebug_FreeThreadCpuUsage(HiDebug_ThreadCpuUsagePtr *threadCpuUsage); + +/** + * @brief 获取系统内存大小。 + * + * @param systemMemInfo 系统内存信息指针。 + * + * @since 12 + */ +void OH_HiDebug_GetSystemMemInfo(HiDebug_SystemMemInfo *systemMemInfo); + +/** + * @brief 获取应用程序进程的内存信息。 + * + * @param nativeMemInfo 应用程序进程的内存信息指针。 + * + * @since 12 + */ +void OH_HiDebug_GetAppNativeMemInfo(HiDebug_NativeMemInfo *nativeMemInfo); + +/** + * @brief 获取应用程序进程的内存限制。 + * + * @param memoryLimit 应用程序进程的内存限制指针。 + * + * @since 12 + */ +void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit); + +/** + * @brief 开始捕获应用程序trace。 + * + * @param fileName 输出trace文件名。 + * @param flag 捕获线程trace方式。 + * @param tags 捕获trace场景标志。 + * @param limitSize 跟踪文件的最大大小(以字节为单位),最大为 500MB。 + * @return 开始捕获应用程序trace是否成功的结果。 + * + * @since 12 + */ +HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(const char* fileName, HiDebug_TraceFlag flag, + uint64_t tags, uint32_t limitSize); + +/** + * @brief 停止捕获应用程序trace。 + * + * @return 停止捕获应用程序trace是否成功的结果。 + * + * @since 12 + */ +HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIDEBUG_H \ No newline at end of file -- Gitee From eb01950223243fb37c7d0a7a4a07a87dbd37c954 Mon Sep 17 00:00:00 2001 From: p30054102 Date: Thu, 29 Feb 2024 20:22:21 +0800 Subject: [PATCH 0325/2135] =?UTF-8?q?hidebug=E8=B5=84=E6=96=99=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: p30054102 --- zh-cn/native_sdk/dfx/hidebug_type.h | 340 ++++++++++++++++++++++++++++ 1 file changed, 340 insertions(+) create mode 100644 zh-cn/native_sdk/dfx/hidebug_type.h diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h new file mode 100644 index 00000000..cb638769 --- /dev/null +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -0,0 +1,340 @@ +/* + * 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 HIVIEWDFX_HIDEBUG_TYPE_H +#define HIVIEWDFX_HIDEBUG_TYPE_H +/** + * @addtogroup HiDebug + * @{ + * + * @brief 提供调试功能。 + * + * 开发者可以使用这些函数来获取 cpu uage、memory、heap、capture trace等。 + * + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * + * @since 12 + */ + +/** + * @file hideug_type.h + * + * @brief 提供HiDebug中的枚举变量与结构体定义。 + * + * @since 12 + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 错误代码定义 + * + * @since 12 + */ +typedef enum HiDebug_ErrorCode { + /** 成功 */ + HIDEBUG_SUCCESS = 0, + /** 无效参数 */ + HIDEBUG_INVALID_ARGUMENT = 401, + /** 已存在trace捕获 */ + HIDEBUG_TRACE_CAPTURED_ALREADY = 11400102, + /** 对文件没有写权限 */ + HIDEBUG_NO_PERMISSION = 11400103, + /** trace状态异常 */ + HIDEBUG_TRACE_ABNORMAL = 11400104 +} HiDebug_ErrorCode; + +/** + * @brief 应用程序线程的CPU使用率定义。 + * + * @since 12 + */ +typedef struct HiDebug_ThreadCpuUsage { + /** 线程ID */ + uint32_t threadId; + /** 线程CPU使用率 */ + double cpuUsage; + /** 下一个线程的使用率信息 */ + struct HiDebug_ThreadCpuUsage *next; +} HiDebug_ThreadCpuUsage; + +/** + * @brief HiDebug_ThreadCpuUsage指针定义。 + * + * @since 12 + */ +typedef HiDebug_ThreadCpuUsage* HiDebug_ThreadCpuUsagePtr; + +/** + * @brief 系统内存信息结构类型定义。 + * + * @since 12 + */ +typedef struct HiDebug_SystemMemInfo { + /** 系统内存总大小(以 KB 为单位)*/ + uint32_t totalMem; + /** 系统空闲内存大小(以 KB 为单位)*/ + uint32_t freeMem; + /** 系统可用内存大小(以 KB 为单位)*/ + uint32_t availableMem; +} HiDebug_SystemMemInfo; + +/** + * @brief 应用程序进程本机内存信息结构类型定义。 + * + * @since 12 + */ +typedef struct HiDebug_NativeMemInfo { + /** 进程比例集大小内存(以 KB 为单位 */ + uint32_t pss; + /** 虚拟集大小内存(以 KB 为单位)*/ + uint32_t vss; + /** 驻留集大小(以 KB 为单位)*/ + uint32_t rss; + /** 共享脏内存的大小(以 KB 为单位)*/ + uint32_t sharedDirty; + /** 专用脏内存的大小(以 KB 为单位)*/ + uint32_t privateDirty; + /** 共享干净内存的大小(以 KB 为单位)*/ + uint32_t sharedClean; + /** 专用干净内存的大小(以 KB 为单位)*/ + uint32_t privateClean; +} HiDebug_NativeMemInfo; + +/** + * @brief 应用程序进程内存限制结构类型定义。 + * + * @since 12 + */ +typedef struct HiDebug_MemoryLimit { + /** 应用程序进程驻留集的限制(以字节为单位)*/ + uint64_t rssLimit; + /** 应用程序进程的虚拟内存限制 (以字节为单位)*/ + uint64_t vssLimit; +} HiDebug_MemoryLimit; + +/** + * @brief trace标志的枚举。 + * + * @since 12 + */ +typedef enum HiDebug_TraceFlag { + /** 仅捕获主线程trace */ + HIDEBUG_TRACE_FLAG_MAIN_THREAD = 1, + /** 捕获所有线程trace */ + HIDEBUG_TRACE_FLAG_ALL_THREADS = 2 +} HiDebug_TraceFlag; +#ifdef __cplusplus +} +#endif + +/** + * @brief FFRT任务。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_FFRT (1ULL << 13) +/** + * @brief 公共库子系统标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_COMMON_LIBRARY (1ULL << 16) +/** + * @brief HDF子系统标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_HDF (1ULL << 18) +/** + * @brief 网络标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_NET (1ULL << 23) +/** + * @brief NWeb标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_NWEB (1ULL << 24) +/** + * @brief 分布式音频标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO (1ULL << 27) +/** + * @brief 文件管理标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_FILE_MANAGEMENT (1ULL << 29) +/** + * @brief OHOS通用标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_OHOS (1ULL << 30) +/** + * @brief Ability Manager标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_ABILITY_MANAGER (1ULL << 31) +/** + * @brief 相机模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_CAMERA (1ULL << 32) +/** + * @brief 媒体模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_MEDIA (1ULL << 33) +/** + * @brief 图像模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_IMAGE (1ULL << 34) +/** + * @brief 音频模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_AUDIO (1ULL << 35) +/** + * @brief 分布式数据管理器模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA (1ULL << 36) +/** + * @brief 图形模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38) +/** + * @brief ACE开发框架标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_ACE (1ULL << 39) +/** + * @brief 通知模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_NOTIFICATION (1ULL << 40) +/** + * @brief MISC模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_MISC (1ULL << 41) +/** + * @brief 多模态输入模块标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT (1ULL << 42) +/** + * @brief RPC标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_RPC (1ULL << 46) +/** + * @brief ARK标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_ARK (1ULL << 47) +/** + * @brief 窗口管理器标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_WINDOW_MANAGER (1ULL << 48) +/** + * @brief 分布式屏幕标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN (1ULL << 50) +/** + * @brief 分布式相机标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA (1ULL << 51) +/** + * @brief 分布式硬件框架标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK (1ULL << 52) +/** + * @brief 全局资源管理器标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER (1ULL << 53) +/** + * @brief 分布式硬件设备管理器标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER (1ULL << 54) +/** + * @brief SA标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_SAMGR (1ULL << 55) +/** + * @brief 电源管理器标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_POWER_MANAGER (1ULL << 56) +/** + * @brief 分布式调度程序标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER (1ULL << 57) +/** + * @brief 分布式输入标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT (1ULL << 59) +/** + * @brief 蓝牙标记。 + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60) + +#endif // HIVIEWDFX_HIDEBUG_TYPE_H \ No newline at end of file -- Gitee From 0c85ab68490507e3aa081d6d877f2f5d4d149dc4 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 01:43:03 +0000 Subject: [PATCH 0326/2135] update zh-cn/native_sdk/dfx/hidebug.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index f1f19ab7..c6404352 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -109,16 +109,17 @@ void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit); /** * @brief 开始捕获应用程序trace。 * - * @param fileName 输出trace文件名。 * @param flag 捕获线程trace方式。 * @param tags 捕获trace场景标志。 * @param limitSize 跟踪文件的最大大小(以字节为单位),最大为 500MB。 + * @param fileName 输出trace文件名。 + * @param length 输出trace文件名长度。 * @return 开始捕获应用程序trace是否成功的结果。 * * @since 12 */ -HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(const char* fileName, HiDebug_TraceFlag flag, - uint64_t tags, uint32_t limitSize); +HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(HiDebug_TraceFlag flag, uint64_t tags, uint32_t limitSize, + char* fileName, uint32_t length); /** * @brief 停止捕获应用程序trace。 -- Gitee From e87631d39969b3f1bae827fff67a52ca6366c517 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 01:53:33 +0000 Subject: [PATCH 0327/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index cb638769..55095ffa 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -235,11 +235,11 @@ typedef enum HiDebug_TraceFlag { */ #define HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38) /** - * @brief ACE开发框架标记。 + * @brief ArkUI开发框架标记。 * * @since 12 */ -#define HIDEBUG_TRACE_TAG_ACE (1ULL << 39) +#define #define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39) /** * @brief 通知模块标记。 * @@ -265,7 +265,7 @@ typedef enum HiDebug_TraceFlag { */ #define HIDEBUG_TRACE_TAG_RPC (1ULL << 46) /** - * @brief ARK标记。 + * @brief JSVM虚拟机标记。 * * @since 12 */ -- Gitee From 38510badac8fe8bc5ca37b589c47afabb639c2fa Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 03:03:49 +0000 Subject: [PATCH 0328/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 90 ++++++++++++++--------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index 55095ffa..1077819e 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -52,16 +52,16 @@ typedef enum HiDebug_ErrorCode { HIDEBUG_SUCCESS = 0, /** 无效参数 */ HIDEBUG_INVALID_ARGUMENT = 401, - /** 已存在trace捕获 */ + /** 重复采集 */ HIDEBUG_TRACE_CAPTURED_ALREADY = 11400102, - /** 对文件没有写权限 */ + /** 权限校验失败 */ HIDEBUG_NO_PERMISSION = 11400103, - /** trace状态异常 */ + /** 内部异常 */ HIDEBUG_TRACE_ABNORMAL = 11400104 } HiDebug_ErrorCode; /** - * @brief 应用程序线程的CPU使用率定义。 + * @brief 应用程序线程的CPU使用1情况定义。 * * @since 12 */ @@ -87,11 +87,11 @@ typedef HiDebug_ThreadCpuUsage* HiDebug_ThreadCpuUsagePtr; * @since 12 */ typedef struct HiDebug_SystemMemInfo { - /** 系统内存总大小(以 KB 为单位)*/ + /** 系统总的内存(以 KB 为单位)*/ uint32_t totalMem; - /** 系统空闲内存大小(以 KB 为单位)*/ + /** 系统空闲的内存(以 KB 为单位)*/ uint32_t freeMem; - /** 系统可用内存大小(以 KB 为单位)*/ + /** 系统可用的内存(以 KB 为单位)*/ uint32_t availableMem; } HiDebug_SystemMemInfo; @@ -101,11 +101,11 @@ typedef struct HiDebug_SystemMemInfo { * @since 12 */ typedef struct HiDebug_NativeMemInfo { - /** 进程比例集大小内存(以 KB 为单位 */ + /** 实际占用的物理内存的大小(比例分配共享库占用的内存,以 KB 为单位) */ uint32_t pss; - /** 虚拟集大小内存(以 KB 为单位)*/ + /** 占用虚拟内存大小(包括共享库所占用的内存,以 KB 为单位)*/ uint32_t vss; - /** 驻留集大小(以 KB 为单位)*/ + /** 实际占用的物理内存的大小(包括共享库占用,以 KB 为单位)*/ uint32_t rss; /** 共享脏内存的大小(以 KB 为单位)*/ uint32_t sharedDirty; @@ -130,14 +130,14 @@ typedef struct HiDebug_MemoryLimit { } HiDebug_MemoryLimit; /** - * @brief trace标志的枚举。 + * @brief 采集trace线程的类型。 * * @since 12 */ typedef enum HiDebug_TraceFlag { - /** 仅捕获主线程trace */ + /** 只采集当前应用主线程 */ HIDEBUG_TRACE_FLAG_MAIN_THREAD = 1, - /** 捕获所有线程trace */ + /** 采集当前应用下所有线程 */ HIDEBUG_TRACE_FLAG_ALL_THREADS = 2 } HiDebug_TraceFlag; #ifdef __cplusplus @@ -145,193 +145,193 @@ typedef enum HiDebug_TraceFlag { #endif /** - * @brief FFRT任务。 + * @brief FFRT任务标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_FFRT (1ULL << 13) /** - * @brief 公共库子系统标记。 + * @brief 公共库子系统标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_COMMON_LIBRARY (1ULL << 16) /** - * @brief HDF子系统标记。 + * @brief HDF子系统标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_HDF (1ULL << 18) /** - * @brief 网络标记。 + * @brief 网络标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_NET (1ULL << 23) /** - * @brief NWeb标记。 + * @brief NWeb标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_NWEB (1ULL << 24) /** - * @brief 分布式音频标记。 + * @brief 分布式音频标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO (1ULL << 27) /** - * @brief 文件管理标记。 + * @brief 文件管理标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_FILE_MANAGEMENT (1ULL << 29) /** - * @brief OHOS通用标记。 + * @brief OHOS通用标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_OHOS (1ULL << 30) /** - * @brief Ability Manager标记。 + * @brief Ability Manager标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_ABILITY_MANAGER (1ULL << 31) /** - * @brief 相机模块标记。 + * @brief 相机模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_CAMERA (1ULL << 32) /** - * @brief 媒体模块标记。 + * @brief 媒体模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_MEDIA (1ULL << 33) /** - * @brief 图像模块标记。 + * @brief 图像模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_IMAGE (1ULL << 34) /** - * @brief 音频模块标记。 + * @brief 音频模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_AUDIO (1ULL << 35) /** - * @brief 分布式数据管理器模块标记。 + * @brief 分布式数据管理器模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA (1ULL << 36) /** - * @brief 图形模块标记。 + * @brief 图形模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38) /** - * @brief ArkUI开发框架标记。 + * @brief ArkUI开发框架标签。 * * @since 12 */ #define #define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39) /** - * @brief 通知模块标记。 + * @brief 通知模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_NOTIFICATION (1ULL << 40) /** - * @brief MISC模块标记。 + * @brief MISC模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_MISC (1ULL << 41) /** - * @brief 多模态输入模块标记。 + * @brief 多模态输入模块标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT (1ULL << 42) /** - * @brief RPC标记。 + * @brief RPC标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_RPC (1ULL << 46) /** - * @brief JSVM虚拟机标记。 + * @brief JSVM虚拟机标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_ARK (1ULL << 47) /** - * @brief 窗口管理器标记。 + * @brief 窗口管理器标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_WINDOW_MANAGER (1ULL << 48) /** - * @brief 分布式屏幕标记。 + * @brief 分布式屏幕标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN (1ULL << 50) /** - * @brief 分布式相机标记。 + * @brief 分布式相机标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA (1ULL << 51) /** - * @brief 分布式硬件框架标记。 + * @brief 分布式硬件框架标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK (1ULL << 52) /** - * @brief 全局资源管理器标记。 + * @brief 全局资源管理器标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER (1ULL << 53) /** - * @brief 分布式硬件设备管理器标记。 + * @brief 分布式硬件设备管理器标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER (1ULL << 54) /** - * @brief SA标记。 + * @brief SA标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_SAMGR (1ULL << 55) /** - * @brief 电源管理器标记。 + * @brief 电源管理器标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_POWER_MANAGER (1ULL << 56) /** - * @brief 分布式调度程序标记。 + * @brief 分布式调度程序标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER (1ULL << 57) /** - * @brief 分布式输入标记。 + * @brief 分布式输入标签。 * * @since 12 */ #define HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT (1ULL << 59) /** - * @brief 蓝牙标记。 + * @brief 蓝牙标签。 * * @since 12 */ -- Gitee From 558dcc72519b5a00556a19b775aed1afd3de09d5 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 03:09:25 +0000 Subject: [PATCH 0329/2135] update zh-cn/native_sdk/dfx/hidebug.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index c6404352..f27d2839 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -44,9 +44,9 @@ extern "C" { #endif /** - * @brief 获取系统的CPU使用率。 + * @brief 获取系统的CPU资源占用情况。 * - * @return 返回系统的CPU使用率。 + * @return 系统CPU资源占用情况。 * * @since 12 */ @@ -62,9 +62,9 @@ double OH_HiDebug_GetSystemCpuUsage(); double OH_HiDebug_GetAppCpuUsage(); /** - * @brief 获取应用程序所有线程的CPU使用率。 + * @brief 获取应用线程CPU使用情况。 * - * @return 返回所有线程CPU使用率。 + * @return 返回当前应用进程下所有ThreadCpuUsage数组。 * * @since 12 */ @@ -80,7 +80,7 @@ HiDebug_ThreadCpuUsagePtr OH_HiDebug_GetAppThreadCpuUsage(); void OH_HiDebug_FreeThreadCpuUsage(HiDebug_ThreadCpuUsagePtr *threadCpuUsage); /** - * @brief 获取系统内存大小。 + * @brief 获取系统内存信息。 * * @param systemMemInfo 系统内存信息指针。 * @@ -107,7 +107,7 @@ void OH_HiDebug_GetAppNativeMemInfo(HiDebug_NativeMemInfo *nativeMemInfo); void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit); /** - * @brief 开始捕获应用程序trace。 + * @brief 启动应用trace采集。 * * @param flag 捕获线程trace方式。 * @param tags 捕获trace场景标志。 @@ -133,5 +133,4 @@ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); #ifdef __cplusplus } #endif -/** @} */ #endif // HIVIEWDFX_HIDEBUG_H \ No newline at end of file -- Gitee From 0eff9653b9119d6d016001e41955ce6a1c685563 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 03:10:44 +0000 Subject: [PATCH 0330/2135] update zh-cn/native_sdk/dfx/hidebug.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index f27d2839..b55adfdc 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -64,7 +64,7 @@ double OH_HiDebug_GetAppCpuUsage(); /** * @brief 获取应用线程CPU使用情况。 * - * @return 返回当前应用进程下所有ThreadCpuUsage数组。 + * @return 返回当前应用进程下所有线程CPU使用情况。 * * @since 12 */ -- Gitee From 7f683cfbb66150a08e9a3760a99a72a68840ded7 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 03:14:46 +0000 Subject: [PATCH 0331/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index 1077819e..f3ebf78e 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -101,7 +101,7 @@ typedef struct HiDebug_SystemMemInfo { * @since 12 */ typedef struct HiDebug_NativeMemInfo { - /** 实际占用的物理内存的大小(比例分配共享库占用的内存,以 KB 为单位) */ + /** 实际占用的物理内存的大小(比例分配共享库占用的内存,以 KB 为单位 */ uint32_t pss; /** 占用虚拟内存大小(包括共享库所占用的内存,以 KB 为单位)*/ uint32_t vss; @@ -125,7 +125,7 @@ typedef struct HiDebug_NativeMemInfo { typedef struct HiDebug_MemoryLimit { /** 应用程序进程驻留集的限制(以字节为单位)*/ uint64_t rssLimit; - /** 应用程序进程的虚拟内存限制 (以字节为单位)*/ + /** 应用程序进程的虚拟内存限制(以字节为单位)*/ uint64_t vssLimit; } HiDebug_MemoryLimit; -- Gitee From c518928eda33d0ec45504cf7738bb3f4b5d52736 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 03:47:55 +0000 Subject: [PATCH 0332/2135] update zh-cn/native_sdk/dfx/hidebug.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug.h | 40 ++++++++++++++-------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index b55adfdc..1f8acc71 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -21,9 +21,8 @@ * * @brief 提供调试功能。 * - * 开发者可以使用这些函数来获取 cpu uage、memory、heap、capture trace等。 + * 例如,你可以使用这些函数来获取 cpu uage、memory、heap、capture trace等。 * - * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug * * @since 12 */ @@ -32,7 +31,9 @@ * @file hideug.h * * @brief 定义 HiDebug 模块的调试功能。 - * + * + * @library libohhidebug.so + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug * @since 12 */ @@ -46,8 +47,7 @@ extern "C" { /** * @brief 获取系统的CPU资源占用情况。 * - * @return 系统CPU资源占用情况。 - * + * @return 返回系统CPU资源占用情况。 * @since 12 */ double OH_HiDebug_GetSystemCpuUsage(); @@ -56,16 +56,14 @@ double OH_HiDebug_GetSystemCpuUsage(); * @brief 获取进程的CPU使用率百分比。 * * @return 返回进程的CPU使用率百分比。 - * * @since 12 */ double OH_HiDebug_GetAppCpuUsage(); /** - * @brief 获取应用线程CPU使用情况。 + * @brief 获取应用所有线程CPU使用情况。 * - * @return 返回当前应用进程下所有线程CPU使用情况。 - * + * @return 返回所有线程CPU使用情况,见{@link HiDebug_ThreadCpuUsagePtr}。 * @since 12 */ HiDebug_ThreadCpuUsagePtr OH_HiDebug_GetAppThreadCpuUsage(); @@ -73,8 +71,7 @@ HiDebug_ThreadCpuUsagePtr OH_HiDebug_GetAppThreadCpuUsage(); /** * @brief 获取应用程序所有线程的可用CPU使用缓冲区。 * - * @param threadCpuUsage 应用的所有线程可用CPU使用缓冲区指针。 - * + * @param threadCpuUsage 应用的所有线程可用CPU使用缓冲区指针,见{@link HiDebug_ThreadCpuUsagePtr}。 * @since 12 */ void OH_HiDebug_FreeThreadCpuUsage(HiDebug_ThreadCpuUsagePtr *threadCpuUsage); @@ -82,8 +79,7 @@ void OH_HiDebug_FreeThreadCpuUsage(HiDebug_ThreadCpuUsagePtr *threadCpuUsage); /** * @brief 获取系统内存信息。 * - * @param systemMemInfo 系统内存信息指针。 - * + * @param systemMemInfo 表示指向{@link HiDebug_SystemMemInfo}。 * @since 12 */ void OH_HiDebug_GetSystemMemInfo(HiDebug_SystemMemInfo *systemMemInfo); @@ -91,8 +87,7 @@ void OH_HiDebug_GetSystemMemInfo(HiDebug_SystemMemInfo *systemMemInfo); /** * @brief 获取应用程序进程的内存信息。 * - * @param nativeMemInfo 应用程序进程的内存信息指针。 - * + * @param nativeMemInfo 表示指向{@link HiDebug_NativeMemInfo}。 * @since 12 */ void OH_HiDebug_GetAppNativeMemInfo(HiDebug_NativeMemInfo *nativeMemInfo); @@ -100,8 +95,7 @@ void OH_HiDebug_GetAppNativeMemInfo(HiDebug_NativeMemInfo *nativeMemInfo); /** * @brief 获取应用程序进程的内存限制。 * - * @param memoryLimit 应用程序进程的内存限制指针。 - * + * @param memoryLimit 表示指向{@link HiDebug_MemoryLimit}。 * @since 12 */ void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit); @@ -111,11 +105,10 @@ void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit); * * @param flag 捕获线程trace方式。 * @param tags 捕获trace场景标志。 - * @param limitSize 跟踪文件的最大大小(以字节为单位),最大为 500MB。 - * @param fileName 输出trace文件名。 - * @param length 输出trace文件名长度。 - * @return 开始捕获应用程序trace是否成功的结果。 - * + * @param limitSize trace文件的最大大小(以字节为单位),最大为 500MB。 + * @param fileName 输出trace文件名缓冲区。 + * @param length 输出trace文件名缓冲区长度。 + * @return 如果成功返回{@code HIDEBUG_SUCCESS},见{@link HiDebug_ErrorCode}。 * @since 12 */ HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(HiDebug_TraceFlag flag, uint64_t tags, uint32_t limitSize, @@ -124,8 +117,7 @@ HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(HiDebug_TraceFlag flag, uint64 /** * @brief 停止捕获应用程序trace。 * - * @return 停止捕获应用程序trace是否成功的结果。 - * + * @return 如果成功返回{@code HIDEBUG_SUCCESS},见{@link HiDebug_ErrorCode}。 * @since 12 */ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); -- Gitee From ed9dea3e710d3b5bdc161977081c7daca1c516f3 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 06:05:15 +0000 Subject: [PATCH 0333/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 78 ++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index f3ebf78e..41250d69 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -19,20 +19,20 @@ * @addtogroup HiDebug * @{ * - * @brief 提供调试功能。 + * @brief 提供调试代码的定义。 * - * 开发者可以使用这些函数来获取 cpu uage、memory、heap、capture trace等。 + * 例如,你可以使用这些函数来获取cpu uage、memory、heap、capture trace等。 * - * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug - * * @since 12 */ /** * @file hideug_type.h * - * @brief 提供HiDebug中的枚举变量与结构体定义。 + * @brief HiDebug模块代码结构体定义。 * + * @library libohhidebug.so + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug * @since 12 */ @@ -43,7 +43,7 @@ extern "C" { #endif /** - * @brief 错误代码定义 + * @brief 错误码定义 * * @since 12 */ @@ -54,23 +54,29 @@ typedef enum HiDebug_ErrorCode { HIDEBUG_INVALID_ARGUMENT = 401, /** 重复采集 */ HIDEBUG_TRACE_CAPTURED_ALREADY = 11400102, - /** 权限校验失败 */ + /** 没有写文件的权限 */ HIDEBUG_NO_PERMISSION = 11400103, - /** 内部异常 */ + /** trace状态异常 */ HIDEBUG_TRACE_ABNORMAL = 11400104 } HiDebug_ErrorCode; /** - * @brief 应用程序线程的CPU使用1情况定义。 + * @brief 应用程序所有线程的CPU使用率结构体定义。 * * @since 12 */ typedef struct HiDebug_ThreadCpuUsage { - /** 线程ID */ + /** + * 线程ID + */ uint32_t threadId; - /** 线程CPU使用率 */ + /** + * 线程CPU使用率 + */ double cpuUsage; - /** 下一个线程的使用率信息 */ + /** + * 下一个线程的使用率信息 + */ struct HiDebug_ThreadCpuUsage *next; } HiDebug_ThreadCpuUsage; @@ -87,11 +93,17 @@ typedef HiDebug_ThreadCpuUsage* HiDebug_ThreadCpuUsagePtr; * @since 12 */ typedef struct HiDebug_SystemMemInfo { - /** 系统总的内存(以 KB 为单位)*/ + /** + * 系统总的内存,以KB为单位 + */ uint32_t totalMem; - /** 系统空闲的内存(以 KB 为单位)*/ + /** + * 系统空闲的内存,以KB为单位 + */ uint32_t freeMem; - /** 系统可用的内存(以 KB 为单位)*/ + /** + * 系统可用的内存,以KB为单位 + */ uint32_t availableMem; } HiDebug_SystemMemInfo; @@ -101,19 +113,33 @@ typedef struct HiDebug_SystemMemInfo { * @since 12 */ typedef struct HiDebug_NativeMemInfo { - /** 实际占用的物理内存的大小(比例分配共享库占用的内存,以 KB 为单位 */ + /** + * 进程比例集大小内存,以KB为单位 + */ uint32_t pss; - /** 占用虚拟内存大小(包括共享库所占用的内存,以 KB 为单位)*/ + /** + * 虚拟内存大小,以KB为单位 + */ uint32_t vss; - /** 实际占用的物理内存的大小(包括共享库占用,以 KB 为单位)*/ + /** + * 常驻集大小,以KB为单位 + */ uint32_t rss; - /** 共享脏内存的大小(以 KB 为单位)*/ + /** + * 共享脏内存的大小,以KB为单位 + */ uint32_t sharedDirty; - /** 专用脏内存的大小(以 KB 为单位)*/ + /** + * 专用脏内存的大小,以KB为单位 + */ uint32_t privateDirty; - /** 共享干净内存的大小(以 KB 为单位)*/ + /** + *共享干净内存的大小,以KB为单位 + */ uint32_t sharedClean; - /** 专用干净内存的大小(以 KB 为单位)*/ + /** + * 专用干净内存的大小,以KB为单位 + */ uint32_t privateClean; } HiDebug_NativeMemInfo; @@ -123,9 +149,13 @@ typedef struct HiDebug_NativeMemInfo { * @since 12 */ typedef struct HiDebug_MemoryLimit { - /** 应用程序进程驻留集的限制(以字节为单位)*/ + /** + * 应用程序进程驻留集的限制,以字节为单位 + */ uint64_t rssLimit; - /** 应用程序进程的虚拟内存限制(以字节为单位)*/ + /** + * 应用程序进程的虚拟内存限制,以字节为单位 + */ uint64_t vssLimit; } HiDebug_MemoryLimit; -- Gitee From 96a1f18a09ad9783aabe2b3626ac09fad6d10b76 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 06:07:20 +0000 Subject: [PATCH 0334/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index 41250d69..35cc85c0 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -67,15 +67,15 @@ typedef enum HiDebug_ErrorCode { */ typedef struct HiDebug_ThreadCpuUsage { /** - * 线程ID + * 线程ID。 */ uint32_t threadId; /** - * 线程CPU使用率 + * 线程CPU使用率。 */ double cpuUsage; /** - * 下一个线程的使用率信息 + * 下一个线程的使用率信息。 */ struct HiDebug_ThreadCpuUsage *next; } HiDebug_ThreadCpuUsage; @@ -94,15 +94,15 @@ typedef HiDebug_ThreadCpuUsage* HiDebug_ThreadCpuUsagePtr; */ typedef struct HiDebug_SystemMemInfo { /** - * 系统总的内存,以KB为单位 + * 系统总的内存,以KB为单位。 */ uint32_t totalMem; /** - * 系统空闲的内存,以KB为单位 + * 系统空闲的内存,以KB为单位。 */ uint32_t freeMem; /** - * 系统可用的内存,以KB为单位 + * 系统可用的内存,以KB为单位。 */ uint32_t availableMem; } HiDebug_SystemMemInfo; @@ -114,31 +114,31 @@ typedef struct HiDebug_SystemMemInfo { */ typedef struct HiDebug_NativeMemInfo { /** - * 进程比例集大小内存,以KB为单位 + * 进程比例集大小内存,以KB为单位。 */ uint32_t pss; /** - * 虚拟内存大小,以KB为单位 + * 虚拟内存大小,以KB为单位。 */ uint32_t vss; /** - * 常驻集大小,以KB为单位 + * 常驻集大小,以KB为单位。 */ uint32_t rss; /** - * 共享脏内存的大小,以KB为单位 + * 共享脏内存的大小,以KB为单位。 */ uint32_t sharedDirty; /** - * 专用脏内存的大小,以KB为单位 + * 专用脏内存的大小,以KB为单位。 */ uint32_t privateDirty; /** - *共享干净内存的大小,以KB为单位 + *共享干净内存的大小,以KB为单位。 */ uint32_t sharedClean; /** - * 专用干净内存的大小,以KB为单位 + * 专用干净内存的大小,以KB为单位。 */ uint32_t privateClean; } HiDebug_NativeMemInfo; @@ -150,11 +150,11 @@ typedef struct HiDebug_NativeMemInfo { */ typedef struct HiDebug_MemoryLimit { /** - * 应用程序进程驻留集的限制,以字节为单位 + * 应用程序进程驻留集的限制,以字节为单位。 */ uint64_t rssLimit; /** - * 应用程序进程的虚拟内存限制,以字节为单位 + * 应用程序进程的虚拟内存限制,以字节为单位。 */ uint64_t vssLimit; } HiDebug_MemoryLimit; -- Gitee From d55104d69e2970d75c6c671f8ada3b59b69cef08 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 06:32:25 +0000 Subject: [PATCH 0335/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index 35cc85c0..bb486687 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -150,11 +150,11 @@ typedef struct HiDebug_NativeMemInfo { */ typedef struct HiDebug_MemoryLimit { /** - * 应用程序进程驻留集的限制,以字节为单位。 + * 应用程序进程驻留集的限制,以KB为单位。 */ uint64_t rssLimit; /** - * 应用程序进程的虚拟内存限制,以字节为单位。 + * 应用程序进程的虚拟内存限制,以KB为单位。 */ uint64_t vssLimit; } HiDebug_MemoryLimit; -- Gitee From d2843f2af247a88d56128f86adcb7058fa9e078f Mon Sep 17 00:00:00 2001 From: zhouchaobo Date: Fri, 1 Mar 2024 17:03:33 +0800 Subject: [PATCH 0336/2135] UiInputEvent return illeagal value Signed-off-by: zhouchaobo --- .../ace/native_interface_xcomponent.h | 4 +++- zh-cn/native_sdk/ace/ui_input_event.h | 22 +++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index 11a74906..7f897ab1 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -611,7 +611,9 @@ int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, * @param component 表示指向OH_NativeXComponent实例的指针。 * @param callback 指示指向UI输入事件回调的指针。 * @param type 指示当前UI输入事件的类型。 - * @return 返回执行的状态代码。 + * @return 0 - 成功。 + * 401 - 参数异常。 + * * @since 12 */ int32_t OH_NativeXComponent_RegisterUIInputEventCallback( diff --git a/zh-cn/native_sdk/ace/ui_input_event.h b/zh-cn/native_sdk/ace/ui_input_event.h index 3e2970a4..318300b7 100644 --- a/zh-cn/native_sdk/ace/ui_input_event.h +++ b/zh-cn/native_sdk/ace/ui_input_event.h @@ -63,7 +63,7 @@ enum ArkUI_UIInputEvent_Type { * @brief 获取UI输入事件的类型。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前UI输入事件的类型。 + * @return 返回当前UI输入事件的类型,如果参数异常则返回0。 * @since 12 */ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); @@ -72,7 +72,7 @@ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); * @brief 获取UI输入事件发生的时间。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回UI输入事件发生的时间。 + * @return 返回UI输入事件发生的时间,如果参数异常则返回0。 * @since 12 */ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); @@ -81,7 +81,7 @@ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前组件左上角的X坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前带有指向性的输入事件相对于当前组件左上角的X坐标。 + * @return 返回当前带有指向性的输入事件相对于当前组件左上角的X坐标,如果参数异常则返回0.0f。 * @since 12 */ float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent *event); @@ -90,7 +90,7 @@ float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent *event); * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前组件左上角的Y坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前带有指向性的输入事件相对于当前组件左上角的Y坐标。 + * @return 返回当前带有指向性的输入事件相对于当前组件左上角的Y坐标,如果参数异常则返回0.0f。 * @since 12 */ float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent *event); @@ -99,7 +99,7 @@ float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent *event); * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前应用窗口左上角的X坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前带有指向性的输入事件相对于当前应用窗口左上角的X坐标。 + * @return 返回当前带有指向性的输入事件相对于当前应用窗口左上角的X坐标,如果参数异常则返回0.0f。 * @since 12 */ float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent *event); @@ -108,7 +108,7 @@ float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent *event); * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前应用窗口左上角的Y坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前带有指向性的输入事件相对于当前应用窗口左上角的Y坐标。 + * @return 返回当前带有指向性的输入事件相对于当前应用窗口左上角的Y坐标,如果参数异常则返回0.0f。 * @since 12 */ float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent *event); @@ -117,7 +117,7 @@ float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent *event); * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前屏幕左上角的X坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前带有指向性的输入事件相对于当前屏幕左上角的X坐标。 + * @return 返回当前带有指向性的输入事件相对于当前屏幕左上角的X坐标,如果参数异常则返回0.0f。 * @since 12 */ float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent *event); @@ -126,7 +126,7 @@ float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent *event); * @brief 从带有指向性的输入事件(如触摸事件、鼠标事件、轴事件)中获取相对于当前屏幕左上角的Y坐标。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前带有指向性的输入事件相对于当前屏幕左上角的Y坐标。 + * @return 返回当前带有指向性的输入事件相对于当前屏幕左上角的Y坐标,如果参数异常则返回0.0f。 * @since 12 */ float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent *event); @@ -135,7 +135,7 @@ float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent *event); * @brief 获取当前轴事件的垂直滚动轴的值。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的垂直滚动轴的值。 + * @return 返回当前轴事件的垂直滚动轴的值,如果参数异常则返回0.0。 * @since 12 */ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); @@ -144,7 +144,7 @@ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); * @brief 获取当前轴事件的水平滚动轴的值。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的水平滚动轴的值。 + * @return 返回当前轴事件的水平滚动轴的值,如果参数异常则返回0.0。 * @since 12 */ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); @@ -153,7 +153,7 @@ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event * @brief 获取当前轴事件的捏合轴缩放的值。 * * @param event 表示指向当前UI输入事件的指针。 - * @return 返回当前轴事件的捏合轴缩放的值。 + * @return 返回当前轴事件的捏合轴缩放的值,如果参数异常则返回0.0。 * @since 12 */ double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); -- Gitee From 98f9a442953f712dd97caf7e3ad61a9b45c41956 Mon Sep 17 00:00:00 2001 From: lzpan Date: Fri, 1 Mar 2024 09:23:53 +0000 Subject: [PATCH 0337/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index bb486687..35cc85c0 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -150,11 +150,11 @@ typedef struct HiDebug_NativeMemInfo { */ typedef struct HiDebug_MemoryLimit { /** - * 应用程序进程驻留集的限制,以KB为单位。 + * 应用程序进程驻留集的限制,以字节为单位。 */ uint64_t rssLimit; /** - * 应用程序进程的虚拟内存限制,以KB为单位。 + * 应用程序进程的虚拟内存限制,以字节为单位。 */ uint64_t vssLimit; } HiDebug_MemoryLimit; -- Gitee From 8f93e4032a226948eb2d2891ee63183b14b71c6a Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Fri, 1 Mar 2024 17:25:34 +0800 Subject: [PATCH 0338/2135] Update docs (0301) Signed-off-by: ester.zhou --- .../ace/native_interface_xcomponent.h | 3 +- en/native_sdk/ace/ui_input_event.h | 31 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/en/native_sdk/ace/native_interface_xcomponent.h b/en/native_sdk/ace/native_interface_xcomponent.h index a23b752b..3cc63e8a 100644 --- a/en/native_sdk/ace/native_interface_xcomponent.h +++ b/en/native_sdk/ace/native_interface_xcomponent.h @@ -620,7 +620,8 @@ int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, * @param component Indicates the pointer to the OH_NativeXComponent instance. * @param callback Indicates the pointer to the UI input event callback. * @param type Indicates the type of the current UI input event. - * @return Returns the status code of the execution. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. * @since 12 */ int32_t OH_NativeXComponent_RegisterUIInputEventCallback( diff --git a/en/native_sdk/ace/ui_input_event.h b/en/native_sdk/ace/ui_input_event.h index 537dbf9a..eb9eac97 100644 --- a/en/native_sdk/ace/ui_input_event.h +++ b/en/native_sdk/ace/ui_input_event.h @@ -63,7 +63,7 @@ enum ArkUI_UIInputEvent_Type { * @brief Obtains the type of this UI input event. * * @param event Indicates the pointer to the current UI input event. - * @return Returns the type of the current UI input event. + * @return Returns the type of the current UI input event; returns 0 if any parameter error occurs. * @since 12 */ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); @@ -72,7 +72,7 @@ int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent *event); * @brief Obtains the time when this UI input event occurs. * * @param event Indicates the pointer to the current UI input event. - * @return Returns the time when the UI input event occurs. + * @return Returns the time when the UI input event occurs; returns 0 if any parameter error occurs. * @since 12 */ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); @@ -82,7 +82,8 @@ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); * input event (such as a touch event, mouse event, or axis event). * * @param event Indicates the pointer to the directional input event. - * @return Returns the X coordinate relative to the upper left corner of the current component. + * @return Returns the X coordinate relative to the upper left corner of the current component; + * returns 0 if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent *event); @@ -92,7 +93,8 @@ float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent *event); * input event (such as a touch event, mouse event, or axis event). * * @param event Indicates the pointer to the UI input event. - * @return Returns the Y coordinate relative to the upper left corner of the current component. + * @return Returns the Y coordinate relative to the upper left corner of the current component; + * returns 0 if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent *event); @@ -102,7 +104,8 @@ float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent *event); * directional input event (such as a touch event, mouse event, or axis event). * * @param event Indicates the pointer to the UI input event. - * @return Returns the X coordinate relative to the upper left corner of the current application window. + * @return Returns the X coordinate relative to the upper left corner of the current application window; + * returns 0 if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent *event); @@ -112,7 +115,8 @@ float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent *event); * directional input event (such as a touch event, mouse event, or axis event). * * @param event Indicates the pointer to the UI input event. - * @return Returns the Y coordinate relative to the upper left corner of the current application window. + * @return Returns the Y coordinate relative to the upper left corner of the current application window; + * returns 0 if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent *event); @@ -122,7 +126,8 @@ float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent *event); * event (such as a touch event, mouse event, or axis event). * * @param event Indicates the pointer to the UI input event. - * @return Returns the X coordinate relative to the upper left corner of the current screen. + * @return Returns the X coordinate relative to the upper left corner of the current screen; + * returns 0 if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent *event); @@ -132,7 +137,8 @@ float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent *event); * event (such as a touch event, mouse event, or axis event). * * @param event Indicates the pointer to the UI input event. - * @return Returns the Y coordinate relative to the upper left corner of the current screen. + * @return Returns the Y coordinate relative to the upper left corner of the current screen; + * returns 0 if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent *event); @@ -141,7 +147,8 @@ float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent *event); * @brief Obtains the value of the vertical scroll axis for this axis event. * * @param event Indicates the pointer to the UI input event. - * @return Returns the value of the vertical scroll axis of the current axis event. + * @return Returns the value of the vertical scroll axis of the current axis event; + * returns 0 if any parameter error occurs. * @since 12 */ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); @@ -150,7 +157,8 @@ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); * @brief Obtains the value of the horizontal scroll axis for this axis event. * * @param event Indicates the pointer to the UI input event. - * @return Returns the value of the horizontal scroll axis of the current axis event. + * @return Returns the value of the horizontal scroll axis of the current axis event; + * returns 0 if any parameter error occurs. * @since 12 */ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); @@ -159,7 +167,8 @@ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event * @brief Obtains the scale value of the pinch axis for this axis event. * * @param event Indicates the pointer to the UI input event. - * @return Returns the scale value of the pinch axis of the current axis event. + * @return Returns the scale value of the pinch axis of the current axis event; + * returns 0 if any parameter error occurs. * @since 12 */ double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); -- Gitee From 6a190e3a55286aeb374fd570b70263faf19bee2c Mon Sep 17 00:00:00 2001 From: yyuanche Date: Fri, 1 Mar 2024 15:14:12 +0800 Subject: [PATCH 0339/2135] =?UTF-8?q?builder=20node=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=88=E5=85=A5=20Signed-off-by:=20yyuanche=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_node_napi.h | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 zh-cn/native_sdk/ace/native_node_napi.h diff --git a/zh-cn/native_sdk/ace/native_node_napi.h b/zh-cn/native_sdk/ace/native_node_napi.h new file mode 100644 index 00000000..50f5da16 --- /dev/null +++ b/zh-cn/native_sdk/ace/native_node_napi.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief Provides UI capabilities of ArkUI on the native side, such as UI component creation and destruction, + * tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_node_napi.h + * + * @brief 提供ArkTS侧的FrameNode转换NodeHandle的方式。 + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_NODE_NAPI_H +#define ARKUI_NATIVE_NODE_NAPI_H + +#include "napi/native_api.h" +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief 获取ArkTS侧创建的FrameNode节点对象映射到native侧的ArkUI_NodeHandle。 + * + * @param env napi的环境指针。 + * @param frameNode ArkTS侧创建的FrameNode对象。 + * @param handle ArkUI_NodeHandle指针。 + * @return 0 - 成功。 + * 401 - 函数参数异常。 + * @since 12 + */ +int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value frameNode, ArkUI_NodeHandle* handle); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_NODE_NAPI_H +/** @} */ \ No newline at end of file -- Gitee From d7a9a07857346b3f1246226068d5eb055fe2199d Mon Sep 17 00:00:00 2001 From: lzpan Date: Sat, 2 Mar 2024 01:36:23 +0000 Subject: [PATCH 0340/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index 35cc85c0..bb486687 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -150,11 +150,11 @@ typedef struct HiDebug_NativeMemInfo { */ typedef struct HiDebug_MemoryLimit { /** - * 应用程序进程驻留集的限制,以字节为单位。 + * 应用程序进程驻留集的限制,以KB为单位。 */ uint64_t rssLimit; /** - * 应用程序进程的虚拟内存限制,以字节为单位。 + * 应用程序进程的虚拟内存限制,以KB为单位。 */ uint64_t vssLimit; } HiDebug_MemoryLimit; -- Gitee From 06cb44ff9b8c8486767c68e123c7f99ee96e55e1 Mon Sep 17 00:00:00 2001 From: lzpan Date: Sat, 2 Mar 2024 01:45:53 +0000 Subject: [PATCH 0341/2135] update zh-cn/native_sdk/dfx/hidebug.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug.h | 1 - 1 file changed, 1 deletion(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index 1f8acc71..d72cd468 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -23,7 +23,6 @@ * * 例如,你可以使用这些函数来获取 cpu uage、memory、heap、capture trace等。 * - * * @since 12 */ -- Gitee From 88aba0a31b1f4538bbcff3cd283a2b714af6e2f1 Mon Sep 17 00:00:00 2001 From: lzpan Date: Sat, 2 Mar 2024 01:47:17 +0000 Subject: [PATCH 0342/2135] update zh-cn/native_sdk/dfx/hidebug.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index d72cd468..0a2b5931 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -103,7 +103,7 @@ void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit); * @brief 启动应用trace采集。 * * @param flag 捕获线程trace方式。 - * @param tags 捕获trace场景标志。 + * @param tags 捕获trace场景标签。 * @param limitSize trace文件的最大大小(以字节为单位),最大为 500MB。 * @param fileName 输出trace文件名缓冲区。 * @param length 输出trace文件名缓冲区长度。 -- Gitee From ad10fcf6d489543dde248da2b447d3333257972d Mon Sep 17 00:00:00 2001 From: lzpan Date: Sat, 2 Mar 2024 01:49:50 +0000 Subject: [PATCH 0343/2135] update zh-cn/native_sdk/dfx/hidebug.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index 0a2b5931..3ae63cd7 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -102,8 +102,8 @@ void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit); /** * @brief 启动应用trace采集。 * - * @param flag 捕获线程trace方式。 - * @param tags 捕获trace场景标签。 + * @param flag 采集线程trace方式。 + * @param tags 采集trace场景标签。 * @param limitSize trace文件的最大大小(以字节为单位),最大为 500MB。 * @param fileName 输出trace文件名缓冲区。 * @param length 输出trace文件名缓冲区长度。 @@ -114,7 +114,7 @@ HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(HiDebug_TraceFlag flag, uint64 char* fileName, uint32_t length); /** - * @brief 停止捕获应用程序trace。 + * @brief 停止采集应用程序trace。 * * @return 如果成功返回{@code HIDEBUG_SUCCESS},见{@link HiDebug_ErrorCode}。 * @since 12 -- Gitee From 4a2cac04be0005e615582be6737c3c4208d8939b Mon Sep 17 00:00:00 2001 From: shaoshuai Date: Mon, 4 Mar 2024 11:38:52 +0800 Subject: [PATCH 0344/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: shaoshuai --- zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h | 30 ++++++++-------- .../native_sdk/ark_runtime/jsvm/jsvm_types.h | 35 ++++++++++--------- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h index 139348d4..4176559c 100644 --- a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h +++ b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm.h @@ -2067,10 +2067,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetHeapStatistics(JSVM_VM vm, JSVM_HeapStatistics* result); /** - * @brief 创建并启动一个CPU分析器。 + * @brief 创建并启动一个CPU profiler。 * * @param vm 启动CPU profiler的虚拟机。 - * @param result 指向CPU分析器的指针。 + * @param result 指向CPU profiler的指针。 * @return 成功则返回JSVM_OK。 * @since 12 */ @@ -2078,12 +2078,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_StartCpuProfiler(JSVM_VM vm, JSVM_CpuProfiler* result); /** - * @brief 停止CPU分析器并将结果输出到流。 + * @brief 停止CPU profiler并将结果输出到流。 * * @param vm 启动CPU profiler的虚拟机。 - * @param profiler 要停止的CPU分析器。 + * @param profiler 要停止的CPU profiler。 * @param stream 接收数据的输出流回调。 - * @param streamData 可选的数据传递到流回调。 + * @param streamData 传递给输出流回调的可选数据。例如,可以是一个文件流,用来将输出流回调中传递的采样数据写入文件。 * @return 成功则返回JSVM_OK。 * @since 12 */ @@ -2095,9 +2095,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_StopCpuProfiler(JSVM_VM vm, /** * @brief 获取当前堆快照并将其输出到流。 * - * @param vm 已创建堆快照的虚拟机。 + * @param vm 将被获取堆快照的虚拟机。 * @param stream 接收数据的输出流回调。 - * @param streamData 可选的数据传递到流回调。 + * @param streamData 传递给输出流回调的可选数据。例如,可以是一个文件流,用来将输出流回调中传递的采样数据写入文件。 * @return 成功则返回JSVM_OK。 * @since 12 */ @@ -2106,12 +2106,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_TakeHeapSnapshot(JSVM_VM vm, void* streamData); /** - * @brief 在主机和端口上激活检测器。 + * @brief 在指定的主机和端口上激活inspector,将用来调试JS代码。 * * @param env 调用JSVM-API的环境。 - * @param host 要监听检查器连接的主机。 - * @param port 要监听检查器连接的端口。 - * @return 成功则返回JSVM_OK。 + * @param host 要监听inspector连接的主机IP地址。 + * @param port 要监听inspector连接的端口。 + * @return 成功则返回JSVM_OK。失败则则可能返回xxx。 * @since 12 */ JSVM_EXTERN JSVM_Status OH_JSVM_OpenInspector(JSVM_Env env, @@ -2119,7 +2119,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenInspector(JSVM_Env env, uint16_t port); /** - * @brief 试图关闭所有剩余的检查器连接。 + * @brief 尝试关闭剩余的所有inspector连接。 * * @param env 调用JSVM-API的环境。 * @return 成功则返回JSVM_OK。 @@ -2128,12 +2128,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenInspector(JSVM_Env env, JSVM_EXTERN JSVM_Status OH_JSVM_CloseInspector(JSVM_Env env); /** - * @brief 将阻塞,直到客户端(已存在或稍后连接) + * @brief 等待主机与inspector建立socket连接,连接建立后程序将继续运行。 * 发送Runtime.runIfWaitingForDebugger命令。 * * @param env 调用JSVM-API的环境。 - * @param breakNextLine 是否在下一行JavaScript代码中中断。 - * @return 成功则返回JSVM_OK。 + * @param breakNextLine 是否在下一行JavaScript代码中中断。传递“是”,后续将暂停在运行下一行JS代码时,继续运行需要开发者通过调试器的调试按钮控制JS的执行。 + * @return 成功则返回JSVM_OK。失败则则可能返回xxx。 * @since 12 */ JSVM_EXTERN JSVM_Status OH_JSVM_WaitForDebugger(JSVM_Env env, diff --git a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h index 2fd18bd7..4c2c87f9 100644 --- a/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h +++ b/zh-cn/native_sdk/ark_runtime/jsvm/jsvm_types.h @@ -94,7 +94,7 @@ typedef struct JSVM_Script__* JSVM_Script; typedef struct JSVM_Env__* JSVM_Env; /** - * @brief 表示一个JavaScript分析器。 + * @brief 表示一个JavaScript CPU时间性能分析器。 * * @since 12 */ @@ -178,7 +178,9 @@ typedef void(JSVM_CDECL* JSVM_Finalize)(JSVM_Env env, void* finalizeHint); /** - * @brief ASCII输出流回调的函数指针类型。 + * @brief ASCII输出流回调的函数指针类型。第一个参数是要输出的数据指针。第二个参数是要输出的数据大小。 + * 空数据指针指示流的结尾。第三个参数是与回调一起传递给API函数的指针,该API函数向输出流生成数据。回 + * 调返回true表示流可以继续接受数据。否则,它将中止流。 * * @since 12 */ @@ -381,37 +383,36 @@ typedef enum { } JSVM_MemoryPressureLevel; /** - * @brief Heapstatisics对象。用于获取有关JavaScript - * 堆内存使用情况的统计信息。 + * @brief Heapstatisics结构体,用于保存有关JavaScript堆内存使用情况的统计信息。 * * @since 12 */ typedef struct { - /** 堆的总大小。 */ + /** 一个数字,表示总堆大小。 */ size_t totalHeapSize; - /** 堆的总可执行大小。 */ + /** 一个数字,表示可执行堆的总大小。 */ size_t totalHeapSizeExecutable; - /** 堆的总物理大小。 */ + /** 一个数字,表示总的物理大小。 */ size_t totalPhysicalSize; - /** 堆的总可用大小。 */ + /** 一个数字,表示总可用大小。 */ size_t totalAvailableSize; - /** 已使用的堆大小。 */ + /** 一个数字,表示已用堆大小。 */ size_t usedHeapSize; - /** 堆大小限制。 */ + /** 一个数字,表示堆大小限制。 */ size_t heapSizeLimit; - /** 堆请求的内存。 */ + /** 一个数字,表示已分配的内存。 */ size_t mallocedMemory; - /** 堆请求的外部内存。 */ + /** 一个数字,表示堆请求的外部内存。 */ size_t externalMemory; - /** 堆请求的峰值内存。 */ + /** 一个数字,表示最大分配的内存。 */ size_t peakMallocedMemory; - /** 本机上下文的数量。 */ + /** 一个数字,表示许多本机上下文或当前活动的顶级上下文。内存泄漏可能通过测量该数字随时间的增量来指示。 */ size_t numberOfNativeContexts; - /** 分离上下文的数量。 */ + /** 一个数字,表示多个分离的上下文或已分离但尚未进行垃圾回收的上下文。如果内存泄漏值为非零值,则可能表明该错误。 */ size_t numberOfDetachedContexts; - /** 总全局句柄的大小。 */ + /** 一个数字,表示总全局句柄的大小。 */ size_t totalGlobalHandlesSize; - /** 使用的全局句柄的大小。 */ + /** 一个数字,表示已用的全局句柄的大小。 */ size_t usedGlobalHandlesSize; } JSVM_HeapStatistics; -- Gitee From 4e6cf7051105fc2e7b2443225d3dff6254f94dfd Mon Sep 17 00:00:00 2001 From: zhouchaobo Date: Mon, 4 Mar 2024 11:45:42 +0800 Subject: [PATCH 0345/2135] onTouchIntercept native interface Signed-off-by: zhouchaobo --- zh-cn/native_sdk/ace/native_event.h | 19 +++++++++++++++++++ .../ace/native_interface_xcomponent.h | 13 +++++++++++++ 2 files changed, 32 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_event.h b/zh-cn/native_sdk/ace/native_event.h index 5c01fde5..255e03af 100644 --- a/zh-cn/native_sdk/ace/native_event.h +++ b/zh-cn/native_sdk/ace/native_event.h @@ -216,6 +216,25 @@ typedef struct { bool preventDefault; } ArkUI_NodeTouchEvent; +/** + * @brief 定义触摸测试类型的枚举值。 + * + * @since 12 + */ +typedef enum { + /** 默认触摸测试效果,自身和子节点都响应触摸测试,但会阻塞兄弟节点的触摸测试。 */ + HTMDEFAULT = 0, + + /** 自身响应触摸测试,阻塞子节点和兄弟节点的触摸测试。 */ + HTMBLOCK, + + /** 自身和子节点都响应触摸测试,不会阻塞兄弟节点的触摸测试。 */ + HTMTRANSPARENT, + + /** 自身不响应触摸测试,不会阻塞子节点和兄弟节点的触摸测试。 */ + HTMNONE, +} HitTestMode; + #ifdef __cplusplus }; #endif diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index 7f897ab1..be38e330 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -39,6 +39,7 @@ #include #include +#include "arkui/native_event.h" #include "arkui/native_type.h" #include "arkui/ui_input_event.h" @@ -622,6 +623,18 @@ int32_t OH_NativeXComponent_RegisterUIInputEventCallback( ArkUI_UIInputEvent_Type type), ArkUI_UIInputEvent_Type type); +/** + * @brief 为此OH_NativeXComponent实例注册自定义事件拦截回调,并使能在做触摸测试时回调此函数。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param callback 指示指向自定义事件拦截回调的指针。 + * @return 0 - 成功。 + * 401 - 参数异常。 + * @since 12 + */ +int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback( + OH_NativeXComponent* component, HitTestMode (*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event)); + #ifdef __cplusplus }; #endif -- Gitee From a1f436ba42f19fc8ca870059b645fce51e829e1e Mon Sep 17 00:00:00 2001 From: lzpan Date: Mon, 4 Mar 2024 06:00:32 +0000 Subject: [PATCH 0346/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index bb486687..78e0f819 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -134,7 +134,7 @@ typedef struct HiDebug_NativeMemInfo { */ uint32_t privateDirty; /** - *共享干净内存的大小,以KB为单位。 + * 共享干净内存的大小,以KB为单位。 */ uint32_t sharedClean; /** -- Gitee From 7be2effba3dbd82d81b937a91bf4d76879097311 Mon Sep 17 00:00:00 2001 From: lzpan Date: Mon, 4 Mar 2024 06:34:16 +0000 Subject: [PATCH 0347/2135] update zh-cn/native_sdk/dfx/hidebug.h. Signed-off-by: lzpan --- zh-cn/native_sdk/dfx/hidebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index 3ae63cd7..3d14c8e6 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -22,7 +22,7 @@ * @brief 提供调试功能。 * * 例如,你可以使用这些函数来获取 cpu uage、memory、heap、capture trace等。 - * + * * @since 12 */ -- Gitee From 714129220919b438aaf44339a7d77ab8cb87da08 Mon Sep 17 00:00:00 2001 From: lzpan Date: Mon, 4 Mar 2024 07:27:17 +0000 Subject: [PATCH 0348/2135] update zh-cn/native_sdk/dfx/hidebug_type.h. Signed-off-by: lzpan Signed-off-by: p30054102 --- zh-cn/native_sdk/dfx/hidebug_type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index 78e0f819..9cd186cb 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -21,7 +21,7 @@ * * @brief 提供调试代码的定义。 * - * 例如,你可以使用这些函数来获取cpu uage、memory、heap、capture trace等。 + * 本模块函数可用于获取cpu uage、memory、heap、capture trace等。 * * @since 12 */ -- Gitee From d3a1a335bd57119d80bc091e82c97529fec95da8 Mon Sep 17 00:00:00 2001 From: p30054102 Date: Mon, 4 Mar 2024 15:47:02 +0800 Subject: [PATCH 0349/2135] 1 Signed-off-by: p30054102 --- zh-cn/native_sdk/dfx/hidebug.h | 10 ++++++---- zh-cn/native_sdk/dfx/hidebug_type.h | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index 3d14c8e6..b08ecfd5 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -21,7 +21,7 @@ * * @brief 提供调试功能。 * - * 例如,你可以使用这些函数来获取 cpu uage、memory、heap、capture trace等。 + * 本模块函数可用于获取 cpu uage、memory、heap、capture trace等。 * * @since 12 */ @@ -29,7 +29,7 @@ /** * @file hideug.h * - * @brief 定义 HiDebug 模块的调试功能。 + * @brief 定义HiDebug模块的调试功能。 * * @library libohhidebug.so * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug @@ -44,9 +44,9 @@ extern "C" { #endif /** - * @brief 获取系统的CPU资源占用情况。 + * @brief 获取系统的CPU资源占用情况百分比。 * - * @return 返回系统CPU资源占用情况。 + * @return 返回系统CPU资源占用情况百分比。 * @since 12 */ double OH_HiDebug_GetSystemCpuUsage(); @@ -124,4 +124,6 @@ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); #ifdef __cplusplus } #endif +/** @} */ + #endif // HIVIEWDFX_HIDEBUG_H \ No newline at end of file diff --git a/zh-cn/native_sdk/dfx/hidebug_type.h b/zh-cn/native_sdk/dfx/hidebug_type.h index 9cd186cb..dc16ed04 100644 --- a/zh-cn/native_sdk/dfx/hidebug_type.h +++ b/zh-cn/native_sdk/dfx/hidebug_type.h @@ -71,7 +71,7 @@ typedef struct HiDebug_ThreadCpuUsage { */ uint32_t threadId; /** - * 线程CPU使用率。 + * 线程CPU使用率百分比。 */ double cpuUsage; /** @@ -269,7 +269,7 @@ typedef enum HiDebug_TraceFlag { * * @since 12 */ -#define #define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39) +#define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39) /** * @brief 通知模块标签。 * @@ -367,4 +367,6 @@ typedef enum HiDebug_TraceFlag { */ #define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60) +/** @} */ + #endif // HIVIEWDFX_HIDEBUG_TYPE_H \ No newline at end of file -- Gitee From 7d6ebe9d5ef65e8b292c57d9379dfa9472eeec70 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Mon, 4 Mar 2024 16:31:30 +0800 Subject: [PATCH 0350/2135] Update docs (0304) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_event.h | 23 +++++++ .../ace/native_interface_xcomponent.h | 21 +++++- en/native_sdk/ace/native_node_napi.h | 64 +++++++++++++++++++ en/native_sdk/ace/ui_input_event.h | 20 +++--- 4 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 en/native_sdk/ace/native_node_napi.h diff --git a/en/native_sdk/ace/native_event.h b/en/native_sdk/ace/native_event.h index 923e78f5..a7696dd2 100644 --- a/en/native_sdk/ace/native_event.h +++ b/en/native_sdk/ace/native_event.h @@ -225,6 +225,29 @@ typedef struct { bool preventDefault; } ArkUI_NodeTouchEvent; +/** + * @brief Enumerates the hit test modes. + * + * @since 12 + */ +typedef enum { + /** Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from + * the hit test. */ + HTMDEFAULT = 0, + + /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit + * test. */ + HTMBLOCK, + + /** Both the node and its child node respond to the hit test of a touch event, and its sibling node is also + * considered during the hit test. */ + HTMTRANSPARENT, + + /** The node does not respond to the hit test of a touch event, but its child node and sibling node are considered + * during the hit test. */ + HTMNONE, +} HitTestMode; + #ifdef __cplusplus }; #endif diff --git a/en/native_sdk/ace/native_interface_xcomponent.h b/en/native_sdk/ace/native_interface_xcomponent.h index 3cc63e8a..a305f8bc 100644 --- a/en/native_sdk/ace/native_interface_xcomponent.h +++ b/en/native_sdk/ace/native_interface_xcomponent.h @@ -40,6 +40,7 @@ #include #include +#include "arkui/native_event.h" #include "arkui/native_type.h" #include "arkui/ui_input_event.h" @@ -595,7 +596,7 @@ int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* compo * @param component Indicates the pointer to the OH_NativeXComponent instance. * @param root Indicates the pointer to the component instance created by the native API. * @return Returns 0 if success. - * Returns 401 if a parameter exception occurs. + * Returns 401 if a parameter exception occurs. * * @since 12 */ @@ -607,7 +608,7 @@ int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, * @param component Indicates the pointer to the OH_NativeXComponent instance. * @param root Indicates the pointer to the component instance created by the native API. * @return Returns 0 if success. - * Returns 401 if a parameter exception occurs. + * Returns 401 if a parameter exception occurs. * * @since 12 */ @@ -621,7 +622,8 @@ int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, * @param callback Indicates the pointer to the UI input event callback. * @param type Indicates the type of the current UI input event. * @return Returns 0 if success. - * Returns 401 if a parameter exception occurs. + * Returns 401 if a parameter exception occurs. + * * @since 12 */ int32_t OH_NativeXComponent_RegisterUIInputEventCallback( @@ -630,6 +632,19 @@ int32_t OH_NativeXComponent_RegisterUIInputEventCallback( ArkUI_UIInputEvent_Type type), ArkUI_UIInputEvent_Type type); +/** + * @brief Registers a custom event intercept callback for this OH_NativeXComponent and enables the callback + * during the hit test. + * + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param callback Indicates the pointer to the custom event intercept callback. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback( + OH_NativeXComponent* component, HitTestMode (*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event)); + #ifdef __cplusplus }; #endif diff --git a/en/native_sdk/ace/native_node_napi.h b/en/native_sdk/ace/native_node_napi.h new file mode 100644 index 00000000..cc219bd5 --- /dev/null +++ b/en/native_sdk/ace/native_node_napi.h @@ -0,0 +1,64 @@ +/* + * 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 UI capabilities of ArkUI on the native side, such as UI component creation and destruction, + * tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_node_napi.h + * + * @brief Declares APIs for converting FrameNode objects on the ArkTS side to ArkUI_NodeHandle objects on + * the native side. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_NODE_NAPI_H +#define ARKUI_NATIVE_NODE_NAPI_H + +#include "napi/native_api.h" +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief Obtains a FrameNode object on the ArkTS side and maps it to an ArkUI_NodeHandle object on the + * native side. + * + * @param env Indicates the NAPI environment pointer. + * @param frameNode Indicates the FrameNode object created on the ArkTS side. + * @param handle Indicates the pointer to the ArkUI_NodeHandle object. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value frameNode, ArkUI_NodeHandle* handle); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_NODE_NAPI_H +/** @} */ diff --git a/en/native_sdk/ace/ui_input_event.h b/en/native_sdk/ace/ui_input_event.h index eb9eac97..8ceb1086 100644 --- a/en/native_sdk/ace/ui_input_event.h +++ b/en/native_sdk/ace/ui_input_event.h @@ -81,9 +81,9 @@ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent *event); * @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). * - * @param event Indicates the pointer to the directional input event. + * @param event Indicates the pointer to the UI input event. * @return Returns the X coordinate relative to the upper left corner of the current component; - * returns 0 if any parameter error occurs. + * returns 0.0f if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent *event); @@ -94,7 +94,7 @@ float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent *event); * * @param event Indicates the pointer to the UI input event. * @return Returns the Y coordinate relative to the upper left corner of the current component; - * returns 0 if any parameter error occurs. + * returns 0.0f if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent *event); @@ -105,7 +105,7 @@ float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent *event); * * @param event Indicates the pointer to the UI input event. * @return Returns the X coordinate relative to the upper left corner of the current application window; - * returns 0 if any parameter error occurs. + * returns 0.0f if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent *event); @@ -116,7 +116,7 @@ float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent *event); * * @param event Indicates the pointer to the UI input event. * @return Returns the Y coordinate relative to the upper left corner of the current application window; - * returns 0 if any parameter error occurs. + * returns 0.0f if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent *event); @@ -127,7 +127,7 @@ float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent *event); * * @param event Indicates the pointer to the UI input event. * @return Returns the X coordinate relative to the upper left corner of the current screen; - * returns 0 if any parameter error occurs. + * returns 0.0f if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent *event); @@ -138,7 +138,7 @@ float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent *event); * * @param event Indicates the pointer to the UI input event. * @return Returns the Y coordinate relative to the upper left corner of the current screen; - * returns 0 if any parameter error occurs. + * returns 0.0f if any parameter error occurs. * @since 12 */ float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent *event); @@ -148,7 +148,7 @@ float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent *event); * * @param event Indicates the pointer to the UI input event. * @return Returns the value of the vertical scroll axis of the current axis event; - * returns 0 if any parameter error occurs. + * returns 0.0 if any parameter error occurs. * @since 12 */ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); @@ -158,7 +158,7 @@ double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent *event); * * @param event Indicates the pointer to the UI input event. * @return Returns the value of the horizontal scroll axis of the current axis event; - * returns 0 if any parameter error occurs. + * returns 0.0 if any parameter error occurs. * @since 12 */ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event); @@ -168,7 +168,7 @@ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent *event * * @param event Indicates the pointer to the UI input event. * @return Returns the scale value of the pinch axis of the current axis event; - * returns 0 if any parameter error occurs. + * returns 0.0 if any parameter error occurs. * @since 12 */ double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent *event); -- Gitee From 2d816a36073b52c98cfd7ac9ac891f2b6f86910b Mon Sep 17 00:00:00 2001 From: sunbees Date: Tue, 5 Mar 2024 22:52:00 +0800 Subject: [PATCH 0351/2135] add OH_NativeXComponent_SetNeedSoftKeyboard Signed-off-by: sunbees --- zh-cn/native_sdk/ace/native_interface_xcomponent.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index be38e330..babcc043 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -635,6 +635,16 @@ int32_t OH_NativeXComponent_RegisterUIInputEventCallback( int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback( OH_NativeXComponent* component, HitTestMode (*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event)); +/** + * @brief 为此OH_NativeXComponent实例设置是否需要软键盘。 + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param needSoftKeyboard 表示此OH_NativeXComponent实例是否需要软键盘。 + * @return 返回执行的状态代码。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool needSoftKeyboard); + #ifdef __cplusplus }; #endif -- Gitee From 772cb4a0140d97f9659ce5ff5be22911eef0bdb4 Mon Sep 17 00:00:00 2001 From: m00472246 Date: Tue, 5 Mar 2024 19:30:06 +0800 Subject: [PATCH 0352/2135] =?UTF-8?q?OH=5FNativeWindow=5FNativeWindowAttac?= =?UTF-8?q?hBuffer=E8=B5=84=E6=96=99=E5=A2=9E=E5=8A=A0=20Signed-off-by:=20?= =?UTF-8?q?m00472246=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: m00472246 --- zh-cn/native_sdk/graphic/external_window.h | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/zh-cn/native_sdk/graphic/external_window.h b/zh-cn/native_sdk/graphic/external_window.h index d940e423..df575d84 100644 --- a/zh-cn/native_sdk/graphic/external_window.h +++ b/zh-cn/native_sdk/graphic/external_window.h @@ -194,6 +194,13 @@ enum NativeWindowOperation { * [输入] uint64_t uiTimestamp。 */ SET_UI_TIMESTAMP, + /** + * 获取内存队列大小, + * 函数中的可变参数是 + * [输出] int32_t *size. + * @since 12 + */ + GET_BUFFERQUEUE_SIZE, }; /** @@ -493,6 +500,30 @@ int32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint3 */ int32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, const OHExtDataHandle *handle); +/** + * @brief 将OHNativeWindowBuffer添加进OHNativeWindow中。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针。 + * @return 返回值为0表示执行成功。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_NativeWindowAttachBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); + +/** + * @brief 将OHNativeWindowBuffer从OHNativeWindow中分离。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window 一个OHNativeWindow的结构体实例的指针。 + * @param buffer 一个OHNativeWindowBuffer的结构体实例的指针。 + * @return 返回值为0表示执行成功。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_NativeWindowDetachBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); + /** * @brief 通过OHNativeWindow获取对应的surfaceId。 * -- Gitee From 8ae47c69daefd677f12afc08928f38670fd7755e Mon Sep 17 00:00:00 2001 From: p30054102 Date: Wed, 6 Mar 2024 09:35:36 +0800 Subject: [PATCH 0353/2135] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: p30054102 --- zh-cn/native_sdk/dfx/hidebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/dfx/hidebug.h b/zh-cn/native_sdk/dfx/hidebug.h index b08ecfd5..eacdc710 100644 --- a/zh-cn/native_sdk/dfx/hidebug.h +++ b/zh-cn/native_sdk/dfx/hidebug.h @@ -68,7 +68,7 @@ double OH_HiDebug_GetAppCpuUsage(); HiDebug_ThreadCpuUsagePtr OH_HiDebug_GetAppThreadCpuUsage(); /** - * @brief 获取应用程序所有线程的可用CPU使用缓冲区。 + * @brief 释放线程数据结构。 * * @param threadCpuUsage 应用的所有线程可用CPU使用缓冲区指针,见{@link HiDebug_ThreadCpuUsagePtr}。 * @since 12 -- Gitee From ffabbd81114ca54c274404eac2d7a8bbb0ed1c9a Mon Sep 17 00:00:00 2001 From: yangguangzhao Date: Tue, 5 Mar 2024 19:10:34 +0800 Subject: [PATCH 0354/2135] add native arkweb api Signed-off-by: yangguangzhao --- zh-cn/native_sdk/web/arkweb_interface.h | 77 +++++++++++ zh-cn/native_sdk/web/arkweb_type.h | 176 ++++++++++++++++++++++++ 2 files changed, 253 insertions(+) create mode 100644 zh-cn/native_sdk/web/arkweb_interface.h create mode 100644 zh-cn/native_sdk/web/arkweb_type.h diff --git a/zh-cn/native_sdk/web/arkweb_interface.h b/zh-cn/native_sdk/web/arkweb_interface.h new file mode 100644 index 00000000..4b9e2ce0 --- /dev/null +++ b/zh-cn/native_sdk/web/arkweb_interface.h @@ -0,0 +1,77 @@ +/* + * 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 Web + * @{ + * + * @brief 提供ArkWeb在Native侧的能力,如网页刷新、执行JavaScript、注册回调等。 + * @since 12 + */ +/** + * @file arkweb_interface.h + * + * @brief 提供ArkWeb在Native侧获取API的接口,及基础Native API类型。 + * @library libohweb.so + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + +#ifndef ARKWEB_INTERFACE_H +#define ARKWEB_INTERFACE_H + +#include "arkweb_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 定义基础Native API类型。 + * + * @since 12 + */ +typedef struct { + /** 结构体对应的大小。 */ + size_t size; +} ArkWeb_AnyNativeAPI; + +/** + * @brief 定义Native API的类型枚举。 + * + * @since 12 + */ +typedef enum { + /** component相关API类型。 */ + ARKWEB_NATIVE_COMPONENT, + /** controller相关API类型。 */ + ARKWEB_NATIVE_CONTROLLER, +} ArkWeb_NativeAPIVariantKind; + +/* + * @brief 根据传入的API类型,获取对应的Native API结构体。 + * @param type ArkWeb支持的Native API类型。 + * @return 根据传入的API类型,返回对应的Native API结构体指针,结构体第一个成员为当前结构体的大小。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +ArkWeb_AnyNativeAPI* OH_ArkWeb_GetNativeAPI(ArkWeb_NativeAPIVariantKind type); + +#ifdef __cplusplus +}; +#endif +#endif // ARKWEB_INTERFACE_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/web/arkweb_type.h b/zh-cn/native_sdk/web/arkweb_type.h new file mode 100644 index 00000000..506c5235 --- /dev/null +++ b/zh-cn/native_sdk/web/arkweb_type.h @@ -0,0 +1,176 @@ +/* + * 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 Web + * @{ + * + * @brief 提供ArkWeb在Native侧的能力,如网页刷新、执行JavaScript、注册回调等。 + * @since 12 + */ +/** + * @file arkweb_type.h + * + * @brief 提供ArkWeb在Native侧的公共类型定义。 + * @library libohweb.so + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + +#ifndef ARKWEB_TYPE_H +#define ARKWEB_TYPE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 定义JavaScript Bridge数据的基础结构。 + * + * @since 12 + */ +typedef struct { + /** 指向传输数据的指针。仅支持前端传入String和ArrayBuffer类型,其余类型会被json序列化后,以String类型传递。 */ + const uint8_t* buffer; + /** 传输数据的长度。 */ + size_t size; +} ArkWeb_JavaScriptBridgeData; + +/** + * @brief 注入的JavaScript执行完成的回调。 + * + * @since 12 + */ +typedef void (*ArkWeb_OnJavaScriptCallback)( + const char* webTag, const ArkWeb_JavaScriptBridgeData* data, void* userData); + +/** + * @brief Proxy方法被执行的回调。 + * + * @since 12 + */ +typedef void (*ArkWeb_OnJavaScriptProxyCallback)( + const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData); + +/** + * @brief 组件事件通知相关的通用回调。 + * + * @since 12 + */ +typedef void (*ArkWeb_OnComponentCallback)(const char* webTag, void* userData); + +/** + * @brief 注入的JavaScript结构体。 + * + * @since 12 + */ +typedef struct { + /** 注入的JavaScript代码。 */ + const uint8_t* buffer; + /** JavaScript代码长度。 */ + size_t size; + /** JavaScript执行完成的回调。 */ + ArkWeb_OnJavaScriptCallback callback; + /** 需要在回调中携带的自定义数据。 */ + void* userData; +} ArkWeb_JavaScriptObject; + +/** + * @brief 注入的Proxy方法通用结构体。 + * + * @since 12 + */ +typedef struct { + /** 注入的方法名。 */ + const char* methodName; + /** Proxy方法执行的回调。 */ + ArkWeb_OnJavaScriptProxyCallback callback; + /** 需要在回调中携带的自定义数据。 */ + void* userData; +} ArkWeb_ProxyMethod; + +/** + * @brief 注入的Proxy对象通用结构体。 + * + * @since 12 + */ +typedef struct { + /** 注入的对象名。 */ + const char* objName; + /** 注入的对象携带的方法结构体数组。 */ + const ArkWeb_ProxyMethod* methodList; + /** 方法结构体数组的长度。 */ + size_t size; +} ArkWeb_ProxyObject; + +/** + * @brief Controller相关的Native API结构体。 + * + * @since 12 + */ +typedef struct { + /** 结构体的大小。 */ + size_t size; + /** 注入JavaScript脚本。 */ + void (*runJavaScript)(const char* webTag, const ArkWeb_JavaScriptObject* javascriptObject); + /** 注入JavaScript对象到window对象中,并在window对象中调用该对象的方法。 */ + void (*registerJavaScriptProxy)(const char* webTag, const ArkWeb_ProxyObject* proxyObject); + /** 删除通过registerJavaScriptProxy注册到window上的指定name的应用侧JavaScript对象。 */ + void (*deleteJavaScriptRegister)(const char* webTag, const char* objName); + /** 刷新当前网页。 */ + void (*refresh)(const char* webTag); +} ArkWeb_ControllerAPI; + +/** + * @brief Component相关的Native API结构体。 + * + * @since 12 + */ +typedef struct { + /** 结构体的大小。 */ + size_t size; + /** 当Controller成功绑定到Web组件时触发该回调。 */ + void (*onControllerAttached)(const char* webTag, ArkWeb_OnComponentCallback callback, void* userData); + /** 网页开始加载时触发该回调,且只在主frame触发,iframe或者frameset的内容加载时不会触发此回调。 */ + void (*onPageBegin)(const char* webTag, ArkWeb_OnComponentCallback callback, void* userData); + /** 网页加载完成时触发该回调,且只在主frame触发。 */ + void (*onPageEnd)(const char* webTag, ArkWeb_OnComponentCallback callback, void* userData); + /** 当前Web组件销毁时触发该回调。 */ + void (*onDestroy)(const char* webTag, ArkWeb_OnComponentCallback callback, void* userData); +} ArkWeb_ComponentAPI; + +/** + * @brief 检查结构体中是否存在该成员变量。 + * + * @since 12 + */ +#define ARKWEB_MEMBER_EXISTS(s, f) \ + ((intptr_t) & ((s)->f) - (intptr_t)(s) + sizeof((s)->f) <= *reinterpret_cast(s)) + +/** + * @brief 当前结构体存在该成员变量则返回false,否则返回true。 + * + * @since 12 + */ +#define ARKWEB_MEMBER_MISSING(s, f) (!ARKWEB_MEMBER_EXISTS(s, f) || !((s)->f)) + +#ifdef __cplusplus +}; +#endif +#endif // ARKWEB_TYPE_H +/** @} */ \ No newline at end of file -- Gitee From 28cff5423ae501cebe667b600256a3918b591ed6 Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Wed, 6 Mar 2024 10:06:56 +0800 Subject: [PATCH 0355/2135] =?UTF-8?q?fix=20NDK=20C-API=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9EAPI=20Signed-off-by:=20liyi0309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_node.h | 153 +++++++++++++++++++++++++++++ zh-cn/native_sdk/ace/native_type.h | 73 ++++++++++++++ 2 files changed, 226 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 4668ecd6..130c5763 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -756,6 +756,17 @@ typedef enum { * */ NODE_TRANSLATE_TRANSITION, + /** + * @brief 转场时从屏幕边缘滑入和滑出的效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * value[0].i32 参数类型{@link ArkUI_TransitionEdge} \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * value[0].i32 参数类型{@link ArkUI_TransitionEdge} \n + * + */ + NODE_MOVE_TRANSITION, /** * @brief 获焦属性,支持属性设置,属性重置和属性获取。 @@ -1240,6 +1251,17 @@ typedef enum { * */ NODE_FOCUS_STATUS, + /** + * @brief 设置组件的宽高比,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:组件的宽高比,输入值为 width/height。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].f32:组件的宽高比,width/height的比值。 \n + * + */ + NODE_ASPECT_RATIO, /** * @brief text组件设置文本内容属性,支持属性设置,属性重置,属性获取接口。 @@ -1494,6 +1516,28 @@ typedef enum { * */ NODE_TEXT_INDENT, + /** + * @brief 文本断行规则属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 参数类型{@link ArkUI_WordBreak}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 参数类型{@link ArkUI_WordBreak}。\n + * + */ + NODE_TEXT_WORD_BREAK, + /** + * @brief 设置文本省略位置,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 参数类型{@link ArkUI_EllipsisMode}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32: 参数类型{@link ArkUI_EllipsisMode}。\n + * + */ + NODE_TEXT_ELLIPSIS_MODE, /** * @brief 文本内容属性,支持属性设置,属性重置,属性获取接口。 * @@ -1505,6 +1549,27 @@ typedef enum { * */ NODE_SPAN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SPAN, + /** + * @brief 文本背景色属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32 表示文本背景颜色,0xargb格式,形如0xFFFF0000 表示红色。\n + * 第二个参数为文本背景圆角设置,支持如下两种设置方式:\n + * 1:.value[1].f32:四个方向的圆角半径统一设置,单位为vp。\n + * 2: .value[1].f32:设置左上角圆角半径,单位为vp。 \n + * .value[2].f32:设置右上角圆角半径,单位为vp。 \n + * .value[3].f32:设置左下角圆角半径,单位为vp。 \n + * .value[4].f32:设置右下角圆角半径,单位为vp。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].u32:文本背景颜色,0xargb格式。\n + * .value[1].f32:左上角圆角半径,单位为vp。 \n + * .value[2].f32:右上角圆角半径,单位为vp。 \n + * .value[3].f32:左下角圆角半径,单位为vp。 \n + * .value[4].f32:右下角圆角半径,单位为vp。 \n + * + */ + NODE_SPAN_TEXT_BACKGROUND_STYLE, /** * @brief imageSpan组件图片地址属性,支持属性设置,属性重置,属性获取接口。 * @@ -1606,6 +1671,28 @@ typedef enum { * */ NODE_IMAGE_ALT, + /** + * @brief 图片拖拽效果属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示是否支持拖拽,设置为true表示支持。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 表示是否支持拖拽。\n + * + */ + NODE_IMAGE_DRAGGABLE, + /** + * @brief 图片渲染模式属性,支持属性设置,属性重置,属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 参数类型{@link ArkUI_RenderMode}。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32 参数类型{@link ArkUI_RenderMode}。\n + * + */ + NODE_IMAGE_RENDER_MODE, /** * @brief 组件打开状态的背景颜色属性,支持属性设置,属性重置和属性获取接口。 * @@ -1913,6 +2000,32 @@ typedef enum { * */ NODE_TEXT_AREA_EDITING, + /** + * @brief 输入框的类型属性,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:输入框类型枚举{@link ArkUI_TextAreaType},默认值为ARKUI_TEXTAREA_TYPE_NORMAL。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:输入框类型枚举{@link ArkUI_TextAreaType}。\n + * + */ + NODE_TEXT_AREA_TYPE, + /** + * @brief 设置输入的字符数超过阈值时是否显示计数器并设置计数器样式,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:是否开启计数器,值为true时为开启。\n + * .value[1]?.f32:可输入字符数占最大字符限制的百分比值,超过此值时显示计数器,取值范围1-100,小数时向下取整。\n + * .value[2]?.i32:输入字符超出限制时是否高亮边框。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:是否开启计数器。\n + * .value[1].f32:可输入字符数占最大字符限制的百分比值,超过此值时显示计数器,取值范围1-100。\n + * .value[2].i32:输入字符超出限制时是否高亮边框,默认高亮。\n + * + */ + NODE_TEXT_AREA_SHOW_COUNTER, /** * @brief button按钮的文本内容属性,支持属性设置,属性重置和属性获取接口。 @@ -3175,6 +3288,14 @@ typedef enum { * {@link ArkUI_NodeComponentEvent}中不包含参数。 */ NODE_EVENT_ON_APPEAR, + /** + * @brief 卸载事件。 + * + * 触发该事件的条件 :组件卸载时触发此回调。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中不包含参数。 + */ + NODE_EVENT_ON_DISAPPEAR, /** * @brief 组件区域变化事件 @@ -3314,6 +3435,17 @@ typedef enum { * */ NODE_TEXT_INPUT_ON_PASTE, + /** + * @brief 文本选择的位置发生变化时,触发该回调。 + * + * 触发该事件的条件:文本选择的位置发生变化时。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示所选文本的起始位置。\n + * ArkUI_NodeComponentEvent.data[1].i32:表示所选文本的结束位置。\n + * + */ + NODE_TEXT_INPUT_ON_TEXT_SELECTION_CHANGE, /** * @brief 输入内容发生变化时,触发该回调。 * @@ -3324,6 +3456,27 @@ typedef enum { * */ NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, + /** + * @brief 长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮,触发该回调。 + * + * 触发该事件的条件:长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_StringAsyncEvent}。\n + * {@link ArkUI_StringAsyncEvent}中包含1个参数:\n + * ArkUI_StringAsyncEvent.pStr:粘贴的文本内容。 + * + */ + NODE_TEXT_AREA_ON_PASTE, + /** + * @brief 文本选择的位置发生变化时,触发该回调。 + * + * 触发该事件的条件:文本选择的位置发生变化时。\n + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示所选文本的起始位置。\n + * ArkUI_NodeComponentEvent.data[1].i32:表示所选文本的结束位置。\n + * + */ + NODE_TEXT_AREA_ON_TEXT_SELECTION_CHANGE, /** * @brief 定义ARKUI_NODE_CHECKBOX当选中状态发生变化时,触发该回调。 diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index 7cdc0793..8feee505 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -227,6 +227,22 @@ typedef enum { ARKUI_TEXTINPUT_TYPE_NUMBER_DECIMAL = 12, } ArkUI_TextInputType; +/** + * @brief 定义多行文本输入法类型枚举值。 + * + * @since 12 + */ +typedef enum { + /** 基本输入模式。 */ + ARKUI_TEXTAREA_TYPE_NORMAL = 0, + /** 纯数字模式。 */ + ARKUI_TEXTAREA_TYPE_NUMBER = 2, + /** 电话号码输入模式。 */ + ARKUI_TEXTAREA_TYPE_PHONE_NUMBER = 3, + /** 邮箱地址输入模式。 */ + ARKUI_TEXTAREA_TYPE_EMAIL = 5, +} ArkUI_TextAreaType; + /** * @brief 定义清除按钮样式枚举值。 * @@ -1167,6 +1183,63 @@ typedef enum { ARKUI_LINEAR_GRADIENT_DIRECTION_NONE, } ArkUI_LinearGradientDirection; +/** + * @brief 定义文本断行规则。 + * + * @since 12 + */ +typedef enum { + /** CJK(中文、日文、韩文)文本可以在任意2个字符间断行,而Non-CJK文本(如英文等)只能在空白符处断行。 */ + ARKUI_WORD_BREAK_NORMAL = 0, + /** 对于Non-CJK的文本,可在任意2个字符间断行。CJK(中文、日文、韩文)文本可以在任意2个字符间断行。 */ + ARKUI_WORD_BREAK_BREAK_ALL, + /** 对于Non-CJK的文本可在任意2个字符间断行,一行文本中有断行破发点(如空白符)时,优先按破发点换行。 + CJK(中文、日文、韩文)文本可以在任意2个字符间断行 */ + ARKUI_WORD_BREAK_BREAK_WORD, +}ArkUI_WordBreak; + +/** + * @brief 定义文本省略位置。 + * + * @since 12 + */ +typedef enum { + /** 省略行首内容。*/ + ARKUI_ELLIPSIS_MODE_START = 0, + /** 省略行中内容。*/ + ARKUI_ELLIPSIS_MODE_CENTER, + /** 省略行末内容。*/ + ARKUI_ELLIPSIS_MODE_END, +}ArkUI_EllipsisMode; + +/** + * @brief 定义图片渲染模式。 + * + * @since 12 + */ +typedef enum { + /** 原色渲染模式。*/ + ARKUI_IMAGE_RENDER_MODE_ORIGINAL = 0, + /** 黑白渲染模式。*/ + ARKUI_IMAGE_RENDER_MODE_TEMPLATE, +}ArkUI_ImageRenderMode; + +/** + * @brief 定义转场从边缘滑入和滑出的效果。 + * + * @since 12 + */ +typedef enum { + /** 窗口的上边缘。*/ + ARKUI_TRANSITION_EDGE_TOP = 0, + /** 窗口的下边缘。*/ + ARKUI_TRANSITION_EDGE_BOTTOM, + /** 窗口的左边缘。*/ + ARKUI_TRANSITION_EDGE_START, + /** 窗口的右边缘。*/ + ARKUI_TRANSITION_EDGE_END, +}ArkUI_TransitionEdge; + #ifdef __cplusplus }; #endif -- Gitee From e51b4ef74f7bd875a514095d7e54154f0d1bd9bd Mon Sep 17 00:00:00 2001 From: zhangkai269 Date: Wed, 6 Mar 2024 15:42:22 +0800 Subject: [PATCH 0356/2135] =?UTF-8?q?audio=20native=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangkai269 --- .../media/ohaudio/native_audiorenderer.h | 22 ++++++++++++ .../media/ohaudio/native_audiostream_base.h | 36 +++++++++++++++++++ .../media/ohaudio/native_audiostreambuilder.h | 13 +++++++ zh-cn/native_sdk/media/player/avplayer_base.h | 1 + 4 files changed, 72 insertions(+) diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h b/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h index 53b4727b..c2e1f6b8 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiorenderer.h @@ -223,6 +223,28 @@ OH_AudioStream_Result OH_AudioRenderer_GetTimestamp(OH_AudioRenderer* renderer, * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 */ OH_AudioStream_Result OH_AudioRenderer_GetFrameSizeInCallback(OH_AudioRenderer* renderer, int32_t* frameSize); + +/** + * @brief 获取音频渲染速率。 + * + * @since 11 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param speed 指向接收播放倍速值的变量的指针(作为返回值使用)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_GetSpeed(OH_AudioRenderer* renderer, float* speed); + +/** + * @brief 设置音频渲染速率。 + * + * @since 11 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param speed 设置播放的倍速值(倍速范围:0.25-4.0)。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioRenderer_SetSpeed(OH_AudioRenderer* renderer, float speed); #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h b/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h index 5395ab02..954077e4 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiostream_base.h @@ -458,6 +458,42 @@ typedef struct OH_AudioCapturer_Callbacks_Struct { void* userData, OH_AudioStream_Result error); } OH_AudioCapturer_Callbacks; + +/** + * @brief 流设备变更原因。 + * + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ +typedef enum { + /** + * 未知原因。 + */ + REASON_UNKNOWN = 0, + /** + * 新设备可用。 + */ + REASON_NEW_DEVICE_AVAILABLE = 1, + /** + * 旧设备不可用。当报告此原因时,应用程序应考虑暂停音频播放。 + */ + REASON_OLD_DEVICE_UNAVAILABLE = 2, + /** + * 用户或系统强制选择切换。 + */ + REASON_OVERRODE = 3 +} OH_AudioStream_DeviceChangeReason; + +/** + * @brief 输出音频流设备变更的回调函数。 + * + * @param renderer 指向{@link OH_AudioStreamBuilder_GenerateRenderer}创建的音频流实例。 + * @param userData 指向通过回调函数传递的应用数据指针。 + * @param reason 流设备变更原因。 + * @since 11 + */ +typedef void (*OH_AudioRenderer_OutputDeviceChangeCallback)(OH_AudioRenderer* renderer, void* userData, + OH_AudioStream_DeviceChangeReason reason); #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h b/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h index d3d7356d..ef57d801 100644 --- a/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h +++ b/zh-cn/native_sdk/media/ohaudio/native_audiostreambuilder.h @@ -166,6 +166,19 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetCapturerInfo(OH_AudioStreamBuilde OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererCallback(OH_AudioStreamBuilder* builder, OH_AudioRenderer_Callbacks callbacks, void* userData); +/** + * @brief 设置输出音频流设备变更的回调。 + * + * @since 11 + * @syscap SystemCapability.Multimedia.Audio.Core + * @param builder 指向OH_AudioStreamBuilder_Create()创建的构造器实例。 + * @param callbacks 将被用来处理输出流设备变更相关事件的回调函数。 + * @param userData 指向通过回调函数传递的应用数据指针。 + * @return {@link AUDIOSTREAM_SUCCESS} 或者一个不期望发生的错误。 + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererOutputDeviceChangeCallback(OH_AudioStreamBuilder* builder, + OH_AudioRenderer_OutputDeviceChangeCallback callback, void* userData); + /** * @brief 设置输入音频流的回调。 * diff --git a/zh-cn/native_sdk/media/player/avplayer_base.h b/zh-cn/native_sdk/media/player/avplayer_base.h index 5a240de5..24474e3c 100644 --- a/zh-cn/native_sdk/media/player/avplayer_base.h +++ b/zh-cn/native_sdk/media/player/avplayer_base.h @@ -127,6 +127,7 @@ typedef enum AVPlayerOnInfoType { AV_INFO_TYPE_TRACKCHANGE = 14, AV_INFO_TYPE_TRACK_INFO_UPDATE = 15, AV_INFO_TYPE_SUBTITLE_UPDATE = 16, + AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17 } AVPlayerOnInfoType; /** -- Gitee From 4b72d63f1f1c2e7900b32b5fd1337eb67f52db62 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Wed, 6 Mar 2024 17:42:02 +0800 Subject: [PATCH 0357/2135] websocket doc modify Signed-off-by: liuxiyao223 --- zh-cn/native_sdk/net_websocket/net_websocket.h | 4 +--- zh-cn/native_sdk/net_websocket/net_websocket_type.h | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket.h b/zh-cn/native_sdk/net_websocket/net_websocket.h index 9a82bb8d..955359d6 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket.h @@ -48,14 +48,13 @@ extern "C" { #endif /** - * @brief OH_NetStack_WebsocketClient客户端的构造函数 + * @brief Websocket客户端的构造函数 * * @param onMessage 客户端定义的接收消息的回调函数 * @param onClose 客户端定义的关闭消息的回调函数 * @param onError 客户端定义的错误消息的回调函数 * @param onOpen 客户端定义的建立连接消息的回调函数 * @return 成功返回客户端指针,失败返回为NULL - * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 @@ -69,7 +68,6 @@ struct WebSocket *OH_WebSocketClient_Constructor(WebSocket_OnOpenCallback onOpen * @param client 客户端指针 * @param header header头信息 * @return 返回值为0表示执行成功。返回错细信息可以查看{@link OH_Websocket_ErrCode}。 - * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetStack * @since 11 * @version 1.0 diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h index 224d5c80..e28b14e7 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket_type.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -47,9 +47,9 @@ extern "C" { * @version 1.0 */ struct WebSocket_CloseResult { - /** 关闭的错误码 */ + /** WebSocket客户端来自服务端关闭的关闭码 */ uint32_t code; - /** 关闭的错误原因 */ + /** WebSocket客户端来自服务端关闭的关闭原因 */ const char *reason; }; @@ -60,9 +60,9 @@ struct WebSocket_CloseResult { * @version 1.0 */ struct WebSocket_CloseOption { - /** 关闭的错误码 */ + /** WebSocket客户端主动关闭的关闭码 */ uint32_t code; - /** 关闭的错误原因 */ + /** WebSocket客户端主动关闭的关闭原因 */ const char *reason; }; -- Gitee From 190c31999bc34931dd7a6fd908757a59ed9bb72f Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 7 Mar 2024 03:07:54 +0000 Subject: [PATCH 0358/2135] update zh-cn/native_sdk/net_websocket/net_websocket_type.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net_websocket/net_websocket_type.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h index e28b14e7..035b9ffc 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket_type.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -47,9 +47,9 @@ extern "C" { * @version 1.0 */ struct WebSocket_CloseResult { - /** WebSocket客户端来自服务端关闭的关闭码 */ + /** 关闭的关闭码 */ uint32_t code; - /** WebSocket客户端来自服务端关闭的关闭原因 */ + /** 关闭的关闭原因 */ const char *reason; }; @@ -60,9 +60,9 @@ struct WebSocket_CloseResult { * @version 1.0 */ struct WebSocket_CloseOption { - /** WebSocket客户端主动关闭的关闭码 */ + /** 关闭的关闭码 */ uint32_t code; - /** WebSocket客户端主动关闭的关闭原因 */ + /** 关闭的关闭原因 */ const char *reason; }; -- Gitee From 1d3c9eb389868009e956c00844ce302bf1a78ff5 Mon Sep 17 00:00:00 2001 From: Aurora Date: Thu, 7 Mar 2024 08:11:34 +0000 Subject: [PATCH 0359/2135] update zh-cn/native_sdk/net_websocket/net_websocket_type.h. Signed-off-by: Aurora --- zh-cn/native_sdk/net_websocket/net_websocket_type.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/net_websocket/net_websocket_type.h b/zh-cn/native_sdk/net_websocket/net_websocket_type.h index 035b9ffc..a8fae7c9 100755 --- a/zh-cn/native_sdk/net_websocket/net_websocket_type.h +++ b/zh-cn/native_sdk/net_websocket/net_websocket_type.h @@ -47,9 +47,9 @@ extern "C" { * @version 1.0 */ struct WebSocket_CloseResult { - /** 关闭的关闭码 */ + /** 关闭值 */ uint32_t code; - /** 关闭的关闭原因 */ + /** 关闭原因 */ const char *reason; }; @@ -60,9 +60,9 @@ struct WebSocket_CloseResult { * @version 1.0 */ struct WebSocket_CloseOption { - /** 关闭的关闭码 */ + /** 关闭值 */ uint32_t code; - /** 关闭的关闭原因 */ + /** 关闭原因 */ const char *reason; }; -- Gitee From 00fe95c4baee7b0d4e016fde642e3cd4f37670cb Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Thu, 7 Mar 2024 15:38:24 +0800 Subject: [PATCH 0360/2135] Update docs (0307) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_node.h | 165 ++++++++++++++++++++++++++++++++ en/native_sdk/ace/native_type.h | 76 +++++++++++++++ 2 files changed, 241 insertions(+) diff --git a/en/native_sdk/ace/native_node.h b/en/native_sdk/ace/native_node.h index c68c6476..94ac5968 100644 --- a/en/native_sdk/ace/native_node.h +++ b/en/native_sdk/ace/native_node.h @@ -800,6 +800,18 @@ typedef enum { * */ NODE_TRANSLATE_TRANSITION, + /** + * @brief Defines the slide-in and slide-out of the component from the screen edge during transition. + * 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 parameter type is {@link ArkUI_TransitionEdge}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: The parameter type is {@link ArkUI_TransitionEdge}. \n + * + */ + NODE_MOVE_TRANSITION, /** * @brief Defines the focus attribute, which can be set, reset, and obtained as required through APIs. @@ -1342,6 +1354,17 @@ typedef enum { * */ NODE_FOCUS_STATUS, + /** + * @brief Defines the aspect ratio 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: aspect ratio of the component, in width/height format. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: aspect ratio of the component, in width/height format. \n + * + */ + NODE_ASPECT_RATIO, /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. @@ -1605,6 +1628,28 @@ typedef enum { * */ NODE_TEXT_INDENT, + /** + * @brief Defines the line break rule. 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 parameter type is {@link ArkUI_WordBreak}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: The parameter type is {@link ArkUI_WordBreak}. \n + * + */ + NODE_TEXT_WORD_BREAK, + /** + * @brief Defines the ellipsis position. 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 parameter type is {@link ArkUI_EllipsisMode}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: The parameter type is {@link ArkUI_EllipsisMode}. \n + * + */ + NODE_TEXT_ELLIPSIS_MODE, /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. * @@ -1616,6 +1661,28 @@ typedef enum { * */ NODE_SPAN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SPAN, + /** + * @brief Defines the text background style. + * 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 text background, in 0xARGB format, for example, 0xFFFF0000 indicating red. \n + * The second parameter indicates the rounded corners of the text background. Two setting modes are available: \n + * 1: .value[1].f32: radius of the four corners, in vp. \n + * 2: .value[1].f32: radius of the upper left corner, in vp. \n + * .value[2].f32: radius of the upper right corner, in vp. \n + * .value[3].f32: radius of the lower left corner, in vp. \n + * .value[4].f32: radius of the lower right corner, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color of the text background, in 0xARGB format. \n + * .value[1].f32: radius of the upper left corner, in vp. \n + * .value[2].f32: radius of the upper right corner, in vp. \n + * .value[3].f32: radius of the lower left corner, in vp. \n + * .value[4].f32: radius of the lower right corner, in vp. \n + * + */ + NODE_SPAN_TEXT_BACKGROUND_STYLE, /** * @brief Defines the image source of the image span. * This attribute can be set, reset, and obtained as required through APIs. @@ -1727,6 +1794,29 @@ typedef enum { * */ NODE_IMAGE_ALT, + /** + * @brief Defines whether the image is draggable. + * 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 image is draggable. The value true means that the image is draggable. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether the image is draggable. \n + * + */ + NODE_IMAGE_DRAGGABLE, + /** + * @brief Defines the image rendering 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: The parameter type is {@link ArkUI_RenderMode}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: The parameter type is {@link ArkUI_RenderMode}. \n + * + */ + NODE_IMAGE_RENDER_MODE, /** * @brief Defines the color of the component when it is selected. * This attribute can be set, reset, and obtained as required through APIs. @@ -2078,6 +2168,38 @@ typedef enum { * */ NODE_TEXT_AREA_EDITING, + /** + * @brief Defines the text box type. 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: text box type {@link ArkUI_TextAreaType}. + * The default value is ARKUI_TEXTAREA_TYPE_NORMAL. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: text box type {@link ArkUI_TextAreaType}. \n + * + */ + NODE_TEXT_AREA_TYPE, + /** + * @brief Defines the counter settings. 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 a character counter. The value true means to show a character counter. \n + * .value[1]? .f32: threshold percentage for displaying the character counter. The character counter is displayed + * when the number of characters that have been entered is greater than the maximum number of characters multiplied + * by the threshold percentage value. The value range is 1 to 100. If the value is a decimal, it is rounded down. \n + * .value[2]? .i32: whether to highlight the border when the number of entered characters reaches the maximum. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to show a character counter. \n + * .value[1].f32: threshold percentage for displaying the character counter. The character counter is displayed + * when the number of characters that have been entered is greater than the maximum number of characters multiplied + * by the threshold percentage value. The value range is 1 to 100. \n + * .value[2].i32: whether to highlight the border when the number of entered characters reaches the maximum. + * The default value is true. \n + * + */ + NODE_TEXT_AREA_SHOW_COUNTER, /** * @brief Defines the button text content. This attribute can be set, reset, and obtained as required through APIs. @@ -3509,6 +3631,14 @@ typedef enum { * {@link ArkUI_NodeComponentEvent} does not contain parameters. */ NODE_EVENT_ON_APPEAR, + /** + * @brief Defines the unmount event. + * + * This event is triggered when the component is unmounted and hidden. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. + */ + NODE_EVENT_ON_DISAPPEAR, /** * @brief Defines the area change event. @@ -3684,6 +3814,17 @@ typedef enum { * */ NODE_TEXT_INPUT_ON_PASTE, + /** + * @brief Defines the event triggered when the text selection position changes. + * + \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: start position of the text selection area. \n + * ArkUI_NodeComponentEvent.data[1].i32: end position of the text selection area. \n + * + */ + NODE_TEXT_INPUT_ON_TEXT_SELECTION_CHANGE, /** * @brief Defines the event triggered when the input in the text box changes. * @@ -3695,6 +3836,30 @@ typedef enum { * */ NODE_TEXT_AREA_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_AREA, + /** + * @brief Defines the event triggered when the paste button on the pasteboard, which displays when the text box is + * long pressed, is clicked. + * + \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_StringAsyncEvent}. \n + * {@link ArkUI_StringAsyncEvent} contains one parameter:\n + * ArkUI_StringAsyncEvent.pStr: text that is pasted + * + */ + NODE_TEXT_AREA_ON_PASTE, + /** + * @brief Defines the event triggered when the text selection position changes. + * + \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: start position of the text selection area. \n + * ArkUI_NodeComponentEvent.data[1].i32: end position of the text selection area. \n + * + */ + NODE_TEXT_AREA_ON_TEXT_SELECTION_CHANGE, /** * @brief Defines the event triggered when the selected status of the ARKUI_NODE_CHECKBOX component changes. diff --git a/en/native_sdk/ace/native_type.h b/en/native_sdk/ace/native_type.h index 24b6a61d..af7f796d 100644 --- a/en/native_sdk/ace/native_type.h +++ b/en/native_sdk/ace/native_type.h @@ -228,6 +228,22 @@ typedef enum { ARKUI_TEXTINPUT_TYPE_NUMBER_DECIMAL = 12, } ArkUI_TextInputType; +/** + * @brief Enumerates the text box types. + * + * @since 12 + */ +typedef enum { + /** Normal input mode. */ + ARKUI_TEXTAREA_TYPE_NORMAL = 0, + /** Number input mode. */ + ARKUI_TEXTAREA_TYPE_NUMBER = 2, + /** Phone number input mode. */ + ARKUI_TEXTAREA_TYPE_PHONE_NUMBER = 3, + /** Email address input mode. */ + ARKUI_TEXTAREA_TYPE_EMAIL = 5, +} ArkUI_TextAreaType; + /** * @brief Enumerates the styles of the Cancel button. * @@ -1203,6 +1219,66 @@ typedef enum { ARKUI_LINEAR_GRADIENT_DIRECTION_NONE, } ArkUI_LinearGradientDirection; +/** + * @brief Enumerates the word break rules. + * + * @since 12 + */ +typedef enum { + /** Word breaks can occur between any two characters for Chinese, Japanese, and Korean (CJK) text, but can occur + * only at a space character for non-CJK text (such as English). */ + ARKUI_WORD_BREAK_NORMAL = 0, + /** Word breaks can occur between any two characters for non-CJK text. CJK text behavior is the same as for + * NORMAL. */ + ARKUI_WORD_BREAK_BREAK_ALL, + /** This option has the same effect as BREAK_ALL for non-CJK text, except that if it preferentially wraps + * lines at appropriate characters (for example, spaces) whenever possible. + CJK text behavior is the same as for NORMAL. */ + ARKUI_WORD_BREAK_BREAK_WORD, +}ArkUI_WordBreak; + +/** + * @brief Enumerates the ellipsis positions. + * + * @since 12 + */ +typedef enum { + /** An ellipsis is used at the start of the line of text. */ + ARKUI_ELLIPSIS_MODE_START = 0, + /** An ellipsis is used at the center of the line of text. */ + ARKUI_ELLIPSIS_MODE_CENTER, + /** An ellipsis is used at the end of the line of text. */ + ARKUI_ELLIPSIS_MODE_END, +}ArkUI_EllipsisMode; + +/** + * @brief Enumerates the image rendering modes. + * + * @since 12 + */ +typedef enum { + /** Render image pixels as they are in the original source image. */ + ARKUI_IMAGE_RENDER_MODE_ORIGINAL = 0, + /** Render image pixels to create a monochrome template image. */ + ARKUI_IMAGE_RENDER_MODE_TEMPLATE, +}ArkUI_ImageRenderMode; + +/** + * @brief Enumerates the slide-in and slide-out positions of the component from the screen edge during transition. + * + * @since 12 + */ +typedef enum { + /** Top edge of the window. */ + ARKUI_TRANSITION_EDGE_TOP = 0, + /** Bottom edge of the window. */ + ARKUI_TRANSITION_EDGE_BOTTOM, + /** Left edge of the window. */ + ARKUI_TRANSITION_EDGE_START, + /** Right edge of the window. */ + ARKUI_TRANSITION_EDGE_END, +}ArkUI_TransitionEdge; + #ifdef __cplusplus }; #endif -- Gitee From c8023a93a4164e13c9ed6dfca4cf7e3ee8a91a85 Mon Sep 17 00:00:00 2001 From: yuhaoqiang Date: Thu, 7 Mar 2024 14:25:10 +0800 Subject: [PATCH 0361/2135] =?UTF-8?q?hiappevent=E6=96=B0=E5=A2=9Endk?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yuhaoqiang --- zh-cn/native_sdk/dfx/hiappevent.h | 209 ++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) diff --git a/zh-cn/native_sdk/dfx/hiappevent.h b/zh-cn/native_sdk/dfx/hiappevent.h index 986aa37e..2d29ef91 100644 --- a/zh-cn/native_sdk/dfx/hiappevent.h +++ b/zh-cn/native_sdk/dfx/hiappevent.h @@ -103,6 +103,40 @@ enum EventType { BEHAVIOR = 4 }; +/** + * @brief 单个事件信息,包含事件领域,事件名称,事件类型和json格式字符串表示的事件中携带的自定义参数列表。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +typedef struct HiAppEvent_AppEventInfo { + /* 事件领域。 */ + const char* domain; + /* 事件名称。 */ + const char* name; + /* 事件类型。 */ + enum EventType type; + /* Json格式字符串类型的事件参数列表, */ + const char* params; +} HiAppEvent_AppEventInfo; + +/** + * @brief 具有相同事件名称的事件组。 + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +typedef struct HiAppEvent_AppEventGroup { + /* 事件数组中相同的事件名称。 */ + const char* name; + /* 具有相同事件名称的事件数组 */ + const struct HiAppEvent_AppEventInfo* appEventInfos; + /* 具有相同事件名称的事件数组的长度. */ + uint32_t infoLen; +} HiAppEvent_AppEventGroup; + /** * @brief 事件参数列表节点。 * @@ -111,6 +145,55 @@ enum EventType { */ typedef struct ParamListNode* ParamList; +/** + * @brief 用于接收app事件的监听器 + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +typedef struct HiAppEvent_Watcher HiAppEvent_Watcher; + +/** + * @brief 监听器接收到事件后,将触发该回调,将事件内容传递给调用方。 + * + * 注意:回调中的指针所指对象的生命周期仅限于该回调函数内,请勿在该回调函数外直接使用该指针,若需缓存该信息,请对指针指向的内容进行深拷贝。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param domain 接收到的app事件的领域。 + * @param appEventGroups 按照不同事件名称分组的事件组数组。 + * @param groupLen 事件组数组的长度。 + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnReceive)( + const char* domain, const struct HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen); + +/** + * @brief 监听器收到事件后,若监听器中未设置OH_HiAppEvent_OnReceive回调,将保存该事件。当保存的事件满足通过 + * OH_HiAppEvent_SetTriggerCondition设定的条件后,将触发该回调。回调结束后,当新保存的事件消息再次满足设定的条件后,将再次进行回调。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param row 监听器新接收到的事件消息的数量。 + * @param size 监听器新接收的事件消息的大小总和(单个事件大小计算方式为,将消息转换为json字符串后,字符串的长度)。 + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnTrigger)(int row, int size); + +/** + * @brief 使用OH_HiAppEvent_TakeWatcherData获取监听器接收到的事件时,监听器接收到的事件将通过该回调函数传递给调用者。 + * + * 注意:回调中的指针所指对象的生命周期仅限于该回调函数内,请勿在该回调函数外直接使用该指针,若需缓存该信息,请对指针指向的内容进行深拷贝。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param events json字符串格式的事件数组 + * @param eventLen 事件数组大小 + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnTake)(const char* const *events, uint32_t eventLen); + /** * @brief 创建一个指向参数列表对象的指针。 * @@ -358,6 +441,132 @@ int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType typ */ bool OH_HiAppEvent_Configure(const char* name, const char* value); +/** + * @brief 创建一个用来监听app事件的监听器。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param name 监听器名称。 + * @return 返回指向的新建监听器的指针。 + * @since 12 + * @version 1.0 + */ +HiAppEvent_Watcher* OH_HiAppEvent_CreateWatcher(const char* name); + +/** + * @brief 销毁已创建的监听器。 + * + * 注意:已创建的监听器不再使用后,需要将其销毁,释放内存,防止内存泄漏。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher 指向的监听器的指针。 + * @since 12 + * @version 1.0 + */ +void OH_HiAppEvent_DestroyWatcher(HiAppEvent_Watcher* watcher); + +/** + * @brief 用来设置监听器OH_HiAppEvent_OnTrigger回调的触发条件。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher 指向的监听器的指针。 + * @param row 当输入值大于0,且新接收事件的数量大于等于该值时,将调用设置的onTrigger回调函数. + * @param size 当输入值大于0,且新接收事件的大小(单个事件大小计算方式为,将事件转换为json字符串后,字符串的长度)大于等于该值时, + * 将调用设置的onTrigger回调函数. + * @param timeOut 当输入值大于0,且新接收事件的大小(单个事件大小计算方式为,将事件转换为json字符串后,字符串的长度)大于等于该值时, + * 将调用设置的onTrigger回调 函数. + * @return Returns {@code 0} 设置成功时返回0,设置失败时返回负值。 + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetTriggerCondition(HiAppEvent_Watcher* watcher, int row, int size, int timeOut); + +/** + * @brief 用来设置监听器需要监听的事件的类型。 + * + * 该函数可以重复调用,可添加多个过滤规则,而非替换,监听器将收到满足任一过滤规则的事件的通知。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher 指向的监听器的指针。 + * @param domain 需要监听事件的领域。 + * @param eventTypes 需要监听事件的事件类型。 + * @param names 需要监听的事件名称数组。 + * @param namesLen 监听的事件名称的数组长度。 + * @return Returns {@code 0} 设置成功时返回0,设置失败时返回负值。 + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetAppEventFilter(HiAppEvent_Watcher* watcher, const char* domain, uint8_t eventTypes, + const char* const *names, int namesLen); + +/** + * @brief 用来设置监听器onTrigger回调的接口。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher 指向的监听器的指针。 + * @param onTrigger 需要设置的回调。 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetWatcherOnTrigger(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnTrigger onTrigger); + +/** + * @brief 用来设置监听器onReceive回调函数的接口。当监听器监听到相应事件后,onReceive回调函数将被调用。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher 指向的监听器的指针。 + * @param onReceive 回调函数的函数指针。 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetWatcherOnReceive(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnReceive onReceive); + +/** + * @brief 用来获取监听器收到后保存的事件。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher 指向的监听器的指针。 + * @param eventNum 需要获取的事件数量。 + * @param onTake 回调函数指针,事件通过调用该函数返回事件信息。 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_TakeWatcherData(HiAppEvent_Watcher* watcher, uint32_t eventNum, OH_HiAppEvent_OnTake onTake); + +/** + * @brief 添加监听器的接口,监听器开始监听系统消息。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher 指向的监听器的指针。 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_AddWatcher(HiAppEvent_Watcher* watcher); + +/** + * @brief 移除监听器的接口,监听器停止监听系统消息。 + * + * 注意:该接口仅仅使监听器停止监听系统消息,并未销毁该监听器,该监听器依然常驻内存。 + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher 指向的监听器的指针。 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher); + +/** + * @brief 清除数据库中的所有的事件. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +void OH_HiAppEvent_ClearData(); #ifdef __cplusplus } #endif -- Gitee From 84a69a53dc81fb228f793f45bdcfa2725428424c Mon Sep 17 00:00:00 2001 From: yuhaoqiang Date: Fri, 8 Mar 2024 16:28:34 +0800 Subject: [PATCH 0362/2135] =?UTF-8?q?hiappevent=E6=96=B0=E5=A2=9Endk?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yuhaoqiang --- zh-cn/native_sdk/dfx/hiappevent.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hiappevent.h b/zh-cn/native_sdk/dfx/hiappevent.h index 2d29ef91..ee880a0c 100644 --- a/zh-cn/native_sdk/dfx/hiappevent.h +++ b/zh-cn/native_sdk/dfx/hiappevent.h @@ -146,7 +146,7 @@ typedef struct HiAppEvent_AppEventGroup { typedef struct ParamListNode* ParamList; /** - * @brief 用于接收app事件的监听器 + * @brief 用于接收app事件的监听器。 * * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 12 @@ -187,8 +187,8 @@ typedef void (*OH_HiAppEvent_OnTrigger)(int row, int size); * 注意:回调中的指针所指对象的生命周期仅限于该回调函数内,请勿在该回调函数外直接使用该指针,若需缓存该信息,请对指针指向的内容进行深拷贝。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param events json字符串格式的事件数组 - * @param eventLen 事件数组大小 + * @param events json字符串格式的事件数组。 + * @param eventLen 事件数组大小。 * @since 12 * @version 1.0 */ @@ -469,11 +469,11 @@ void OH_HiAppEvent_DestroyWatcher(HiAppEvent_Watcher* watcher); * * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher 指向的监听器的指针。 - * @param row 当输入值大于0,且新接收事件的数量大于等于该值时,将调用设置的onTrigger回调函数. + * @param row 当输入值大于0,且新接收事件的数量大于等于该值时,将调用设置的onTrigger回调函数。 * @param size 当输入值大于0,且新接收事件的大小(单个事件大小计算方式为,将事件转换为json字符串后,字符串的长度)大于等于该值时, - * 将调用设置的onTrigger回调函数. + * 将调用设置的onTrigger回调函数。 * @param timeOut 当输入值大于0,且新接收事件的大小(单个事件大小计算方式为,将事件转换为json字符串后,字符串的长度)大于等于该值时, - * 将调用设置的onTrigger回调 函数. + * 将调用设置的onTrigger回调 函数。 * @return Returns {@code 0} 设置成功时返回0,设置失败时返回负值。 * @since 12 * @version 1.0 @@ -504,7 +504,7 @@ int OH_HiAppEvent_SetAppEventFilter(HiAppEvent_Watcher* watcher, const char* dom * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher 指向的监听器的指针。 * @param onTrigger 需要设置的回调。 - * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 * @version 1.0 */ @@ -516,7 +516,7 @@ int OH_HiAppEvent_SetWatcherOnTrigger(HiAppEvent_Watcher* watcher, OH_HiAppEvent * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher 指向的监听器的指针。 * @param onReceive 回调函数的函数指针。 - * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 * @version 1.0 */ @@ -529,7 +529,7 @@ int OH_HiAppEvent_SetWatcherOnReceive(HiAppEvent_Watcher* watcher, OH_HiAppEvent * @param watcher 指向的监听器的指针。 * @param eventNum 需要获取的事件数量。 * @param onTake 回调函数指针,事件通过调用该函数返回事件信息。 - * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 * @version 1.0 */ @@ -540,7 +540,7 @@ int OH_HiAppEvent_TakeWatcherData(HiAppEvent_Watcher* watcher, uint32_t eventNum * * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher 指向的监听器的指针。 - * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 * @version 1.0 */ @@ -553,14 +553,14 @@ int OH_HiAppEvent_AddWatcher(HiAppEvent_Watcher* watcher); * * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher 指向的监听器的指针。 - * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值 + * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 * @version 1.0 */ int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher); /** - * @brief 清除数据库中的所有的事件. + * @brief 清除数据库中的所有的事件。 * * @SystemCapability.HiviewDFX.HiAppEvent * @since 12 -- Gitee From 91b8216fd7ffb7d5645584479995c2a6d0baf271 Mon Sep 17 00:00:00 2001 From: yuhaoqiang Date: Mon, 11 Mar 2024 10:01:23 +0800 Subject: [PATCH 0363/2135] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yuhaoqiang --- zh-cn/native_sdk/dfx/hiappevent.h | 44 +++++++++++++++++-------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hiappevent.h b/zh-cn/native_sdk/dfx/hiappevent.h index ee880a0c..8637ca7a 100644 --- a/zh-cn/native_sdk/dfx/hiappevent.h +++ b/zh-cn/native_sdk/dfx/hiappevent.h @@ -117,7 +117,7 @@ typedef struct HiAppEvent_AppEventInfo { const char* name; /* 事件类型。 */ enum EventType type; - /* Json格式字符串类型的事件参数列表, */ + /* Json格式字符串类型的事件参数列表。 */ const char* params; } HiAppEvent_AppEventInfo; @@ -131,9 +131,9 @@ typedef struct HiAppEvent_AppEventInfo { typedef struct HiAppEvent_AppEventGroup { /* 事件数组中相同的事件名称。 */ const char* name; - /* 具有相同事件名称的事件数组 */ + /* 具有相同事件名称的事件数组。 */ const struct HiAppEvent_AppEventInfo* appEventInfos; - /* 具有相同事件名称的事件数组的长度. */ + /* 具有相同事件名称的事件数组的长度。 */ uint32_t infoLen; } HiAppEvent_AppEventGroup; @@ -444,6 +444,8 @@ bool OH_HiAppEvent_Configure(const char* name, const char* value); /** * @brief 创建一个用来监听app事件的监听器。 * + * 注意:创建的监听器不再使用后必须通过调用OH_HiAppEvent_DestroyWatcher接口进行销毁。 + * * @SystemCapability.HiviewDFX.HiAppEvent * @param name 监听器名称。 * @return 返回指向的新建监听器的指针。 @@ -455,25 +457,27 @@ HiAppEvent_Watcher* OH_HiAppEvent_CreateWatcher(const char* name); /** * @brief 销毁已创建的监听器。 * - * 注意:已创建的监听器不再使用后,需要将其销毁,释放内存,防止内存泄漏。 + * 注意:已创建的监听器不再使用后,需要将其销毁,释放内存,防止内存泄漏,销毁后需将对应指针置空。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher 指向的监听器的指针。 + * @param watcher 指向监听器的指针(即OH_HiAppEvent_CreateWatcher接口返回的指针)。 * @since 12 * @version 1.0 */ void OH_HiAppEvent_DestroyWatcher(HiAppEvent_Watcher* watcher); /** - * @brief 用来设置监听器OH_HiAppEvent_OnTrigger回调的触发条件。 + * @brief 用来设置监听器OH_HiAppEvent_OnTrigger回调的触发条件,分别可以从监视器新接收事件数量,新接收事件大小,onTrigger触发超时时间 + * 设置触发条件,调用方应至少保证从一个方面设置触发条件。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher 指向的监听器的指针。 - * @param row 当输入值大于0,且新接收事件的数量大于等于该值时,将调用设置的onTrigger回调函数。 - * @param size 当输入值大于0,且新接收事件的大小(单个事件大小计算方式为,将事件转换为json字符串后,字符串的长度)大于等于该值时, - * 将调用设置的onTrigger回调函数。 - * @param timeOut 当输入值大于0,且新接收事件的大小(单个事件大小计算方式为,将事件转换为json字符串后,字符串的长度)大于等于该值时, - * 将调用设置的onTrigger回调 函数。 + * @param watcher 指向监听器的指针(即OH_HiAppEvent_CreateWatcher接口返回的指针)。 + * @param row 当输入值大于0,且新接收事件的数量大于等于该值时,将调用设置的onTrigger回调函数吗,当输入值小于等于0时,不再以接收数量多少为维度 + * 来触发onTrigger回调。 + * @param size 当输入值大于0,且新接收事件的大小(单个事件大小计算方式为,将事件转换为json字符串后,字符串的长度)大于等于该值时,将调用设置的 + * onTrigger回调函数,当输入值小于等于0时,不再以新接收事件大小为维度触发onTrigger回调。 + * @param timeOut 单位秒,当输入值大于0,每经过timeout秒,将检查监视器是否存在新接收到的事件,如果存在将触发onTrigger回调。触发onTrigger + * 后,经过timeOut秒后将再次检查是否存在新接收到的事件。当输入值小于等于0,不以超时时间为维度触发onTrigger回调。 * @return Returns {@code 0} 设置成功时返回0,设置失败时返回负值。 * @since 12 * @version 1.0 @@ -486,7 +490,7 @@ int OH_HiAppEvent_SetTriggerCondition(HiAppEvent_Watcher* watcher, int row, int * 该函数可以重复调用,可添加多个过滤规则,而非替换,监听器将收到满足任一过滤规则的事件的通知。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher 指向的监听器的指针。 + * @param watcher 指向监听器的指针(即OH_HiAppEvent_CreateWatcher接口返回的指针)。 * @param domain 需要监听事件的领域。 * @param eventTypes 需要监听事件的事件类型。 * @param names 需要监听的事件名称数组。 @@ -502,7 +506,7 @@ int OH_HiAppEvent_SetAppEventFilter(HiAppEvent_Watcher* watcher, const char* dom * @brief 用来设置监听器onTrigger回调的接口。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher 指向的监听器的指针。 + * @param watcher 指向监听器的指针(即OH_HiAppEvent_CreateWatcher接口返回的指针)。 * @param onTrigger 需要设置的回调。 * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 @@ -514,7 +518,7 @@ int OH_HiAppEvent_SetWatcherOnTrigger(HiAppEvent_Watcher* watcher, OH_HiAppEvent * @brief 用来设置监听器onReceive回调函数的接口。当监听器监听到相应事件后,onReceive回调函数将被调用。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher 指向的监听器的指针。 + * @param watcher 指向监听器的指针(即OH_HiAppEvent_CreateWatcher接口返回的指针)。 * @param onReceive 回调函数的函数指针。 * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 @@ -526,7 +530,7 @@ int OH_HiAppEvent_SetWatcherOnReceive(HiAppEvent_Watcher* watcher, OH_HiAppEvent * @brief 用来获取监听器收到后保存的事件。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher 指向的监听器的指针。 + * @param watcher 指向监听器的指针(即OH_HiAppEvent_CreateWatcher接口返回的指针)。 * @param eventNum 需要获取的事件数量。 * @param onTake 回调函数指针,事件通过调用该函数返回事件信息。 * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 @@ -539,7 +543,7 @@ int OH_HiAppEvent_TakeWatcherData(HiAppEvent_Watcher* watcher, uint32_t eventNum * @brief 添加监听器的接口,监听器开始监听系统消息。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher 指向的监听器的指针。 + * @param watcher 指向监听器的指针(即OH_HiAppEvent_CreateWatcher接口返回的指针)。 * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 * @version 1.0 @@ -549,10 +553,10 @@ int OH_HiAppEvent_AddWatcher(HiAppEvent_Watcher* watcher); /** * @brief 移除监听器的接口,监听器停止监听系统消息。 * - * 注意:该接口仅仅使监听器停止监听系统消息,并未销毁该监听器,该监听器依然常驻内存。 + * 注意:该接口仅仅使监听器停止监听系统消息,并未销毁该监听器,该监听器依然常驻内存,直至调用OH_HiAppEvent_DestroyWatcher接口,内存才会释放。 * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher 指向的监听器的指针。 + * @param watcher 指向监听器的指针(即OH_HiAppEvent_CreateWatcher接口返回的指针)。 * @return Returns {@code 0} 接口调用成功返回0,异常时返回负值。 * @since 12 * @version 1.0 @@ -560,7 +564,7 @@ int OH_HiAppEvent_AddWatcher(HiAppEvent_Watcher* watcher); int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher); /** - * @brief 清除数据库中的所有的事件。 + * @brief 清除所有监视器保存的所有事件。 * * @SystemCapability.HiviewDFX.HiAppEvent * @since 12 -- Gitee From 92738169742eb546c2656793c6d8f86727d77f70 Mon Sep 17 00:00:00 2001 From: wangxinqiang007 Date: Tue, 5 Mar 2024 20:10:40 +0800 Subject: [PATCH 0364/2135] =?UTF-8?q?Swider=E7=BB=84=E4=BB=B6NDK-CAPI?= =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangxinqiang007 --- zh-cn/native_sdk/ace/native_node.h | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 4668ecd6..97744003 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -3010,6 +3010,19 @@ typedef enum { */ NODE_SWIPER_SHOW_DISPLAY_ARROW, + /** + * @brief 设置Swiper的边缘滑动效果,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32: 边缘滑动效果,参数类型{@link ArkUI_EdgeEffect}, \n + * 默认值为ARKUI_EDGE_EFFECT_SPRING。 \n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32: 边缘滑动效果,参数类型{@link ArkUI_EdgeEffect}, \n + * + */ + NODE_SWIPER_EDGE_EFFECT_MODE, + /** * @brief 设置 ListItemGroup 头部组件,支持属性设置,属性重置和属性获取接口。 * @@ -3386,6 +3399,48 @@ typedef enum { */ NODE_SLIDER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, + /** + * @brief 定义ARKUI_NODE_SWIPER当前元素索引变化时触发事件回调。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含1个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示当前显示元素的索引。\n + */ + NODE_SWIPER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SWIPER, + + /** + * @brief 定义ARKUI_NODE_SWIPER切换动画开始时触发回调。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含5个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示当前显示元素的索引。\n + * ArkUI_NodeComponentEvent.data[1].i32:表示切换动画目标元素的索引。\n + * ArkUI_NodeComponentEvent.data[2].f32:表示主轴方向上当前显示元素相对Swiper起始位置的位移。\n + * ArkUI_NodeComponentEvent.data[3].f32:表示主轴方向上目标元素相对Swiper起始位置的位移。\n + * ArkUI_NodeComponentEvent.data[4].f32:表示离手速度。\n + */ + NODE_SWIPER_EVENT_ON_ANIMATION_START, + + /** + * @brief 定义ARKUI_NODE_SWIPER切换动画结束是触发回调。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示当前显示元素的索引。\n + * ArkUI_NodeComponentEvent.data[1].f32:表示主轴方向上当前显示元素相对Swiper起始位置的位移。\n + */ + NODE_SWIPER_EVENT_ON_ANIMATION_END, + + /** + * @brief 定义ARKUI_NODE_SWIPER在页面跟手滑动过程中,逐帧触发该回调。 + * + * 事件回调发生时,事件参数{@link ArkUI_NodeEvent}对象中的联合体类型为{@link ArkUI_NodeComponentEvent}。\n + * {@link ArkUI_NodeComponentEvent}中包含2个参数:\n + * ArkUI_NodeComponentEvent.data[0].i32:表示当前显示元素的索引。\n + * ArkUI_NodeComponentEvent.data[1].f32:表示主轴方向上当前显示元素相对Swiper起始位置的位移。\n + */ + NODE_SWIPER_EVENT_ON_GESTURE_SWIPE, + /** * @brief 定义ARKUI_NODE_SCROLL滚动组件的滚动事件枚举值。 * -- Gitee From 0cf36860d10cff87b7002de01beebcb334ae31de Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Thu, 7 Mar 2024 19:55:06 +0800 Subject: [PATCH 0365/2135] =?UTF-8?q?fix=20NDK=20C-API=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9EAPI=20Signed-off-by:=20liyi0309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_interface.h | 2 +- zh-cn/native_sdk/ace/native_node.h | 33 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/ace/native_interface.h b/zh-cn/native_sdk/ace/native_interface.h index 9be224b3..1c8ce2fc 100644 --- a/zh-cn/native_sdk/ace/native_interface.h +++ b/zh-cn/native_sdk/ace/native_interface.h @@ -72,7 +72,7 @@ typedef enum { */ typedef enum { /** ARKUI_NATIVE_NODE类型支持版本1的结构体{@link ArkUI_NativeNodeAPI_1}。*/ - ARKUI_NATIVE_NODE_VERSION_1, + ARKUI_NATIVE_NODE_VERSION_1 = 1, } ArkUI_NativeNodeAPIVersion; /** diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 130c5763..6bf0a700 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -106,6 +106,8 @@ typedef enum { ARKUI_NODE_FLEX, /** 刷新组件。 */ ARKUI_NODE_REFRESH, + /** 瀑布流容器。 */ + ARKUI_NODE_WATER_FLOW, } ArkUI_NodeType; /** @@ -1715,6 +1717,17 @@ typedef enum { * */ NODE_TOGGLE_SWITCH_POINT_COLOR, + /** + * @brief Switch类型的开关值,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:设置开关的值,true表示开启。\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:设置开关的值。\n + * + */ + NODE_TOGGLE_VALUE, /** * @brief 加载进度条前景色属性,支持属性设置,属性重置和属性获取接口。 @@ -3244,6 +3257,26 @@ typedef enum { * */ NODE_REFRESH_REFRESHING = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, + /** + * @brief 设置下拉区域的自定义内容,支持属性设置和重置。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .object:参数类型{@Link ArkUI_NodeHandle}。 + * + */ + NODE_REFRESH_CONTENT, + + /** + * @brief 定义瀑布流组件布局主轴方向,支持属性设置、重置和获取。 + * + * 属性设置方法{@link ArkUI_AttributeItem}参数格式: \n + * .value[0].i32 主轴方向,参数类型{@Link ArkUI_FlexDirection}。 + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式: \n + * .value[0].i32 主轴方向,参数类型{@Link ArkUI_FlexDirection}。 + * + */ + NODE_WATER_FLOW_LAYOUT_DIRECTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_WATER_FLOW, } ArkUI_NodeAttributeType; #define MAX_COMPONENT_EVENT_ARG_NUM 12 -- Gitee From 2daa9bcd8b84623512063b94dc712e18780966f8 Mon Sep 17 00:00:00 2001 From: yuhaoqiang Date: Mon, 11 Mar 2024 15:57:47 +0800 Subject: [PATCH 0366/2135] hiappevent_event.h Signed-off-by: yuhaoqiang --- zh-cn/native_sdk/dfx/hiappevent_event.h | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/zh-cn/native_sdk/dfx/hiappevent_event.h b/zh-cn/native_sdk/dfx/hiappevent_event.h index 3794ec70..d541114b 100644 --- a/zh-cn/native_sdk/dfx/hiappevent_event.h +++ b/zh-cn/native_sdk/dfx/hiappevent_event.h @@ -77,6 +77,70 @@ extern "C" { */ #define EVENT_DISTRIBUTED_SERVICE_START "hiappevent.distributed_service_start" +/** + * @brief app崩溃事件. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_CRASH "APP_CRASH" + +/** + * @brief app卡顿事件. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_FREEZE "APP_FREEZE" + +/** + * @brief app应用加载事件. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_LAUNCH "APP_LAUNCH" + +/** + * @brief app应用滑动卡顿事件. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_SCROLL_JANK "SCROLL_JANK" + +/** + * @brief app应用CPU资源占用高事件. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_CPU_USAGE_HIGH "CPU_USAGE_HIGH" + +/** + * @brief app应用电池使用率事件. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_BATTERY_USAGE "BATTERY_USAGE" + +/** + * @brief app应用资源超限事件. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_RESOURCE_OVERLIMIT "RESOURCE_OVERLIMIT" + +/** + * @brief OS作用域. + * + * @since 12 + * @version 1.0 + */ +#define DOMAIN_OS "OS" + #ifdef __cplusplus } #endif -- Gitee From 54a0998346ddba105d60642c29591a33e4918211 Mon Sep 17 00:00:00 2001 From: guoxing Date: Mon, 11 Mar 2024 07:22:13 +0000 Subject: [PATCH 0367/2135] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoxing --- .../native_drawing/drawing_register_font.h | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 zh-cn/native_sdk/graphic/native_drawing/drawing_register_font.h diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_register_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_register_font.h new file mode 100644 index 00000000..1e95ae00 --- /dev/null +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_register_font.h @@ -0,0 +1,79 @@ +/* + * 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 C_INCLUDE_DRAWING_REGISTER_FONT_H +#define C_INCLUDE_DRAWING_REGISTER_FONT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Drawing模块提供包括2D图形渲染、文字绘制和图片显示等功能函数。 + * 本模块不提供像素单位,和应用上下文环境保持一致。如果处于ArkUI开发环境中,采用框架默认像素单位vp。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 11 + * @version 1.0 + */ + +/** + * @file drawing_register_font.h + * + * @brief 定义绘制模块中字体管理器相关的函数。 + * + * @since 11 + * @version 1.0 + */ + +#include "drawing_text_declaration.h" +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief 用于在字体管理器中注册自定义字体。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection对象的指针。 + * @param fontFamily 指需要注册的字体的字体名称。 + * @param familySrc 指需要注册的字体文件的路径。 + * @return 返回错误代码,0为成功,1为文件不存在,2为打开文件失败,3为读取文件失败,4为寻找文件失败,5为获取大小失败。 + * @since 11 + * @version 1.0 + */ +uint32_t OH_Drawing_RegisterFont(OH_Drawing_FontCollection*, const char* fontFamily, const char* familySrc); + +/** + * @brief 用于在字体管理器中注册字体缓冲区。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontCollection 指向OH_Drawing_FontCollection对象的指针。 + * @param fontFamily 指需要注册的字体的字体名称。 + * @param fontBuffer 指需要注册的字体文件的缓冲区。 + * @param length 指需要注册的字体文件的长度。 + * @return 返回错误代码,0为成功,6为缓冲区大小为零,7为字体集合为空。 + * @since 11 + * @version 1.0 + */ +uint32_t OH_Drawing_RegisterFontBuffer(OH_Drawing_FontCollection*, const char* fontFamily, uint8_t* fontBuffer, + size_t length); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif \ No newline at end of file -- Gitee From 3c3e48e1700918bf5c6fe68e2ac9999858b41eb2 Mon Sep 17 00:00:00 2001 From: yuhaoqiang Date: Mon, 11 Mar 2024 16:57:32 +0800 Subject: [PATCH 0368/2135] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yuhaoqiang --- zh-cn/native_sdk/dfx/hiappevent.h | 16 ++++++++-------- zh-cn/native_sdk/dfx/hiappevent_event.h | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/zh-cn/native_sdk/dfx/hiappevent.h b/zh-cn/native_sdk/dfx/hiappevent.h index 8637ca7a..d3bbf84b 100644 --- a/zh-cn/native_sdk/dfx/hiappevent.h +++ b/zh-cn/native_sdk/dfx/hiappevent.h @@ -111,13 +111,13 @@ enum EventType { * @version 1.0 */ typedef struct HiAppEvent_AppEventInfo { - /* 事件领域。 */ + /** 事件领域。 */ const char* domain; - /* 事件名称。 */ + /** 事件名称。 */ const char* name; - /* 事件类型。 */ + /** 事件类型。 */ enum EventType type; - /* Json格式字符串类型的事件参数列表。 */ + /** Json格式字符串类型的事件参数列表。 */ const char* params; } HiAppEvent_AppEventInfo; @@ -129,11 +129,11 @@ typedef struct HiAppEvent_AppEventInfo { * @version 1.0 */ typedef struct HiAppEvent_AppEventGroup { - /* 事件数组中相同的事件名称。 */ + /** 事件数组中相同的事件名称。 */ const char* name; - /* 具有相同事件名称的事件数组。 */ + /** 具有相同事件名称的事件数组。 */ const struct HiAppEvent_AppEventInfo* appEventInfos; - /* 具有相同事件名称的事件数组的长度。 */ + /** 具有相同事件名称的事件数组的长度。 */ uint32_t infoLen; } HiAppEvent_AppEventGroup; @@ -570,7 +570,7 @@ int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher); * @since 12 * @version 1.0 */ -void OH_HiAppEvent_ClearData(); +void OH_HiAppEvent_ClearData(void); #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/dfx/hiappevent_event.h b/zh-cn/native_sdk/dfx/hiappevent_event.h index d541114b..68fdefb9 100644 --- a/zh-cn/native_sdk/dfx/hiappevent_event.h +++ b/zh-cn/native_sdk/dfx/hiappevent_event.h @@ -78,7 +78,7 @@ extern "C" { #define EVENT_DISTRIBUTED_SERVICE_START "hiappevent.distributed_service_start" /** - * @brief app崩溃事件. + * @brief 应用崩溃事件。 * * @since 12 * @version 1.0 @@ -86,7 +86,7 @@ extern "C" { #define EVENT_APP_CRASH "APP_CRASH" /** - * @brief app卡顿事件. + * @brief 应用卡顿事件。 * * @since 12 * @version 1.0 @@ -94,7 +94,7 @@ extern "C" { #define EVENT_APP_FREEZE "APP_FREEZE" /** - * @brief app应用加载事件. + * @brief 应用加载事件。 * * @since 12 * @version 1.0 @@ -102,7 +102,7 @@ extern "C" { #define EVENT_APP_LAUNCH "APP_LAUNCH" /** - * @brief app应用滑动卡顿事件. + * @brief 应用滑动卡顿事件。 * * @since 12 * @version 1.0 @@ -110,7 +110,7 @@ extern "C" { #define EVENT_SCROLL_JANK "SCROLL_JANK" /** - * @brief app应用CPU资源占用高事件. + * @brief 应用CPU资源占用高事件。 * * @since 12 * @version 1.0 @@ -118,7 +118,7 @@ extern "C" { #define EVENT_CPU_USAGE_HIGH "CPU_USAGE_HIGH" /** - * @brief app应用电池使用率事件. + * @brief 应用电源使用率事件。 * * @since 12 * @version 1.0 @@ -126,7 +126,7 @@ extern "C" { #define EVENT_BATTERY_USAGE "BATTERY_USAGE" /** - * @brief app应用资源超限事件. + * @brief 应用资源超限事件。 * * @since 12 * @version 1.0 @@ -134,7 +134,7 @@ extern "C" { #define EVENT_RESOURCE_OVERLIMIT "RESOURCE_OVERLIMIT" /** - * @brief OS作用域. + * @brief OS作用域。 * * @since 12 * @version 1.0 -- Gitee From 1e3d1a4476753ae7f8fad9efad706ce406d5a34d Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Mon, 11 Mar 2024 19:52:29 +0800 Subject: [PATCH 0369/2135] =?UTF-8?q?fix=20NDK=20C-API=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9Etextinput=20api=20Signed-off-by:=20liyi0309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/native_sdk/ace/native_node.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 6bf0a700..a1141529 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -1929,6 +1929,19 @@ typedef enum { * */ NODE_TEXT_INPUT_CANCEL_BUTTON, + /** + * @brief 单行文本设置文本选中并高亮的区域,支持属性设置,属性重置和属性获取接口。 + * + * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:选中文本的起始位置;\n + * .value[1].i32:选中文本的终止位置;\n + * \n + * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n + * .value[0].i32:选中文本的起始位置;\n + * .value[1].i32:选中文本的终止位置;\n + * + */ + NODE_TEXT_INPUT_TEXT_SELECTION, /** * @brief 多行文本输入框的默认提示文本内容属性,支持属性设置,属性重置和属性获取接口。 -- Gitee From 145bd4fedddcf5ea96ddca1e614b5981d9aee1cd Mon Sep 17 00:00:00 2001 From: lixuhui Date: Mon, 11 Mar 2024 22:07:02 +0800 Subject: [PATCH 0370/2135] add OH_NativeXComponent_RegisterSurfaceHideCallback and OH_NativeXComponent_RegisterSurfaceShowCallback Signed-off-by: lixuhui --- .../ace/native_interface_xcomponent.h | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index babcc043..312eaa57 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -645,6 +645,30 @@ int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback( */ int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool needSoftKeyboard); +/** + * @brief 为此OH_NativeXComponent实例注册应用界面显示回调。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param callback 指示指向应用界面显示回调的指针。 + * @return 返回执行的状态代码。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterSurfaceShowCallback( + OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); + +/** + * @brief 为此OH_NativeXComponent实例注册应用界面隐藏回调。 + * + * @param component 表示指向OH_NativeXComponent实例的指针。 + * @param callback 指示指向应用界面隐藏回调的指针。 + * @return 返回执行的状态代码。 + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterSurfaceHideCallback( + OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); + #ifdef __cplusplus }; #endif -- Gitee From e4727c48a62eba99ab2a733da30b72e6f78fdd14 Mon Sep 17 00:00:00 2001 From: lixuhui Date: Mon, 11 Mar 2024 22:54:05 +0800 Subject: [PATCH 0371/2135] fix Signed-off-by: lixuhui --- zh-cn/native_sdk/ace/native_interface_xcomponent.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_interface_xcomponent.h b/zh-cn/native_sdk/ace/native_interface_xcomponent.h index 312eaa57..430bd2a5 100644 --- a/zh-cn/native_sdk/ace/native_interface_xcomponent.h +++ b/zh-cn/native_sdk/ace/native_interface_xcomponent.h @@ -646,10 +646,10 @@ int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback( int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool needSoftKeyboard); /** - * @brief 为此OH_NativeXComponent实例注册应用界面显示回调。 + * @brief 为此OH_NativeXComponent实例注册surface显示回调,该回调在应用从后台返回前台时触发。 * * @param component 表示指向OH_NativeXComponent实例的指针。 - * @param callback 指示指向应用界面显示回调的指针。 + * @param callback 指示指向surface显示回调的指针。 * @return 返回执行的状态代码。 * @since 12 * @version 1.0 @@ -658,10 +658,10 @@ int32_t OH_NativeXComponent_RegisterSurfaceShowCallback( OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); /** - * @brief 为此OH_NativeXComponent实例注册应用界面隐藏回调。 + * @brief 为此OH_NativeXComponent实例注册surface隐藏回调,该回调在应用从前台来到后台时触发。 * * @param component 表示指向OH_NativeXComponent实例的指针。 - * @param callback 指示指向应用界面隐藏回调的指针。 + * @param callback 指示指向surface隐藏回调的指针。 * @return 返回执行的状态代码。 * @since 12 * @version 1.0 -- Gitee From f4bfdb7a41348b36083769c310cecb3d64d9560f Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Tue, 12 Mar 2024 10:44:48 +0800 Subject: [PATCH 0372/2135] Update docs (0312) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_interface.h | 2 +- .../ace/native_interface_xcomponent.h | 10 ++ en/native_sdk/ace/native_node.h | 129 +++++++++++++++++- 3 files changed, 136 insertions(+), 5 deletions(-) diff --git a/en/native_sdk/ace/native_interface.h b/en/native_sdk/ace/native_interface.h index 98a39fc1..bd0ac14e 100644 --- a/en/native_sdk/ace/native_interface.h +++ b/en/native_sdk/ace/native_interface.h @@ -73,7 +73,7 @@ typedef enum { */ typedef enum { /** The ARKUI_NATIVE_NODE type supports the structure {@link ArkUI_NativeNodeAPI_1} of version 1. */ - ARKUI_NATIVE_NODE_VERSION_1, + ARKUI_NATIVE_NODE_VERSION_1 = 1, } ArkUI_NativeNodeAPIVersion; /** diff --git a/en/native_sdk/ace/native_interface_xcomponent.h b/en/native_sdk/ace/native_interface_xcomponent.h index a305f8bc..128aff95 100644 --- a/en/native_sdk/ace/native_interface_xcomponent.h +++ b/en/native_sdk/ace/native_interface_xcomponent.h @@ -645,6 +645,16 @@ int32_t OH_NativeXComponent_RegisterUIInputEventCallback( int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback( OH_NativeXComponent* component, HitTestMode (*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event)); +/** + * @brief Specifies whether a soft keyboard is required for this OH_NativeXComponent instance. + * @param component Indicates the pointer to the OH_NativeXComponent instance. + * @param needSoftKeyboard Indicates whether a soft keyboard is required. + * @return Returns the status code of the execution. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool needSoftKeyboard); + #ifdef __cplusplus }; #endif diff --git a/en/native_sdk/ace/native_node.h b/en/native_sdk/ace/native_node.h index 94ac5968..53584fe4 100644 --- a/en/native_sdk/ace/native_node.h +++ b/en/native_sdk/ace/native_node.h @@ -107,6 +107,8 @@ typedef enum { ARKUI_NODE_FLEX, /** Refresh component. */ ARKUI_NODE_REFRESH, + /** Waterfall container. */ + ARKUI_NODE_WATER_FLOW, } ArkUI_NodeType; /** @@ -213,10 +215,12 @@ typedef enum { * @brief Defines the interactivity 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].i32: The value true means that the component can interact with users, and false means the opposite.\n + *.value[0].i32: The value true means that the component can interact with users, and false means + * the opposite.\n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - *.value[0].i32: The value 1 means that the component can interact with users, and 0 means the opposite. \n + *.value[0].i32: The value 1 means that the component can interact with users, and 0 means + * the opposite. \n * */ NODE_ENABLED, @@ -1841,6 +1845,17 @@ typedef enum { * */ NODE_TOGGLE_SWITCH_POINT_COLOR, + /** + * @brief Defines the toggle switch value. 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 the toggle. The value true means to enable the toggle. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable the toggle. \n + * + */ + NODE_TOGGLE_VALUE, /** * @brief Defines the foreground color of the loading progress bar. @@ -2072,6 +2087,20 @@ typedef enum { * */ NODE_TEXT_INPUT_CANCEL_BUTTON, + /** + * @brief Sets the text selection area, which will be highlighted. + * 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: start position of the text selection. \n + * .value[1].i32: end position of the text selection. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: start position of the text selection. \n + * .value[1].i32: end position of the text selection. \n + * + */ + NODE_TEXT_INPUT_TEXT_SELECTION, /** * @brief Defines the default placeholder text for the multi-line text box. @@ -3446,6 +3475,22 @@ typedef enum { */ NODE_SWIPER_SHOW_DISPLAY_ARROW, + /** + * @brief Defines the effect used at the edges of the swiper when the boundary of the scrollable content is reached. + * 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: effect used at the edges of the swiper when the boundary of the scrollable content is reached. + * The parameter type is {@link ArkUI_EdgeEffect}.\n + * The default value is ARKUI_EDGE_EFFECT_SPRING. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: effect used at the edges of the swiper when the boundary of the scrollable content is reached. + * The parameter type is {@link ArkUI_EdgeEffect}. \n + * + */ + NODE_SWIPER_EDGE_EFFECT_MODE, + /** * @brief Defines the header of the list item group. * This attribute can be set, reset, and obtained as required through APIs. @@ -3586,6 +3631,28 @@ typedef enum { * */ NODE_REFRESH_REFRESHING = MAX_NODE_SCOPE_NUM * ARKUI_NODE_REFRESH, + /** + * @brief Sets the custom content in the pull-down area. + * 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: The parameter type is {@Link ArkUI_NodeHandle}. + * + */ + NODE_REFRESH_CONTENT, + + /** + * @brief Defines the main axis direction of the component layout. + * 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: main axis direction. The parameter type is {@Link ArkUI_FlexDirection}. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: main axis direction. The parameter type is {@Link ArkUI_FlexDirection}. + * + */ + NODE_WATER_FLOW_LAYOUT_DIRECTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_WATER_FLOW, } ArkUI_NodeAttributeType; #define MAX_COMPONENT_EVENT_ARG_NUM 12 @@ -3635,7 +3702,8 @@ typedef enum { * @brief Defines the unmount event. * * This event is triggered when the component is unmounted and hidden. \n - * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent}. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} does not contain parameters. */ NODE_EVENT_ON_DISAPPEAR, @@ -3818,7 +3886,8 @@ typedef enum { * @brief Defines the event triggered when the text selection position changes. * \n - * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent}. \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: start position of the text selection area. \n * ArkUI_NodeComponentEvent.data[1].i32: end position of the text selection area. \n @@ -3928,6 +3997,58 @@ typedef enum { */ NODE_SLIDER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SLIDER, + /** + * @brief Defines the event triggered when the index of the currently displayed element of this + * ARKUI_NODE_SWIPER instance changes. + * + * 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 displayed element. \n + */ + NODE_SWIPER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SWIPER, + + /** + * @brief Defines the event triggered when the switching animation of this ARKUI_NODE_SWIPER instance starts. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains five parameters: \n + * ArkUI_NodeComponentEvent.data[0].i32: index of the currently displayed element. \n + * ArkUI_NodeComponentEvent.data[1].i32: index of the target element to switch to. \n + * ArkUI_NodeComponentEvent.data[2].f32: offset of the currently displayed element relative to the + * start position of the swiper along the main axis. \n + * ArkUI_NodeComponentEvent.data[3].f32: offset of the target element relative to the start position + * of the swiper along the main axis. \n + * ArkUI_NodeComponentEvent.data[4].f32: hands-off velocity. \n + */ + NODE_SWIPER_EVENT_ON_ANIMATION_START, + + /** + * @brief Defines the event triggered when the switching animation of this ARKUI_NODE_SWIPER instance ends. + * + * 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: index of the currently displayed element. \n + * ArkUI_NodeComponentEvent.data[1].f32: offset of the currently displayed element relative to the + * start position of the swiper along the main axis. \n + */ + NODE_SWIPER_EVENT_ON_ANIMATION_END, + + /** + * @brief Defines the event triggered on a frame-by-frame basis when the page is turned by a swipe in this + * ARKUI_NODE_SWIPER instance. + * + * 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: index of the currently displayed element. \n + * ArkUI_NodeComponentEvent.data[1].f32: offset of the currently displayed element relative to the + * start position of the swiper along the main axis. \n + */ + NODE_SWIPER_EVENT_ON_GESTURE_SWIPE, + /** * @brief Defines the event triggered when the ARKUI_NODE_SCROLL component scrolls. * -- Gitee From ab41d00170079957329b76693c77b6d304eeb443 Mon Sep 17 00:00:00 2001 From: aryawang Date: Tue, 12 Mar 2024 15:14:52 +0800 Subject: [PATCH 0373/2135] =?UTF-8?q?NDK=20C-Api=20=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=BC=B9=E7=AA=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: aryawang --- zh-cn/native_sdk/ace/native_dialog.h | 202 ++++++++++++++++++++++++ zh-cn/native_sdk/ace/native_interface.h | 4 +- zh-cn/native_sdk/ace/native_type.h | 30 ++++ 3 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 zh-cn/native_sdk/ace/native_dialog.h diff --git a/zh-cn/native_sdk/ace/native_dialog.h b/zh-cn/native_sdk/ace/native_dialog.h new file mode 100644 index 00000000..94edf90b --- /dev/null +++ b/zh-cn/native_sdk/ace/native_dialog.h @@ -0,0 +1,202 @@ +/* + * 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 ARKUI_NATIVE_DIALOG_H +#define ARKUI_NATIVE_DIALOG_H + +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** +* @brief 弹窗关闭的触发方式。 +* +* @since 12 +*/ +typedef enum { + /** 系统定义的返回操作、键盘ESC触发。*/ + DIALOG_DISMISS_BACK_PRESS = 0, + /** 点击遮障层触发。*/ + DIALOG_DISMISS_TOUCH_OUTSIDE, +} ArkUI_DismissReason; + +/** +* @brief 弹窗关闭的回调函数。 +* +* @since 12 +*/ +typedef bool (*OnWillDismissEvent)(int32_t reason); + +/** + * @brief ArkUI提供的Native侧自定义弹窗接口集合。 + * + * @version 1 + * @since 12 + */ +typedef struct { + /** 结构体版本。 */ + int32_t version; + /** + * @brief 创建自定义弹窗并返回指向自定义弹窗的指针。 + * + * @note create方法需要在调用show方法之前调用。 + * @return 返回指向自定义弹窗的指针,如创建失败,返回空指针。 + */ + ArkUI_NativeDialogHandler (*create)(); + /** + * @brief 销毁自定义弹窗。 + * + * @param handler 指向自定义弹窗控制器的指针。 + */ + void (*dispose)(ArkUI_NativeDialogHandler handler); + /** + * @brief 挂载自定义弹窗内容。 + * + * @note attachContent方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param content 弹窗内容根节点指针。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*attachContent)(ArkUI_NativeDialogHandler handler, ArkUI_NodeHandle content); + /** + * @brief 卸载自定义弹窗内容。 + * + * @note detachContent方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param content 弹窗内容根节点指针。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*detachContent)(ArkUI_NativeDialogHandler handler, ArkUI_NodeHandle content); + /** + * @brief 为自定义弹窗设置对齐方式。 + * + * @note setContentAlignment方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param alignment 对齐方式,参数类型{@Link ArkUI_Alignment}。 + * @param offsetX 弹窗的水平偏移量,浮点型。 + * @param offsetY 弹窗的垂直偏移量,浮点型。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*setContentAlignment)(ArkUI_NativeDialogHandler handler, int32_t alignment, float offsetX, float offsetY); + /** + * @brief 重置setContentAlignment方法设置的属性,使用系统默认的对齐方式。 + * + * @note resetContentAlignment方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*resetContentAlignment)(ArkUI_NativeDialogHandler handler); + /** + * @brief 设置自定义弹窗是否开启模态样式的弹窗。 + * + * @note setMode方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param useModalMode 设置是否开启模态窗口,模态窗口有蒙层,非模态窗口无蒙层,为true时开启模态窗口。 + * @param autoCancel 设置是否允许点击遮罩层退出,true表示关闭弹窗,false表示不关闭弹窗。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*setMode)(ArkUI_NativeDialogHandler handler, bool useModalMode, bool autoCancel); + /** + * @brief 设置自定义弹窗遮罩属性。 + * + * @note setMask方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param maskColor 设置遮罩颜色,0xargb格式。 + * @param rect 遮蔽层区域范围的指针,遮蔽层区域内的事件不透传,在遮蔽层区域外的事件透传。参数类型{@Link ArkUI_Rect}。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*setMask)(ArkUI_NativeDialogHandler handler, uint32_t maskColor, const ArkUI_Rect* rect); + /** + * @brief 设置弹窗背景色。 + * + * @note setBackgroundColor方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param backgroundColor 设置弹窗背景颜色,0xargb格式。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*setBackgroundColor)(ArkUI_NativeDialogHandler handler, uint32_t backgroundColor); + /** + * @brief 设置弹窗背板圆角半径。 + * + * @note setCornerRadius方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param topLeft 设置弹窗背板左上角圆角半径。 + * @param topRight 设置弹窗背板右上角圆角半径。 + * @param bottomLeft 设置弹窗背板左下圆角半径。 + * @param bottomRight 设置弹窗背板右下角圆角半径。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*setCornerRadius)(ArkUI_NativeDialogHandler handler, float topLeft, float topRight, + float bottomLeft, float bottomRight); + /** + * @brief 弹窗宽度占栅格宽度的个数。 + * + * @note setGridCount方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param gridCount 默认为按照窗口大小自适应,最大栅格数为系统最大栅格数。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*setGridCount)(ArkUI_NativeDialogHandler handler, int32_t gridCount); + /** + * @brief 弹窗容器样式是否自定义。 + * + * @note setCustomStyle方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param customStyle true:宽度自适应子节点,圆角为0,弹窗背景色透明;false:高度自适应子节点,宽度由栅格系统定义, 圆角半径24vp。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*setCustomStyle)(ArkUI_NativeDialogHandler handler, bool customStyle); + /** + * @brief 弹窗容器是否使用自定义弹窗动画。 + * + * @note useCustomAnimation方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param useCustomAnimation true:使用自定义动画,关闭系统默认动画;false:使用系统默认动画。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*useCustomAnimation)(ArkUI_NativeDialogHandler handler, bool useCustomAnimation); + /** + * @brief 当触发系统定义的返回操作、键盘ESC关闭交互操作时,如果注册该回调函数,则不会立刻关闭弹窗,是否关闭由用户自行决定。 + * + * @note registerOnWillDismiss方法需要在调用show方法之前调用。 + * @param handler 指向自定义弹窗控制器的指针。 + * @param eventHandler 弹窗关闭的回调函数 参数类型{@Link OnWillDismissEvent}。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*registerOnWillDismiss)(ArkUI_NativeDialogHandler handler, OnWillDismissEvent eventHandler); + /** + * @brief 显示自定义弹窗。 + * + * @param handler 指向自定义弹窗控制器的指针。 + * @param showInSubWindow 是否在子窗口显示弹窗。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*show)(ArkUI_NativeDialogHandler handler, bool showInSubWindow); + /** + * @brief 关闭自定义弹窗,如已关闭,则不生效。 + * + * @param handler 指向自定义弹窗控制器的指针。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*close)(ArkUI_NativeDialogHandler handler); +} ArkUI_NativeDialogAPI_1; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_DIALOG_H \ No newline at end of file diff --git a/zh-cn/native_sdk/ace/native_interface.h b/zh-cn/native_sdk/ace/native_interface.h index 9be224b3..aa911f52 100644 --- a/zh-cn/native_sdk/ace/native_interface.h +++ b/zh-cn/native_sdk/ace/native_interface.h @@ -63,6 +63,8 @@ typedef struct { typedef enum { /** UI组件相关接口类型。*/ ARKUI_NATIVE_NODE, + /** 弹窗相关接口类型. */ + ARKUI_NATIVE_DIALOG, } ArkUI_NativeAPIVariantKind; /** @@ -120,4 +122,4 @@ ArkUI_AnyNativeAPI* OH_ArkUI_QueryModuleInterface(ArkUI_NativeAPIVariantKind typ #endif #endif // ARKUI_NATIVE_INTERFACE_H -/** @} */ +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index 8feee505..ef57e88f 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -48,6 +48,13 @@ extern "C" { */ struct ArkUI_Node; +/** + * @brief 提供ArkUI在native侧的自定义弹窗控制器对象定义。 + * + * @since 12 + */ +struct ArkUI_NativeDialog; + /** * @brief 定义ArkUI native组件实例对象指针定义。 * @@ -55,6 +62,13 @@ struct ArkUI_Node; */ typedef struct ArkUI_Node* ArkUI_NodeHandle; +/** + * @brief 定义ArkUI在Native侧的自定义弹窗控制器对象指针。 + * + * @since 12 + */ +typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandler; + /** * @brief ArkUI在native侧的数字类型定义。 * @@ -1240,6 +1254,22 @@ typedef enum { ARKUI_TRANSITION_EDGE_END, }ArkUI_TransitionEdge; +/** + * @brief 定义遮罩屏蔽区域的范围结构体。 + * + * @since 12 + */ +typedef struct { + /** 区域在x轴的位置。 */ + float x; + /** 区域在y轴的位置。 */ + float y; + /** 区域宽度。 */ + float width; + /** 区域高度。 */ + float height; +} ArkUI_Rect; + #ifdef __cplusplus }; #endif -- Gitee From bc73e5fe2827c4df5f4fb91288d212d68e53f35a Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Wed, 13 Mar 2024 11:02:50 +0800 Subject: [PATCH 0374/2135] Update docs (0313) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_dialog.h | 212 +++++++++++++++++++++++++++ en/native_sdk/ace/native_interface.h | 6 +- en/native_sdk/ace/native_type.h | 30 ++++ 3 files changed, 246 insertions(+), 2 deletions(-) create mode 100644 en/native_sdk/ace/native_dialog.h diff --git a/en/native_sdk/ace/native_dialog.h b/en/native_sdk/ace/native_dialog.h new file mode 100644 index 00000000..fdd59f76 --- /dev/null +++ b/en/native_sdk/ace/native_dialog.h @@ -0,0 +1,212 @@ +/* + * 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 ARKUI_NATIVE_DIALOG_H +#define ARKUI_NATIVE_DIALOG_H + +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** +* @brief Enumerates the actions for triggering closure of the dialog box. +* +* @since 12 +*/ +typedef enum { + /** Touching the system-defined Back button or pressing the Esc key. */ + DIALOG_DISMISS_BACK_PRESS = 0, + /** Touching the mask. */ + DIALOG_DISMISS_TOUCH_OUTSIDE, +} ArkUI_DismissReason; + +/** +* @brief Invoked when the dialog box is closed. +* +* @since 12 +*/ +typedef bool (*OnWillDismissEvent)(int32_t reason); + +/** + * @brief Provides the custom dialog box APIs for the native side. + * + * @version 1 + * @since 12 + */ +typedef struct { + /** Struct version. */ + int32_t version; + /** + * @brief Creates a custom dialog box and returns the pointer to the created dialog box. + * + * @note This method must be called before the show method. + * @return Returns the pointer to the created custom dialog box; returns a null pointer if the creation fails. + */ + ArkUI_NativeDialogHandler (*create)(); + /** + * @brief Destroys a custom dialog box. + * + * @param handler Indicates the pointer to the custom dialog box controller. + */ + void (*dispose)(ArkUI_NativeDialogHandler handler); + /** + * @brief Attaches the content of a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param content Indicates the pointer to the root node of the custom dialog box content. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*attachContent)(ArkUI_NativeDialogHandler handler, ArkUI_NodeHandle content); + /** + * @brief Detaches the content of a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param content Indicates the pointer to the root node of the custom dialog box content. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*detachContent)(ArkUI_NativeDialogHandler handler, ArkUI_NodeHandle content); + /** + * @brief Sets the alignment mode for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param alignment Indicates the alignment mode. 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 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setContentAlignment)(ArkUI_NativeDialogHandler handler, int32_t alignment, float offsetX, float offsetY); + /** + * @brief Resets the alignment mode of a custom dialog box to its default settings. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*resetContentAlignment)(ArkUI_NativeDialogHandler handler); + /** + * @brief Sets the modal mode for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param useModalMode Specifies whether the custom dialog box is a modal, which has a mask applied. + * The value true means that the custom dialog box is a modal, and false means the opposite. + * @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 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setMode)(ArkUI_NativeDialogHandler handler, bool useModalMode, bool autoCancel); + /** + * @brief Sets the mask for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param maskColor Indicates the mask color, in 0xARGB format. + * @param rect Indicates the 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 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setMask)(ArkUI_NativeDialogHandler handler, uint32_t maskColor, const ArkUI_Rect* rect); + /** + * @brief Sets the background color for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param backgroundColor Indicates the background color of the custom dialog box, in 0xARGB format. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setBackgroundColor)(ArkUI_NativeDialogHandler handler, uint32_t backgroundColor); + /** + * @brief Sets the background corner radius for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param topLeft Indicates the radius of the upper left corner of the custom dialog box background. + * @param topRight Indicates the radius of the upper right corner of the custom dialog box background. + * @param bottomLeft Indicates the radius of the lower left corner of the custom dialog box background. + * @param bottomRight Indicates the radius of the lower right corner of the custom dialog box background. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setCornerRadius)(ArkUI_NativeDialogHandler handler, float topLeft, float topRight, + float bottomLeft, float bottomRight); + /** + * @brief Sets the number of grid columns occupied by a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param gridCount Indicates the number of grid columns occupied by the dialog box. The default value is subject to + * the window size, and the maximum value is the maximum number of columns supported by the system. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setGridCount)(ArkUI_NativeDialogHandler handler, int32_t gridCount); + /** + * @brief Specifies whether to use a custom style for the custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param customStyle Specifies whether to use a custom style for the dialog box. + * true: The dialog box automatically adapts its width to the child components; the rounded corner is 0; + * the background color is transparent. + * false: The dialog box automatically adapts its width to the grid system and its height to the child + * components; the rounded corner is 24 vp. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setCustomStyle)(ArkUI_NativeDialogHandler handler, bool customStyle); + /** + * @brief Specifies whether to use a custom animation for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param useCustomAnimation Specifies whether to use a custom animation. + * The value true means to use a custom animation, and false means to use the default animation. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*useCustomAnimation)(ArkUI_NativeDialogHandler handler, bool useCustomAnimation); + /** + * @brief Registers a callback for a custom dialog box so that the user can decide whether to close the dialog box + * after they touch the Back button or press the Esc key. + * + * @note This method must be called before the show method. + * @param handler Indicates the pointer to the custom dialog box controller. + * @param eventHandler Indicates the callback to register. The parameter type is {@link OnWillDismissEvent}. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*registerOnWillDismiss)(ArkUI_NativeDialogHandler handler, OnWillDismissEvent eventHandler); + /** + * @brief Shows a custom dialog box. + * + * @param handler Indicates the pointer to the custom dialog box controller. + * @param showInSubWindow Specifies whether to show the dialog box in a sub-window. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*show)(ArkUI_NativeDialogHandler handler, bool showInSubWindow); + /** + * @brief Closes a custom dialog box. If the dialog box has been closed, this API does not take effect. + * + * @param handler Indicates the pointer to the custom dialog box controller. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*close)(ArkUI_NativeDialogHandler handler); +} ArkUI_NativeDialogAPI_1; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_DIALOG_H diff --git a/en/native_sdk/ace/native_interface.h b/en/native_sdk/ace/native_interface.h index bd0ac14e..ac01cc68 100644 --- a/en/native_sdk/ace/native_interface.h +++ b/en/native_sdk/ace/native_interface.h @@ -57,13 +57,15 @@ typedef struct { } ArkUI_AnyNativeAPI; /** - * @brief Defines the native API set type. + * @brief Defines the native API types. * * @since 12 */ typedef enum { - /** API type related to UI components. */ + /** API related to UI components. */ ARKUI_NATIVE_NODE, + /** API related to dialog boxes. */ + ARKUI_NATIVE_DIALOG, } ArkUI_NativeAPIVariantKind; /** diff --git a/en/native_sdk/ace/native_type.h b/en/native_sdk/ace/native_type.h index af7f796d..d4b780cd 100644 --- a/en/native_sdk/ace/native_type.h +++ b/en/native_sdk/ace/native_type.h @@ -49,6 +49,13 @@ extern "C" { */ struct ArkUI_Node; +/** + * @brief Defines the custom dialog box controller of ArkUI on the native side. + * + * @since 12 + */ +struct ArkUI_NativeDialog; + /** * @brief Defines the pointer to the ArkUI native component object. * @@ -56,6 +63,13 @@ struct ArkUI_Node; */ typedef struct ArkUI_Node* ArkUI_NodeHandle; +/** + * @brief Defines the pointer to the custom dialog box controller of ArkUI on the native side. + * + * @since 12 + */ +typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandler; + /** * @brief Provides the number types of ArkUI in the native code. * @@ -1279,6 +1293,22 @@ typedef enum { ARKUI_TRANSITION_EDGE_END, }ArkUI_TransitionEdge; +/** + * @brief Defines a mask area. + * + * @since 12 + */ +typedef struct { + /** X coordinate of the mask area. */ + float x; + /** Y coordinate of the mask area. */ + float y; + /** Width of the mask area. */ + float width; + /** Height of the mask area. */ + float height; +} ArkUI_Rect; + #ifdef __cplusplus }; #endif -- Gitee From 69c278639b657aa896d8bb548c40dcabcedf73a4 Mon Sep 17 00:00:00 2001 From: Gloria Date: Wed, 13 Mar 2024 14:29:45 +0800 Subject: [PATCH 0375/2135] updated EN docs against CH docs Signed-off-by: Gloria --- en/native_sdk/graphic/external_window.h | 55 ++ en/native_sdk/graphic/native_buffer.h | 156 +++ .../graphic/native_drawing/drawing_bitmap.h | 23 +- .../graphic/native_drawing/drawing_brush.h | 13 + .../graphic/native_drawing/drawing_canvas.h | 198 +++- .../graphic/native_drawing/drawing_color.h | 4 +- .../native_drawing/drawing_color_filter.h | 4 +- .../graphic/native_drawing/drawing_filter.h | 4 +- .../graphic/native_drawing/drawing_font.h | 103 +- .../native_drawing/drawing_font_collection.h | 26 +- .../graphic/native_drawing/drawing_image.h | 122 +++ .../native_drawing/drawing_mask_filter.h | 6 +- .../graphic/native_drawing/drawing_matrix.h | 157 ++- .../native_drawing/drawing_memory_stream.h | 79 ++ .../graphic/native_drawing/drawing_path.h | 145 ++- .../native_drawing/drawing_path_effect.h | 79 ++ .../graphic/native_drawing/drawing_pen.h | 52 +- .../graphic/native_drawing/drawing_point.h | 4 +- .../graphic/native_drawing/drawing_rect.h | 4 +- .../native_drawing/drawing_round_rect.h | 4 +- .../native_drawing/drawing_sampling_options.h | 107 +++ .../native_drawing/drawing_shader_effect.h | 6 +- .../native_drawing/drawing_text_blob.h | 67 +- .../native_drawing/drawing_text_declaration.h | 35 +- .../native_drawing/drawing_text_typography.h | 899 ++++++++++++++++-- .../graphic/native_drawing/drawing_typeface.h | 30 +- .../graphic/native_drawing/drawing_types.h | 101 +- 27 files changed, 2371 insertions(+), 112 deletions(-) create mode 100644 en/native_sdk/graphic/native_drawing/drawing_image.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_memory_stream.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_path_effect.h create mode 100644 en/native_sdk/graphic/native_drawing/drawing_sampling_options.h diff --git a/en/native_sdk/graphic/external_window.h b/en/native_sdk/graphic/external_window.h index dddd18ca..4a8e28d3 100644 --- a/en/native_sdk/graphic/external_window.h +++ b/en/native_sdk/graphic/external_window.h @@ -194,6 +194,13 @@ enum NativeWindowOperation { * [Input] uint64_t uiTimestamp. */ SET_UI_TIMESTAMP, + /** + * Obtaining the memory queue size, + * Variable arguments in the function: + * [Output] int32_t *size. + * @since 12 + */ + GET_BUFFERQUEUE_SIZE, }; /** @@ -505,6 +512,54 @@ int32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint3 */ int32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, const OHExtDataHandle *handle); +/** + * @brief Attaches an OHNativeWindowBuffer to an OHNativeWindow instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window Pointer to an OHNativeWindow instance. + * @param buffer Pointer to an OHNativeWindowBuffer instance. + * @return Returns 0 if the operation is successful. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_NativeWindowAttachBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); + +/** + * @brief Detaches an OHNativeWindowBuffer from an OHNativeWindow instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window Pointer to an OHNativeWindow instance. + * @param buffer Pointer to an OHNativeWindowBuffer instance. + * @return Returns 0 if the operation is successful. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_NativeWindowDetachBuffer(OHNativeWindow *window, OHNativeWindowBuffer *buffer); + +/** + * @brief Obtains a surface ID through an OHNativeWindow. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window Pointer to an OHNativeWindow instance. + * @param surfaceId Pointer to the surface ID. + * @return Returns 0 if the operation is successful. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_GetSurfaceId(OHNativeWindow *window, uint64_t *surfaceId); + +/** + * @brief Creates an OHNativeWindow instance based on a surface ID. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param surfaceId Pointer to the surface ID. + * @param window Double pointer to an OHNativeWindow instance. + * @return Returns 0 if the operation is successful. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeWindow_CreateNativeWindowFromSurfaceId(uint64_t surfaceId, OHNativeWindow **window); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_buffer.h b/en/native_sdk/graphic/native_buffer.h index 4063c5e7..6c960daf 100644 --- a/en/native_sdk/graphic/native_buffer.h +++ b/en/native_sdk/graphic/native_buffer.h @@ -88,6 +88,21 @@ enum OH_NativeBuffer_Usage { * @version 1.0 */ enum OH_NativeBuffer_Format { + /** + * CLUT8. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_CLUT8 = 0, + /** + * CLUT1. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_CLUT1, + /** + * CLUT4. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_CLUT4, /** * RGB565. */ @@ -160,6 +175,81 @@ enum OH_NativeBuffer_Format { * BGRA8888. */ NATIVEBUFFER_PIXEL_FMT_BGRA_8888, + /** + * YUV422 interleaved. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YUV_422_T, + /** + * YCbCr422 semi-planar. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_422_SP, + /** + * YCrCr422 semi-planar. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCR_422_SP, + /** + * YCbCr420 semi-planar. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_420_SP, + /** + * YCrCr420 semi-planar. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCR_420_SP, + /** + * YCbCr422 planar. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_422_P, + /** + * YCrCr422 planar. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCR_422_P, + /** + * YCbCr420 planar. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCBCR_420_P, + /** + * YCrCr420 planar. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YCRCR_420_P, + /** + * YUYV422 packed. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YUYV_422_PKG, + /** + * UYVY422 packed. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_UYVY_422_PKG, + /** + * YVYU422 packed. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_YVYU_422_PKG, + /** + * VYUY422 packed. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_VYUY_422_PKG, + /** + * RGBA_1010102 packed. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_RGBA_1010102, + /** + * Vender mask. + * @since 12 + */ + NATIVEBUFFER_PIXEL_FMT_VENDER_MASK = 0X7FFF0000, /** * Invalid format. */ @@ -303,6 +393,72 @@ enum OH_NativeBuffer_ColorSpace { OH_COLORSPACE_DISPLAY_BT2020_PQ, }; +/** + * @brief Enumerates the transform types of an OH_NativeBuffer instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 12 + * @version 1.0 + */ +enum OH_NativeBuffer_TransformType { + /** No rotation. */ + NATIVEBUFFER_ROTATE_NONE = 0, + /** Rotates by 90 degrees. */ + NATIVEBUFFER_ROTATE_90, + /** Rotates by 180 degrees. */ + NATIVEBUFFER_ROTATE_180, + /** Rotates by 270 degrees. */ + NATIVEBUFFER_ROTATE_270, + /** Flips horizontally. */ + NATIVEBUFFER_FLIP_H, + /** Flips vertically. */ + NATIVEBUFFER_FLIP_V, + /** Flips horizontally and rotates by 90 degrees. */ + NATIVEBUFFER_FLIP_H_ROT90, + /** Flips vertically and rotates by 90 degrees. */ + NATIVEBUFFER_FLIP_V_ROT90, + /** Flips horizontally and rotates by 180 degrees. */ + NATIVEBUFFER_FLIP_H_ROT180, + /** Flips vertically and rotates by 180 degrees. */ + NATIVEBUFFER_FLIP_V_ROT180, + /** Flips horizontally and rotates by 270 degrees. */ + NATIVEBUFFER_FLIP_H_ROT270, + /** Flips vertically and rotates by 270 degrees. */ + NATIVEBUFFER_FLIP_V_ROT270, +}; + +/** + * @brief Enumerates the color gamuts of an OH_NativeBuffer instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer + * @since 12 + * @version 1.0 + */ +enum OH_NativeBuffer_ColorGamut { + /** Default gamut. */ + NATIVEBUFFER_COLOR_GAMUT_NATIVE = 0, + /** Standard BT.601 color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT601 = 1, + /** Standard BT.709 color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_STANDARD_BT709 = 2, + /** DCI P3 color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_DCI_P3 = 3, + /** SRGB color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_SRGB = 4, + /** Adobe RGB color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_ADOBE_RGB = 5, + /** Display P3 color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_DISPLAY_P3 = 6, + /** BT.2020 color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_BT2020 = 7, + /** BT.2100 PQ color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_BT2100_PQ = 8, + /** BT.2100 HLG color gamut format. */ + NATIVEBUFFER_COLOR_GAMUT_BT2100_HLG = 9, + /** Display BT.2020 color gamut. */ + NATIVEBUFFER_COLOR_GAMUT_DISPLAY_BT2020 = 10, +}; + /** * @brief Defines the OH_NativeBuffer attribute configuration, which is used when you apply for * a new OH_NativeBuffer instance or query the attributes of an existing instance. diff --git a/en/native_sdk/graphic/native_drawing/drawing_bitmap.h b/en/native_sdk/graphic/native_drawing/drawing_bitmap.h index 30405b8c..09a34be4 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/en/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -21,7 +21,9 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. - * + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -51,7 +53,7 @@ extern "C" { * @since 8 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_BitmapFormat { /** Storage format of bitmap pixels. */ OH_Drawing_ColorFormat colorFormat; /** Alpha format of bitmap pixels. */ @@ -78,6 +80,21 @@ OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void); */ void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); +/** + * @brief Creates an OH_Drawing_Bitmap object, with the address of the memory for storing the bitmap pixels + * set to the memory address that you applied for. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image_Info Pointer to an {@link OH_Drawing_Image_Info} object. + * @param pixels Pointer to the start address of the memory for storing the bitmap pixels. + * You need to apply for the memory and ensure its validity. + * @param rowBytes Size of pixels per row. + * @return Returns the pointer to the {@link 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); + /** * @brief Initializes the width and height of a bitmap and sets the pixel format for the bitmap. * @@ -119,7 +136,7 @@ uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_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 Pointer to an OH_Drawing_Bitmap object. + * @param OH_Drawing_Bitmap Pointer to an OH_Drawing_Bitmap object. * @return Returns the pixel address. * @since 8 * @version 1.0 diff --git a/en/native_sdk/graphic/native_drawing/drawing_brush.h b/en/native_sdk/graphic/native_drawing/drawing_brush.h index 8d096aeb..6eb517a2 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_brush.h +++ b/en/native_sdk/graphic/native_drawing/drawing_brush.h @@ -21,6 +21,8 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -156,6 +158,17 @@ void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect* */ void OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*); +/** + * @brief Sets a blender for a brush. The blender implements the specified blend mode. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object. + * @param OH_Drawing_BlendMode Blend mode. For details about the available options, see {@link OH_Drawing_BlendMode}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_BrushSetBlendMode(OH_Drawing_Brush*, OH_Drawing_BlendMode); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_canvas.h b/en/native_sdk/graphic/native_drawing/drawing_canvas.h index a1b19041..63dccf9f 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_canvas.h +++ b/en/native_sdk/graphic/native_drawing/drawing_canvas.h @@ -21,6 +21,8 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -131,6 +133,20 @@ void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*); */ void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); +/** + * @brief Saves the matrix and cropping region, and allocates a bitmap for subsequent drawing. If you call + * {@link OH_Drawing_CanvasRestore}, the changes made to the matrix and clipping region are discarded, + * and the bitmap is drawn. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object. + * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas*, const OH_Drawing_Rect*, const OH_Drawing_Brush*); + /** * @brief Restores the canvas status (canvas matrix) saved on the top of the stack. * @@ -202,6 +218,79 @@ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); */ void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); +/** + * @brief Draws a portion of a bitmap onto a specified area of the canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Bitmap Pointer to an {@link OH_Drawing_Bitmap} object. + * @param src Pointer to a rectangle on the bitmap. This parameter can be left empty. + * @param dst Pointer to a rectangle on the canvas. + * @param OH_Drawing_SamplingOptions Pointer to an {@link OH_Drawing_SamplingOptions} object. + * @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*); + +/** + * @brief Sets the matrix status for a canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object, + * which is obtained by calling {@link OH_Drawing_MatrixCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasSetMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief Draws an image onto a specified area of the canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object. + * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object. + * @param OH_Drawing_SamplingOptions Pointer to an {@link 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*); + +/** + * @brief Copies pixel data from a canvas to a specified address. This function cannot be used for recorded canvases. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Image_Info Pointer to an {@link OH_Drawing_Image_Info} object. + * @param dstPixels Pointer to the start address for storing the pixel data. + * @param dstRowBytes Size of pixels per row. + * @param srcX X-axis offset of the pixels on the canvas, in px. + * @param srcY Y-axis offset of the pixels on the canvas, in px. + * @return Returns true if the pixel data is copied to the start address of the storage; + * returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas*, OH_Drawing_Image_Info*, + void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY); + +/** + * @brief Copies pixel data from a canvas to an image. This function cannot be used for recorded canvases. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Bitmap Pointer to an {@link OH_Drawing_Bitmap} object. + * @param srcX X-axis offset of the pixels on the canvas, in px. + * @param srcY Y-axis offset of the pixels on the canvas, in px. + * @return Returns true if the pixel data is copied to the image; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, int32_t srcX, int32_t srcY); + /** * @brief Draws a rectangle. * @@ -279,7 +368,7 @@ void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_CanvasClipOp { /** * Clips a specified area. That is, the difference set is obtained. */ @@ -321,8 +410,8 @@ void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** - * @brief Rotates a canvas by a given angle. A positive number indicates clockwise rotation, and a negative number - * indicates clockwise rotation. + * @brief Rotates a canvas by a given angle. A positive number indicates a clockwise rotation, + * and a negative number indicates a counterclockwise rotation. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object. @@ -369,6 +458,109 @@ void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); */ void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, uint32_t color); +/** + * @brief Obtains the canvas width. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @return Returns the canvas width, in px. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_CanvasGetWidth(OH_Drawing_Canvas*); + +/** + * @brief Obtains the canvas width. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @return Returns the canvas height, in pixels. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_CanvasGetHeight(OH_Drawing_Canvas*); + +/** + * @brief Obtains the bounds of the cropping region of a canvas. This function cannot be used for recorded canvases. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object, + * which is obtained by calling {@link OH_Drawing_RectCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasGetLocalClipBounds(OH_Drawing_Canvas*, OH_Drawing_Rect*); + +/** + * @brief Obtains the 3x3 matrix of a canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * which is obtained by calling {@link OH_Drawing_MatrixCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasGetTotalMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief Preconcats the existing matrix with the passed-in matrix. + * The drawing operation triggered before this function is called is not affected. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief Enumerates the canvas shadow flags. + * + * @since 12 + * @version 1.0 + */ +typedef enum OH_Drawing_CanvasShadowFlags { + /** + * There is no shadow flag. + */ + SHADOW_FLAGS_NONE, + /** + * The occluding object is transparent. + */ + SHADOW_FLAGS_TRANSPARENT_OCCLUDER, + /** + * No analysis on the shadows is required. + */ + SHADOW_FLAGS_GEOMETRIC_ONLY, + /** + * All the preceding shadow flags are used. + */ + SHADOW_FLAGS_ALL, +} OH_Drawing_CanvasShadowFlags; + +/** + * @brief Draws an offset spot shadow and uses a given path to outline the ambient shadow. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Pointer to an {@link OH_Drawing_Canvas} object. + * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object, which is used to generate the shadow. + * @param planeParams Value of the function that returns the Z-axis of the occluding object from the canvas based on + * the x-axis and y-axis. + * @param devLightPos Position of the light relative to the canvas. + * @param lightRadius Radius of the light. + * @param ambientColor Color of the ambient shadow. + * @param spotColor Color of the spot shadow. + * @param flag Shadow flag. For details about the available options, see {@link OH_Drawing_CanvasShadowFlags}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas*, OH_Drawing_Path*, OH_Drawing_Point3D planeParams, + OH_Drawing_Point3D devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, + OH_Drawing_CanvasShadowFlags flag); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_color.h b/en/native_sdk/graphic/native_drawing/drawing_color.h index df868295..3458886e 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_color.h +++ b/en/native_sdk/graphic/native_drawing/drawing_color.h @@ -21,7 +21,9 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. - * + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 diff --git a/en/native_sdk/graphic/native_drawing/drawing_color_filter.h b/en/native_sdk/graphic/native_drawing/drawing_color_filter.h index b41d8fca..5262ec1b 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_color_filter.h +++ b/en/native_sdk/graphic/native_drawing/drawing_color_filter.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_filter.h b/en/native_sdk/graphic/native_drawing/drawing_filter.h index dbb9faa2..f663a2cb 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_filter.h +++ b/en/native_sdk/graphic/native_drawing/drawing_filter.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_font.h b/en/native_sdk/graphic/native_drawing/drawing_font.h index a6b22459..4c4e2577 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_font.h +++ b/en/native_sdk/graphic/native_drawing/drawing_font.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -66,6 +68,17 @@ OH_Drawing_Font* OH_Drawing_FontCreate(void); */ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); +/** + * @brief Obtains the typeface of a font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object. + * @return Returns the pointer to the {@link OH_Drawing_Typeface} object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_FontGetTypeface(OH_Drawing_Font*); + /** * @brief Sets the font size. * @@ -77,13 +90,28 @@ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); */ void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); +/** + * @brief Obtains the number of glyphs represented by text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object. + * @param text Pointer to the start address of the storage. + * @param byteLength Text length, in bytes. + * @param encoding Encoding type of the text. + * For details about the available options, see {@link OH_Drawing_TextEncoding}. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_FontCountText(OH_Drawing_Font*, const void* text, size_t byteLength, + OH_Drawing_TextEncoding encoding); + /** * @brief Sets linear scaling for a font. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. - * @param isLinearText Whether to set linear scaling. The value true means to set linear scaling, - * and false means the opposite. + * @param isLinearText Whether to set linear scaling. + * The value true means to set linear scaling, and false means the opposite. * @since 11 * @version 1.0 */ @@ -105,8 +133,8 @@ void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Font Pointer to an OH_Drawing_Font object. - * @param isFakeBoldText Whether to set fake bold. The value true means to set fake bold, - * and false means the opposite. + * @param isFakeBoldText Whether to set fake bold. + * The value true means to set fake bold, and false means the opposite. * @since 11 * @version 1.0 */ @@ -122,6 +150,71 @@ void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); */ void OH_Drawing_FontDestroy(OH_Drawing_Font*); +/** + * @brief Defines a struct that describes the measurement information about a font. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_Font_Metrics { + /** Measurement information that is valid. */ + uint32_t fFlags; + /** Maximum distance from the baseline to the highest coordinate of a character. */ + float top; + /** Recommended distance from the baseline to the highest coordinate of a character. */ + float ascent; + /** Recommended distance from the baseline to the lowest coordinate of a character. */ + float descent; + /** Maximum distance from the baseline to the lowest coordinate of a character. */ + float bottom; + /** Interline spacing. */ + float leading; + /** Average character width, or zero if unknown. */ + float avgCharWidth; + /** Maximum character width, or zero if unknown. */ + float maxCharWidth; + /** + * Maximum distance to the leftmost of the font bounding box. Generally, the value is a negative value. + * Variable fonts are not recommended. + */ + float xMin; + /** + * Maximum distance to the rightmost of the font bounding box. Generally, the value is a negative value. + * Variable fonts are not recommended. + */ + float xMax; + /** Height of a lowercase letter, or zero if unknown. Generally, the value is a negative value. */ + float xHeight; + /** Height of an uppercase letter, or zero if unknown. Generally, the value is a negative value. */ + float capHeight; + /** Thickness of the underline. */ + float underlineThickness; + /** + * Position of the underline, that is, vertical distance from the baseline to the top of the underline. + * Generally, the value is a positive value. + */ + float underlinePosition; + /** Thickness of the strikethrough. */ + float strikeoutThickness; + /** + * Position of the strikethrough, that is, vertical distance from the baseline to the bottom of the strikethrough. + * Generally, the value is a negative value. + */ + float strikeoutPosition; +} OH_Drawing_Font_Metrics; + +/** + * @brief Obtains the measurement information about a font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object. + * @param OH_Drawing_Font_Metrics Pointer to an {@link OH_Drawing_Font_Metrics} object. + * @return Returns a floating-point variable that indicates the recommended interline spacing. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_FontGetMetrics(OH_Drawing_Font*, OH_Drawing_Font_Metrics*); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_font_collection.h b/en/native_sdk/graphic/native_drawing/drawing_font_collection.h index 2aab1772..3e504622 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/en/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -21,6 +21,8 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -45,10 +47,10 @@ extern "C" { #endif /** - * @brief Creates an OH_Drawing_FontCollection object. + * @brief Creates an {@link OH_Drawing_FontCollection} object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @return Returns the pointer to the OH_Drawing_FontCollection object created. + * @return Returns the pointer to the {@link OH_Drawing_FontCollection} object created. * @since 8 * @version 1.0 */ @@ -64,6 +66,26 @@ OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void); */ void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection*); +/** + * @brief Disables the alternate fonts. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontCollection Pointer to an {@link OH_Drawing_FontCollection} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection* fontCollection); + +/** + * @brief Disables the system fonts. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontCollection Pointer to an {@link OH_Drawing_FontCollection} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection* fontCollection); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_image.h b/en/native_sdk/graphic/native_drawing/drawing_image.h new file mode 100644 index 00000000..32801362 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_image.h @@ -0,0 +1,122 @@ +/* + * 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 + * + * 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 C_INCLUDE_DRAWING_IMAGE_H +#define C_INCLUDE_DRAWING_IMAGE_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 8 + * @version 1.0 + */ + +/** + * @file drawing_image.h + * + * @brief Declares the functions related to the image in the drawing module. + * + * File to include: native_drawing/drawing_image.h + * @library libnative_drawing.so + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an {@link OH_Drawing_Image} object that describes an array of two-dimensional pixels to draw. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the {@link OH_Drawing_Image} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Image* OH_Drawing_ImageCreate(void); + +/** + * @brief Destroys an {@link OH_Drawing_Image} object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_ImageDestroy(OH_Drawing_Image*); + +/** + * @brief Builds an image from a bitmap by sharing or copying bitmap pixels. If the bitmap is marked as immutable, + * Pixel memory is shared, not copied. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object. + * @param OH_Drawing_Bitmap Pointer to an {@link OH_Drawing_Bitmap} object. + * @return Returns true if the image is built; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_ImageBuildFromBitmap(OH_Drawing_Image*, OH_Drawing_Bitmap*); + +/** + * @brief Obtains the image width, that is, the number of pixels in each line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object. + * @return Returns the width. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_ImageGetWidth(OH_Drawing_Image*); + +/** + * @brief Obtains the image height, that is, the number of pixel lines. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object. + * @return Returns the height. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_ImageGetHeight(OH_Drawing_Image*); + +/** + * @brief Obtains the image information. + * After this function is called, the passed-in image information object is filled. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Pointer to an {@link OH_Drawing_Image} object. + * @param OH_Drawing_Image_Info Pointer to an {@link OH_Drawing_Image_Info} object, + * which is obtained by calling {@link OH_Drawing_Image_Info}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_ImageGetImageInfo(OH_Drawing_Image*, OH_Drawing_Image_Info*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h b/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h index 89b8432b..47e752fa 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h +++ b/en/native_sdk/graphic/native_drawing/drawing_mask_filter.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -51,7 +53,7 @@ extern "C" { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_BlurType { /** * Blurs both inside and outside the original border. */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_matrix.h b/en/native_sdk/graphic/native_drawing/drawing_matrix.h index 0bcfff4d..d2444f7c 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/en/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -55,6 +57,48 @@ extern "C" { */ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); +/** + * @brief Creates an OH_Drawing_Matrix with the rotation attribute. + * The matrix can rotate by a given degree around the rotation point (x, y). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @param deg Angle to rotate, in degrees. A positive number indicates a clockwise rotation, + * and a negative number indicates a counterclockwise rotation. + * @param x Coordinate point on the X axis. + * @param y Coordinate point on the Y axis. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation(float deg, float x, float y); + +/** + * @brief Creates an OH_Drawing_Matrix with the scale attribute. + The matrix can be scaled with the factor (sx, sy) at the rotation point (px, py). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param sx Horizontal scaling factor. + * @param sy Vertical scale factor. + * @param px Coordinate point on the X axis. + * @param py Coordinate point on the Y axis. + * @return Returns the pointer to the {@link OH_Drawing_Matrix} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale(float sx, float sy, float px, float py); + +/** + * @brief Creates an OH_Drawing_Matrix with the translation attribute. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param dx Horizontal distance to translate. + * @param dy Vertical distance to translate. + * @return Returns the pointer to the {@link OH_Drawing_Matrix} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation(float dx, float dy); + /** * @brief Sets matrix parameters for an OH_Drawing_Matrix object. * @@ -75,6 +119,117 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2); +/** + * @brief Multiplies two matrices to produce a new matrix. + * For example, if a given matrix a and a given matrix b are shown as follows, + * | A B C | | J K L | + * a = | D E F |, b = | M N O | + * | G H I | | P Q R | + * then the final matrix total is as follows: + * | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | + * total = a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | + * | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param total Pointer to the new matrix, which is an {@link OH_Drawing_Matrix} object. + * @param a Pointer to the first matrix, which is an {@link OH_Drawing_Matrix} object. + * @param b Pointer to the second matrix, which is an {@link OH_Drawing_Matrix} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixConcat(OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, + const OH_Drawing_Matrix* b); + +/** + * @brief Obtains a matrix value of a given index. The index ranges from 0 to 8. + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @param index Index. The value ranges from 0 to 8. + * @return Returns the matrix value. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_MatrixGetValue(OH_Drawing_Matrix*, int index); + +/** + * @brief Sets a matrix as an identity matrix and rotates it by a given degree around the rotation point (px, py). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @param degree Angle to rotate, in degrees. A positive number indicates a clockwise rotation, + * and a negative number indicates a counterclockwise rotation. + * @param px Coordinate point on the X axis. + * @param py Coordinate point on the Y axis. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixRotate(OH_Drawing_Matrix*, float degree, float px, float py); + +/** + * @brief Sets a matrix as an identity matrix and translates it by a given distance (dx, dy). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @param dx Horizontal distance to translate. + * @param dy Vertical distance to translate. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix*, float dx, float dy); + +/** + * @brief Sets a matrix as an identity matrix and scales it with the factor (sx, sy) at the rotation point (px, py). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @param sx Horizontal scale factor. + * @param sy Vertical scale factor. + * @param px Coordinate point on the X axis. + * @param py Coordinate point on the Y axis. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py); + +/** + * @brief Inverts a matrix and returns the result. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @param inverse Pointer to the matrix to invert, which is an {@link OH_Drawing_Matrix} object. + * The object can be created by calling {@link OH_Drawing_MatrixCreate}. + * @return Returns true if the matrix is reversible and the passed-in inverse is inverted; + * returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse); + +/** + * @brief Checks whether two OH_Drawing_Matrix objects are equal. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to a matrix, which is an {@link OH_Drawing_Matrix} object. + * @param other Pointer to the other matrix, which is an {@link OH_Drawing_Matrix} object. + * @return Returns true if the two matrices are equal; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixIsEqual(OH_Drawing_Matrix*, OH_Drawing_Matrix* other); + +/** + * @brief Checks whether an OH_Drawing_Matrix object is an identity matrix. + * The identity matrix is as follows: | 1 0 0 | + * | 0 1 0 | + * | 0 0 1 | + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @return Returns true if the matrix is an identity matrix; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixIsIdentity(OH_Drawing_Matrix*); + /** * @brief Destroys an OH_Drawing_Matrix object and reclaims the memory occupied by the object. * diff --git a/en/native_sdk/graphic/native_drawing/drawing_memory_stream.h b/en/native_sdk/graphic/native_drawing/drawing_memory_stream.h new file mode 100644 index 00000000..5e0bb850 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_memory_stream.h @@ -0,0 +1,79 @@ +/* + * 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 + * + * 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 C_INCLUDE_DRAWING_MEMORY_STREAM_H +#define C_INCLUDE_DRAWING_MEMORY_STREAM_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 8 + * @version 1.0 + */ + +/** + * @file drawing_memory_stream.h + * + * @brief Declares the functions related to the memory stream in the drawing module. + * + * File to include: native_drawing/drawing_memory_stream.h + * @library libnative_drawing.so + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_MemoryStream object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param data Pointer to the data. + * @param length Length of the data. + * @param copyData Whether to copy data. + * The value true means that the OH_Drawing_MemoryStream object copies the data, + * false means that the OH_Drawing_MemoryStream object directly uses the data without copying. + * @return Returns the pointer to the {@link OH_Drawing_MemoryStream} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate(const void* data, size_t length, bool copyData); + +/** + * @brief Destroys an OH_Drawing_MemoryStream object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_MemoryStream Pointer to an {@link OH_Drawing_MemoryStream} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MemoryStreamDestroy(OH_Drawing_MemoryStream*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_path.h b/en/native_sdk/graphic/native_drawing/drawing_path.h index 8d0e5dcf..67bbc190 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_path.h +++ b/en/native_sdk/graphic/native_drawing/drawing_path.h @@ -21,7 +21,9 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. - * + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -45,6 +47,39 @@ extern "C" { #endif +/** + * @brief Enumerates the directions of a closed contour. + * + * @since 12 + * @version 1.0 + */ +typedef enum OH_Drawing_PathDirection { + /** Adds a closed contour clockwise. */ + PATH_DIRECTION_CW, + /** Adds a closed contour counterclockwise. */ + PATH_DIRECTION_CCW, +} OH_Drawing_PathDirection; + +/** + * @brief Enumerates the fill types of a path. + * + * @since 12 + * @version 1.0 + */ +typedef enum OH_Drawing_PathFillType { + /** Draws inside of the area surrounded by all line segments. */ + PATH_FILL_TYPE_WINDING, + /** Draws inside of the area surrounded by all line segments by odd times. */ + PATH_FILL_TYPE_EVEN_ODD, + /** Same as PATH_FILL_TYPE_WINDING, but draws outside of the area surrounded by all line segments. */ + PATH_FILL_TYPE_INVERSE_WINDING, + /** + * Same as PATH_FILL_TYPE_EVEN_ODD, but draws outside of the area surrounded by all line segments + * by odd times. + */ + PATH_FILL_TYPE_INVERSE_EVEN_ODD, +} OH_Drawing_PathFillType; + /** * @brief Creates an OH_Drawing_Path object. * @@ -55,6 +90,17 @@ extern "C" { */ OH_Drawing_Path* OH_Drawing_PathCreate(void); +/** + * @brief Copies an existing {@link OH_Drawing_Path} object to create a new one. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object. + * @return Returns the pointer to the {@link OH_Drawing_Path} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path*); + /** * @brief Destroys an OH_Drawing_Path object and reclaims the memory occupied by the object. * @@ -139,6 +185,103 @@ void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float end void OH_Drawing_PathCubicTo( OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); +/** + * @brief Adds a rectangle contour to a path in the specified direction. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object. + * @param left X coordinate of the upper left corner of the rectangle. + * @param top Y coordinate of the upper left corner of the rectangle. + * @param right X coordinate of the lower right corner of the rectangle. + * @param bottom Y coordinate of the lower right corner of the rectangle. + * @param OH_Drawing_PathDirection Path direction. + * For details about the available options, see {@link OH_Drawing_PathDirection}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddRect(OH_Drawing_Path*, float left, float top, + float right, float bottom, OH_Drawing_PathDirection); + +/** + * @brief Adds a rounded rectangle contour to a path in the specified direction. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object. + * @param OH_Drawing_RoundRect Pointer to an {@link OH_Drawing_RoundRect} object. + * @param OH_Drawing_PathDirection Path direction. + * For details about the available options, see {@link OH_Drawing_PathDirection}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddRoundRect(OH_Drawing_Path*, const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection); + +/** + * @brief Adds an arc to a path as the start of a new contour. The arc added is part of the ellipse bounded by oval, + * from the start angle through the sweep angle, measured in degrees. A positive angle indicates a clockwise sweep, + * and a negative angle indicates a counterclockwise sweep. If the sweep angle is less than or equal to -360°, + * or if the sweep angle is greater than or equal to 360° and start angle modulo 90 is nearly zero, + * an oval instead of an ellipse is added. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object. + * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object. + * @param startAngle Start angle of the arc, in degrees. + * @param sweepAngle Angle to sweep, in degrees. A positive number indicates a clockwise sweep, + * and a negative number indicates a counterclockwise sweep. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddArc(OH_Drawing_Path*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); + +/** + * @brief Adds a copy of src to the path, transformed by matrix. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Pointer to the current path, which is an {@link OH_Drawing_Path} object. + * @param src Pointer to an {@link OH_Drawing_Path} object. + * @param OH_Drawing_Matrix Pointer to an {@link 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*); + +/** + * @brief Checks whether a coordinate point is included in a path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object. + * @param x Coordinate point on the X axis. + * @param y Coordinate point on the Y axis. + * @return Returns true if the coordinate point is included in the path; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_PathContains(OH_Drawing_Path*, float x, float y); + +/** + * @brief Transforms the points in a path by matrix. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object. + * @param OH_Drawing_Matrix Pointer to an {@link OH_Drawing_Matrix} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*); + +/** + * @brief Sets the fill type for a path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Pointer to an {@link OH_Drawing_Path} object. + * @param OH_Drawing_PathFillType Fill type of the path. + * For details about the available options, see {@link OH_Drawing_PathFillType}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathSetFillType(OH_Drawing_Path*, OH_Drawing_PathFillType); + + /** * @brief Closes a path by drawing a line segment from the current point to the start point of the path. * diff --git a/en/native_sdk/graphic/native_drawing/drawing_path_effect.h b/en/native_sdk/graphic/native_drawing/drawing_path_effect.h new file mode 100644 index 00000000..d835cacf --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_path_effect.h @@ -0,0 +1,79 @@ +/* + * 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 + * + * 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 C_INCLUDE_DRAWING_PATH_EFFECT_H +#define C_INCLUDE_DRAWING_PATH_EFFECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 8 + * @version 1.0 + */ + +/** + * @file drawing_path_effect.h + * + * @brief Declares the functions related to the path effect in the drawing module. + * + * File to include: native_drawing/drawing_path_effect.h + * @library libnative_drawing.so + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_PathEffect object with a dotted line effect. + * The dashed line effect is determined by a group of "on" and "off" intervals. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param intervals Pointer to the start address of the dashed line interval array. + * In the array, an even entry indicates an "on" interval and an odd entry indicates an "off" interval. The unit is px. + * @param count Number of entries in the dashed line interval array. The value must be an even number greater than 0. + * @param phase Offset in the dashed line interval array. + * @return Returns the pointer to the {@link OH_Drawing_PathEffect} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect(float* intervals, int count, float phase); + +/** + * @brief Destroys an OH_Drawing_PathEffect object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PathEffect Pointer to an {@link OH_Drawing_PathEffect} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathEffectDestroy(OH_Drawing_PathEffect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_pen.h b/en/native_sdk/graphic/native_drawing/drawing_pen.h index 14cc4d92..9c3ad8fd 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_pen.h +++ b/en/native_sdk/graphic/native_drawing/drawing_pen.h @@ -21,7 +21,9 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. - * + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -188,7 +190,7 @@ void OH_Drawing_PenSetMiterLimit(OH_Drawing_Pen*, float miter); * @since 8 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_PenLineCapStyle { /** There is no cap style. Both ends of the line segment are cut off square. */ LINE_FLAT_CAP, /** @@ -232,7 +234,7 @@ void OH_Drawing_PenSetCap(OH_Drawing_Pen*, OH_Drawing_PenLineCapStyle); * @since 8 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_PenLineJoinStyle { /** * Mitered corner. If the angle of a polyline is small, its miter length may be inappropriate. In this case, * you need to use the miter limit to limit the miter length. @@ -266,6 +268,50 @@ OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen*); */ void OH_Drawing_PenSetJoin(OH_Drawing_Pen*, OH_Drawing_PenLineJoinStyle); +/** + * @brief Sets the shader effect for a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object. + * @param OH_Drawing_ShaderEffect Pointer to an {@link OH_Drawing_ShaderEffect} object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*); + +/** + * @brief Sets the path effect for a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object. + * @param OH_Drawing_PathEffect Pointer to an {@link OH_Drawing_PathEffect} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PenSetPathEffect(OH_Drawing_Pen*, OH_Drawing_PathEffect*); + +/** + * @brief Sets a filter for a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object. + * @param OH_Drawing_Filter Pointer to an {@link OH_Drawing_Filter} object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_PenSetFilter(OH_Drawing_Pen*, OH_Drawing_Filter*); + +/** + * @brief Sets a blender for a pen. The blender implements the specified blend mode. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object. + * @param OH_Drawing_BlendMode Blend mode. For details about the available options, see {@link OH_Drawing_BlendMode}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PenSetBlendMode(OH_Drawing_Pen*, OH_Drawing_BlendMode); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_point.h b/en/native_sdk/graphic/native_drawing/drawing_point.h index 6f740f3e..d484a684 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_point.h +++ b/en/native_sdk/graphic/native_drawing/drawing_point.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_rect.h b/en/native_sdk/graphic/native_drawing/drawing_rect.h index 4c1e4847..ea10739a 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_rect.h +++ b/en/native_sdk/graphic/native_drawing/drawing_rect.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_round_rect.h b/en/native_sdk/graphic/native_drawing/drawing_round_rect.h index 22206d51..cc525c83 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_round_rect.h +++ b/en/native_sdk/graphic/native_drawing/drawing_round_rect.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_sampling_options.h b/en/native_sdk/graphic/native_drawing/drawing_sampling_options.h new file mode 100644 index 00000000..386525c8 --- /dev/null +++ b/en/native_sdk/graphic/native_drawing/drawing_sampling_options.h @@ -0,0 +1,107 @@ +/* + * 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 + * + * 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 C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H +#define C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 8 + * @version 1.0 + */ + +/** + * @file drawing_sampling_options.h + * + * @brief Declares the functions related to the sampling options in the drawing module. + * It is used for image or texture sampling. + * + * File to include: native_drawing/drawing_sampling_options.h + * @library libnative_drawing.so + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the filter modes. + * + * @since 12 + * @version 1.0 + */ +typedef enum OH_Drawing_FilterMode { + /** Nearest filter mode. */ + FILTER_MODE_NEAREST, + /** Linear filter mode. */ + FILTER_MODE_LINEAR, +} OH_Drawing_FilterMode; + +/** + * @brief Enumerates the mipmap modes. + * + * @since 12 + * @version 1.0 + */ +typedef enum OH_Drawing_MipmapMode { + /** Mipmap level ignored. */ + MIPMAP_MODE_NONE, + /** Nearest sampling from two adjacent mipmap levels. */ + MIPMAP_MODE_NEAREST, + /** Linear interpolation sampling between two adjacent mipmap levels. */ + MIPMAP_MODE_LINEAR, +} OH_Drawing_MipmapMode; + +/** + * @brief Creates an OH_Drawing_SamplingOptions object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FilterMode Filter mode. + * For details about the available options, see {@link OH_Drawing_FilterMode} object. + * @param OH_Drawing_MipmapMode Mipmap mode. + * For details about the available options, see {@link OH_Drawing_MipmapMode}. + * @return Returns the pointer to the {@link OH_Drawing_SamplingOptions} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode, OH_Drawing_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 Pointer to an {@link OH_Drawing_SamplingOptions} object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SamplingOptionsDestroy(OH_Drawing_SamplingOptions*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h b/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h index 83f396e1..20bd19f2 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h +++ b/en/native_sdk/graphic/native_drawing/drawing_shader_effect.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -51,7 +53,7 @@ extern "C" { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_TileMode { /** * Replicates the edge color if the shader effect draws outside of its original boundary. */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_blob.h b/en/native_sdk/graphic/native_drawing/drawing_text_blob.h index 84257ec5..bb0eb6a5 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_text_blob.h +++ b/en/native_sdk/graphic/native_drawing/drawing_text_blob.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -55,13 +57,74 @@ extern "C" { */ OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void); +/** + * @brief Creates an OH_Drawing_TextBlob object from the text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param text Pointer to the text. + * @param byteLength Length of the text, in bytes. + * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object. + * @param OH_Drawing_TextEncoding Encoding type of the text. + * For details about the available options, see {@link OH_Drawing_TextEncoding}. + * @return Returns the pointer to the {@link 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); + +/** + * @brief Creates an OH_Drawing_TextBlob object from the text and text position. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param text Pointer to the text. + * @param byteLength Length of the text, in bytes. + * @param OH_Drawing_Point2D Pointer to the start address of an {@link OH_Drawing_Point2D} array. + * The number of entries in the array is the value obtained by calling {@link OH_Drawing_FontCountText}. + * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object. + * @param OH_Drawing_TextEncoding Encoding type of the text. + * For details about the available options, see {@link OH_Drawing_TextEncoding}. + * @return Returns the pointer to the {@link 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); + +/** + * @brief Creates an OH_Drawing_TextBlob object from a string. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param str Pointer to a string. + * @param OH_Drawing_Font Pointer to an {@link OH_Drawing_Font} object. + * @param OH_Drawing_TextEncoding Encoding type of the text. + * For details about the available options, see {@link OH_Drawing_TextEncoding}. + * @return Returns the pointer to the {@link 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); + +/** + * @brief Obtains the bounds of an OH_Drawing_TextBlob object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlobPointer to an {@link OH_Drawing_TextBlob} object. + * @param OH_Drawing_Rect Pointer to an {@link OH_Drawing_Rect} object, + * which is obtained by calling {@link OH_Drawing_Rect}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob*, OH_Drawing_Rect*); + /** * @brief Describes a run, which provides storage for glyphs and positions. * * @since 11 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_RunBuffer { /** Storage for glyph indexes in the run. */ uint16_t* glyphs; /** Storage for glyph positions in the run. */ diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h b/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h index 2ce58973..e4e3d646 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h +++ b/en/native_sdk/graphic/native_drawing/drawing_text_declaration.h @@ -21,6 +21,8 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -44,7 +46,7 @@ extern "C" { #endif /** - * @brief Defines an OH_Drawing_FontCollection, which is used to load fonts. + * @brief Defines a struct used to load fonts. * * @since 8 * @version 1.0 @@ -52,7 +54,7 @@ extern "C" { typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection; /** - * @brief Defines an OH_Drawing_Typography, which is used to manage the typography layout and display. + * @brief Defines a struct used to manage the typography layout and display. * * @since 8 * @version 1.0 @@ -60,7 +62,7 @@ typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection; typedef struct OH_Drawing_Typography OH_Drawing_Typography; /** - * @brief Defines an OH_Drawing_TextStyle, which is used to manage text colors and decorations. + * @brief Defines a struct used to manage text colors and decorations. * * @since 8 * @version 1.0 @@ -68,8 +70,7 @@ typedef struct OH_Drawing_Typography OH_Drawing_Typography; typedef struct OH_Drawing_TextStyle OH_Drawing_TextStyle; /** - * @brief Defines an OH_Drawing_TypographyStyle, which is used to manage the typography style, - * such as the text direction. + * @brief Defines a struct used to manage the typography style, such as the text direction. * * @since 8 * @version 1.0 @@ -85,8 +86,7 @@ typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle; typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate; /** - * @brief Defines an OH_Drawing_TextBox, which is used to receive the rectangle size, direction, and quantity - * of text boxes. + * @brief Defines a struct for a text box, which is used to receive the rectangle size, direction, and quantity. * * @since 11 * @version 1.0 @@ -94,8 +94,7 @@ typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate; typedef struct OH_Drawing_TextBox OH_Drawing_TextBox; /** - * @brief Defines an OH_Drawing_PositionAndAffinity, which is used to receive the position and affinity - * of the font. + * @brief Defines a struct used to receive the position and affinity of the graph. * * @since 11 * @version 1.0 @@ -103,13 +102,29 @@ typedef struct OH_Drawing_TextBox OH_Drawing_TextBox; typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity; /** - * @brief Defines an OH_Drawing_Range, which is used to receive the start position and end position of the font. + * @brief Defines a struct for a range, which is used to receive the start position and end position of the font. * * @since 11 * @version 1.0 */ typedef struct OH_Drawing_Range OH_Drawing_Range; +/** + * @brief Defines a struct used to manage text shadows. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow; + +/** + * @brief Defines a struct used to parse system font files. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontParser OH_Drawing_FontParser; + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_text_typography.h b/en/native_sdk/graphic/native_drawing/drawing_text_typography.h index c5d73a89..8bd9a447 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/en/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -21,6 +21,8 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -41,6 +43,7 @@ #include "drawing_canvas.h" #include "drawing_color.h" +#include "drawing_font.h" #include "drawing_text_declaration.h" #include "drawing_types.h" @@ -155,7 +158,7 @@ enum OH_Drawing_FontStyle { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_PlaceholderVerticalAlignment { /** Aligned to the baseline. */ ALIGNMENT_OFFSET_AT_BASELINE, /** Aligned above the baseline. */ @@ -176,7 +179,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef struct { +typedef struct OH_Drawing_PlaceholderSpan { /** Width of the placeholder. */ double width; /** Height of the placeholder. */ @@ -195,7 +198,7 @@ typedef struct { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_TextDecorationStyle { /** Solid style. */ TEXT_DECORATION_STYLE_SOLID, /** Double style. */ @@ -214,7 +217,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_EllipsisModal { /** Places the ellipsis in the text header. */ ELLIPSIS_MODAL_HEAD = 0, /** Places the ellipsis in the middle of the text. */ @@ -229,7 +232,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_BreakStrategy { /** Each line is filled as much as possible during line break. */ BREAK_STRATEGY_GREEDY = 0, /** Text continuity is preferentially considered during line break. */ @@ -244,7 +247,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_WordBreakType { /** Normal mode. */ WORD_BREAK_TYPE_NORMAL = 0, /** Breaks the words at any character to prevent overflow. */ @@ -259,7 +262,7 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_RectHeightStyle { /** Tight style. */ RECT_HEIGHT_STYLE_TIGHT, /** Maximum style. */ @@ -280,13 +283,85 @@ typedef enum { * @since 11 * @version 1.0 */ -typedef enum { - */Tight style. */ +typedef enum OH_Drawing_RectWidthStyle { + /** Tight style. */ RECT_WIDTH_STYLE_TIGHT, */Maximum style. */ RECT_WIDTH_STYLE_MAX, } OH_Drawing_RectWidthStyle; +/** + * @brief Defines a struct that describes the detailed information about a system font. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontDescriptor { + /** File path of the system font. */ + char* path; + /** PostScript name that uniquely identifies the system font. */ + char* postScriptName; + /** Full name of the system font. */ + char* fullName; + /** Family of the system font. */ + char* fontFamily; + /** Subfamily of the system font. */ + char* fontSubfamily; + /** Weight of the system font. */ + int weight; + /** Width of the system font. */ + int width; + /** Slope of the system font. */ + int italic; + /** + * Whether the system font is monospaced. + * The value true means that the system font is monospaced, and false means the opposite. + */ + bool monoSpace; + /** + * Whether the system font supports symbols. + * The value true means that the system font supports symbols, and false means the opposite. + */ + bool symbolic; +} OH_Drawing_FontDescriptor; + +/** + * @brief Defines a struct that describes the measurement information about a line of text. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_LineMetrics { + /** Part of a lowercase letter that extends beyond the meanline. */ + double ascender; + /** Part of a lowercase letter that extends below the baseline. */ + double descender; + /** Height of an uppercase letter above the baseline. */ + double capHeight; + /** Height of a lowercase letter, specifically the lowercase x, not including ascenders and descenders. */ + double xHeight; + /** Horizontal space taken up by a character. */ + double width; + /** Line height. */ + double height; + /** + * Distance from the left edge of the leftmost character to the left edge of the container. + * For left alignment, the value is 0. For right alignment, the value is the container width minus the text width. + */ + double x; + /** + * Height from the top edge of the character to the top of the container. + * The first line is 0, and the second line is the height of the first line. + */ + double y; + /** Index of the first character in the line. */ + size_t startIndex; + /** Index of the last character in the line. */ + size_t endIndex; + /** Measurement information of the first character. */ + OH_Drawing_Font_Metrics firstCharMetrics; +} OH_Drawing_LineMetrics; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -302,7 +377,7 @@ OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle(void); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by - * {@link OH_Drawing_CreateTypographyStyle}. + * calling {@link OH_Drawing_CreateTypographyStyle}. * @since 8 * @version 1.0 */ @@ -313,7 +388,7 @@ void OH_Drawing_DestroyTypographyStyle(OH_Drawing_TypographyStyle*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by - * {@link OH_Drawing_CreateTypographyStyle}. + * calling {@link OH_Drawing_CreateTypographyStyle}. * @param int Text direction. For details about the available options, see {@link OH_Drawing_TextDirection}. * @since 8 * @version 1.0 @@ -325,19 +400,31 @@ void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle*, int /* O * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by - * {@link OH_Drawing_CreateTypographyStyle}. + * calling {@link OH_Drawing_CreateTypographyStyle}. * @param int Text alignment mode. For details about the available options, see {@link OH_Drawing_TextAlign}. * @since 8 * @version 1.0 */ void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Drawing_TextAlign */); +/** + * @brief Obtains the text alignment mode. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @return Returns the text alignment mode. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_TypographyGetEffectiveAlignment(OH_Drawing_TypographyStyle* style); + /** * @brief Sets the maximum number of lines in the text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by - * {@link OH_Drawing_CreateTypographyStyle}. + * calling {@link OH_Drawing_CreateTypographyStyle}. * @param int Maximum number of lines. * @since 8 * @version 1.0 @@ -354,11 +441,23 @@ void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle*, int /* ma */ OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); +/** + * @brief Obtains the text style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @return Returns the pointer to the {@link OH_Drawing_TextStyle} object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle(OH_Drawing_TypographyStyle* style); + /** * @brief Destroys an OH_Drawing_TextStyle object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @since 8 * @version 1.0 @@ -369,7 +468,7 @@ void OH_Drawing_DestroyTextStyle(OH_Drawing_TextStyle*); * @brief Sets the text color. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param uint32_t Color. * @since 8 @@ -381,7 +480,7 @@ void OH_Drawing_SetTextStyleColor(OH_Drawing_TextStyle*, uint32_t /* color */); * @brief Sets the font size. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param double Font size. * @since 8 @@ -393,7 +492,7 @@ void OH_Drawing_SetTextStyleFontSize(OH_Drawing_TextStyle*, double /* fontSize * * @brief Sets the font weight. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param int Font weight. * For details about the available options, see {@link OH_Drawing_FontWeight}. @@ -406,7 +505,7 @@ void OH_Drawing_SetTextStyleFontWeight(OH_Drawing_TextStyle*, int /* OH_Drawing_ * @brief Sets the text baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param int Text baseline. For details about the available options, see {@link OH_Drawing_TextBaseline}. * @since 8 @@ -418,7 +517,7 @@ void OH_Drawing_SetTextStyleBaseLine(OH_Drawing_TextStyle*, int /* OH_Drawing_Te * @brief Sets the text decoration. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param int Text decoration. For details about the available options, see {@link OH_Drawing_TextDecoration}. * @since 8 @@ -430,7 +529,7 @@ void OH_Drawing_SetTextStyleDecoration(OH_Drawing_TextStyle*, int /* OH_Drawing_ * @brief Sets the color for the text decoration. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param uint32_t Color. * @since 8 @@ -442,7 +541,7 @@ void OH_Drawing_SetTextStyleDecorationColor(OH_Drawing_TextStyle*, uint32_t /* c * @brief Sets the font height. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param double Font height. * @since 8 @@ -454,7 +553,7 @@ void OH_Drawing_SetTextStyleFontHeight(OH_Drawing_TextStyle*, double /* fontHeig * @brief Sets the font families. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param int Number of font families. * @param char Pointer to the font families. @@ -468,7 +567,7 @@ void OH_Drawing_SetTextStyleFontFamilies(OH_Drawing_TextStyle*, * @brief Sets the font style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param int Font style. For details about the available options, see {@link OH_Drawing_FontStyle}. * @since 8 @@ -480,7 +579,7 @@ void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_F * @brief Sets the locale. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param char Pointer to the locale. * @since 8 @@ -488,14 +587,118 @@ void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_F */ void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); +/** + * @brief Sets the foreground brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object, which is obtained by calling + * {@link OH_Drawing_BrushCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief Obtains the foreground brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object, which is obtained by calling + * {@link OH_Drawing_BrushCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief Sets the foreground pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object, which is obtained by calling + * {@link OH_Drawing_PenCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief Obtains the foreground pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object, which is obtained by calling + * {@link OH_Drawing_PenCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief Sets the background brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object, which is obtained by calling + * {@link OH_Drawing_BrushCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief Obtains the background brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Brush Pointer to an {@link OH_Drawing_Brush} object, which is obtained by calling + * {@link OH_Drawing_BrushCreate}. + * @since 12 + * @version 1.0 + */ + void OH_Drawing_TextStyleGetBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); + +/** + * @brief Sets the background pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object, which is obtained by calling + * {@link OH_Drawing_PenCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + +/** + * @brief Obtains the background pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Pen Pointer to an {@link OH_Drawing_Pen} object, which is obtained by calling + * {@link OH_Drawing_PenCreate}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); + /** * @brief Creates an OH_Drawing_TypographyCreate object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by - * {@link OH_Drawing_CreateTypographyStyle}. + * calling {@link OH_Drawing_CreateTypographyStyle}. * @param OH_Drawing_FontCollection Pointer to an OH_Drawing_FontCollection object, which is obtained by - * {@link OH_Drawing_CreateFontCollection}. + * calling {@link OH_Drawing_CreateFontCollection}. * @return Returns the pointer to the OH_Drawing_TypographyCreate object created. * @since 8 * @version 1.0 @@ -520,7 +723,7 @@ void OH_Drawing_DestroyTypographyHandler(OH_Drawing_TypographyCreate*); * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyCreate Pointer to an OH_Drawing_TypographyCreate object. The pointer is obtained * by {@link OH_Drawing_CreateTypographyHandler}. - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @since 8 * @version 1.0 @@ -566,7 +769,7 @@ OH_Drawing_Typography* OH_Drawing_CreateTypography(OH_Drawing_TypographyCreate*) * @brief Destroys an OH_Drawing_Typography object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @since 8 * @version 1.0 @@ -577,7 +780,7 @@ void OH_Drawing_DestroyTypography(OH_Drawing_Typography*); * @brief Lays out the typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @param double Maximum text width. * @since 8 @@ -589,9 +792,9 @@ void OH_Drawing_TypographyLayout(OH_Drawing_Typography*, double /* maxWidth */); * @brief Paints text on the canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. - * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object, which is obtained by + * @param OH_Drawing_Canvas Pointer to an OH_Drawing_Canvas object, which is obtained by calling * {@link OH_Drawing_CanvasCreate()}. * @param double X coordinate. * @param double Y coordinate. @@ -605,7 +808,7 @@ void OH_Drawing_TypographyPaint(OH_Drawing_Typography*, OH_Drawing_Canvas*, * @brief Obtains the maximum width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the maximum width. * @since 9 @@ -617,7 +820,7 @@ double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); * @brief Obtains the height. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the height. * @since 9 @@ -631,7 +834,7 @@ 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 OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the width of the longest row. * @since 9 @@ -643,7 +846,7 @@ double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography*); * @brief Obtains the minimum intrinsic width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the minimum intrinsic width. * @since 9 @@ -655,7 +858,7 @@ double OH_Drawing_TypographyGetMinIntrinsicWidth(OH_Drawing_Typography*); * @brief Obtains the maximum intrinsic width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the maximum intrinsic width. * @since 9 @@ -667,7 +870,7 @@ double OH_Drawing_TypographyGetMaxIntrinsicWidth(OH_Drawing_Typography*); * @brief Obtains the alphabetic baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the alphabetic baseline. * @since 9 @@ -679,7 +882,7 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); * @brief Obtains the ideographic baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the ideographic baseline. * @since 9 @@ -703,7 +906,7 @@ void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH * @brief Checks whether the maximum number of lines is exceeded. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns true if the maximum number of lines is exceeded; returns false otherwise. * @since 11 @@ -715,7 +918,7 @@ bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); * @brief Obtains text boxes in a given range. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @param size_t Start position. * @param size_t End position. @@ -734,7 +937,7 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* * @brief Obtains text boxes for placeholders. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the {@link OH_Drawing_TextBox} struct that holds the text boxes. * @since 11 @@ -746,7 +949,7 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typo * @brief Obtains the left position of a text box. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. * @param int Index of the text box. * @return Returns the left position. @@ -759,7 +962,7 @@ float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int); * @brief Obtains the right position of a text box. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. * @param int Index of the text box. * @return Returns the right position. @@ -772,7 +975,7 @@ float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int); * @brief Obtains the top position of a text box. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. * @param int Index of the text box. * @return Returns the top position. @@ -785,7 +988,7 @@ float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int); * @brief Obtains the bottom position of a text box. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. * @param int Index of the text box. * @return Returns the bottom position. @@ -798,7 +1001,7 @@ float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int); * @brief Obtains the text direction of a text box. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. * @param int Index of the text box. * @return Returns the text direction. @@ -811,7 +1014,7 @@ int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int); * @brief Obtains the number of text boxes. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by + * @param OH_Drawing_TextBox Pointer to an OH_Drawing_TextBox object, which is obtained by calling * {@link OH_Drawing_TypographyGetRectsForRange} or {@link OH_Drawing_TypographyGetRectsForPlaceholders}. * @return Returns the number of text boxes. * @since 11 @@ -823,7 +1026,7 @@ size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*); * @brief Obtains the position and affinity of the glyph at the given coordinates. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @param double X coordinate. * @param double Y coordinate. @@ -839,7 +1042,7 @@ OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinat * The glyph cluster is a container that holds one or more glyphs. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @param double X coordinate. * @param double Y coordinate. @@ -856,7 +1059,7 @@ OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinat * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_PositionAndAffinity Pointer to an OH_Drawing_PositionAndAffinity object, - * which is obtained by {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate} or + * which is obtained by calling {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate} or * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}. * @return Returns the position attribute. * @since 11 @@ -869,8 +1072,8 @@ size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffin * The affinity determines whether the font is close to the front text or rear text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_PositionAndAffinity Pointer to an OH_Drawing_PositionAndAffinity object. - * which is obtained by {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate} or + * @param OH_Drawing_PositionAndAffinity Pointer to an OH_Drawing_PositionAndAffinity object, + * which is obtained by calling {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinate} or * {@link OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster}. * @return Returns the affinity attribute. * @since 11 @@ -882,7 +1085,7 @@ int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity * @brief Obtains the word boundary. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @param size_t Index of the word. * @return Returns the {@link OH_Drawing_Range} struct that holds the word boundary. @@ -895,7 +1098,7 @@ OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, s * @brief Obtains the start position of an OH_Drawing_Range object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Range Pointer to an OH_Drawing_Range object, which is obtained by + * @param OH_Drawing_Range Pointer to an OH_Drawing_Range object, which is obtained by calling * {@link OH_Drawing_TypographyGetWordBoundary}. * @return Returns the start position. * @since 11 @@ -907,7 +1110,7 @@ size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*); * @brief Obtains the end position of an OH_Drawing_Range object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Range Pointer to an OH_Drawing_Range object, which is obtained by + * @param OH_Drawing_Range Pointer to an OH_Drawing_Range object, which is obtained by calling * {@link OH_Drawing_TypographyGetWordBoundary}. * @return Returns the end position. * @since 11 @@ -919,7 +1122,7 @@ size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*); * @brief Obtains the number of lines. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @return Returns the number of lines. * @since 11 @@ -931,7 +1134,7 @@ size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); * @brief Sets the text decoration style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param int Text decoration style. For details about the available options, * see {@link OH_Drawing_TextDecorationStyle}. @@ -944,7 +1147,7 @@ void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); * @brief Sets the thickness scale factor of the text decoration line. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param double Scale factor. * @since 11 @@ -956,7 +1159,7 @@ void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, doub * @brief Sets the letter spacing for text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param double Letter spacing. * @since 11 @@ -968,7 +1171,7 @@ void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); * @brief Sets the word spacing for text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param double Word spacing. * @since 11 @@ -980,7 +1183,7 @@ void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); * @brief Sets half leading for text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param bool Whether to enable half leading. The value true means to enable half lading, * and false means the opposite. @@ -993,7 +1196,7 @@ void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); * @brief Sets the ellipsis content for text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param char* Pointer to the ellipsis content. The data type is a pointer pointing to char. * @since 11 @@ -1005,7 +1208,7 @@ void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*); * @brief Sets the ellipsis style for text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by + * @param OH_Drawing_TextStyle Pointer to an OH_Drawing_TextStyle object, which is obtained by calling * {@link OH_Drawing_CreateTextStyle}. * @param int Ellipsis style. For details about the available options, see {@link OH_Drawing_EllipsisModal}. * @since 11 @@ -1018,7 +1221,7 @@ void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by - * {@link OH_Drawing_CreateTypographyStyle}. + * calling {@link OH_Drawing_CreateTypographyStyle}. * @param int Text break strategy. For details about the available options, see {@link OH_Drawing_BreakStrategy}. * @since 11 * @version 1.0 @@ -1030,7 +1233,7 @@ void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int) * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by - * {@link OH_Drawing_CreateTypographyStyle}. + * calling {@link OH_Drawing_CreateTypographyStyle}. * @param int Word break type. For details about the available options, see {@link OH_Drawing_WordBreakType}. * @since 11 * @version 1.0 @@ -1042,18 +1245,30 @@ void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int) * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Pointer to an OH_Drawing_TypographyStyle object, which is obtained by - * {@link OH_Drawing_CreateTypographyStyle}. + * calling {@link OH_Drawing_CreateTypographyStyle}. * @param int Ellipsis style. For details about the available options, see {@link OH_Drawing_EllipsisModal}. * @since 11 * @version 1.0 */ void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); +/** + * @brief Sets the ellipsis style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param char Pinter to an ellipsis style. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextEllipsis(OH_Drawing_TypographyStyle* style, const char* ellipsis); + /** * @brief Obtains the height of a line. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @param int Target line. * @return Returns the height. @@ -1066,7 +1281,7 @@ double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); * @brief Obtains the width of a line. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by calling * {@link OH_Drawing_CreateTypography}. * @param int Target line. * @return Returns the width. @@ -1075,6 +1290,554 @@ double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); */ double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); +/** + * @brief Sets the text split ratio. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param float Text split ratio. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle* style, float textSplitRatio); + +/** + * @brief Checks whether the maximum number of lines is limited for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @return Returns true if that the maximum number of lines is limited; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle* style); + +/** + * @brief Checks whether the text has an ellipsis. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @return Returns true if the text has an ellipsis; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle* style); + +/** + * @brief Sets the text locale. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param char Pointer to the text locale. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const char* locale); + +/** + * @brief Obtains the font metrics. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by + * calling {@link OH_Drawing_CreateTypography}. + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_Font_Metrics Pointer to an {@link OH_Drawing_Font_Metrics} object, which is obtained by + * calling {@link OH_Drawing_Font_Metrics}. + * @return Returns true if the font metrics is obtained; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_Typography*, OH_Drawing_TextStyle*, OH_Drawing_Font_Metrics*); + +/** + * @brief Sets the text style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTextStyle}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*,OH_Drawing_TextStyle*); + +/** + * @brief Creates an OH_Drawing_FontDescriptor object to describe the detailed information about a system font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the {@link OH_Drawing_FontDescriptor} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); + +/** + * @brief Destroys an OH_Drawing_FontDescriptor object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontDescriptor Pointer to an {@link OH_Drawing_FontDescriptor} object, which is obtained by + * calling {@link OH_Drawing_CreateFontDescriptor}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); + +/** + * @brief Creates an OH_Drawing_FontParser object to parse a system font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the {@link OH_Drawing_FontParser} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void); + +/** + * @brief Destroys an OH_Drawing_FontParser object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser Pointer to an {@link OH_Drawing_FontParser} object, which is obtained by calling + * {@link OH_Drawing_CreateFontParser}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser*); + +/** + * @brief Obtains the list of system fonts. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser Pointer to an {@link OH_Drawing_FontParser} object, which is obtained by calling + * {@link OH_Drawing_CreateFontParser}. + * @param size_t Pointer to the number of system font names. + * @return Returns the system font list. + * @since 12 + * @version 1.0 + */ +char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*); + +/** + * @brief Reclaims the memory occupied by the system font list. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param char** Double pointer to the list of system font names. + * @param size_t* Number of system font names. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroySystemFontList(char**, size_t); + +/** + * @brief Obtains information about a system font based on the font name. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontParser Pointer to an {@link OH_Drawing_FontParser} object, which is obtained by calling + * {@link OH_Drawing_CreateFontParser}. + * @param char* Pointer to the system font name. + * @return Returns the system font. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontParser*, const char*); + +/** + * @brief Obtains the line metrics. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling + * {@link OH_Drawing_CreateTypography}. + * @return Returns the pointer to the {@link OH_Drawing_LineMetrics} object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typography*); + +/** + * @brief Obtains the number of lines. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_LineMetrics Pointer to an {@link OH_Drawing_LineMetrics} object, which is obtained by calling + * {@link OH_Drawing_LineMetrics}. + * @return Returns the number of lines. + * @since 12 + * @version 1.0 + */ +size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics*); + +/** + * @brief Destroys an OH_Drawing_LineMetrics object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_LineMetrics Pointer to an {@link OH_Drawing_LineMetrics} object, which is obtained by calling + * {@link OH_Drawing_LineMetrics}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); + +/** + * @brief Obtains the metrics of a given line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling + * {@link OH_Drawing_CreateTypography}. + * @param int Line No. + * @param OH_Drawing_LineMetrics Pointer to an {@link OH_Drawing_LineMetrics} object, which is obtained by calling + * {@link OH_Drawing_LineMetrics}. + * @return Returns true if the metrics of the given line is obtained; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int, OH_Drawing_LineMetrics*); + +/** + * @brief Obtains the metrics of a given line or the metrics of the first character in a given line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling + * {@link OH_Drawing_CreateTypography}. + * @param int Line No. + * @param bool Whether to obtain the metrics of the entire line. The value true means to obtain the metrics of + * the entire line, and false means to obtain the metrics of the first character in the line. + * @param bool Whether whitespace characters are included in the text width. The value true means that + * whitespace characters are not included, false means the opposite. + * @param OH_Drawing_LineMetrics Pointer to an {@link OH_Drawing_LineMetrics} object, which is obtained by calling + * {@link OH_Drawing_LineMetrics}. + * @return Returns true if the metrics of the given line or the metrics of the first character in the given line + * is obtained; returns false otherwise. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, OH_Drawing_LineMetrics*); + +/** + * @brief Sets the font weight for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param int Font weight. + * For details about the available options, see {@link OH_Drawing_FontWeight}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the font style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param int Font style. For details about the available options, see {@link OH_Drawing_FontStyle}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the font family name for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param char Pointer to the name of the font family. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle*, const char*); + +/** + * @brief Sets the font size for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param double Font size, which must be greater than 0. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets the font height for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param double Font height. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets whether half leading is used for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param bool Whether to enable half leading. The value true means to enable half lading, + * and false means the opposite. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief Sets whether to enable the line style for text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param bool Whether to enable the line style for text. The value true means to enable the line style for text, + * and false means the opposite. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief Sets the font weight of the text line style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param int Font weight. + * For details about the available options, see {@link OH_Drawing_FontWeight}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the font style of the text line style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param int Font style. For details about the available options, see {@link OH_Drawing_FontStyle}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the font families of the text line style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param int Number of font families. + * @param char Pointer to the font families. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle*, + int, const char* fontFamilies[]); + +/** + * @brief Sets the font size for a text line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param double Font size, which must be greater than 0. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontSize(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets the font height of the text line style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param double Font height. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets whether half leading is used for the text line style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param bool Whether to enable half leading. The value true means to enable half lading, + * and false means the opposite. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief Sets the spacing ratio of the text line style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param double Spacing ratio. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyle*, double); + +/** + * @brief Sets whether to enable the text line style only. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Pointer to an {@link OH_Drawing_TypographyStyle} object, which is obtained by + * calling {@link OH_Drawing_CreateTypographyStyle}. + * @param bool Whether to enable the text line style only. The value true means to enable the text line style + * only, and false means the opposite. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle*, bool); + +/** + * @brief Creates an OH_Drawing_TextShadow object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_TextShadow object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); + +/** + * @brief Destroys an OH_Drawing_TextShadow object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextShadow Pointer to an {@link OH_Drawing_TextShadow} object, which is obtained by calling + * {@link OH_Drawing_CreateTextShadow}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow*); + +/** + * @brief Obtains a text shadow container. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @return Returns the pointer to the {@link OH_Drawing_TextShadow} object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*); + +/** + * @brief Obtains the size of a text shadow container. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @return Returns the size. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); + +/** + * @brief Adds a shadow to a text shadow container. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param OH_Drawing_TextShadow Pointer to an {@link OH_Drawing_TextShadow} object, which is obtained by calling + * {@link OH_Drawing_CreateTextShadow}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, const OH_Drawing_TextShadow*); + +/** + * @brief Clears all shadows in a text shadow container. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*); + +/** + * @brief Obtains a shadow with a given index in a text shadow container. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Pointer to an {@link OH_Drawing_TextStyle} object, which is obtained by calling + * {@link OH_Drawing_CreateTextStyle}. + * @param int Index. + * @return Returns the pointer to the {@link OH_Drawing_TextShadow} object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextStyle*, int); + +/** + * @brief Sets the indents for typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling + * {@link OH_Drawing_CreateTypography}. + * @param int Number of indents. + * @param float Array holding the indents. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographySetIndents(OH_Drawing_Typography*, int, const float indents[]); + +/** + * @brief Obtains indents with a given index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling + * {@link OH_Drawing_CreateTypography}. + * @param int Index. + * @return Returns the indents. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); + +/** + * @brief Obtains the line bounds. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Pointer to an {@link OH_Drawing_Typography} object, which is obtained by calling + * {@link OH_Drawing_CreateTypography}. + * @param int Row index. + * @param bool Whether the returned bounds contain spaces. The value true means that the bounds contain spaces, + * and false means the opposite. + * @return Returns the pointer to the {@link OH_Drawing_Range} object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, int, bool); + +/** + * @brief Reclaims the memory occupied by the vector consisting of the OH_Drawing_TextShadow objects. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextShadow Pointer to an {@link OH_Drawing_TextShadow} object, which is obtained by calling + * {@link OH_Drawing_CreateTextShadow}. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); + #ifdef __cplusplus } #endif diff --git a/en/native_sdk/graphic/native_drawing/drawing_typeface.h b/en/native_sdk/graphic/native_drawing/drawing_typeface.h index f7d9e1a6..35fefb98 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_typeface.h +++ b/en/native_sdk/graphic/native_drawing/drawing_typeface.h @@ -21,10 +21,12 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -57,6 +59,32 @@ extern "C" { */ OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); +/** + * @brief Creates an OH_Drawing_Typeface object through a file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Pointer to the file path. + * @param index File index. + * @return Returns the pointer to the {@link OH_Drawing_Typeface} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile(const char* path, int index); + +/** + * @brief Creates an OH_Drawing_Typeface object through a memory stream. + * If the memory stream is an invalid font file, a null pointer is returned. + * After the memory stream is passed in, the ownership is transferred and you cannot release it. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_MemoryStream Pointer to an {@link OH_Drawing_MemoryStream} object. + * @param index Index of the memory stream. + * @return Returns the pointer to the {@link OH_Drawing_Typeface} object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream(OH_Drawing_MemoryStream*, int32_t index); + /** * @brief Destroys an OH_Drawing_Typeface object and reclaims the memory occupied by the object. * diff --git a/en/native_sdk/graphic/native_drawing/drawing_types.h b/en/native_sdk/graphic/native_drawing/drawing_types.h index 178bce33..1d827b25 100644 --- a/en/native_sdk/graphic/native_drawing/drawing_types.h +++ b/en/native_sdk/graphic/native_drawing/drawing_types.h @@ -21,6 +21,8 @@ * @{ * * @brief Provides the functions for 2D graphics rendering, text drawing, and image display. + * This module does not provide the pixel unit. The pixel unit to use is consistent with the application context + * environment. In the ArkUI development environment, the default pixel unit vp is used. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @@ -94,6 +96,42 @@ typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap; */ typedef struct OH_Drawing_Point OH_Drawing_Point; +/** + * @brief Defines a struct for a two-dimensional coordinate point. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_Point2D { + /** X-coordinate. */ + float x; + /** Y-coordinate. */ + float y; +} OH_Drawing_Point2D; + +/** + * @brief Defines a struct for a three-dimensional coordinate point. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_Point3D { + /** X-coordinate. */ + float x; + /** Y-coordinate. */ + float y; + /** Z-coordinate. */ + float z; +} OH_Drawing_Point3D; + +/** + * @brief Defines a struct for a path effect that affects the stroke. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect; + /** * @brief Defines a rectangle. * @@ -158,6 +196,14 @@ typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter; */ typedef struct OH_Drawing_Font OH_Drawing_Font; +/** + * @brief Defines a struct for a memory stream. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream; + /** * @brief Defines a typeface. * @@ -168,13 +214,29 @@ typedef struct OH_Drawing_Typeface OH_Drawing_Typeface; /** * @brief Defines a text blob, which is an immutable container that holds multiple texts. - * Each text line consists of a glyph and position. + * Each text blob consists of glyphs and position. * * @since 11 * @version 1.0 */ typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob; +/** + * @brief Defines a struct for an image that describes a two-dimensional pixel array. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_Image OH_Drawing_Image; + +/** + * @brief Defines a struct for sampling options, which describe the sampling methods for images and bitmaps. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions; + /** * @brief Defines a text blob builder, which is used to build a text blob. * @@ -189,7 +251,7 @@ typedef struct OH_Drawing_TextBlobBuilder OH_Drawing_TextBlobBuilder; * @since 8 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_ColorFormat { /** Unknown format. */ COLOR_FORMAT_UNKNOWN, /** Each pixel is represented by 8 bits, which together indicate alpha. */ @@ -222,7 +284,7 @@ typedef enum { * @since 8 * @version 1.0 */ -typedef enum { +typedef enum OH_Drawing_AlphaFormat { /** Unknown format. */ ALPHA_FORMAT_UNKNOWN, /** The bitmap does not have the alpha component. */ @@ -327,6 +389,39 @@ typedef enum { BLEND_MODE_LUMINOSITY, } OH_Drawing_BlendMode; +/** + * @brief Defines a struct that describes the image information. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_Image_Info { + /** Width, in px. */ + int32_t width; + /** Height, in px. */ + int32_t height; + /** Color format. For details, see {@link OH_Drawing_ColorFormat}. */ + OH_Drawing_ColorFormat colorType; + /** Alpha format. For details, see {@link OH_Drawing_AlphaFormat}. */ + OH_Drawing_AlphaFormat alphaType; +} OH_Drawing_Image_Info; + +/** + * @brief Enumerates the text encoding types. + * @since 12 + * @version 1.0 + */ +typedef enum OH_Drawing_TextEncoding { + /** One byte used to indicate UTF-8 or ASCII characters. */ + TEXT_ENCODING_UTF8, + /** Two bytes used to indicate most Unicode characters. */ + TEXT_ENCODING_UTF16, + /** Four bytes used to indicate all Unicode characters. */ + TEXT_ENCODING_UTF32, + /** Two bytes used to indicate the glyph index. */ + TEXT_ENCODING_GLYPH_ID, +} OH_Drawing_TextEncoding; + #ifdef __cplusplus } #endif -- Gitee From 1217e04f5d3df07b3917102b0fa270f18cf61f2b Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 13 Mar 2024 18:54:23 +0800 Subject: [PATCH 0376/2135] =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0getimageinfo=20s?= =?UTF-8?q?etpolytopoly=20=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuwei --- .../graphic/native_drawing/drawing_bitmap.h | 33 +++++++++++++++++++ .../graphic/native_drawing/drawing_matrix.h | 16 +++++++++ 2 files changed, 49 insertions(+) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h index 04430456..ab56b2d3 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_bitmap.h @@ -128,6 +128,28 @@ uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_Bitmap*); */ uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_Bitmap*); +/** + * @brief 用于获取指定位图的像素存储格式。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Bitmap 指向位图对象的指针。 + * @return 函数返回位图的像素存储格式,支持格式参考{@link OH_Drawing_ColorFormat}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat(OH_Drawing_Bitmap*); + +/** + * @brief 用于获取指定位图的像素透明度分量。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Bitmap 指向位图对象的指针。 + * @return 函数返回位图的像素透明度分量,支持格式参考{@link OH_Drawing_AlphaFormat}。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat(OH_Drawing_Bitmap*); + /** * @brief 用于获取指定位图的像素地址,可以通过像素地址获取到位图的像素数据。 * @@ -139,6 +161,17 @@ uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_Bitmap*); */ void* OH_Drawing_BitmapGetPixels(OH_Drawing_Bitmap*); +/** + * @brief 用于获取指定位图的信息。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Bitmap 指向位图对象{@link OH_Drawing_Bitmap}的指针。 + * @param OH_Drawing_Image_Info 指向图片信息对象{@link OH_Drawing_Image_Info}的指针。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_BitmapGetImageInfo(OH_Drawing_Bitmap*, OH_Drawing_Image_Info*); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h index 9efd7f8f..6e1e5bea 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_matrix.h @@ -200,6 +200,22 @@ void OH_Drawing_MatrixScale(OH_Drawing_Matrix*, float sx, float sy, float px, fl */ bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse); +/** + * @brief 通过设置源点以及目标点,生成对应的变换矩阵。 + * 源点以及目标点的个数要大于等于0,小于等于4。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix 指向矩阵对象{@link OH_Drawing_Matrix}的指针。 + * @param src 源点数组。 + * @param dst 目标点数组,个数要与源点相等。 + * @param count 源点数组以及目标点数组的个数。 + * @return 函数返回是否可以生成对应矩阵以用来完成变换。true表示矩阵生成成功,false表示无法生成对应矩阵。 + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixSetPolyToPoly(OH_Drawing_Matrix*, const OH_Drawing_Point2D* src, + const OH_Drawing_Point2D* dst, uint32_t count); + /** * @brief 判断两个矩阵是否相等。 * -- Gitee From 5d3abcc1694f232cc1f7c222e8c4be834cba46fd Mon Sep 17 00:00:00 2001 From: zoulinken Date: Wed, 13 Mar 2024 21:50:02 +0800 Subject: [PATCH 0377/2135] modify c-api customDialog SDK Signed-off-by: zoulinken --- zh-cn/native_sdk/ace/native_dialog.h | 91 +++++++++++++++------------- zh-cn/native_sdk/ace/native_node.h | 4 +- zh-cn/native_sdk/ace/native_type.h | 2 +- 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/zh-cn/native_sdk/ace/native_dialog.h b/zh-cn/native_sdk/ace/native_dialog.h index 94edf90b..509ddd8f 100644 --- a/zh-cn/native_sdk/ace/native_dialog.h +++ b/zh-cn/native_sdk/ace/native_dialog.h @@ -56,143 +56,150 @@ typedef struct { * @note create方法需要在调用show方法之前调用。 * @return 返回指向自定义弹窗的指针,如创建失败,返回空指针。 */ - ArkUI_NativeDialogHandler (*create)(); + ArkUI_NativeDialogHandle (*create)(); /** * @brief 销毁自定义弹窗。 * - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 */ - void (*dispose)(ArkUI_NativeDialogHandler handler); + void (*dispose)(ArkUI_NativeDialogHandle handle); /** * @brief 挂载自定义弹窗内容。 * - * @note attachContent方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 + * @note setContent方法需要在调用show方法之前调用。 + * @param handle 指向自定义弹窗控制器的指针。 * @param content 弹窗内容根节点指针。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*attachContent)(ArkUI_NativeDialogHandler handler, ArkUI_NodeHandle content); + int32_t (*setContent)(ArkUI_NativeDialogHandle handle, ArkUI_NodeHandle content); /** * @brief 卸载自定义弹窗内容。 * - * @note detachContent方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 - * @param content 弹窗内容根节点指针。 + * @note removeContent方法需要在调用show方法之前调用。 + * @param handle 指向自定义弹窗控制器的指针。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*detachContent)(ArkUI_NativeDialogHandler handler, ArkUI_NodeHandle content); + int32_t (*removeContent)(ArkUI_NativeDialogHandle handle); /** * @brief 为自定义弹窗设置对齐方式。 * * @note setContentAlignment方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 * @param alignment 对齐方式,参数类型{@Link ArkUI_Alignment}。 * @param offsetX 弹窗的水平偏移量,浮点型。 * @param offsetY 弹窗的垂直偏移量,浮点型。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*setContentAlignment)(ArkUI_NativeDialogHandler handler, int32_t alignment, float offsetX, float offsetY); + int32_t (*setContentAlignment)(ArkUI_NativeDialogHandle handle, int32_t alignment, float offsetX, float offsetY); /** * @brief 重置setContentAlignment方法设置的属性,使用系统默认的对齐方式。 * * @note resetContentAlignment方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*resetContentAlignment)(ArkUI_NativeDialogHandler handler); + int32_t (*resetContentAlignment)(ArkUI_NativeDialogHandle handle); /** * @brief 设置自定义弹窗是否开启模态样式的弹窗。 * - * @note setMode方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 - * @param useModalMode 设置是否开启模态窗口,模态窗口有蒙层,非模态窗口无蒙层,为true时开启模态窗口。 + * @note setModalMode方法需要在调用show方法之前调用。 + * @param handle 指向自定义弹窗控制器的指针。 + * @param isModal 设置是否开启模态窗口,模态窗口有蒙层,非模态窗口无蒙层,为true时开启模态窗口。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*setModalMode)(ArkUI_NativeDialogHandle handle, bool isModal); + /** + * @brief 设置自定义弹窗是否允许点击遮罩层退出。 + * + * @note setAutoCancel方法需要在调用show方法之前调用。 + * @param handle 指向自定义弹窗控制器的指针。 * @param autoCancel 设置是否允许点击遮罩层退出,true表示关闭弹窗,false表示不关闭弹窗。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*setMode)(ArkUI_NativeDialogHandler handler, bool useModalMode, bool autoCancel); + int32_t (*setAutoCancel)(ArkUI_NativeDialogHandle handle, bool autoCancel); /** * @brief 设置自定义弹窗遮罩属性。 * * @note setMask方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 * @param maskColor 设置遮罩颜色,0xargb格式。 - * @param rect 遮蔽层区域范围的指针,遮蔽层区域内的事件不透传,在遮蔽层区域外的事件透传。参数类型{@Link ArkUI_Rect}。 + * @param maskRect 遮蔽层区域范围的指针,遮蔽层区域内的事件不透传,在遮蔽层区域外的事件透传。参数类型{@Link ArkUI_Rect}。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*setMask)(ArkUI_NativeDialogHandler handler, uint32_t maskColor, const ArkUI_Rect* rect); + int32_t (*setMask)(ArkUI_NativeDialogHandle handle, uint32_t maskColor, const ArkUI_Rect* maskRect); /** * @brief 设置弹窗背景色。 * * @note setBackgroundColor方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 * @param backgroundColor 设置弹窗背景颜色,0xargb格式。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*setBackgroundColor)(ArkUI_NativeDialogHandler handler, uint32_t backgroundColor); + int32_t (*setBackgroundColor)(ArkUI_NativeDialogHandle handle, uint32_t backgroundColor); /** * @brief 设置弹窗背板圆角半径。 * * @note setCornerRadius方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 * @param topLeft 设置弹窗背板左上角圆角半径。 * @param topRight 设置弹窗背板右上角圆角半径。 * @param bottomLeft 设置弹窗背板左下圆角半径。 * @param bottomRight 设置弹窗背板右下角圆角半径。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*setCornerRadius)(ArkUI_NativeDialogHandler handler, float topLeft, float topRight, + int32_t (*setCornerRadius)(ArkUI_NativeDialogHandle handle, float topLeft, float topRight, float bottomLeft, float bottomRight); /** * @brief 弹窗宽度占栅格宽度的个数。 * - * @note setGridCount方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 + * @note setGridColumnCount方法需要在调用show方法之前调用。 + * @param handle 指向自定义弹窗控制器的指针。 * @param gridCount 默认为按照窗口大小自适应,最大栅格数为系统最大栅格数。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*setGridCount)(ArkUI_NativeDialogHandler handler, int32_t gridCount); + int32_t (*setGridColumnCount)(ArkUI_NativeDialogHandle handle, int32_t gridCount); /** * @brief 弹窗容器样式是否自定义。 * - * @note setCustomStyle方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 - * @param customStyle true:宽度自适应子节点,圆角为0,弹窗背景色透明;false:高度自适应子节点,宽度由栅格系统定义, 圆角半径24vp。 + * @note enableCustomStyle方法需要在调用show方法之前调用。 + * @param handle 指向自定义弹窗控制器的指针。 + * @param enableCustomStyle true:宽度自适应子节点,圆角为0,弹窗背景色透明;false:高度自适应子节点,宽度由栅格系统定义, 圆角半径24vp。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*setCustomStyle)(ArkUI_NativeDialogHandler handler, bool customStyle); + int32_t (*enableCustomStyle)(ArkUI_NativeDialogHandle handle, bool enableCustomStyle); /** * @brief 弹窗容器是否使用自定义弹窗动画。 * - * @note useCustomAnimation方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 - * @param useCustomAnimation true:使用自定义动画,关闭系统默认动画;false:使用系统默认动画。 + * @note enableCustomAnimation方法需要在调用show方法之前调用。 + * @param handle 指向自定义弹窗控制器的指针。 + * @param enableCustomAnimation true:使用自定义动画,关闭系统默认动画;false:使用系统默认动画。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*useCustomAnimation)(ArkUI_NativeDialogHandler handler, bool useCustomAnimation); + int32_t (*enableCustomAnimation)(ArkUI_NativeDialogHandle handle, bool enableCustomAnimation); /** * @brief 当触发系统定义的返回操作、键盘ESC关闭交互操作时,如果注册该回调函数,则不会立刻关闭弹窗,是否关闭由用户自行决定。 * * @note registerOnWillDismiss方法需要在调用show方法之前调用。 - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 * @param eventHandler 弹窗关闭的回调函数 参数类型{@Link OnWillDismissEvent}。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*registerOnWillDismiss)(ArkUI_NativeDialogHandler handler, OnWillDismissEvent eventHandler); + int32_t (*registerOnWillDismiss)(ArkUI_NativeDialogHandle handle, OnWillDismissEvent eventHandler); /** * @brief 显示自定义弹窗。 * - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 * @param showInSubWindow 是否在子窗口显示弹窗。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*show)(ArkUI_NativeDialogHandler handler, bool showInSubWindow); + int32_t (*show)(ArkUI_NativeDialogHandle handle, bool showInSubWindow); /** * @brief 关闭自定义弹窗,如已关闭,则不生效。 * - * @param handler 指向自定义弹窗控制器的指针。 + * @param handle 指向自定义弹窗控制器的指针。 * @return 返回错误码,0 - 成功, 401 - 参数错误。 */ - int32_t (*close)(ArkUI_NativeDialogHandler handler); + int32_t (*close)(ArkUI_NativeDialogHandle handle); } ArkUI_NativeDialogAPI_1; #ifdef __cplusplus diff --git a/zh-cn/native_sdk/ace/native_node.h b/zh-cn/native_sdk/ace/native_node.h index 8e32d741..673ef98b 100644 --- a/zh-cn/native_sdk/ace/native_node.h +++ b/zh-cn/native_sdk/ace/native_node.h @@ -1688,10 +1688,10 @@ typedef enum { * @brief 图片渲染模式属性,支持属性设置,属性重置,属性获取接口。 * * 属性设置方法参数{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32 参数类型{@link ArkUI_RenderMode}。\n + * .value[0].i32 参数类型{@link ArkUI_ImageRenderMode}。\n * \n * 属性获取方法返回值{@link ArkUI_AttributeItem}格式:\n - * .value[0].i32 参数类型{@link ArkUI_RenderMode}。\n + * .value[0].i32 参数类型{@link ArkUI_ImageRenderMode}。\n * */ NODE_IMAGE_RENDER_MODE, diff --git a/zh-cn/native_sdk/ace/native_type.h b/zh-cn/native_sdk/ace/native_type.h index ef57e88f..9f7f3975 100644 --- a/zh-cn/native_sdk/ace/native_type.h +++ b/zh-cn/native_sdk/ace/native_type.h @@ -67,7 +67,7 @@ typedef struct ArkUI_Node* ArkUI_NodeHandle; * * @since 12 */ -typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandler; +typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandle; /** * @brief ArkUI在native侧的数字类型定义。 -- Gitee From ac0391aad94c57587b604b612718921d5af1d3c2 Mon Sep 17 00:00:00 2001 From: guoxing Date: Tue, 12 Mar 2024 07:32:13 +0000 Subject: [PATCH 0378/2135] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoxing --- .../graphic/native_drawing/drawing_font_collection.h | 10 ++++++++++ .../graphic/native_drawing/drawing_register_font.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h index 5f7fe035..821ac2ef 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_font_collection.h @@ -85,6 +85,16 @@ void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection* fontCol */ void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection* fontCollection); +/** + * @brief 创建可共享的字体集对象{@link OH_Drawing_FontCollection}。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return 指向创建的字体集对象的指针。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection(void); + #ifdef __cplusplus } #endif diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_register_font.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_register_font.h index 1e95ae00..22a48eb0 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_register_font.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_register_font.h @@ -25,7 +25,7 @@ * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * - * @since 11 + * @since 8 * @version 1.0 */ @@ -34,6 +34,8 @@ * * @brief 定义绘制模块中字体管理器相关的函数。 * + * 引用文件"native_drawing/drawing_register_font.h" + * @library libnative_drawing.so * @since 11 * @version 1.0 */ -- Gitee From b58754c1fd17875a635faa755336f03c9f517c25 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Thu, 14 Mar 2024 10:41:41 +0800 Subject: [PATCH 0379/2135] Update docs (0314) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_dialog.h | 85 +++++++++++++++++-------------- en/native_sdk/ace/native_node.h | 8 +-- en/native_sdk/ace/native_type.h | 2 +- 3 files changed, 51 insertions(+), 44 deletions(-) diff --git a/en/native_sdk/ace/native_dialog.h b/en/native_sdk/ace/native_dialog.h index fdd59f76..437f1320 100644 --- a/en/native_sdk/ace/native_dialog.h +++ b/en/native_sdk/ace/native_dialog.h @@ -56,153 +56,160 @@ typedef struct { * @note This method must be called before the show method. * @return Returns the pointer to the created custom dialog box; returns a null pointer if the creation fails. */ - ArkUI_NativeDialogHandler (*create)(); + ArkUI_NativeDialogHandle (*create)(); /** * @brief Destroys a custom dialog box. * - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. */ - void (*dispose)(ArkUI_NativeDialogHandler handler); + void (*dispose)(ArkUI_NativeDialogHandle handle); /** * @brief Attaches the content of a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @param content Indicates the pointer to the root node of the custom dialog box content. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*attachContent)(ArkUI_NativeDialogHandler handler, ArkUI_NodeHandle content); + int32_t (*setContent)(ArkUI_NativeDialogHandle handle, ArkUI_NodeHandle content); /** * @brief Detaches the content of a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. - * @param content Indicates the pointer to the root node of the custom dialog box content. + * @param handle Indicates the pointer to the custom dialog box controller. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*detachContent)(ArkUI_NativeDialogHandler handler, ArkUI_NodeHandle content); + int32_t (*removeContent)(ArkUI_NativeDialogHandle handle); /** * @brief Sets the alignment mode for a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @param alignment Indicates the alignment mode. 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 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*setContentAlignment)(ArkUI_NativeDialogHandler handler, int32_t alignment, float offsetX, float offsetY); + int32_t (*setContentAlignment)(ArkUI_NativeDialogHandle handle, int32_t alignment, float offsetX, float offsetY); /** * @brief Resets the alignment mode of a custom dialog box to its default settings. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*resetContentAlignment)(ArkUI_NativeDialogHandler handler); + int32_t (*resetContentAlignment)(ArkUI_NativeDialogHandle handle); /** * @brief Sets the modal mode for a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. - * @param useModalMode Specifies whether the custom dialog box is a modal, which has a mask applied. - * The value true means that the custom dialog box is a modal, and false means the opposite. + * @param handle Indicates the pointer to the custom dialog box controller. + * @param isModal Specifies whether the custom dialog box is a modal, which has a mask applied. The value + * true means that the custom dialog box is a modal, and false means the opposite. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setModalMode)(ArkUI_NativeDialogHandle handle, bool isModal); + /** + * @brief Specifies whether to allow users to touch the mask to dismiss the 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 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 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*setMode)(ArkUI_NativeDialogHandler handler, bool useModalMode, bool autoCancel); + int32_t (*setAutoCancel)(ArkUI_NativeDialogHandle handle, bool autoCancel); /** * @brief Sets the mask for a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @param maskColor Indicates the mask color, in 0xARGB format. - * @param rect Indicates the 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}. + * @param maskRect Indicates the 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 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*setMask)(ArkUI_NativeDialogHandler handler, uint32_t maskColor, const ArkUI_Rect* rect); + int32_t (*setMask)(ArkUI_NativeDialogHandle handle, uint32_t maskColor, const ArkUI_Rect* maskRect); /** * @brief Sets the background color for a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @param backgroundColor Indicates the background color of the custom dialog box, in 0xARGB format. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*setBackgroundColor)(ArkUI_NativeDialogHandler handler, uint32_t backgroundColor); + int32_t (*setBackgroundColor)(ArkUI_NativeDialogHandle handle, uint32_t backgroundColor); /** * @brief Sets the background corner radius for a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @param topLeft Indicates the radius of the upper left corner of the custom dialog box background. * @param topRight Indicates the radius of the upper right corner of the custom dialog box background. * @param bottomLeft Indicates the radius of the lower left corner of the custom dialog box background. * @param bottomRight Indicates the radius of the lower right corner of the custom dialog box background. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*setCornerRadius)(ArkUI_NativeDialogHandler handler, float topLeft, float topRight, + int32_t (*setCornerRadius)(ArkUI_NativeDialogHandle handle, float topLeft, float topRight, float bottomLeft, float bottomRight); /** * @brief Sets the number of grid columns occupied by a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @param gridCount Indicates the number of grid columns occupied by the dialog box. The default value is subject to * the window size, and the maximum value is the maximum number of columns supported by the system. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*setGridCount)(ArkUI_NativeDialogHandler handler, int32_t gridCount); + int32_t (*setGridColumnCount)(ArkUI_NativeDialogHandle handle, int32_t gridCount); /** * @brief Specifies whether to use a custom style for the custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. - * @param customStyle Specifies whether to use a custom style for the dialog box. + * @param handle Indicates the pointer to the custom dialog box controller. + * @param enableCustomStyle Specifies whether to use a custom style for the dialog box. * true: The dialog box automatically adapts its width to the child components; the rounded corner is 0; * the background color is transparent. * false: The dialog box automatically adapts its width to the grid system and its height to the child * components; the rounded corner is 24 vp. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*setCustomStyle)(ArkUI_NativeDialogHandler handler, bool customStyle); + int32_t (*enableCustomStyle)(ArkUI_NativeDialogHandle handle, bool enableCustomStyle); /** * @brief Specifies whether to use a custom animation for a custom dialog box. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. - * @param useCustomAnimation Specifies whether to use a custom animation. - * The value true means to use a custom animation, and false means to use the default animation. + * @param handle Indicates the pointer to the custom dialog box controller. + * @param enableCustomAnimation Specifies whether to use a custom animation. The value true means to use a + * custom animation, and false means to use the default animation. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*useCustomAnimation)(ArkUI_NativeDialogHandler handler, bool useCustomAnimation); + int32_t (*enableCustomAnimation)(ArkUI_NativeDialogHandle handle, bool enableCustomAnimation); /** * @brief Registers a callback for a custom dialog box so that the user can decide whether to close the dialog box * after they touch the Back button or press the Esc key. * * @note This method must be called before the show method. - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @param eventHandler Indicates the callback to register. The parameter type is {@link OnWillDismissEvent}. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*registerOnWillDismiss)(ArkUI_NativeDialogHandler handler, OnWillDismissEvent eventHandler); + int32_t (*registerOnWillDismiss)(ArkUI_NativeDialogHandle handle, OnWillDismissEvent eventHandler); /** * @brief Shows a custom dialog box. * - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @param showInSubWindow Specifies whether to show the dialog box in a sub-window. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*show)(ArkUI_NativeDialogHandler handler, bool showInSubWindow); + int32_t (*show)(ArkUI_NativeDialogHandle handle, bool showInSubWindow); /** * @brief Closes a custom dialog box. If the dialog box has been closed, this API does not take effect. * - * @param handler Indicates the pointer to the custom dialog box controller. + * @param handle Indicates the pointer to the custom dialog box controller. * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*close)(ArkUI_NativeDialogHandler handler); + int32_t (*close)(ArkUI_NativeDialogHandle handle); } ArkUI_NativeDialogAPI_1; #ifdef __cplusplus diff --git a/en/native_sdk/ace/native_node.h b/en/native_sdk/ace/native_node.h index 53584fe4..a8d9e5b1 100644 --- a/en/native_sdk/ace/native_node.h +++ b/en/native_sdk/ace/native_node.h @@ -1814,10 +1814,10 @@ typedef enum { * @brief Defines the image rendering 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: The parameter type is {@link ArkUI_RenderMode}. \n + * .value[0].i32: The parameter type is {@link ArkUI_ImageRenderMode}. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: The parameter type is {@link ArkUI_RenderMode}. \n + * .value[0].i32: The parameter type is {@link ArkUI_ImageRenderMode}. \n * */ NODE_IMAGE_RENDER_MODE, @@ -4341,10 +4341,10 @@ typedef struct { * * @param node Indicates the target node. * @param eventType Indicates the type of event to register. - * @param eventId Indicates the custom event ID, which is passed in the callback of <@link ArkUI_NodeEvent> + * @param eventId Indicates the custom event ID, which is passed in the callback of {@link ArkUI_NodeEvent} * when the event is triggered. * @param extraParam Indicates the custom event parameter, which is passed in the callback of - * <@link ArkUI_NodeEvent> when the event is triggered. + * {@link ArkUI_NodeEvent} when the event is triggered. * @return Returns 0 if success. * Returns 401 if a parameter exception occurs. * Returns 106102 if the dynamic implementation library of the native API was not found. diff --git a/en/native_sdk/ace/native_type.h b/en/native_sdk/ace/native_type.h index d4b780cd..10f276b8 100644 --- a/en/native_sdk/ace/native_type.h +++ b/en/native_sdk/ace/native_type.h @@ -68,7 +68,7 @@ typedef struct ArkUI_Node* ArkUI_NodeHandle; * * @since 12 */ -typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandler; +typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandle; /** * @brief Provides the number types of ArkUI in the native code. -- Gitee From f01a367970b56e90b33c21ef9432dcc32e8b9021 Mon Sep 17 00:00:00 2001 From: xiyupeng Date: Fri, 8 Mar 2024 14:33:54 +0800 Subject: [PATCH 0380/2135] =?UTF-8?q?scheme=20handler=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E6=89=98=E7=AE=A1=E6=8E=A5=E5=8F=A3=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiyupeng --- zh-cn/native_sdk/web/arkweb_error_code.h | 60 + zh-cn/native_sdk/web/arkweb_net_error_list.h | 2015 ++++++++++++++++++ zh-cn/native_sdk/web/arkweb_scheme_handler.h | 858 ++++++++ 3 files changed, 2933 insertions(+) create mode 100644 zh-cn/native_sdk/web/arkweb_error_code.h create mode 100644 zh-cn/native_sdk/web/arkweb_net_error_list.h create mode 100644 zh-cn/native_sdk/web/arkweb_scheme_handler.h diff --git a/zh-cn/native_sdk/web/arkweb_error_code.h b/zh-cn/native_sdk/web/arkweb_error_code.h new file mode 100644 index 00000000..b0e2b313 --- /dev/null +++ b/zh-cn/native_sdk/web/arkweb_error_code.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Web + * @{ + * + * @brief 为ArkWeb NDK接口发生异常提供错误码。 + * @since 12 + */ +/** + * @file arkweb_error_code.h + * + * @brief 声明ArkWeb NDK接口异常错误码。 + * @library libohweb.so + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +#ifndef ARKWEB_ERROR_CODE_H +#define ARKWEB_ERROR_CODE_H + +typedef enum ArkWeb_ErrorCode { +/* + * @brief 未知错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +ARKWEB_ERROR_UNKNOWN = 17100100, + +/* + * @brief 参数无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +ARKWEB_INVALID_PARAM = 17100101, + +/* + * @brief 注册scheme的配置失败,应该在创建ArkWeb之前注册。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +ARKWEB_SCHEME_REGISTER_FAILED = 17100102, +} ArkWeb_ErrorCode; + +#endif // ARKWEB_ERROR_CODE_H diff --git a/zh-cn/native_sdk/web/arkweb_net_error_list.h b/zh-cn/native_sdk/web/arkweb_net_error_list.h new file mode 100644 index 00000000..a50f79c1 --- /dev/null +++ b/zh-cn/native_sdk/web/arkweb_net_error_list.h @@ -0,0 +1,2015 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Web + * @{ + * + * @brief 为ArkWeb网络协议栈提供错误码。 + * @since 12 + */ +/** + * @file arkweb_net_error_list.h + * + * @brief 声明ArkWeb网络协议栈错误码。 + * @library libohweb.so + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +#ifndef ARKWEB_NET_ERROR_LIST_H +#define ARKWEB_NET_ERROR_LIST_H + +typedef enum ArkWeb_NetError { + /* + * @brief 正常。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_NET_OK = 0, + + /* + * @brief 异步IO操作尚未完成。这通常并不表示致命错误。 + * 通常,这个错误将作为通知生成,以等待某个外部通知,表明IO操作最终已完成。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IO_PENDING = -1, + + /* + * @brief 发生了通用故障。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FAILED = -2, + + /* + * @brief 操作被中止(由于用户操作)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ABORTED = -3, + + /* + * @brief 该函数的参数不正确。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_ARGUMENT = -4, + + /* + * @brief 句柄或文件描述符无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_HANDLE = -5, + + /* + * @brief 文件或目录无法找到。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_NOT_FOUND = -6, + + /* + * @brief 操作超时。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TIMED_OUT = -7, + + /* + * @brief 文件过大。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_TOO_LARGE = -8, + + /* + * @brief 发生了一个意外的错误。这可能是由编程错误或无效的假设导致的。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNEXPECTED = -9, + + /* + * @brief 访问除网络外的资源被拒绝。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ACCESS_DENIED = -10, + + /* + * @brief 由于功能未实现,操作失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NOT_IMPLEMENTED = -11, + + /* + * @brief 没有足够的资源来完成操作。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INSUFFICIENT_RESOURCES = -12, + + /* + * @brief 内存溢出。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_OUT_OF_MEMORY = -13, + + /* + * @brief 文件上传失败,因为文件的修改时间与预期不同。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UPLOAD_FILE_CHANGED = -14, + + /* + * @brief socket未连接。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_NOT_CONNECTED = -15, + + /* + * @brief 文件已存在。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_EXISTS = -16, + + /* + * @brief 文件路径或者文件名过长。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_PATH_TOO_LONG = -17, + + /* + * @brief 磁盘上剩余空间不足。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_NO_SPACE = -18, + + /* + * @brief 文件含有病毒。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_VIRUS_INFECTED = -19, + + /* + * @brief 客户端选择阻止该请求。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_CLIENT = -20, + + /* + * @brief 网络发生变化。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NETWORK_CHANGED = -21, + + /* + * @brief 请求被域管理员配置的URL阻止列表所阻止。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_ADMINISTRATOR = -22, + + /* + * @brief socket已连接。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_CONNECTED = -23, + + /* + * @brief 由于重试或重定向,需要重新读取上传流,但上传流不支持该操作,因此上传失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UPLOAD_STREAM_REWIND_NOT_SUPPORTED = -25, + + /* + * @brief 请求失败,因为URLRequestContext正在关闭或已经关闭。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONTEXT_SHUT_DOWN = -26, + + /* + * @brief 请求失败,因为响应不满足要求(例如“X-Frame-Options”和“Content Security Policy”检查以及“Cross Origin Resource Policy”)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_RESPONSE = -27, + + /* + * @brief 由于系统策略禁止某些或所有明文请求,请求被阻止。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CLEARTEXT_NOT_PERMITTED = -29, + + /* + * @brief 请求被内容安全策略阻止。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_CSP = -30, + + /* + * @brief 由于没有H/2或QUIC会话,请求被阻止。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_H2_OR_QUIC_REQUIRED = -31, + + /* + * @brief 请求被 CORB 或 ORB 阻止。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_ORB = -32, + + /* + * @brief 连接已关闭(对应于TCP FIN)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_CLOSED = -100, + + /* + * @brief 连接被重置(对应于TCP RST)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_RESET = -101, + + /* + * @brief 连接尝试被拒绝。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_REFUSED = -102, + + /* + * @brief 由于未收到发送数据的ACK而导致连接超时。这可能包括未收到ACK的FIN数据包。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_ABORTED = -103, + + /* + * @brief 连接尝试失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_FAILED = -104, + + /* + * @brief 域名无法解析。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NAME_NOT_RESOLVED = -105, + + /* + * @brief 网络断开。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INTERNET_DISCONNECTED = -106, + + /* + * @brief 发生了SSL协议错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_PROTOCOL_ERROR = -107, + + /* + * @brief IP地址或端口号无效(例如,无法连接到IP地址0或端口0)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ADDRESS_INVALID = -108, + + /* + * @brief IP地址无法访问。这通常意味着没有到达指定主机或网络的路由。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ADDRESS_UNREACHABLE = -109, + + /* + * @brief 服务器请求SSL客户端身份验证的客户端证书。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110, + + /* + * @brief 无法通过代理建立隧道连接。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TUNNEL_CONNECTION_FAILED = -111, + + /* + * @brief 未启用任何SSL协议版本。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NO_SSL_VERSIONS_ENABLED = -112, + + /* + * @brief 客户端和服务器不支持通用的SSL协议版本或密码套件。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113, + + /* + * @brief 服务器请求重新协商(重新握手)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_RENEGOTIATION_REQUESTED = -114, + + /* + * @brief 代理请求进行身份验证(用于建立隧道,但使用的方法不受支持)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_AUTH_UNSUPPORTED = -115, + + /* + * @brief SSL握手未能成功,原因是客户端证书不正确或缺失。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BAD_SSL_CLIENT_AUTH_CERT = -117, + + /* + * @brief 连接尝试超时。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_TIMED_OUT = -118, + + /* + * @brief 有太多待处理的DNS解析,因此队列中的一个请求被中止了。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HOST_RESOLVER_QUEUE_TOO_LARGE = -119, + + /* + * @brief 为目标主机建立到SOCKS代理服务器的连接失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKS_CONNECTION_FAILED = -120, + + /* + * @brief SOCKS代理服务器无法建立与目标主机的连接,因为该主机无法访问。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKS_CONNECTION_HOST_UNREACHABLE = -121, + + /* + * @brief 协商备用协议的请求失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ALPN_NEGOTIATION_FAILED = -122, + + /* + * @brief 对等端发送了SSL no_regregation警报消息。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_NO_RENEGOTIATION = -123, + + /* + * @brief Winsock有时会报告写入的数据多于传递的数据。这可能是由于LSP损坏。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES = -124, + + /* + * @brief SSL对等端向我们发送了一个致命的decompression_failure警告。 + * 这通常发生在对等端错误地认为它支持DEFLATE压缩并选择它时。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_DECOMPRESSION_FAILURE_ALERT = -125, + + /* + * @brief SSL对等端向我们发送了一个致命的bad_record_mac警告。 + * 这通常发生在错误支持DEFLATE的服务器上。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_BAD_RECORD_MAC_ALERT = -126, + + /* + * @brief 代理请求身份验证(用于建立隧道)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_AUTH_REQUESTED = -127, + + /* + * @brief 无法创建到代理服务器的连接。在解析其名称或将其套接字连接到代理服务器时发生错误。 + * 请注意,这不包括HTTP代理的实际“CONNECT”方法期间的失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_CONNECTION_FAILED = -130, + + /* + * @brief 无法使用强制代理配置。目前,这意味着无法获取、解析或执行强制PAC脚本。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MANDATORY_PROXY_CONFIGURATION_FAILED = -131, + + /* + * @brief 在预连接时,我们已达到套接字池的最大套接字限制。我们不再尝试预连接更多套接字。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PRECONNECT_MAX_SOCKET_LIMIT = -133, + + /* + * @brief 使用SSL客户端证书的私钥的权限被拒绝。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED = -134, + + /* + * @brief SSL客户端证书没有私钥。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_CERT_NO_PRIVATE_KEY = -135, + + /* + * @brief HTTPS代理提供的证书无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_CERTIFICATE_INVALID = -136, + + /* + * @brief 在尝试进行域名解析(DNS)时发生错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NAME_RESOLUTION_FAILED = -137, + + /* + * @brief 访问网络的权限被拒绝。这用于区分很可能是由防火墙导致的错误和其他访问被拒绝的错误。 + * 另请参阅ERR_ACCESS_DENIED。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NETWORK_ACCESS_DENIED = -138, + + /* + * @brief 请求节流模块取消了此请求,以避免DDOS攻击。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TEMPORARILY_THROTTLED = -139, + + /* + * @brief 通过HTTPS代理创建SSL隧道连接的请求收到了302(临时重定向)响应。 + * 响应体可能包含请求失败原因的说明。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTPS_PROXY_TUNNEL_RESPONSE_REDIRECT = -140, + + /* + * @brief 我们无法使用客户端证书的私钥签署SSL客户端身份验证握手的CertificateVerify数据。 + * 可能导致这种情况的原因包括用户隐式或显式地拒绝访问私钥,私钥可能无法用于签名, + * 密钥可能依赖于已无效的缓存句柄,或者CSP不允许签署任意数据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED = -141, + + /* + * @brief 消息对于传输来说太大了。(例如,UDP消息超过了大小阈值)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MSG_TOO_BIG = -142, + + /* + * @brief Websocket协议错误。表示由于帧格式错误或其他协议违规,我们正在终止连接。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WS_PROTOCOL_ERROR = -145, + + /* + * @brief 当尝试绑定已使用的地址时返回。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ADDRESS_IN_USE = -147, + + /* + * @brief 由于SSL握手尚未完成,操作失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_HANDSHAKE_NOT_COMPLETED = -148, + + /* + * @brief SSL对等方的公钥无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_BAD_PEER_PUBLIC_KEY = -149, + + /* + * @brief 证书与主机名的内置公钥Pins不匹配。Pin在net/http/transport_security_state.cc中设置, + * 并且要求在从叶节点到根节点的路径上存在一组公钥中的一个。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN = -150, + + /* + * @brief 服务器请求客户端证书,但请求中未包含我们支持的任何类型。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CLIENT_AUTH_CERT_TYPE_UNSUPPORTED = -151, + + /* + * @brief SSL对等端向我们发送了一个致命的decrypt_error警告。这通常发生在对等端无法正确验证签名 + * (在CertificateVerify或ServerKeyExchange中)或验证Finished消息时。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_DECRYPT_ERROR_ALERT = -153, + + /* + * @brief 待处理的WebSocketJob实例太多,因此新任务没有推送到队列中。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WS_THROTTLE_QUEUE_TOO_LARGE = -154, + + /* + * @brief 在重新协商过程中,SSL服务器证书发生了更改。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_SERVER_CERT_CHANGED = -156, + + /* + * @brief SSL服务器向我们发送了一个致命的unrecognized_name警告。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_UNRECOGNIZED_NAME_ALERT = -159, + + /* + * @brief 无法按照请求设置套接字的接收缓冲区大小。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_SET_RECEIVE_BUFFER_SIZE_ERROR = -160, + + /* + * @brief 无法按照请求设置套接字的发送缓冲区大小。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_SET_SEND_BUFFER_SIZE_ERROR = -161, + + /* + * @brief 尽管setsockopt返回成功代码,但无法将套接字的接收缓冲区大小设置为所请求的值。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_RECEIVE_BUFFER_SIZE_UNCHANGEABLE = -162, + + /* + * @brief 尽管setsockopt返回成功代码,但无法将套接字的发送缓冲区大小设置为所请求的值。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_SEND_BUFFER_SIZE_UNCHANGEABLE = -163, + + /* + * @brief 无法将客户端证书从平台存储导入到SSL库中。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_CERT_BAD_FORMAT = -164, + + /* + * @brief 将主机名解析为IP地址列表时,包含了IPv4地址“127.0.53.53”。 + * 这是ICANN推荐的一个特殊IP地址,用于指示存在名称冲突,并提醒管理员注意潜在问题。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ICANN_NAME_COLLISION = -166, + + /* + * @brief SSL服务器提供了一个无法解码的证书。这不是一个证书错误代码,因为没有可用的X509Certificate对象。 + * 这个错误是致命的。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_SERVER_CERT_BAD_FORMAT = -167, + + /* + * @brief Certificate Transparency: 收到的 Signed Tree Head 无法解析。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CT_STH_PARSING_FAILED = -168, + + /* + * @brief 证书透明度:收到的已签名树头可以成功解析为JSON,但缺少某些字段。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CT_STH_INCOMPLETE = -169, + + /* + * @brief 在AuthController用于生成凭据之前,尝试重用连接以发送代理身份验证凭据失败。 + * 调用者应该使用新连接重新使用控制器。此错误仅由网络堆栈内部使用。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH = -170, + + /* + * @brief 证书透明度:无法解析收到的一致性证明。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CT_CONSISTENCY_PROOF_PARSING_FAILED = -171, + + /* + * @brief SSL服务器要求一个已被移除的不受支持的密码套件。在这个密码套件被移除后的一两个版本更新中, + * 作为回退策略,这个错误将被临时发出信号,之后回退策略将被移除。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_OBSOLETE_CIPHER = -172, + + /* + * @brief 当WebSocket握手成功完成并且连接已升级时,将使用此错误代码取消URLRequest。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WS_UPGRADE = -173, + + /* + * @brief Socket ReadIfReady支持尚未实现。这个错误不应该被用户看到,因为正常的Read方法将作为备选方案使用。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_READ_IF_READY_NOT_IMPLEMENTED = -174, + + /* + * @brief 没有可用的套接字缓冲区空间。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NO_BUFFER_SPACE = -176, + + /* + * @brief 我们的客户端证书私钥和服务器的首选项之间没有共同的签名算法。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_NO_COMMON_ALGORITHMS = -177, + + /* + * @brief TLS 1.3 Early Data 被服务器拒绝。这将在从套接字返回任何数据之前收到。 + * 应该禁用 Early Data 并重试请求。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_EARLY_DATA_REJECTED = -178, + + /* + * @brief 提供了TLS 1.3 Early Data,但服务器以TLS 1.2或更早版本进行响应。 + * 这是为了解决Early Data和TLS 1.2之间向后兼容问题的内部错误代码。 + * 在套接字返回任何数据之前将收到此错误代码。应该禁用Early Data后重试请求。 + * 详情请参阅https://tools.ietf.org/html/rfc8446#appendix-D.3。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WRONG_VERSION_ON_EARLY_DATA = -179, + + /* + * @brief 启用了TLS 1.3,但协商了一个较低版本,并且服务器返回了一个值,表明它支持TLS 1.3。 + * 这是TLS 1.3安全检查的一部分,但也可能表明用户位于一个有问题的TLS终止代理之后, + * 该代理错误地实现了TLS 1.2。(参见 https://crbug.com/boringssl/226) + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TLS13_DOWNGRADE_DETECTED = -180, + + /* + * @brief 服务器的证书有一个与协商的TLS密钥交换方法不兼容的keyUsage扩展。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_KEY_USAGE_INCOMPATIBLE = -181, + + /* + * @brief 通过DNS获取的ECHConfigList无法解析。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_ECH_CONFIG_LIST = -182, + + /* + * @brief 已启用ECH(Encrypted Client Hello,加密客户端Hello),但服务器无法解密加密的ClientHello。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ECH_NOT_NEGOTIATED = -183, + + /* + * @brief ECH(Encrypted Client Hello)已启用,但服务器无法解密加密的ClientHello, + * 并且没有提供对公共名称有效的证书。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ECH_FALLBACK_CERTIFICATE_INVALID = -184, + + /* + * @brief 服务器响应了一个证书,其通用名称与主机名不匹配。这可能意味着: + * 1. 攻击者已将我们的流量重定向到他们的服务器,并呈现了一个他们知道私钥的证书。 + * 2. 服务器配置错误,响应了错误的证书。 + * 3. 用户处于无线网络中,被重定向到网络的登录页面。 + * 4. 操作系统使用了DNS搜索后缀,而服务器没有为地址栏中的缩写名称提供证书。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_COMMON_NAME_INVALID = -200, + + /* + * @brief 服务器以证书作为响应,但根据我们的时钟,该证书似乎尚未生效或已过期。这可能是以下情况之一: + * 1. 攻击者提供了旧的证书,并设法获取了私钥。 + * 2. 服务器配置错误,没有提供有效的证书。 + * 3. 我们的时钟错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_DATE_INVALID = -201, + + /* + * @brief 服务器回应了一个由我们不信任的机构签名的证书。这可能意味着: + * 1. 攻击者已经将真实的证书替换为包含其公钥并由其同伙签名的证书。 + * 2. 服务器运营商拥有一个来自我们不了解但应该信任的CA的合法证书。 + * 3. 服务器正在展示一个自签名证书,这无法抵御活跃攻击者(但可以挫败被动攻击者)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_AUTHORITY_INVALID = -202, + + /* + * @brief 服务器返回的证书包含错误。 + * 此错误无法恢复。 + * MSDN对此错误的描述如下: + * "SSL证书包含错误。" + * 注意:目前尚不清楚这与ERR_CERT_INVALID有何不同。为了保持一致性,从现在开始,请使用 + * ERR_CERT_INVALID代码代替此代码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_CONTAINS_ERRORS = -203, + + /* + * @brief 该证书没有用于确定其是否被吊销的机制。实际上,此证书无法被吊销。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_NO_REVOCATION_MECHANISM = -204, + + /* + * @brief 此站点的安全证书的吊销信息不可用。这可能意味着: + * 1. 攻击者已破解证书中的私钥,并阻止了我们尝试查明证书已被吊销的操作。 + * 2. 证书未被吊销,但吊销服务器繁忙或不可用。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205, + + /* + * @brief 服务器响应的证书已被吊销。 + * 我们有能力忽略此错误,但这可能不是正确的做法。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_REVOKED = -206, + + /* + * @brief 服务器以无效的证书进行了响应。 + * 这个错误无法恢复。 + * MSDN描述此错误如下: + * "SSL证书无效。" + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_INVALID = -207, + + /* + * @brief 服务器使用弱签名算法签名的证书进行了响应。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_WEAK_SIGNATURE_ALGORITHM = -208, + + /* + * @brief 证书中指定的主机名不是唯一的。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_NON_UNIQUE_NAME = -210, + + /* + * @brief 服务器响应了一个包含弱密钥(例如,太小的RSA密钥)的证书。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_WEAK_KEY = -211, + + /* + * @brief 证书中声明的DNS名称违反了名称约束。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_NAME_CONSTRAINT_VIOLATION = -212, + + /* + * @brief 证书的有效期太长。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_VALIDITY_TOO_LONG = -213, + + /* + * @brief 此连接需要证书透明度,但服务器未提供符合策略的CT信息。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERTIFICATE_TRANSPARENCY_REQUIRED = -214, + + /* + * @brief 证书链接到不再受信任的旧版Symantec根证书。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_SYMANTEC_LEGACY = -215, + + /* + * @brief 已知该证书被除设备所有者之外的其他实体拦截。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_KNOWN_INTERCEPTION_BLOCKED = -217, + + /* + * @brief 连接使用了SSL/TLS或加密算法的过时版本。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_OBSOLETE_VERSION_OR_CIPHER = -218, + + /* + * @brief 紧接在最后一个证书错误代码之后的值。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_END = -219, + + /* + * @brief URL无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_URL = -300, + + /* + * @brief URL的scheme不被允许。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DISALLOWED_URL_SCHEME = -301, + + /* + * @brief 该URL的scheme未知。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNKNOWN_URL_SCHEME = -302, + + /* + * @brief 尝试加载一个URL导致重定向到一个无效的URL。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_REDIRECT = -303, + + /* + * @brief 尝试加载一个URL时发生了太多次重定向。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TOO_MANY_REDIRECTS = -310, + + /* + * @brief 尝试加载某个URL时出现了不安全的重定向(例如,重定向到file://被视为不安全)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNSAFE_REDIRECT = -311, + + /* + * @brief 尝试加载带有不安全端口号的 URL。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNSAFE_PORT = -312, + + /* + * @brief 服务器的响应无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_RESPONSE = -320, + + /* + * @brief 块传输编码中出现错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_CHUNKED_ENCODING = -321, + + /* + * @brief 服务器不支持该请求方法。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_METHOD_UNSUPPORTED = -322, + + /* + * @brief 响应是 407(需要代理身份验证),但我们并没有将请求发送到代理。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNEXPECTED_PROXY_AUTH = -323, + + /* + * @brief 服务器关闭了连接而没有发送任何数据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_EMPTY_RESPONSE = -324, + + /* + * @brief 响应的headers部分过大。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_TOO_BIG = -325, + + /* + * @brief PAC 脚本的执行失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PAC_SCRIPT_FAILED = -327, + + /* + * @brief 响应是416(请求的范围无法满足,服务器无法满足请求的范围)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_REQUEST_RANGE_NOT_SATISFIABLE = -328, + + /* + * @brief 用于身份验证的身份无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MALFORMED_IDENTITY = -329, + + /* + * @brief 响应体的内容解码失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONTENT_DECODING_FAILED = -330, + + /* + * @brief 一个操作无法完成,因为所有网络IO都已挂起。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NETWORK_IO_SUSPENDED = -331, + + /* + * @brief 在流上未收到 SYN_REPLY 就接收到了 FLIP 数据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SYN_REPLY_NOT_RECEIVED = -332, + + /* + * @brief 将响应转换为目标编码失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ENCODING_CONVERSION_FAILED = -333, + + /* + * @brief 服务器发送了一个我们无法理解的 FTP 目录列表格式。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT = -334, + + /* + * @brief 提供的列表中没有任何受支持的代理。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NO_SUPPORTED_PROXIES = -336, + + /* + * @brief 存在一个HTTP/2协议错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_PROTOCOL_ERROR = -337, + + /* + * @brief 在HTTP认证过程中无法建立凭据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_AUTH_CREDENTIALS = -338, + + /* + * @brief 尝试了一种此计算机不支持的 HTTP 身份验证方案。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNSUPPORTED_AUTH_SCHEME = -339, + + /* + * @brief 检测响应的编码失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ENCODING_DETECTION_FAILED = -340, + + /* + * @brief (GSSAPI)在HTTP身份验证期间没有可用的Kerberos凭据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MISSING_AUTH_CREDENTIALS = -341, + + /* + * @brief 返回了一个意外但已记录的SSPI或GSSAPI状态码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNEXPECTED_SECURITY_LIBRARY_STATUS = -342, + + /* + * @brief 认证环境未正确设置(例如,找不到KDC或主体未知)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MISCONFIGURED_AUTH_ENVIRONMENT = -343, + + /* + * @brief 返回了一个未记录的SSPI或GSSAPI状态码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNDOCUMENTED_SECURITY_LIBRARY_STATUS = -344, + + /* + * @brief HTTP响应太大,无法完全读取。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_BODY_TOO_BIG_TO_DRAIN = -345, + + /* + * @brief HTTP 响应包含了多个不同的 Content-Length 响应头。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH = -346, + + /* + * @brief 已经接收到HTTP/2的响应头,但并非全部——缺失了状态码或版本等响应头,因此我们期望更多的帧来完成它们。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INCOMPLETE_HTTP2_HEADERS = -347, + + /* + * @brief 无法从DHCP检索PAC URL配置。这可能表明检索DHCP配置失败,或者在DHCP中没有配置PAC URL。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PAC_NOT_IN_DHCP = -348, + + /* + * @brief HTTP 响应包含多个 Content-Disposition 响应头。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION = -349, + + /* + * @brief HTTP 响应包含了多个 Location 响应头。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_MULTIPLE_LOCATION = -350, + + /* + * @brief HTTP/2服务器在未处理请求的情况下拒绝了请求,并发送了带有错误代码NO_ERROR和低于与请求对应的流ID的 + * Last-Stream-ID的GOAWAY帧,表明该请求尚未处理,或者发送了带有错误代码REFUSED_STREAM的 + * RST_STREAM帧。客户端可以重试(在不同的连接上)。请参阅RFC7540第8.1.4节。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_SERVER_REFUSED_STREAM = -351, + + /* + * @brief HTTP/2服务器未响应PING消息。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_PING_FAILED = -352, + + /* + * @brief 当连接关闭时,HTTP 响应主体传输的字节数少于 Content-Length 头中公布的字节数。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONTENT_LENGTH_MISMATCH = -354, + + /* + * @brief HTTP 响应体使用分块编码传输,但在连接关闭时,终止的零长度区块从未被发送。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INCOMPLETE_CHUNKED_ENCODING = -355, + + /* + * @brief 存在QUIC协议错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_QUIC_PROTOCOL_ERROR = -356, + + /* + * @brief HTTP 响应头信息被文件结束符(EOF)截断。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_TRUNCATED = -357, + + /* + * @brief QUIC 加密握手失败。这意味着服务器无法读取发送的任何请求,因此它们可能会被重新发送。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_QUIC_HANDSHAKE_FAILED = -358, + + /* + * @brief 传输安全性不适合HTTP/2版本。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY = -360, + + /* + * @brief 对等方违反了HTTP/2流控制。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_FLOW_CONTROL_ERROR = -361, + + /* + * @brief 对等方发送了大小不正确的HTTP/2帧。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_FRAME_SIZE_ERROR = -362, + + /* + * @brief 压缩HTTP/2 响应头信息的解码或编码失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_COMPRESSION_ERROR = -363, + + /* + * @brief 请求的代理身份验证没有有效的客户端套接字句柄。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_AUTH_REQUESTED_WITH_NO_CONNECTION = -364, + + /* + * @brief 在 HTTP/2 会话中收到 HTTP_1_1_REQUIRED 错误代码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP_1_1_REQUIRED = -365, + + /* + * @brief 在通过 HTTP/2 会话代理时收到 HTTP_1_1_REQUIRED 错误代码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_HTTP_1_1_REQUIRED = -366, + + /* + * @brief PAC 脚本已终止并必须重新加载。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PAC_SCRIPT_TERMINATED = -367, + + /* + * @brief 服务器应返回 HTTP/1.x 响应,但未返回。而不是将其视为 HTTP/0.9,返回此错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_HTTP_RESPONSE = -370, + + /* + * @brief 初始化内容解码失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONTENT_DECODING_INIT_FAILED = -371, + + /* + * @brief 收到带有 NO_ERROR 错误代码的 HTTP/2 RST_STREAM 帧。 + * 此错误应由 HTTP/2 代码内部处理,而不应超过 SpdyStream 层。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_RST_STREAM_NO_ERROR_RECEIVED = -372, + + /* + * @brief 请求声明的推送流不再可用。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_PUSHED_STREAM_NOT_AVAILABLE = -373, + + /* + * @brief 已声明推送的流,随后服务器将其重置。发生这种情况时,应该重试请求。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_CLAIMED_PUSHED_STREAM_RESET_BY_SERVER = -374, + + /* + * @brief 由于身份验证或证书无效,重试次数过多。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TOO_MANY_RETRIES = -375, + + /* + * @brief 在已关闭的流上收到一个 HTTP/2 帧。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_STREAM_CLOSED = -376, + + /* + * @brief 客户端拒绝了一个 HTTP/2 流。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_CLIENT_REFUSED_STREAM = -377, + + /* + * @brief 基于匹配的 URL 和请求头,一个 HTTP/2 推送的流被请求所接收,但是推送的响应头并不匹配请求。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_PUSHED_RESPONSE_DOES_NOT_MATCH = -378, + + /* + * @brief 服务器返回了非2xx的HTTP响应代码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP_RESPONSE_CODE_FAILURE = -379, + + /* + * @brief 在 QUIC 连接上展示的证书未链接到已知根证书,并且连接到的原始服务器不在允许未知根证书的域名列表中。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_QUIC_UNKNOWN_CERT_ROOT = -380, + + /* + * @brief 已接收到一个 GOAWAY 帧,表明请求未得到处理,因此可以安全地在不同的连接上重试。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_QUIC_GOAWAY_REQUEST_CAN_BE_RETRIED = -381, + + /* + * @brief ACCEPT_CH 重启已被触发太多次。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TOO_MANY_ACCEPT_CH_RESTARTS = -382, + + /* + * @brief 在相同的请求期间,远程端点的 IP 地址空间与先前观察到的值不同。 + * 任何受影响的请求的缓存条目都应被标记为无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INCONSISTENT_IP_ADDRESS_SPACE = -383, + + /* + * @brief 缓存的远程端点的 IP 地址空间被本地网络访问检查所阻止。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHED_IP_ADDRESS_SPACE_BLOCKED_BY_LOCAL_NETWORK_ACCESS_POLICY = -384, + + /* + * @brief 缓存中没有请求的条目。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_MISS = -400, + + /* + * @brief 无法从磁盘缓存中读取。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_READ_FAILURE = -401, + + /* + * @brief 无法写入磁盘缓存。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_WRITE_FAILURE = -402, + + /* + * @brief 此条目不支持此操作。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_OPERATION_UNSUPPORTED = -403, + + /* + * @brief 磁盘缓存无法打开此条目。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_OPEN_FAILURE = -404, + + /* + * @brief 磁盘缓存无法创建此条目。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_CREATE_FAILURE = -405, + + /* + * @brief 多个事务正在竞相创建磁盘缓存条目。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_RACE = -406, + + /* + * @brief 缓存无法读取条目上的校验和记录。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_CHECKSUM_READ_FAILURE = -407, + + /* + * @brief 缓存发现一个具有无效校验和的条目。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_CHECKSUM_MISMATCH = -408, + + /* + * @brief HTTP缓存的内部错误代码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_LOCK_TIMEOUT = -409, + + /* + * @brief 在事务读取某些数据后收到质询,但凭据不可用。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_AUTH_FAILURE_AFTER_READ = -410, + + /* + * @brief 针对HTTP缓存的一个内部使用的、非标准的错误代码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_ENTRY_NOT_SUITABLE = -411, + + /* + * @brief 磁盘缓存无法删除此条目。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_DOOM_FAILURE = -412, + + /* + * @brief 磁盘缓存无法打开或创建此条目。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_OPEN_OR_CREATE_FAILURE = -413, + + /* + * @brief 服务器的响应不安全(例如,存在证书错误)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INSECURE_RESPONSE = -501, + + /* + * @brief 尝试导入客户端证书失败,因为用户的密钥数据库缺少相应的私钥。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NO_PRIVATE_KEY_FOR_CERT = -502, + + /* + * @brief 向操作系统证书数据库添加证书时发生错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ADD_USER_CERT_FAILED = -503, + + /* + * @brief 处理已签名的交换时发生错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_SIGNED_EXCHANGE = -504, + + /* + * @brief 处理Web Bundle源时发生错误。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_WEB_BUNDLE = -505, + + /* + * @brief 执行Trust Tokens协议操作的请求失败(原因包括:预置条件失败、内部错误、不良响应)。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TRUST_TOKEN_OPERATION_FAILED = -506, + + /* + * @brief 在处理一个与Trust Tokens协议相关的操作执行请求时,系统能够执行该请求中的Trust Tokens操作, + * 但并没有将请求发送到其指定的目的地。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TRUST_TOKEN_OPERATION_SUCCESS_WITHOUT_SENDING_REQUEST = -507, + + /* + * @brief FTP控制连接命令失败的通用错误。 + * 如果可能的话,请使用或添加一个更具体的错误代码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_FAILED = -601, + + /* + * @brief 服务器目前无法满足请求。这是一个临时错误。 + * FTP响应代码421。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_SERVICE_UNAVAILABLE = -602, + + /* + * @brief 服务器已中止传输。 + * FTP响应代码426。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_TRANSFER_ABORTED = -603, + + /* + * @brief 文件正在使用中,或在打开文件时发生了一些其他临时错误条件。 + * FTP响应代码450。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_FILE_BUSY = -604, + + /* + * @brief 由于语法错误,服务器拒绝了我们的命令。 + * FTP响应代码500、501。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_SYNTAX_ERROR = -605, + + /* + * @brief 服务器不支持我们发出的命令。 + * FTP响应代码502、504。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_COMMAND_UNSUPPORTED = -606, + + /* + * @brief 服务器拒绝了我们的命令,因为我们没有按照正确的顺序发出命令。 + * FTP响应代码503。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_BAD_COMMAND_SEQUENCE = -607, + + /* + * @brief 由于密码不正确,PKCS #12 导入失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_BAD_PASSWORD = -701, + + /* + * @brief 由于其他错误,PKCS #12 导入失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_FAILED = -702, + + /* + * @brief CA导入失败——不是CA证书。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IMPORT_CA_CERT_NOT_CA = -703, + + /* + * @brief 导入失败——数据库中已存在证书。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IMPORT_CERT_ALREADY_EXISTS = -704, + + /* + * @brief 由于其他错误,CA导入失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IMPORT_CA_CERT_FAILED = -705, + + /* + * @brief 由于某些内部错误,服务器证书导入失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IMPORT_SERVER_CERT_FAILED = -706, + + /* + * @brief PKCS #12 导入失败,因为 MAC(消息认证码)无效。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_INVALID_MAC = -707, + + /* + * @brief PKCS #12 导入失败,因为文件无效或已损坏。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_INVALID_FILE = -708, + + /* + * @brief 由于不支持的特性,PKCS #12 导入失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_UNSUPPORTED = -709, + + /* + * @brief 密钥生成失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_KEY_GENERATION_FAILED = -710, + + /* + * @brief 无法导出私钥。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PRIVATE_KEY_EXPORT_FAILED = -712, + + /* + * @brief 自签名证书生成失败。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SELF_SIGNED_CERT_GENERATION_FAILED = -713, + + /* + * @brief 证书数据库已发生某种更改。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_DATABASE_CHANGED = -714, + + /* + * @brief 证书验证配置已发生某种更改。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_VERIFIER_CHANGED = -716, + + /* + * @brief DNS解析程序收到格式错误的响应。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_MALFORMED_RESPONSE = -800, + + /* + * @brief DNS服务器需要TCP。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SERVER_REQUIRES_TCP = -801, + + /* + * @brief DNS服务器失败。对于以下所有错误情况,都会返回此错误: + * 1 - 格式错误 - 名称服务器无法解释查询。 + * 2 - 服务器故障 - 名称服务器由于自身问题无法处理这个查询。 + * 4 - 未实现 - 名称服务器不支持请求的查询类型。 + * 5 - 拒绝 - 名称服务器出于策略原因拒绝执行指定的操作。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SERVER_FAILED = -802, + + /* + * @brief DNS事务超时。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_TIMED_OUT = -803, + + /* + * @brief 对于只查询本地源的查找,在缓存或其他本地源中未找到该条目。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_CACHE_MISS = -804, + + /* + * @brief 后缀搜索列表规则阻止了给定主机名的解析。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SEARCH_EMPTY = -805, + + /* + * @brief 未能根据RFC3484对地址进行排序。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SORT_ERROR = -806, + + /* + * @brief 未能解析DNS-over-HTTPS服务器的主机名。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SECURE_RESOLVER_HOSTNAME_RESOLUTION_FAILED = -808, + + /* + * @brief DNS已识别请求因不安全的连接(http/ws)而被禁止。 + * 应用程序应该像处理HTTP重定向一样处理这个错误,将连接重定向到安全的https或wss。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_NAME_HTTPS_ONLY = -809, + + /* + * @brief 与此任务相关的所有 DNS 请求已被取消。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_REQUEST_CANCELED = -810, + + /* + * @brief HTTPS记录的主机名解析预期未能使用受支持协议的ALPN值进行解析。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_NO_MATCHING_SUPPORTED_ALPN = -811, +} ArkWeb_NetError; + +#endif // ARKWEB_NET_ERROR_LIST_H diff --git a/zh-cn/native_sdk/web/arkweb_scheme_handler.h b/zh-cn/native_sdk/web/arkweb_scheme_handler.h new file mode 100644 index 00000000..2d465719 --- /dev/null +++ b/zh-cn/native_sdk/web/arkweb_scheme_handler.h @@ -0,0 +1,858 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Web + * @{ + * + * @brief 提供用于拦截ArkWeb请求的API。 + * @since 12 + */ +/** + * @file arkweb_scheme_handler.h + * + * @brief 声明用于拦截来自ArkWeb的请求的API。 + * @library libohweb.so + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +#ifndef ARKWEB_SCHEME_HANDLER_H +#define ARKWEB_SCHEME_HANDLER_H + +#include "stdint.h" + +#include "arkweb_error_code.h" +#include "arkweb_net_error_list.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * @brief custom schemes的配置信息。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef enum ArkWeb_CustomSchemeOption { + OH_ARKWEB_SCHEME_OPTION_NONE = 0, + + /* + * @brief 如果设置了ARKWEB_SCHEME_OPTION_STANDARD,那么该scheme将被视为标准scheme来处理。 + * 标准scheme需要遵守在RFC 1738第3.1节中定义的URL规范化和解析规则, + * 该规则可以在 http://www.ietf.org/rfc/rfc1738.txt 中找到。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_STANDARD = 1 << 0, + + /* + * @brief 如果设置了ARKWEB_SCHEME_OPTION_LOCAL,则将使用与“file” URL相同的安全规则来处理该scheme。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_LOCAL = 1 << 1, + + /* + * @brief 如果设置了ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED,则该scheme的请求只能由使用相同scheme加载的页面中发起。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED = 1 << 2, + + /* + * @brief 如果设置了ARKWEB_SCHEME_OPTION_SECURE,则将使用与“https” URL相同的安全规则来处理该scheme。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_SECURE = 1 << 3, + + /* + * @brief 如果设置了ARKWEB_SCHEME_OPTION_CORS_ENABLED,则该scheme可以发送CORS请求。 + * 在大多数情况下,当设置了ARKWEB_SCHEME_OPTION_STANDARD时,应该设置此值。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_CORS_ENABLED = 1 << 4, + + /* + * @brief 如果设置了ARKWEB_SCHEME_OPTION_CSP_BYPASSING,则该scheme可以绕过内容安全策略(CSP)检查。 + * 在大多数情况下,当设置了ARKWEB_SCHEME_OPTION_STANDARD时,不应设置此值。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_CSP_BYPASSING = 1 << 5, + + /* + * @brief 如果设置了ARKWEB_SCHEME_OPTION_FETCH_ENABLED,则可以发起该scheme的FETCH API请求。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_FETCH_ENABLED = 1 << 6, +} ArkWeb_CustomSchemeOption; + +/* + * @brief 该类用于拦截指定scheme的请求。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_SchemeHandler_ ArkWeb_SchemeHandler; + +/* + * @brief 用于被拦截的URL请求。可以通过ArkWeb_ResourceHandler发送自定义请求头以及自定义请求体。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_ResourceHandler_ ArkWeb_ResourceHandler; + +/* + * @brief 为被拦截的请求构造一个ArkWeb_Response。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_Response_ ArkWeb_Response; + +/* + * @brief 对应内核的一个请求,可以通过 OH_ArkWeb_ResourceRequest 获取请求的URL、method、post data以及其他信息。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_ResourceRequest_ ArkWeb_ResourceRequest; + +/* + * @brief 请求头列表。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_RequestHeaderList_ ArkWeb_RequestHeaderList; + +/* + * @brief 请求的响应体。使用 OH_ArkWebHttpBodyStream_* 接口来读取响应体。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_HttpBodyStream_ ArkWeb_HttpBodyStream; + + +/* + * @brief 请求开始的回调,这将在IO线程上被调用。在函数中不应使用resourceHandler。 + * + * @param schemeHandler ArkWeb_SchemeHandler。 + * @param resourceRequest 通过该对象获取请求的信息。 + * @param resourceHandler 请求的ArkWeb_ResourceHandler。如果intercept设置为false,则不应使用它。 + * @param intercept 如果为true,则会拦截请求;如果为false,则不会拦截。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef void (*ArkWeb_OnRequestStart)(const ArkWeb_SchemeHandler* schemeHandler, + ArkWeb_ResourceRequest* resourceRequest, + const ArkWeb_ResourceHandler* resourceHandler, + bool* intercept); + +/* + * @brief 请求完成时的回调函数。这将在IO线程上被调用。 + * 应该使用ArkWeb_ResourceRequest_Destroy销毁resourceRequest, + * 并使用ArkWeb_ResourceHandler_Destroy销毁在ArkWeb_OnRequestStart中接收到的ArkWeb_ResourceHandler。 + * @param schemeHandler ArkWeb_SchemeHandler。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef void (*ArkWeb_OnRequestStop)(const ArkWeb_SchemeHandler* schemeHandler, + const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief 当OH_ArkWebHttpBodyStream_Read读取操作完成时的回调函数。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @param buffer 接收数据的buffer。 + * @param bytesRead OH_ArkWebHttpBodyStream_Read后的回调函数。如果bytesRead大于0,则表示buffer已填充了bytesRead大小的数据。 + * 调用者可以从buffer中读取数据,如果OH_ArkWebHttpBodyStream_IsEOF为false,则调用者可以继续读取剩余的数据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef void (*ArkWeb_HttpBodyStreamReadCallback)(const ArkWeb_HttpBodyStream* httpBodyStream, + uint8_t* buffer, + int bytesRead); + +/* + * @brief ArkWeb_HttpBodyStream初始化操作完成时回调函数。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @param result 成功时返回ARKWEB_NET_OK,否则请参考ARKWEB_NET_ERROR。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef void (*ArkWeb_HttpBodyStreamInitCallback)(const ArkWeb_HttpBodyStream* httpBodyStream, ArkWeb_NetError result); + +/* + * @brief 销毁ArkWeb_RequestHeaderList对象。。 + * @param requestHeaderList 将被销毁的ArkWeb_RequestHeaderList。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebRequestHeaderList_Destroy(ArkWeb_RequestHeaderList* requestHeaderList); + +/* + * @brief 获取请求头列表的大小。 + * @param requestHeaderList 请求头的列表。 + * @return 请求头的大小。如果requestHeaderList无效,则为-1。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebRequestHeaderList_GetSize(const ArkWeb_RequestHeaderList* requestHeaderList); + +/* + * @brief 获取指定的请求头。 + * @param requestHeaderList 请求头列表。 + * @param index 请求头的索引。 + * @param key 请求头的键(key)。调用者必须使用 OH_ArkWeb_ReleaseString 函数来释放这个字符串。 + * @param value 请求头的值(value)。调用者必须使用 OH_ArkWeb_ReleaseString 函数来释放这个字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebRequestHeaderList_GetHeader(const ArkWeb_RequestHeaderList* requestHeaderList, + int32_t index, + char** key, + char** value); + +/* + * @brief 将一个用户数据设置到ArkWeb_ResourceRequest对象中。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @param userData 将要设置的用户数据。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceRequest_SetUserData(ArkWeb_ResourceRequest* resourceRequest, void* userData); + +/* + * @brief 从ArkWeb_ResourceRequest获取用户数据。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @return 设置的用户数据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void* OH_ArkWebResourceRequest_GetUserData(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief 获取请求的method。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @param method HTTP请求方法。此函数将为method字符串分配内存,调用者必须使用OH_ArkWeb_ReleaseString释放字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetMethod(const ArkWeb_ResourceRequest* resourceRequest, char** method); + +/* + * @brief 获取请求的url。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @param url 请求的URL。此函数将为URL字符串分配内存,调用者必须通过OH_ArkWeb_ReleaseString释放该字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetUrl(const ArkWeb_ResourceRequest* resourceRequest, char** url); + +/* + * @brief 创建一个ArkWeb_HttpBodyStream,用于读取响应体。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @param httpBodyStream 请求的POST数据。此函数将为httpBodyStream分配内存, + * 调用者必须使用 OH_ArkWebResourceRequest_DestroyHttpBodyStream 释放httpBodyStream。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetHttpBodyStream(const ArkWeb_ResourceRequest* resourceRequest, + ArkWeb_HttpBodyStream** httpBodyStream); + +/* + * @brief 销毁ArkWeb_HttpBodyStream对象。 + * @param httpBodyStream 待销毁的httpBodyStream。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_DestroyHttpBodyStream(ArkWeb_HttpBodyStream* httpBodyStream); + +/* + * @brief 将一个用户数据设置到ArkWeb_HttpBodyStream对象中。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @param userData 要设置的用户数据。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebHttpBodyStream_SetUserData(ArkWeb_HttpBodyStream* httpBodyStream, void* userData); + +/* + * @brief 从ArkWeb_HttpBodyStream获取用户数据。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @return 设置的用户数据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void* OH_ArkWebHttpBodyStream_GetUserData(const ArkWeb_HttpBodyStream* httpBodyStream); + +/* + * @brief 为 OH_ArkWebHttpBodyStream_Read 设置回调函数,OH_ArkWebHttpBodyStream_Read 的结果将通过 readCallback 通知给调用者。 + * 该回调函数将在与 OH_ArkWebHttpBodyStream_Read 相同的线程中运行。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @param readCallback OH_ArkWebHttpBodyStream_Read的回调函数。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebHttpBodyStream_SetReadCallback(ArkWeb_HttpBodyStream* httpBodyStream, + ArkWeb_HttpBodyStreamReadCallback readCallback); + +/* + * @brief 初始化ArkWeb_HttpBodyStream。在调用任何其他函数之前,必须调用此函数。该接口需要在IO线程调用。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @param initCallback 初始化的回调函数。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebHttpBodyStream_Init(ArkWeb_HttpBodyStream* httpBodyStream, + ArkWeb_HttpBodyStreamInitCallback initCallback); + +/* + * @brief 将响应体读取到buffer。buffer的大小必须大于bufLen。我们将从工作线程读取数据到buffer, + * 因此在回调函数返回之前,不应在其他线程中使用buffer,以避免并发问题。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @param buffer 接收数据的buffer。 + * @param bufLen 要读取的字节的大小。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebHttpBodyStream_Read(const ArkWeb_HttpBodyStream* httpBodyStream, uint8_t* buffer, int bufLen); + +/* + * @brief 获取httpBodyStream的大小。 + * 当数据以分块的形式传输或httpBodyStream无效时,始终返回0。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @return httpBodyStream的大小。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +uint64_t OH_ArkWebHttpBodyStream_GetSize(const ArkWeb_HttpBodyStream* httpBodyStream); + +/* + * @brief 获取httpBodyStream当前的读取位置。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @return httpBodyStream当前的读取位置。如果httpBodyStream无效,则位置为0。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +uint64_t OH_ArkWebHttpBodyStream_GetPosition(const ArkWeb_HttpBodyStream* httpBodyStream); + +/* + * @brief 获取httpBodyStream是否采用分块传输。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @return 如果采用分块传输则返回true;否则返回false。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebHttpBodyStream_IsChunked(const ArkWeb_HttpBodyStream* httpBodyStream); + + +/* + * @brief 如果httpBodyStream中的所有数据都已被读取,则返回true。 + * 对于分块传输类型的httpBodyStream,在第一次读取尝试之前返回false。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @return 如果所有数据都已被读取则返回true;否则返回false。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebHttpBodyStream_IsEof(const ArkWeb_HttpBodyStream* httpBodyStream); + +/* + * @brief 如果httpBodyStream中的上传数据完全在内存中,并且所有读取请求都将同步成功,则返回true。 + * 对于分块传输类型的数据,预期返回false。 + * @param httpBodyStream ArkWeb_HttpBodyStream。 + * @return 如果上传数据完全在内存中则返回true;否则返回false。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebHttpBodyStream_IsInMemory(const ArkWeb_HttpBodyStream* httpBodyStream); + +/* + * @brief 销毁ArkWeb_ResourceRequest对象。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceRequest_Destroy(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief 获取请求的Referrer。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @param referrer 请求的Referrer。此函数将为referrer字符串分配内存,调用者必须使用 OH_ArkWeb_ReleaseString 释放该字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetReferrer(const ArkWeb_ResourceRequest* resourceRequest, char** referrer); + +/* + * @brief 获取请求的请求头列表 OH_ArkWeb_RequestHeaderList。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @param requestHeaderList 请求的请求头列表。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetRequestHeaders(const ArkWeb_ResourceRequest* resourceRequest, + ArkWeb_RequestHeaderList** requestHeaderList); + +/* + * @brief 判断这是否是一个重定向请求。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @return 如果这是一个重定向,则返回true;否则返回false。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebResourceRequest_IsRedirect(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief 判断这是否是主框架文档资源的请求。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @return 如果这是来自主框架,则返回true;否则返回false。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebResourceRequest_IsMainFrame(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief 判断这是否是一个由用户手势触发的请求。 + * @param resourceRequest ArkWeb_ResourceRequest。 + * @return 如果这是由用户手势触发的,则返回true;否则返回false。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebResourceRequest_HasGesture(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief 将custom scheme注册到ArkWeb。对于内置的HTTP、HTTPS、FILE、FTP、ABOUT和DATA协议,不应调用此函数。 + * 此函数应在主线程上调用并且需要在内核初始化之前调用。 + * @param scheme 待注册的scheme。 + * @param option scheme的配置(行为)。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWeb_RegisterCustomSchemes(const char* scheme, int32_t option); + +/* + * @brief 为指定scheme设置一个 ArkWeb_SchemeHandler 以拦截ServiceWorker触发的该scheme类型的请求。 + * 应该在创建BrowserContext之后设置SchemeHandler。 + * 可以使用 WebviewController.initializeWebEngine 来初始化BrowserContext而无需创建 ArkWeb。 + * + * @param scheme 需要被拦截的scheme。 + * @param schemeHandler 该scheme的拦截器ArkWeb_SchemeHandler。只有通过 ServiceWorker 触发的请求才会通过这个schemeHandler进行通知。 + * @return 如果为指定scheme设置SchemeHandler成功,则返回true,否则返回false。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebServiceWorker_SetSchemeHandler(const char* scheme, ArkWeb_SchemeHandler* schemeHandler); + +/* + * @brief 为指定scheme设置一个 ArkWeb_SchemeHandler 以拦截该scheme类型的请求。 + * 应该在创建BrowserContext之后设置SchemeHandler。 + * 可以使用 WebviewController.initializeWebEngine 来初始化BrowserContext而无需创建 ArkWeb。 + * + * @param scheme 需要被拦截的scheme。 + * @param webTag Web组件的标签名称,用于标识某个唯一组件,由开发者来保证名称唯一性。 + * @param schemeHandler 该scheme的拦截器ArkWeb_SchemeHandler。只有从指定web触发的请求才会通过这个schemeHandler进行通知。 + * @return 如果为指定scheme设置SchemeHandler成功,则返回true,否则返回false。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWeb_SetSchemeHandler(const char* scheme, const char* webTag, ArkWeb_SchemeHandler* schemeHandler); + +/* + * @brief 清除为ServiceWorker注册的SchemeHandler。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebServiceWorker_ClearSchemeHandlers(); + +/* + * @brief 清除为指定web注册的SchemeHandler。 + * @param webTag Web组件的标签名称,用于标识某个唯一组件,由开发者来保证名称唯一性。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWeb_ClearSchemeHandlers(const char* webTag); + +/* + * @brief 创建一个ArkWeb_SchemeHandler。 + * @param schemeHandler 返回创建的ArkWeb_SchemeHandler。在不需要时使用OH_ArkWeb_DestoryschemeHandler销毁它。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_CreateSchemeHandler(ArkWeb_SchemeHandler** schemeHandler); + +/* + * @brief 销毁一个ArkWeb_SchemeHandler对象。 + * @param schemeHandler 待销毁的ArkWeb_SchemeHandler。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_DestroySchemeHandler(ArkWeb_SchemeHandler* schemeHandler); + +/* + * @brief 将一个用户数据设置到ArkWeb_SchemeHandler对象中。 + * @param schemeHandler ArkWeb_SchemeHandler。 + * @param userData 要设置的用户数据。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebSchemeHandler_SetUserData(ArkWeb_SchemeHandler* schemeHandler, void* userData); + +/* + * @brief 从ArkWeb_SchemeHandler获取用户数据。 + * @param schemeHandler ArkWeb_SchemeHandler。 + * @return 设置的用户数据。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void* OH_ArkWebSchemeHandler_GetUserData(const ArkWeb_SchemeHandler* schemeHandler); + +/* + * @brief 为SchemeHandler设置OnRequestStart回调。 + * @param schemeHandler 该scheme的SchemeHandler。 + * @param onRequestStart OnRequestStart回调函数。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebSchemeHandler_SetOnRequestStart(ArkWeb_SchemeHandler* schemeHandler, + ArkWeb_OnRequestStart onRequestStart); + +/* + * @brief 为SchemeHandler设置OnRequestStop回调。 + * @param schemeHandler 该scheme的SchemeHandler。 + * @param onRequestStop OnRequestStop回调函数。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebSchemeHandler_SetOnRequestStop(ArkWeb_SchemeHandler* schemeHandler, + ArkWeb_OnRequestStop onRequestStop); + +/* + * @brief 为被拦截的请求创建一个ArkWeb_Response对象。 + * @param response 返回创建的ArkWeb_Response。在不需要时使用OH_ArkWeb_DestoryResponse进行销毁。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_CreateResponse(ArkWeb_Response** response); + +/* + * @brief 销毁一个ArkWeb_Response对象。 + * @param response 待销毁的ArkWeb_Response。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_DestroyResponse(ArkWeb_Response* response); + +/* + * @brief 设置经过重定向或由于HSTS而改变后的解析URL,设置后会触发跳转。 + * @param response ArkWeb_Response。 + * @param url 解析后的URL。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetUrl(ArkWeb_Response* response, const char* url); + +/* + * @brief 获取经过重定向或由于HSTS而更改后的解析URL。 + * @param response ArkWeb_Response。 + * @param url 解析后的URL。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetUrl(const ArkWeb_Response* response, char** url); + +/* + * @brief 给ArkWeb_Response对象设置一个错误码。 + * @param response ArkWeb_Response。 + * @param errorCode 失败请求的错误码。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetError(ArkWeb_Response* response, ArkWeb_NetError errorCode); + +/* + * @brief 获取ArkWeb_Response的错误码。 + * @param response ArkWeb_Response。 + * @return ArkWeb_Response的错误码。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +ArkWeb_NetError OH_ArkWebResponse_GetError(const ArkWeb_Response* response); + +/* + * @brief 为ArkWeb_Response对象设置一个HTTP状态码。 + * @param response ArkWeb_Response。 + * @param status 请求的HTTP状态码。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetStatus(ArkWeb_Response* response, int status); + +/* + * @brief 获取ArkWeb_Response的HTTP状态码。 + * @param response ArkWeb_Response。 + * @return ArkWeb_Response的HTTP状态码。如果ArkWeb_Response无效,则为-1。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int OH_ArkWebResponse_GetStatus(const ArkWeb_Response* response); + +/* + * @brief 为ArkWeb_Response设置状态文本。 + * @param response ArkWeb_Response。 + * @param statusText 请求的状态文本。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetStatusText(ArkWeb_Response* response, const char* statusText); + +/* + * @brief 获取ArkWeb_Response的状态文本。 + * @param response ArkWeb_Response。 + * @param statusText 返回ArkWeb_Response的状态文本。此函数将为statusText字符串分配内存,调用方必须通过OH_ArkWeb_ReleaseString释放该字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetStatusText(const ArkWeb_Response* response, char** statusText); + +/* + * @brief 为ArkWeb_Response设置媒体类型。 + * @param response ArkWeb_Response。 + * @param mimeType 请求的媒体类型。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetMimeType(ArkWeb_Response* response, const char* mimeType); + +/* + * @brief 获取ArkWeb_Response的媒体类型。 + * @param response ArkWeb_Response。 + * @param mimeType 返回ArkWeb_Response的媒体类型。此函数将为mimeType字符串分配内存,调用方必须通过OH_ArkWeb_ReleaseString释放该字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetMimeType(const ArkWeb_Response* response, char** mimeType); + +/* + * @brief 为ArkWeb_Response设置字符集。 + * @param response ArkWeb_Response。 + * @param charset 请求的字符集。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetCharset(ArkWeb_Response* response, const char* charset); + +/* + * @brief 获取ArkWeb_Response的字符集。 + * @param response ArkWeb_Response。 + * @param charset 返回ArkWeb_Response的字符集。此函数将为charset字符串分配内存,调用方必须通过OH_ArkWeb_ReleaseString释放字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetCharset(const ArkWeb_Response* response, char** charset); + +/* + * @brief 为ArkWeb_Response设置一个header。 + * @param response ArkWeb_Response。 + * @param name header的名称。 + * @param value header的值。 + * @bool overwirte 如果为true,将覆盖现有的header,否则不覆盖。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetHeaderByName(ArkWeb_Response* response, + const char* name, + const char* value, + bool overwrite); + +/* + * @brief 从ArkWeb_Response中获取header。 + * @param response ArkWeb_Response。 + * @param name header的名称。 + * @param value 返回header的值。此函数将为value字符串分配内存,调用方必须通过OH_ArkWeb_ReleaseString释放该字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetHeaderByName(const ArkWeb_Response* response, const char* name, char** value); + +/* + * @brief 销毁一个ArkWeb_ResourceHandler对象。 + * @param resourceHandler ArkWeb_ResourceHandler。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_Destroy(const ArkWeb_ResourceHandler* resourceHandler); + +/* + * @brief 将构造的响应头传递给被拦截的请求。 + * @param resourceHandler 该请求的ArkWeb_ResourceHandler。 + * @param response 该拦截请求的ArkWeb_Response。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_DidReceiveResponse(const ArkWeb_ResourceHandler* resourceHandler, + const ArkWeb_Response* response); + +/* + * @brief 将构造的响应体传递给被拦截的请求。 + * @param resourceHandler 该请求的ArkWeb_ResourceHandler。 + * @param buffer 要发送的buffer数据。 + * @param bufLen buffer的大小。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_DidReceiveData(const ArkWeb_ResourceHandler* resourceHandler, + const uint8_t* buffer, + int64_t bufLen); + +/* + * @brief 通知ArkWeb内核被拦截的请求已经完成,并且没有更多的数据可用。 + * @param resourceHandler 该请求的ArkWeb_ResourceHandler。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_DidFinish(const ArkWeb_ResourceHandler* resourceHandler); + +/* + * @brief 通知ArkWeb内核被拦截请求应该失败。 + * @param resourceHandler 该请求的ArkWeb_ResourceHandler。 + * @param errorCode 该请求的错误码。 请参考arkweb_net_error_list.h。 + * @return 如果成功,返回0;失败返回其它错误码。请参考arkweb_error_code.h。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_DidFailWithError(const ArkWeb_ResourceHandler* resourceHandler, + ArkWeb_NetError errorCode); + +/* + * @brief 释放由NDK接口创建的字符串 + * @param string 待释放的字符串。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_ReleaseString(char* string); + +/* + * @brief 释放由NDK接口创建的字节数组。 + * @param byteArray 待释放的字节数组。 + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_ReleaseByteArray(uint8_t* byteArray); + + +#ifdef __cplusplus +}; +#endif +#endif // ARKWEB_SCHEME_HANDLER_H -- Gitee From 85845518cb62c6d1ee8453e848850c53090c184a Mon Sep 17 00:00:00 2001 From: changleipeng Date: Fri, 8 Mar 2024 03:43:59 +0000 Subject: [PATCH 0381/2135] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h index eb4c740b..dfb860d8 100644 --- a/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h +++ b/zh-cn/native_sdk/graphic/native_drawing/drawing_text_typography.h @@ -288,6 +288,23 @@ typedef enum OH_Drawing_RectWidthStyle { RECT_WIDTH_STYLE_MAX, } OH_Drawing_RectWidthStyle; +/** + * @brief 获取系统字体配置信息列表结果枚举。 + * + * @since 12 + * @version 1.0 + */ +enum OH_Drawing_FontConfigJsonInfoCode { + /** 获取系统字体文件路径列表失败 */ + FONT_DIR_SET_ERROR = 0, + /** 获取系统字体文件路径列表成功 */ + FONT_DIR_SET_SUC = 1, + /** 获取系统字体文件路径列表成功以及通用字体集列表成功 */ + FONT_DIR_GENERIC_SET_SUC = 2, + /** 获取系统字体配置信息列表成功 */ + FONT_CONFIG_JSON_INFO_SUC = 3, +}; + /** * @brief 描述系统字体详细信息的结构体。 * @@ -348,6 +365,100 @@ typedef struct OH_Drawing_LineMetrics { OH_Drawing_Font_Metrics firstCharMetrics; } OH_Drawing_LineMetrics; +/** + * @brief 备用字体信息。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FallbackInfo { + /** 字体集所支持的语言类型,语言格式为bcp47 */ + char* language; + /** 字体家族名 */ + char* familyName; +} OH_Drawing_FallbackInfo; + +/** + * @brief 备用字体集信息。 + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** 备用字体集所对应的字体集名称,如果值为空,表示可以使用备用字体集列表集所有的字体 */ + char* groupName; + /** 备用字体集数量 */ + size_t fallbackInfoSize; + /** 备用字体字体集列表*/ + OH_Drawing_FallbackInfo** fallbackInfo; +} OH_Drawing_FallbackGroup; + +/** + * @brief 字重映射信息。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_AdjustInfo { + /** 字体原本的字重值 */ + int weight; + /** 字体在应用中显示的字重值 */ + int to; +} OH_Drawing_AdjustInfo; + +/** + * @brief 别名字体信息。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_AliasInfo { + /** 字体家族名 */ + char* familyName; + /** 字体字重值,当字重值大于0时,表示此字体集只包含所指定weight的字体,当字重值等于0时,表示此字体集包含所有字体 */ + int weight; +} OH_Drawing_AliasInfo; + +/** + * @brief 系统所支持的通用字体集信息。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontGenericInfo { + /** 字体家族名 */ + char* familyName; + /** 别名字体列表的数量 */ + size_t aliasInfoSize; + /** 字重映射列表的数量 */ + size_t adjustInfoSize; + /** 别名字体列表 */ + OH_Drawing_AliasInfo** aliasInfoSet; + /** 字重映射列表 */ + OH_Drawing_AdjustInfo** adjustInfoSet; +} OH_Drawing_FontGenericInfo; + +/** + * @brief 系统字体配置信息。 + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontConfigJsonInfo { + /** 系统字体文件路径数量 */ + size_t fontDirSize; + /** 通用字体集列表数量 */ + size_t fontGenericInfoSize; + /** 备用字体集列表数量 */ + size_t fallbackGroupSize; + /** 系统字体文件路径列表 */ + char** fontDirSet; + /** 通用字体集列表 */ + OH_Drawing_FontGenericInfo** fontGenericInfoSet; + /** 备用字体集列表 */ + OH_Drawing_FallbackGroup** fallbackGroupSet; +} OH_Drawing_FontConfigJsonInfo; + /** * @brief 创建指向OH_Drawing_TypographyStyle对象的指针。 * @@ -1687,6 +1798,28 @@ OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, */ void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); +/** + * @brief 获取系统字体配置信息。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontConfigJsonInfoCode 错误码,根据错误码释放系统字体配置信息的内存,具体可见{@link OH_Drawing_FontConfigJsonInfoCode}枚举。 + * @return 返回系统字体配置信息的指针。 + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontConfigJsonInfo* OH_Drawing_CreateFontConfigJsonInfo(OH_Drawing_FontConfigJsonInfoCode*); + +/** + * @brief 释放系统字体配置信息占用的的内存。 + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontConfigJsonInfo 指向系统字体配置信息{@link OH_Drawing_CreateFontConfigJsonInfo}的指针, + * 由{@link OH_Drawing_CreateFontConfigJsonInfo}获取。 + * @param OH_Drawing_FontConfigJsonInfoCode 错误码,根据错误码释放系统字体配置信息的内存,具体可见{@link OH_Drawing_FontConfigJsonInfoCode}枚举。 + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFontConfigJsonInfo(OH_Drawing_FontConfigJsonInfo**, OH_Drawing_FontConfigJsonInfoCode*); #ifdef __cplusplus } #endif -- Gitee From 6290b8d5ff7af9e3fa06ff4ac395988918642272 Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 14 Mar 2024 17:53:56 +0800 Subject: [PATCH 0382/2135] =?UTF-8?q?=E5=A2=9E=E5=8A=A0av=20screen=20captu?= =?UTF-8?q?re=E7=9A=84=E4=B8=AD=E6=96=87=E6=8E=A5=E5=8F=A3=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liyang --- .../native_avscreen_capture.h | 292 ++++++++++ .../native_avscreen_capture_base.h | 521 ++++++++++++++++++ .../native_avscreen_capture_errors.h | 85 +++ 3 files changed, 898 insertions(+) create mode 100644 zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h create mode 100644 zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h create mode 100644 zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h new file mode 100644 index 00000000..665d0b73 --- /dev/null +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h @@ -0,0 +1,292 @@ +/* + * 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 NATIVE_AVSCREEN_CAPTURE_H +#define NATIVE_AVSCREEN_CAPTURE_H + +#include +#include +#include "native_avscreen_capture_errors.h" +#include "native_avscreen_capture_base.h" +#include "external_window.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 创建OH_AVScreenCapture。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @return 返回一个capture 指向OH_AVScreenCapture实例的指针。 + * @since 10 + * @version 1.0 + */ +struct OH_AVScreenCapture *OH_AVScreenCapture_Create(void); + +/** + * @brief 初始化OH_AVScreenCapture相关参数,包括下发的音频麦克风采样信息参数,音频内录相关参数(可选),视频分辨率相关参数。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param config 录屏初始化相关参数。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Init(struct OH_AVScreenCapture *capture, + OH_AVScreenCaptureConfig config); + +/** + * @brief 启动录屏,调用此接口,可采集编码后的码流。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCapture(struct OH_AVScreenCapture *capture); + +/** + * @brief 使用Surface模式录屏。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param window 指向OHNativeWindow实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 12 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCaptureWithSurface(struct OH_AVScreenCapture *capture, + OHNativeWindow* window); + +/** + * @brief 结束录屏,与OH_AVScreenCapture_StartScreenCapture配合使用。调用后针对调用该接口的应用会停止录屏或屏幕共享,释放麦克风。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenCapture(struct OH_AVScreenCapture *capture); + +/** + * @brief 启动录屏,调用此接口,可采集编码后的码流。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenRecording(struct OH_AVScreenCapture *capture); + +/** + * @brief 停止录屏,与OH_AVScreenCapture_StartScreenRecording配合使用。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenRecording(struct OH_AVScreenCapture *capture); + +/** + * @brief 获取音频buffer,应用在调用时,需要对audiobuffer分配对应结构体大小的内存,否则会影响音频buffer的获取。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param audiobuffer 保存音频buffer的结构体,通过该结构体获取到音频buffer以及buffer的时间戳等信息。 + * @param type 音频buffer的类型,区分是麦克风录制的外部流还是系统内部播放音频的内录流,详情请参阅OH_AudioCaptureSourceType + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnBufferAvailable} + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_AcquireAudioBuffer(struct OH_AVScreenCapture *capture, + OH_AudioBuffer **audiobuffer, OH_AudioCaptureSourceType type); + +/** + * @brief 获取视频buffer,应用在调用时,通过此接口来获取到视频的buffer以及时间戳等信息。 buffer使用完成后,调用OH_AVScreenCapture_ReleaseVideoBuffer接口进行视频buffer的释放。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param fence 用于同步的显示相关参数信息。 + * @param timestamp 视频帧的时间戳。 + * @param region 视频显示相关的坐标信息。 + * @return 执行成功返回OH_NativeBuffer对象,通过OH_NativeBuffer对象相关接口可以获取到视频buffer和分辨率等信息参数。 + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnBufferAvailable} + * @since 10 + * @version 1.0 + */ +OH_NativeBuffer* OH_AVScreenCapture_AcquireVideoBuffer(struct OH_AVScreenCapture *capture, + int32_t *fence, int64_t *timestamp, struct OH_Rect *region); + +/** + * @brief 根据音频类型释放buffer。当某一帧音频buffer使用完成后,调用此接口进行释放对应的音频buffer。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param type 音频buffer的类型,区分麦克风录制的外部流还是系统内部播放音频的内录流。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnBufferAvailable} + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseAudioBuffer(struct OH_AVScreenCapture *capture, + OH_AudioCaptureSourceType type); + +/** + * @brief 根据视频类型释放buffer。当某一帧视频buffer使用完成后,调用此接口进行释放对应的视频buffer。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnBufferAvailable} + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseVideoBuffer(struct OH_AVScreenCapture *capture); + +/** + * @brief 设置监听接口,通过设置监听,可以监听到调用过程中的错误信息,以及是否有可用的视频buffer和音频buffer。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param callback OH_AVScreenCaptureCallback的结构体,保存相关回调函数指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_SetErrorCallback} {@link OH_AVScreenCapture_SetBufferCallback} + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCallback(struct OH_AVScreenCapture *capture, + struct OH_AVScreenCaptureCallback callback); + +/** + * @brief 释放创建的OH_AVScreenCapture实例,对应OH_AVScreenCapture_Create。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Release(struct OH_AVScreenCapture *capture); + +/** + * @brief 设置麦克风开关。当isMicrophone为true时,则打开麦克风,通过调用OH_AVScreenCapture_StartScreenCapture和OH_AVScreenCapture_AcquireAudioBuffer可以正常获取到音频的麦克风原始PCM数据;isMicrophone为false时,获取到的音频数据为无声数据。 默认麦克风开关为开启。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param isMicrophone 麦克风开关参数。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 10 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMicrophoneEnabled(struct OH_AVScreenCapture *capture, + bool isMicrophone); +/** + * @brief 设置状态回调,在开始录制前调用。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param callback OH_AVScreenCapture_OnStateChange实例。 + * @param userData 指向userData实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 12 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetStateCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnStateChange callback, void *userData); + +/** + * @brief 设置数据回调,在开始录制前调用。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param callback OH_AVScreenCapture_OnBufferAvailable实例。 + * @param userData 指向userData实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 12 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDataCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnBufferAvailable callback, void *userData); + +/** + * @brief 设置错误回调,在开始录制前调用。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param callback OH_AVScreenCapture_OnError实例。 + * @param userData 指向userData实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 12 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetErrorCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnError callback, void *userData); + +/** + * @brief 设置屏幕旋转配置开关。当canvasRotation为true时,则打开屏幕旋转配置,通过调用OH_AVScreenCapture_StartScreenCapture后可以设置屏幕的旋转配置,canvasRotation为true时,旋转配置生效,在横屏分辨率投屏录屏,屏幕竖起时录制画面为正向等比缩放的屏幕,两侧区域填充黑边。 默认屏幕旋转配置开关为关闭。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param canvasRotation 屏幕旋转配置参数。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 12 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetScreenCanvasRotation(struct OH_AVScreenCapture *capture, + bool canvasRotation); + +/** + * @brief 创建ContentFilter。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @return 执行成功返回OH_AVScreenCapture_ContentFilter实例,否则返回空指针。 + * @since 12 + * @version 1.0 + */ +struct OH_AVScreenCapture_ContentFilter *OH_AVScreenCapture_CreateContentFilter(void); + +/** + * @brief 释放ContentFilter。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param filter 指向OH_AVScreenCapture_ContentFilter实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK,否则返回具体错误码,请参阅OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 12 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseContentFilter(struct OH_AVScreenCapture_ContentFilter *filter); + +/** + * @brief 增加过滤声音至ContentFilter。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param filter 指向OH_AVScreenCapture_ContentFilter实例的指针。 + * @param content OH_AVScreenCaptureFilterableAudioContent实例。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK,否则返回具体错误码,请参阅OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 12 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddAudioContent( + struct OH_AVScreenCapture_ContentFilter *filter, OH_AVScreenCaptureFilterableAudioContent content); + +/** + * @brief ContentFilter排除过滤声音。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param filter 指向OH_AVScreenCapture_ContentFilter实例的指针。 + * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK,否则返回具体错误码,请参阅OH_AVSCREEN_CAPTURE_ErrCode。 + * @since 12 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ExcludeContent(struct OH_AVScreenCapture *capture, + struct OH_AVScreenCapture_ContentFilter *filter); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AVSCREEN_CAPTURE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h new file mode 100644 index 00000000..0bb084df --- /dev/null +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h @@ -0,0 +1,521 @@ +/* + * 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 NATIVE_AVSCREEN_CAPTURE_BASE_H +#define NATIVE_AVSCREEN_CAPTURE_BASE_H + +#include +#include "native_avbuffer.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 提供录屏的视频原始码流类。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_NativeBuffer OH_NativeBuffer; + +/** + * @brief 通过OH_AVScreenCapture可以获取视频与音频的原始码流。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_AVScreenCapture OH_AVScreenCapture; + +/** + * @brief 通过OH_AVScreenCapture_ContentFilter过滤音视频内容。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_AVScreenCapture_ContentFilter OH_AVScreenCapture_ContentFilter; + +/** + * @brief 枚举,表示屏幕录制的不同模式。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef enum OH_CaptureMode { + /** 录制主屏幕。 **/ + OH_CAPTURE_HOME_SCREEN = 0, + /** 录制指定屏幕。 **/ + OH_CAPTURE_SPECIFIED_SCREEN = 1, + /** 录制指定窗口。 **/ + OH_CAPTURE_SPECIFIED_WINDOW = 2, + /** 无效模式。 **/ + OH_CAPTURE_INVAILD = -1 +} OH_CaptureMode; + +/** + * @brief 枚举,表示屏幕录制时的音频源类型。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef enum OH_AudioCaptureSourceType { + /** 无效音频源。 **/ + OH_SOURCE_INVALID = -1, + /** 默认音频源,默认为MIC。 **/ + OH_SOURCE_DEFAULT = 0, + /** 麦克风录制的外部音频流。 **/ + OH_MIC = 1, + /** 系统播放的所有内部音频流。 **/ + OH_ALL_PLAYBACK = 2, + /** 指定应用播放的内部音频流。 **/ + OH_APP_PLAYBACK = 3, +} OH_AudioCaptureSourceType; + +/** + * @brief 枚举,表示音频编码格式。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef enum OH_AudioCodecFormat { + /** 默认音频编码,默认为AAC_LC。 **/ + OH_AUDIO_DEFAULT = 0, + /** AAC_LC音频编码。 **/ + OH_AAC_LC = 3, + /** 无效格式。 **/ + OH_AUDIO_CODEC_FORMAT_BUTT, +} OH_AudioCodecFormat; + +/** + * @brief 枚举,表示视频编码格式。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef enum OH_VideoCodecFormat { + /** 默认视频编码,默认为H.264。 **/ + OH_VIDEO_DEFAULT = 0, + /** H.264 **/ + OH_H264 = 2, + /** H.265/HEVC **/ + OH_H265 = 4, + /** MPEG4 **/ + OH_MPEG4 = 6, + /** VP8 **/ + OH_VP8 = 8, + /** VP9 **/ + OH_VP9 = 10, + /** 无效格式。 **/ + OH_VIDEO_CODEC_FORMAT_BUTT, +} OH_VideoCodecFormat; + +/** + * @brief 枚举,表示屏幕录制流的数据格式。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef enum OH_DataType { + /** 原始流格式,如YUV/RGBA/PCM等。 **/ + OH_ORIGINAL_STREAM = 0, + /** 编码格式,如H264/AAC等。 **/ + OH_ENCODED_STREAM = 1, + /** 保存文件格式,支持mp4。 **/ + OH_CAPTURE_FILE = 2, + /** 无效格式。 **/ + OH_INVAILD = -1 +} OH_DataType; + +/** + * @brief 枚举,表示视频源格式。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef enum OH_VideoSourceType { + /** YUV格式。 **/ + OH_VIDEO_SOURCE_SURFACE_YUV = 0, + /** raw格式。 **/ + OH_VIDEO_SOURCE_SURFACE_ES, + /** RGBA格式。 **/ + OH_VIDEO_SOURCE_SURFACE_RGBA, + /** 无效格式。 **/ + OH_VIDEO_SOURCE_BUTT +} OH_VideoSourceType; + +/** + * @brief 枚举,表示屏幕录制生成的文件类型。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef enum OH_ContainerFormatType { + /** 音频格式 m4a。 **/ + CFT_MPEG_4A = 0, + /** 视频格式 mp4。 **/ + CFT_MPEG_4 = 1 +} OH_ContainerFormatType; + +/** + * @brief 音频录制信息。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_AudioCaptureInfo { + /* 音频采样率,支持列表参考OH_AudioCapturer_GetSamplingRate。 */ + int32_t audioSampleRate; + /* 音频声道数。 */ + int32_t audioChannels; + /* 音频源。 */ + OH_AudioCaptureSourceType audioSource; +} OH_AudioCaptureInfo; + +/** + * @brief 音频解码信息 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_AudioEncInfo { + /* 音频解码比特率 */ + int32_t audioBitrate; + /* 解码格式 */ + OH_AudioCodecFormat audioCodecformat; +} OH_AudioEncInfo; + +/** + * @brief 音频信息 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_AudioInfo { + /* 音频麦克风信息 */ + OH_AudioCaptureInfo micCapInfo; + /* 内录信息 */ + OH_AudioCaptureInfo innerCapInfo; + /* 音频解码信息,原始码流时不需要设置 */ + OH_AudioEncInfo audioEncInfo; +} OH_AudioInfo; + +/** + * @brief 视频录制信息 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_VideoCaptureInfo { + /* 显示ID,指定窗口时需设置 */ + uint64_t displayId; + /* missionID,指定窗口时需设置 */ + int32_t *missionIDs; + /* MissionIds长度, ,指定窗口时需设置 */ + int32_t missionIDsLen; + /* 宽度 */ + int32_t videoFrameWidth; + /* 高度 */ + int32_t videoFrameHeight; + /* 视频类型 */ + OH_VideoSourceType videoSource; +} OH_VideoCaptureInfo; + +/** + * @brief 视频解码信息 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_VideoEncInfo { + /* 视频解码格式 */ + OH_VideoCodecFormat videoCodec; + /* 比特率 */ + int32_t videoBitrate; + /* 帧率 */ + int32_t videoFrameRate; +} OH_VideoEncInfo; + +/** + * @brief 视频信息 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_VideoInfo { + /* 视频录制信息 */ + OH_VideoCaptureInfo videoCapInfo; + /* 视频解码信息 */ + OH_VideoEncInfo videoEncInfo; +} OH_VideoInfo; + +/** + * @brief 录制文件信息 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_RecorderInfo { + /* 录制文件url */ + char *url; + /* 录制文件url长度 */ + uint32_t urlLen; + /* 录制文件url格式 */ + OH_ContainerFormatType fileFormat; +} OH_RecorderInfo; + +/** + * @brief 录屏配置信息 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_AVScreenCaptureConfig { + OH_CaptureMode captureMode; + OH_DataType dataType; + OH_AudioInfo audioInfo; + OH_VideoInfo videoInfo; + /* 存文件必须设置录制文件信息 */ + OH_RecorderInfo recorderInfo; +} OH_AVScreenCaptureConfig; + +/** + * @brief 当OH_AVScreenCapture实例运行出错时,将调用函数指针。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param errorCode 指定错误码。 + * + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnError} + * @since 10 + * @version 1.0 + */ +typedef void (*OH_AVScreenCaptureOnError)(OH_AVScreenCapture *capture, int32_t errorCode); + +/** + * @brief 当OH_AVScreenCapture操作期间音频缓冲区可用时,将调用函数指针。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param isReady 音频缓冲区是否可用。 + * @param type 音频源类型。 + * + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnBufferAvailable} + * @since 10 + * @version 1.0 + */ +typedef void (*OH_AVScreenCaptureOnAudioBufferAvailable)(OH_AVScreenCapture *capture, bool isReady, + OH_AudioCaptureSourceType type); + +/** + * @brief 当OH_AVScreenCapture操作期间视频缓冲区可用时,将调用函数指针。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param isReady 视频缓冲区是否可用。 + * + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnBufferAvailable} + * @since 10 + * @version 1.0 + */ +typedef void (*OH_AVScreenCaptureOnVideoBufferAvailable)(OH_AVScreenCapture *capture, bool isReady); + +/** + * @brief OH_AVScreenCapture中所有异步回调函数指针的集合。将该结构体的实例注册到OH_AVScreenCapture实例中, 并处理回调上报的信息,以保证OH_AVScreenCapture的正常运行。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param onError 监控录屏调用操作错误,请参见OH_AVScreenCaptureOnError。 + * @param onAudioBufferAvailable 监控音频码流是否有数据产生,请参见OH_AVScreenCaptureOnAudioBufferAvailable。 + * @param onVideoBufferAvailable 监控视频码流是否有数据产生,请参见OH_AVScreenCaptureOnVideoBufferAvailable。 + * + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnError} {@link OH_AVScreenCapture_OnBufferAvailable} + * @since 10 + * @version 1.0 + */ +typedef struct OH_AVScreenCaptureCallback { + /** + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnError} + */ + OH_AVScreenCaptureOnError onError; + /** + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnBufferAvailable} + */ + OH_AVScreenCaptureOnAudioBufferAvailable onAudioBufferAvailable; + /** + * @deprecated since 12 + * @useinstead {@link OH_AVScreenCapture_OnBufferAvailable} + */ + OH_AVScreenCaptureOnVideoBufferAvailable onVideoBufferAvailable; +} OH_AVScreenCaptureCallback; + +/** + * @brief 定义录屏界面的宽高以及画面信息。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_Rect { + /* 录屏界面的X坐标。 */ + int32_t x; + /* 录屏界面的Y坐标。 */ + int32_t y; + /* 录屏界面的宽度。 */ + int32_t width; + /* 录屏界面的高度。 */ + int32_t height; +} OH_Rect; + + +/** + * @brief 定义了音频数据的大小,类型,时间戳等配置信息。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 10 + * @version 1.0 + */ +typedef struct OH_AudioBuffer { + /* 音频buffer块 */ + uint8_t *buf; + /* 音频buffer块大小 */ + int32_t size; + /* 时间戳 */ + int64_t timestamp; + /* 音频录制类型 */ + OH_AudioCaptureSourceType type; +} OH_AudioBuffer; + +/** + * @brief 枚举,表示状态码。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 12 + * @version 1.0 + */ +typedef enum OH_AVScreenCaptureStateCode { + /** 已开始录屏。 **/ + OH_SCREEN_CAPTURE_STATE_STARTED = 0, + /** 已取消录屏。 **/ + OH_SCREEN_CAPTURE_STATE_CANCELED = 1, + /** 已停止录屏。 **/ + OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER = 2, + /** 录屏被其他录屏中断。 **/ + OH_SCREEN_CAPTURE_STATE_STOPPED_BY_INTERRUPT = 3, + /** 录屏被通话中断。 **/ + OH_SCREEN_CAPTURE_STATE_STOPPED_BY_INCALL = 4, + /** 麦克风不可用。 **/ + OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE = 5, + /** 麦克风被静音。 **/ + OH_SCREEN_CAPTURE_STATE_MIC_MUTED_BY_USER = 6, + /** 麦克风被取消静音。 **/ + OH_SCREEN_CAPTURE_STATE_MIC_UNMUTED_BY_BSER = 7, + /** 进入隐私弹窗。 **/ + OH_SCREEN_CAPTURE_STATE_ENTER_PRIVATE_SCENE = 8, + /** 隐私弹窗退出。 **/ + OH_SCREEN_CAPTURE_STATE_EXIT_PRIVATE_SCENE = 9, +} OH_AVScreenCaptureStateCode; + +/** + * @brief 枚举,表示buffer类型。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 12 + * @version 1.0 + */ +typedef enum OH_AVScreenCaptureBufferType { + /** 视频数据。 **/ + OH_SCREEN_CAPTURE_BUFFERTYPE_VIDEO = 0, + /** 内录。 **/ + OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_INNER = 1, + /** 麦克风录音。 **/ + OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_MIC = 2, +} OH_AVScreenCaptureBufferType; + +/** + * @brief 枚举,表示可过滤的音频类型。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 12 + * @version 1.0 + */ +typedef enum OH_AVScreenCaptureFilterableAudioContent { + /** 通知音。 **/ + OH_SCREEN_CAPTURE_NOTIFICATION_AUDIO = 0, +} OH_AVScreenCaptureFilterableAudioContent; + +/** + * @brief 当OH_AVScreenCapture实例状态改变时,将调用函数指针。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param stateCode 指定状态码。 + * @param userData 指向userData实例的指针。 + * + * @since 12 + * @version 1.0 + */ +typedef void (*OH_AVScreenCapture_OnStateChange)(struct OH_AVScreenCapture *capture, + OH_AVScreenCaptureStateCode stateCode, void *userData); + +/** + * @brief 当OH_AVScreenCapture实例运行出错时,将调用函数指针。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param errorCode 指定错误码。 + * @param userData 指向userData实例的指针。 + * + * @since 12 + * @version 1.0 + */ +typedef void (*OH_AVScreenCapture_OnError)(OH_AVScreenCapture *capture, int32_t errorCode, void *userData); + +/** + * @brief 当OH_AVScreenCapture操作期间缓冲区可用时,将调用函数指针。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture 指向OH_AVScreenCapture实例的指针。 + * @param buffer 指向avBuffer缓冲内容实例的指针。 + * @param bufferType 源类型。 + * @param timestamp 时间戳。 + * @param userData 指向userData实例的指针。 + * + * @since 12 + * @version 1.0 + */ +typedef void (*OH_AVScreenCapture_OnBufferAvailable)(OH_AVScreenCapture *capture, OH_AVBuffer *buffer, + OH_AVScreenCaptureBufferType bufferType, int64_t timestamp, void *userData); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AVSCREEN_CAPTURE_BASE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h new file mode 100644 index 00000000..34fd791c --- /dev/null +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h @@ -0,0 +1,85 @@ +/* + * 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 NATIVE_AVSCREEN_CAPTURE_ERRORS_H +#define NATIVE_AVSCREEN_CAPTURE_ERRORS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 屏幕录制过程中产生的不同结果码。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 10 + * @version 1.0 + */ + +typedef enum OH_AVSCREEN_CAPTURE_ErrCode { + /** + * 接口调用错误返回的基础值。 + */ + AV_SCREEN_CAPTURE_ERR_BASE = 0, + /** + * 操作成功。 + */ + AV_SCREEN_CAPTURE_ERR_OK = AV_SCREEN_CAPTURE_ERR_BASE, + /** + * 内存不足。 + */ + AV_SCREEN_CAPTURE_ERR_NO_MEMORY = AV_SCREEN_CAPTURE_ERR_BASE + 1, + /** + * 不允许操作。 + */ + AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT = AV_SCREEN_CAPTURE_ERR_BASE + 2, + /** + * 无效参数。 + */ + AV_SCREEN_CAPTURE_ERR_INVALID_VAL = AV_SCREEN_CAPTURE_ERR_BASE + 3, + /** + * 输入输出流异常。 + */ + AV_SCREEN_CAPTURE_ERR_IO = AV_SCREEN_CAPTURE_ERR_BASE + 4, + /** + * 网络超时。 + */ + AV_SCREEN_CAPTURE_ERR_TIMEOUT = AV_SCREEN_CAPTURE_ERR_BASE + 5, + /** + * 未知错误。 + */ + AV_SCREEN_CAPTURE_ERR_UNKNOWN = AV_SCREEN_CAPTURE_ERR_BASE + 6, + /** + * 媒体服务已终止。 + */ + AV_SCREEN_CAPTURE_ERR_SERVICE_DIED = AV_SCREEN_CAPTURE_ERR_BASE + 7, + /** + * 当前状态不支持此操作。 + */ + AV_SCREEN_CAPTURE_ERR_INVALID_STATE = AV_SCREEN_CAPTURE_ERR_BASE + 8, + /** + * 不支持的接口。 + */ + AV_SCREEN_CAPTURE_ERR_UNSUPPORT = AV_SCREEN_CAPTURE_ERR_BASE + 9, + /** + * 预期之外的错误。 + */ + AV_SCREEN_CAPTURE_ERR_EXTEND_START = AV_SCREEN_CAPTURE_ERR_BASE + 100, +} OH_AVSCREEN_CAPTURE_ErrCode; + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_AVSCREEN_CAPTURE_ERRORS_H \ No newline at end of file -- Gitee From dc0b5d96191a28db156dcaff6ac88e2df60dd173 Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 14 Mar 2024 18:00:30 +0800 Subject: [PATCH 0383/2135] =?UTF-8?q?=E5=A2=9E=E5=8A=A0av=20screen=20captu?= =?UTF-8?q?re=E7=9A=84=E4=B8=AD=E6=96=87=E6=8E=A5=E5=8F=A3=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liyang --- .../native_sdk/media/avscreen_capture/native_avscreen_capture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h index 665d0b73..2e4bc0f6 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h @@ -48,7 +48,7 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Init(struct OH_AVScreenCapture *c OH_AVScreenCaptureConfig config); /** - * @brief 启动录屏,调用此接口,可采集编码后的码流。 + * @brief 启动录屏,调用此接口,可将录屏文件保存。 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @param capture 指向OH_AVScreenCapture实例的指针。 * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 -- Gitee From ebd7ca1fed6a4ca3d0c46ad39e130437f0d87a07 Mon Sep 17 00:00:00 2001 From: aryawang Date: Thu, 14 Mar 2024 18:04:26 +0800 Subject: [PATCH 0384/2135] =?UTF-8?q?NDK=20C-Api=20CustomDialog=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=96=87=E6=A1=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: aryawang --- zh-cn/native_sdk/ace/native_dialog.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/ace/native_dialog.h b/zh-cn/native_sdk/ace/native_dialog.h index 94edf90b..3dc4fd2f 100644 --- a/zh-cn/native_sdk/ace/native_dialog.h +++ b/zh-cn/native_sdk/ace/native_dialog.h @@ -13,6 +13,25 @@ * limitations under the License. */ +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief 提供ArkUI在Native侧的UI能力,如UI组件创建销毁、树节点操作,属性设置,事件监听等。 + * + * @since 12 + */ + +/** + * @file native_dialog.h + * + * @brief 提供ArkUI在Native侧的自定义弹窗接口定义集合。 + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + #ifndef ARKUI_NATIVE_DIALOG_H #define ARKUI_NATIVE_DIALOG_H @@ -199,4 +218,4 @@ typedef struct { }; #endif -#endif // ARKUI_NATIVE_DIALOG_H \ No newline at end of file +#endif // ARKUI_NATIVE_DIALOG_H -- Gitee From f8da0859befb7379ee19ed22e795a8f573cb7d22 Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 14 Mar 2024 19:12:40 +0800 Subject: [PATCH 0385/2135] =?UTF-8?q?=E5=A2=9E=E5=8A=A0av=20screen=20captu?= =?UTF-8?q?re=E7=9A=84=E4=B8=AD=E6=96=87=E6=8E=A5=E5=8F=A3=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liyang --- .../native_avscreen_capture.h | 21 ++++- .../native_avscreen_capture_base.h | 87 ++++++++++++------- .../native_avscreen_capture_errors.h | 21 ++++- 3 files changed, 95 insertions(+), 34 deletions(-) diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h index 2e4bc0f6..80175bb5 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h @@ -26,6 +26,25 @@ extern "C" { #endif +/** + * @addtogroup AVScreenCapture + * @{ + * + * @brief 调用本模块下的接口,应用可以完成屏幕录制的功能。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 10 + */ + +/** + * @file native_avscreen_capture.h + * + * @brief 声明用于构造屏幕录制对象的API。 + * + * @library libnative_avscreen_capture.so + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 10 + */ + /** * @brief 创建OH_AVScreenCapture。 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture @@ -288,5 +307,5 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ExcludeContent(struct OH_AVScreen #ifdef __cplusplus } #endif - +/** @} */ #endif // NATIVE_AVSCREEN_CAPTURE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h index 0bb084df..547e26a2 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h @@ -23,6 +23,25 @@ extern "C" { #endif +/** + * @addtogroup AVScreenCapture + * @{ + * + * @brief 调用本模块下的接口,应用可以完成屏幕录制的功能。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 10 + */ + +/** + * @file native_avscreen_capture_base.h + * + * @brief 声明用于运行屏幕录制通用的结构体、字符常量、枚举。 + * + * @library libnative_avscreen_capture.so + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 10 + */ + /** * @brief 提供录屏的视频原始码流类。 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture @@ -186,11 +205,11 @@ typedef enum OH_ContainerFormatType { * @version 1.0 */ typedef struct OH_AudioCaptureInfo { - /* 音频采样率,支持列表参考OH_AudioCapturer_GetSamplingRate。 */ + /** 音频采样率,支持列表参考OH_AudioCapturer_GetSamplingRate。 **/ int32_t audioSampleRate; - /* 音频声道数。 */ + /** 音频声道数。 **/ int32_t audioChannels; - /* 音频源。 */ + /** 音频源。 **/ OH_AudioCaptureSourceType audioSource; } OH_AudioCaptureInfo; @@ -202,9 +221,9 @@ typedef struct OH_AudioCaptureInfo { * @version 1.0 */ typedef struct OH_AudioEncInfo { - /* 音频解码比特率 */ + /** 音频解码比特率 **/ int32_t audioBitrate; - /* 解码格式 */ + /** 解码格式 **/ OH_AudioCodecFormat audioCodecformat; } OH_AudioEncInfo; @@ -216,11 +235,11 @@ typedef struct OH_AudioEncInfo { * @version 1.0 */ typedef struct OH_AudioInfo { - /* 音频麦克风信息 */ + /** 音频麦克风信息 **/ OH_AudioCaptureInfo micCapInfo; - /* 内录信息 */ + /** 内录信息 **/ OH_AudioCaptureInfo innerCapInfo; - /* 音频解码信息,原始码流时不需要设置 */ + /** 音频解码信息,原始码流时不需要设置 **/ OH_AudioEncInfo audioEncInfo; } OH_AudioInfo; @@ -232,17 +251,17 @@ typedef struct OH_AudioInfo { * @version 1.0 */ typedef struct OH_VideoCaptureInfo { - /* 显示ID,指定窗口时需设置 */ + /** 显示ID,指定窗口时需设置 **/ uint64_t displayId; - /* missionID,指定窗口时需设置 */ + /** missionID,指定窗口时需设置 **/ int32_t *missionIDs; - /* MissionIds长度, ,指定窗口时需设置 */ + /** MissionIds长度, ,指定窗口时需设置 **/ int32_t missionIDsLen; - /* 宽度 */ + /** 宽度 **/ int32_t videoFrameWidth; - /* 高度 */ + /** 高度 **/ int32_t videoFrameHeight; - /* 视频类型 */ + /** 视频类型 **/ OH_VideoSourceType videoSource; } OH_VideoCaptureInfo; @@ -254,11 +273,11 @@ typedef struct OH_VideoCaptureInfo { * @version 1.0 */ typedef struct OH_VideoEncInfo { - /* 视频解码格式 */ + /** 视频解码格式 **/ OH_VideoCodecFormat videoCodec; - /* 比特率 */ + /** 比特率 **/ int32_t videoBitrate; - /* 帧率 */ + /** 帧率 **/ int32_t videoFrameRate; } OH_VideoEncInfo; @@ -270,9 +289,9 @@ typedef struct OH_VideoEncInfo { * @version 1.0 */ typedef struct OH_VideoInfo { - /* 视频录制信息 */ + /** 视频录制信息 **/ OH_VideoCaptureInfo videoCapInfo; - /* 视频解码信息 */ + /** 视频解码信息 **/ OH_VideoEncInfo videoEncInfo; } OH_VideoInfo; @@ -284,11 +303,11 @@ typedef struct OH_VideoInfo { * @version 1.0 */ typedef struct OH_RecorderInfo { - /* 录制文件url */ + /** 录制文件url **/ char *url; - /* 录制文件url长度 */ + /** 录制文件url长度 **/ uint32_t urlLen; - /* 录制文件url格式 */ + /** 录制文件url格式 **/ OH_ContainerFormatType fileFormat; } OH_RecorderInfo; @@ -300,11 +319,15 @@ typedef struct OH_RecorderInfo { * @version 1.0 */ typedef struct OH_AVScreenCaptureConfig { + /** 录屏模式 **/ OH_CaptureMode captureMode; + /** 数据类型 **/ OH_DataType dataType; + /** 音频信息 **/ OH_AudioInfo audioInfo; + /** 视频信息 **/ OH_VideoInfo videoInfo; - /* 存文件必须设置录制文件信息 */ + /** 存文件必须设置录制文件信息 **/ OH_RecorderInfo recorderInfo; } OH_AVScreenCaptureConfig; @@ -387,13 +410,13 @@ typedef struct OH_AVScreenCaptureCallback { * @version 1.0 */ typedef struct OH_Rect { - /* 录屏界面的X坐标。 */ + /** 录屏界面的X坐标。 **/ int32_t x; - /* 录屏界面的Y坐标。 */ + /** 录屏界面的Y坐标。 **/ int32_t y; - /* 录屏界面的宽度。 */ + /** 录屏界面的宽度。 **/ int32_t width; - /* 录屏界面的高度。 */ + /** 录屏界面的高度。 **/ int32_t height; } OH_Rect; @@ -406,13 +429,13 @@ typedef struct OH_Rect { * @version 1.0 */ typedef struct OH_AudioBuffer { - /* 音频buffer块 */ + /** 音频buffer块 **/ uint8_t *buf; - /* 音频buffer块大小 */ + /** 音频buffer块大小 **/ int32_t size; - /* 时间戳 */ + /** 时间戳 **/ int64_t timestamp; - /* 音频录制类型 */ + /** 音频录制类型 **/ OH_AudioCaptureSourceType type; } OH_AudioBuffer; @@ -517,5 +540,5 @@ typedef void (*OH_AVScreenCapture_OnBufferAvailable)(OH_AVScreenCapture *capture #ifdef __cplusplus } #endif - +/** @} */ #endif // NATIVE_AVSCREEN_CAPTURE_BASE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h index 34fd791c..fff811f9 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h @@ -20,6 +20,25 @@ extern "C" { #endif +/** + * @addtogroup AVScreenCapture + * @{ + * + * @brief 调用本模块下的接口,应用可以完成屏幕录制的功能。 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 10 + */ + +/** + * @file native_avscreen_capture_errors.h + * + * @brief 声明用于运行屏幕录制过程中接口调用的错误码说明。 + * + * @library libnative_avscreen_capture.so + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 10 + */ + /** * @brief 屏幕录制过程中产生的不同结果码。 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture @@ -81,5 +100,5 @@ typedef enum OH_AVSCREEN_CAPTURE_ErrCode { #ifdef __cplusplus } #endif - +/** @} */ #endif // NATIVE_AVSCREEN_CAPTURE_ERRORS_H \ No newline at end of file -- Gitee From 2bc17717103cee10a36ea5f88d27bbb15688b46a Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 14 Mar 2024 19:37:31 +0800 Subject: [PATCH 0386/2135] =?UTF-8?q?=E5=A2=9E=E5=8A=A0av=20screen=20captu?= =?UTF-8?q?re=E7=9A=84=E4=B8=AD=E6=96=87=E6=8E=A5=E5=8F=A3=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liyang --- .../media/avscreen_capture/native_avscreen_capture.h | 8 ++++++-- .../media/avscreen_capture/native_avscreen_capture_base.h | 4 +++- .../avscreen_capture/native_avscreen_capture_errors.h | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h index 80175bb5..4b283ac5 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h @@ -134,7 +134,8 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_AcquireAudioBuffer(struct OH_AVSc OH_AudioBuffer **audiobuffer, OH_AudioCaptureSourceType type); /** - * @brief 获取视频buffer,应用在调用时,通过此接口来获取到视频的buffer以及时间戳等信息。 buffer使用完成后,调用OH_AVScreenCapture_ReleaseVideoBuffer接口进行视频buffer的释放。 + * @brief 获取视频buffer,应用在调用时,通过此接口来获取到视频的buffer以及时间戳等信息。 + * buffer使用完成后,调用OH_AVScreenCapture_ReleaseVideoBuffer接口进行视频buffer的释放。 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @param capture 指向OH_AVScreenCapture实例的指针。 * @param fence 用于同步的显示相关参数信息。 @@ -250,7 +251,8 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetErrorCallback(struct OH_AVScre OH_AVScreenCapture_OnError callback, void *userData); /** - * @brief 设置屏幕旋转配置开关。当canvasRotation为true时,则打开屏幕旋转配置,通过调用OH_AVScreenCapture_StartScreenCapture后可以设置屏幕的旋转配置,canvasRotation为true时,旋转配置生效,在横屏分辨率投屏录屏,屏幕竖起时录制画面为正向等比缩放的屏幕,两侧区域填充黑边。 默认屏幕旋转配置开关为关闭。 + * @brief 设置屏幕旋转配置开关。当canvasRotation为true时,则打开屏幕旋转配置,通过调用OH_AVScreenCapture_StartScreenCapture后可以设置屏幕的旋转配置, + * canvasRotation为true时,旋转配置生效,在横屏分辨率投屏录屏,屏幕竖起时录制画面为正向等比缩放的屏幕,两侧区域填充黑边。 默认屏幕旋转配置开关为关闭。 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @param capture 指向OH_AVScreenCapture实例的指针。 * @param canvasRotation 屏幕旋转配置参数。 @@ -307,5 +309,7 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ExcludeContent(struct OH_AVScreen #ifdef __cplusplus } #endif + /** @} */ + #endif // NATIVE_AVSCREEN_CAPTURE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h index 547e26a2..82c04115 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h @@ -335,7 +335,7 @@ typedef struct OH_AVScreenCaptureConfig { * @brief 当OH_AVScreenCapture实例运行出错时,将调用函数指针。 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @param capture 指向OH_AVScreenCapture实例的指针。 - * @param errorCode 指定错误码。 + * @param errorCode 指定错误码。 * * @deprecated since 12 * @useinstead {@link OH_AVScreenCapture_OnError} @@ -540,5 +540,7 @@ typedef void (*OH_AVScreenCapture_OnBufferAvailable)(OH_AVScreenCapture *capture #ifdef __cplusplus } #endif + /** @} */ + #endif // NATIVE_AVSCREEN_CAPTURE_BASE_H \ No newline at end of file diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h index fff811f9..a8047b0a 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_errors.h @@ -100,5 +100,7 @@ typedef enum OH_AVSCREEN_CAPTURE_ErrCode { #ifdef __cplusplus } #endif + /** @} */ + #endif // NATIVE_AVSCREEN_CAPTURE_ERRORS_H \ No newline at end of file -- Gitee From c976284059edc4e9be6f2bdb7717cf4c8aebdc98 Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 14 Mar 2024 19:49:15 +0800 Subject: [PATCH 0387/2135] =?UTF-8?q?=E5=A2=9E=E5=8A=A0av=20screen=20captu?= =?UTF-8?q?re=E7=9A=84=E4=B8=AD=E6=96=87=E6=8E=A5=E5=8F=A3=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liyang --- .../media/avscreen_capture/native_avscreen_capture.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h index 4b283ac5..096c51b8 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h @@ -201,7 +201,8 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCallback(struct OH_AVScreenCap OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Release(struct OH_AVScreenCapture *capture); /** - * @brief 设置麦克风开关。当isMicrophone为true时,则打开麦克风,通过调用OH_AVScreenCapture_StartScreenCapture和OH_AVScreenCapture_AcquireAudioBuffer可以正常获取到音频的麦克风原始PCM数据;isMicrophone为false时,获取到的音频数据为无声数据。 默认麦克风开关为开启。 + * @brief 设置麦克风开关。当isMicrophone为true时,则打开麦克风,通过调用OH_AVScreenCapture_StartScreenCapture和 + * OH_AVScreenCapture_AcquireAudioBuffer可以正常获取到音频的麦克风原始PCM数据;isMicrophone为false时,获取到的音频数据为无声数据。 默认麦克风开关为开启。 * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @param capture 指向OH_AVScreenCapture实例的指针。 * @param isMicrophone 麦克风开关参数。 -- Gitee From 9138d92dc4b58042c589fe8b56ebc8306ffcf662 Mon Sep 17 00:00:00 2001 From: liyang Date: Thu, 14 Mar 2024 21:09:14 +0800 Subject: [PATCH 0388/2135] Add ScreenCapture new native Interface doc sample Signed-off-by: liyang --- .../native_sdk/media/avscreen_capture/native_avscreen_capture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h index 096c51b8..7c7a120f 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h @@ -183,7 +183,7 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseVideoBuffer(struct OH_AVSc * @param callback OH_AVScreenCaptureCallback的结构体,保存相关回调函数指针。 * @return 执行成功返回AV_SCREEN_CAPTURE_ERR_OK, 否则返回具体错误码,请参阅 OH_AVSCREEN_CAPTURE_ErrCode。 * @deprecated since 12 - * @useinstead {@link OH_AVScreenCapture_SetErrorCallback} {@link OH_AVScreenCapture_SetBufferCallback} + * @useinstead {@link OH_AVScreenCapture_SetErrorCallback} {@link OH_AVScreenCapture_SetDataCallback} * @since 10 * @version 1.0 */ -- Gitee From 5f58c4745e5dfbadde9a56affb0989ae88cdbd4c Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 15 Mar 2024 10:19:38 +0800 Subject: [PATCH 0389/2135] screen capture API Changes after review Signed-off-by: liyang --- .../media/avscreen_capture/native_avscreen_capture.h | 2 +- .../media/avscreen_capture/native_avscreen_capture_base.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h index 7c7a120f..af9f03d6 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture.h @@ -261,7 +261,7 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetErrorCallback(struct OH_AVScre * @since 12 * @version 1.0 */ -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetScreenCanvasRotation(struct OH_AVScreenCapture *capture, +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCanvasRotation(struct OH_AVScreenCapture *capture, bool canvasRotation); /** diff --git a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h index 82c04115..118c7b91 100644 --- a/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h +++ b/zh-cn/native_sdk/media/avscreen_capture/native_avscreen_capture_base.h @@ -454,15 +454,15 @@ typedef enum OH_AVScreenCaptureStateCode { /** 已停止录屏。 **/ OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER = 2, /** 录屏被其他录屏中断。 **/ - OH_SCREEN_CAPTURE_STATE_STOPPED_BY_INTERRUPT = 3, + OH_SCREEN_CAPTURE_STATE_INTERRUPT_BY_OTHER = 3, /** 录屏被通话中断。 **/ - OH_SCREEN_CAPTURE_STATE_STOPPED_BY_INCALL = 4, + OH_SCREEN_CAPTURE_STATE_STOPPED_BY_CALL = 4, /** 麦克风不可用。 **/ OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE = 5, /** 麦克风被静音。 **/ OH_SCREEN_CAPTURE_STATE_MIC_MUTED_BY_USER = 6, /** 麦克风被取消静音。 **/ - OH_SCREEN_CAPTURE_STATE_MIC_UNMUTED_BY_BSER = 7, + OH_SCREEN_CAPTURE_STATE_MIC_UNMUTED_BY_USER = 7, /** 进入隐私弹窗。 **/ OH_SCREEN_CAPTURE_STATE_ENTER_PRIVATE_SCENE = 8, /** 隐私弹窗退出。 **/ -- Gitee From 97c21e09af66964e9e2a8930cce6f4702765e3a1 Mon Sep 17 00:00:00 2001 From: LiAn Date: Fri, 15 Mar 2024 06:01:21 +0000 Subject: [PATCH 0390/2135] update zh-cn/native_sdk/web/arkweb_interface.h. Signed-off-by: LiAn Signed-off-by: LiAn --- zh-cn/native_sdk/web/arkweb_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zh-cn/native_sdk/web/arkweb_interface.h b/zh-cn/native_sdk/web/arkweb_interface.h index 4b9e2ce0..0f4e2ac7 100644 --- a/zh-cn/native_sdk/web/arkweb_interface.h +++ b/zh-cn/native_sdk/web/arkweb_interface.h @@ -60,7 +60,7 @@ typedef enum { ARKWEB_NATIVE_CONTROLLER, } ArkWeb_NativeAPIVariantKind; -/* +/** * @brief 根据传入的API类型,获取对应的Native API结构体。 * @param type ArkWeb支持的Native API类型。 * @return 根据传入的API类型,返回对应的Native API结构体指针,结构体第一个成员为当前结构体的大小。 -- Gitee From 7c1f1da29c69b282007321fc5ebb089d4a370924 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 15 Mar 2024 16:38:17 +0800 Subject: [PATCH 0391/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/dfx/hiappevent.h | 609 +++++++++++++++++++++++++++ en/native_sdk/dfx/hiappevent_cfg.h | 76 ++++ en/native_sdk/dfx/hiappevent_event.h | 150 +++++++ en/native_sdk/dfx/hiappevent_param.h | 86 ++++ en/native_sdk/dfx/hidebug.h | 131 ++++++ en/native_sdk/dfx/hidebug_type.h | 373 ++++++++++++++++ 6 files changed, 1425 insertions(+) create mode 100644 en/native_sdk/dfx/hiappevent.h create mode 100644 en/native_sdk/dfx/hiappevent_cfg.h create mode 100644 en/native_sdk/dfx/hiappevent_event.h create mode 100644 en/native_sdk/dfx/hiappevent_param.h create mode 100644 en/native_sdk/dfx/hidebug.h create mode 100644 en/native_sdk/dfx/hidebug_type.h diff --git a/en/native_sdk/dfx/hiappevent.h b/en/native_sdk/dfx/hiappevent.h new file mode 100644 index 00000000..532cc3cf --- /dev/null +++ b/en/native_sdk/dfx/hiappevent.h @@ -0,0 +1,609 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_H +#define HIVIEWDFX_HIAPPEVENT_H +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief Provides APIs for implementing the application event logging function. + * + * This function allows your application to record fault events, statistics events, security events, + * and user behavior events reported during system running. Based on the event information, you can + * analyze the operating status of your application. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent.h + * + * @brief Defines the application event logging functions of the HiAppEvent module. + * + * Before performing application event logging, you must construct a parameter list object to store + * the input event parameters and specify the event domain, event name, and event type. + * + *

    Event domain: domain associated with the application event. + *

    Event name: name of the application event. + *

    Event type: fault, statistics, security, or behavior. + *

    Parameter list: a linked list used to store event parameters. Each parameter consists of a + * parameter name and a parameter value. + * + * Example: + * Import the header file: + *

    + *     #include "hiappevent/hiappevent.h"
    + * 
    + * Create a parameter list pointer: + *
    + *     ParamList list = OH_HiAppEvent_CreateParamList();
    + * 
    + * Add parameters to the parameter list. + *
    + *     bool boolean = true;
    + *     OH_HiAppEvent_AddBoolParam(list, "bool_key", boolean);
    + *     int32_t nums[] = {1, 2, 3};
    + *     OH_HiAppEvent_AddInt32ArrayParam(list, "int32_arr_key", nums, sizeof(nums) / sizeof(nums[0]));
    + * 
    + * Perform event logging: + *
    + *     int res = OH_HiAppEvent_Write("test_domain", "test_event", BEHAVIOR, list);
    + * 
    + * Destroy the parameter list pointer and release its allocated memory: + *
    + *     OH_HiAppEvent_DestroyParamList(list);
    + * 
    + * + * @since 8 + * @version 1.0 + */ + +#include +#include + +#include "hiappevent_cfg.h" +#include "hiappevent_event.h" +#include "hiappevent_param.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the event types. + * + * You are advised to select an event type based on the application scenario. + * + * @since 8 + * @version 1.0 + */ +enum EventType { + /* Fault event */ + FAULT = 1, + + /* Statistics event */ + STATISTIC = 2, + + /* Security event */ + SECURITY = 3, + + /* Behavior event */ + BEHAVIOR = 4 +}; + +/** + * @brief Defines information about a single event, including the event domain, event name, event type, + * and custom parameter list in JSON string format. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +typedef struct HiAppEvent_AppEventInfo { + /** Event domain. */ + const char* domain; + /** Event name. */ + const char* name; + /** Event type. */ + enum EventType type; + /** Event parameter list in JSON string format. */ + const char* params; +} HiAppEvent_AppEventInfo; + +/** + * @brief Event groups with the same event name. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +typedef struct HiAppEvent_AppEventGroup { + /** Same event name in the event array. */ + const char* name; + /** Event array with the same event name. */ + const struct HiAppEvent_AppEventInfo* appEventInfos; + /** Length of the event array with the same event name. */ + uint32_t infoLen; +} HiAppEvent_AppEventGroup; + +/** + * @brief Defines an event parameter list node. + * + * @since 8 + * @version 1.0 + */ +typedef struct ParamListNode* ParamList; + +/** + * @brief Defines the watcher for application events. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +typedef struct HiAppEvent_Watcher HiAppEvent_Watcher; + +/** + * @brief Callback invoked to pass event content to the caller. + * + * Note: The lifecycle of the object pointed by the pointer in the callback is limited to the callback function. + * Do not use the pointer outside of the callback function. If the information needs to be cached, perform a + * deep copy of the content pointed by the pointer. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param domain Domain of the received application event. + * @param appEventGroups Event group array . + * @param groupLen Length of the event group array. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnReceive)( + const char* domain, const struct HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen); + +/** + * @brief Callback invoked if the event received by the watcher meets the conditions specified by + * OH_HiAppEvent_SetTriggerCondition. Specifically, if the OH_HiAppEvent_OnReceive callback is not + * set in the watcher, the event received by the watcher will be saved. If the saved event meets the + * conditions * specified by OH_HiAppEvent_SetTriggerCondition, the callback is invoked. + * After the callback is complete, if a newly saved event meets the specified condition, the callback is invoked again. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param row Number of events newly received by the watcher. + * @param size Total size of events newly received by the watcher. The size of a single event is the length + * of the JSON string converted from the event. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnTrigger)(int row, int size); + +/** + * @brief Callback invoked to pass the events received by the watcher to the caller when OH_HiAppEvent_TakeWatcherData + * is used to obtain the events. + * + * Note: The lifecycle of the object pointed by the pointer in the callback is limited to the callback function. + * Do not use the pointer outside of the callback function. If the information needs to be cached, perform a + * deep copy of the content pointed by the pointer. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param events Event array in JSON string format. + * @param eventLen Size of the event array. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnTake)(const char* const *events, uint32_t eventLen); + +/** + * @brief Creates a pointer to a parameter list object. + * + * @return Pointer to the parameter list object. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_CreateParamList(void); + +/** + * @brief Destroys a pointer to a parameter list object and releases its allocated memory. + * + * @param list Pointer to the parameter list object. + * @since 8 + * @version 1.0 + */ +void OH_HiAppEvent_DestroyParamList(ParamList list); + +/** + * @brief Adds an event parameter of the Boolean type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param boolean Value of the Boolean parameter to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddBoolParam(ParamList list, const char* name, bool boolean); + +/** + * @brief Adds an event parameter of the Boolean array type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param booleans Value of the Boolean array parameter to be added. + * @param arrSize Size of the parameter array to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddBoolArrayParam(ParamList list, const char* name, const bool* booleans, int arrSize); + +/** + * @brief Adds an event parameter of the int8_t type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param num Value of the int8_t parameter to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt8Param(ParamList list, const char* name, int8_t num); + +/** + * @brief Adds an event parameter of the int8_t array type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param nums Value of the int8_t array parameter to be added. + * @param arrSize Size of the parameter array to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt8ArrayParam(ParamList list, const char* name, const int8_t* nums, int arrSize); + +/** + * @brief Adds an event parameter of the int16_t type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param num Value of the int16_t parameter to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt16Param(ParamList list, const char* name, int16_t num); + +/** + * @brief Adds an event parameter of the int16_t array type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param nums Value of the int16_t array parameter to be added. + * @param arrSize Size of the parameter array to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt16ArrayParam(ParamList list, const char* name, const int16_t* nums, int arrSize); + +/** + * @brief Adds an event parameter of the int32_t type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param num Value of the int32_t parameter to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt32Param(ParamList list, const char* name, int32_t num); + +/** + * @brief Adds an event parameter of the int32_t array type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param nums Value of the int32_t array parameter to be added. + * @param arrSize Size of the parameter array to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt32ArrayParam(ParamList list, const char* name, const int32_t* nums, int arrSize); + +/** + * @brief Adds an event parameter of the int64_t type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param num Value of the int64_t parameter to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt64Param(ParamList list, const char* name, int64_t num); + +/** + * @brief Adds an event parameter of the int64_t array type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param nums Value of the int64_t array parameter to be added. + * @param arrSize Size of the parameter array to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddInt64ArrayParam(ParamList list, const char* name, const int64_t* nums, int arrSize); + +/** + * @brief Adds an event parameter of the float type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param num Value of the float parameter to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddFloatParam(ParamList list, const char* name, float num); + +/** + * @brief Adds an event parameter of the float array type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param nums Value of the float array parameter to be added. + * @param arrSize Size of the parameter array to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddFloatArrayParam(ParamList list, const char* name, const float* nums, int arrSize); + +/** + * @brief Adds an event parameter of the double type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param num Value of the double parameter to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddDoubleParam(ParamList list, const char* name, double num); + +/** + * @brief Adds an event parameter of the double array type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param nums Value of the double array parameter to be added. + * @param arrSize Size of the parameter array to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddDoubleArrayParam(ParamList list, const char* name, const double* nums, int arrSize); + +/** + * @brief Adds a parameter of the string type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param str Value of the string parameter to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddStringParam(ParamList list, const char* name, const char* str); + +/** + * @brief Adds a parameter of the string array type to the parameter list. + * + * @param list Pointer to the parameter list to which parameters are to be added. + * @param name Name of the parameter to be added. + * @param strs Value of the string array parameter to be added. + * @param arrSize Size of the parameter array to be added. + * @return Pointer to the parameter list that contains the parameters added. + * @since 8 + * @version 1.0 + */ +ParamList OH_HiAppEvent_AddStringArrayParam(ParamList list, const char* name, const char * const *strs, int arrSize); + +/** + * @brief Logs application events whose parameters are of the list type. + * + * Before application event logging, use this API to verify parameters of the events. + * If the verification is successful, the API writes the events to the event file. + * + * @param domain Event domain. You can customize event domains as required. + * @param name Event name. You can customize event names as required. + * @param type Event type, which is defined in {@link EventType}. + * @param list List of event parameters. Each parameter consists of a parameter name and a parameter value. + * @return {@code 0} if the event parameter verification is successful and the application event is written to the + * event file; a value greater than **0** if invalid parameters are present in the event, and the event will be written + * to the event file after the invalid parameters are ignored; a value smaller than **0** if the event parameter + * verification fails, and the event will not be written to the event file. + * @since 8 + * @version 1.0 + */ +int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType type, const ParamList list); + +/** + * @brief Configures the application event logging function. + * + * This function is used to configure the event logging function and the storage quota of the event file directory. + * + * @param name Configuration item name. + * @param value Configuration item value. + * @return Configuration result. + * @since 8 + * @version 1.0 + */ +bool OH_HiAppEvent_Configure(const char* name, const char* value); + +/** + * @brief Creates a watcher for application events. + * + * Note: If a created watcher is no longer used, you are required to destroy it by calling OH_HiAppEvent_DestroyWatcher. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param name Watcher name. + * @return Pointer to the new watcher. + * @since 12 + * @version 1.0 + */ +HiAppEvent_Watcher* OH_HiAppEvent_CreateWatcher(const char* name); + +/** + * @brief Destroys a created watcher. + * + * Note: If a created watcher is no longer used, destroy it to release memory to prevent memory leakage. + * After the watcher is destroyed, set its pointer to null. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher). + * @since 12 + * @version 1.0 + */ +void OH_HiAppEvent_DestroyWatcher(HiAppEvent_Watcher* watcher); + +/** + * @brief Sets the conditions for triggering the OH_HiAppEvent_OnTrigger callback, including the number + * and size of newly received events and the timeout interval for triggering onTrigger. + * Ensure that at least one of the trigger conditions is set on the caller side. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher). + * @param row Row count. If the input value is greater than 0 and the number of newly received events is greater than + * or equal to the value of this parameter, the configured onTrigger callback is called. + * If the input value is less than or equal to 0, the number of received events is not used as the condition + * to trigger the onTrigger callback. + * @param size Size value. If the input value is greater than 0 and the size of the newly received event is greater than + * or equal to the value of this parameter, the configured onTrigger callback is called. The size of a single event is + * the length of the JSON string converted from the event. + * If the input value is less than or equal to 0, the size of received events is not used as the condition to trigger + * the onTrigger callback. + * @param timeOut Timeout value, in seconds. If the input value is greater than 0, the system checks the watcher for + * newly received events based on the timeout interval. If there are any newly received events, the configured onTrigger + * callback is triggered. + * After the callback is complete, the system checks the watcher for newly received events when the timeout value expires. + * If the input value is less than or equal to 0, the timeout interval is not used as the condition to trigger the + * onTrigger callback. + * @return {@code 0} If the setting is successful; a negative value otherwise. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetTriggerCondition(HiAppEvent_Watcher* watcher, int row, int size, int timeOut); + +/** + * @brief Sets the type of events to be listened for. + * + * This function can be called repeatedly. You can add multiple filtering conditions instead of replacing them. + * The watcher will receive notifications of events that meet any of the filtering conditions. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher). + * @param domain Domain of events to be listened for. + * @param eventTypes Types of events to be listened for. + * @param names Array of the event names. + * @param namesLen Length of the event name array. + * @return {@code 0} If the setting is successful; a negative value otherwise. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetAppEventFilter(HiAppEvent_Watcher* watcher, const char* domain, uint8_t eventTypes, + const char* const *names, int namesLen); + +/** + * @brief Sets the onTrigger callback. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher). + * @param onTrigger Callback to be set. + * @return {@code 0} if the operation is successful; a negative value otherwise. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetWatcherOnTrigger(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnTrigger onTrigger); + +/** + * @brief Sets the onReceive callback. When the listener detects the corresponding event, the onReceive callback + * is called. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher). + * @param eventPkgCallback Pointer to the callback. + * @return {@code 0} if the operation is successful; a negative value otherwise. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetWatcherOnReceive(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnReceive onReceive); + +/** + * @brief Obtains the event saved by the watcher. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher). + * @param eventNum Number of events. + * @param onTake Pointer to the callback. The event information is returned through this callback. + * @return {@code 0} if the operation is successful; a negative value otherwise. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_TakeWatcherData(HiAppEvent_Watcher* watcher, uint32_t eventNum, OH_HiAppEvent_OnTake onTake); + +/** + * @brief Adds a watcher. Once a watcher is added, it starts to listen for system messages. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher). + * @return {@code 0} if the operation is successful; a negative value otherwise. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_AddWatcher(HiAppEvent_Watcher* watcher); + +/** + * @brief Removes a watcher. Once a watcher is removed, it stops listening for system messages. + * + * Note: This API only enables the watcher to stop listening for system messages. It does not destroy the watcher. + * The watcher still resides in the memory until the OH_HiAppEvent_DestroyWatcher API is called. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @param watcher Pointer to the watcher (that is, the pointer returned by OH_HiAppEvent_CreateWatcher). + * @return {@code 0} if the operation is successful; a negative value otherwise. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher); + +/** + * @brief Clears the events saved by all watchers. + * + * @SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +void OH_HiAppEvent_ClearData(void); +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_H diff --git a/en/native_sdk/dfx/hiappevent_cfg.h b/en/native_sdk/dfx/hiappevent_cfg.h new file mode 100644 index 00000000..b22443ed --- /dev/null +++ b/en/native_sdk/dfx/hiappevent_cfg.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_CONFIG_H +#define HIVIEWDFX_HIAPPEVENT_CONFIG_H + +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief Provides APIs for implementing the application event logging function. + * + * This function allows your application to record fault events, statistics events, security events, + * and user behavior events reported during system running. Based on the event information, + * you can analyze the operating status of your application. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent_cfg.h + * + * @brief Defines the configuration items of the event logging configuration function. + * + * @brief If you want to configure the application event logging function, + * you can directly use configuration item constants. + * + * Example: + *
    + *     bool res = OH_HiAppEvent_Configure(MAX_STORAGE, "100M");
    + * 
    + * + * @since 8 + * @version 1.0 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Event logging switch. + * + * @since 8 + * @version 1.0 + */ +#define DISABLE "disable" + +/** + * @brief Storage quota of the event file directory. + * + * @since 8 + * @version 1.0 + */ +#define MAX_STORAGE "max_storage" + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_CONFIG_H diff --git a/en/native_sdk/dfx/hiappevent_event.h b/en/native_sdk/dfx/hiappevent_event.h new file mode 100644 index 00000000..983b8bb1 --- /dev/null +++ b/en/native_sdk/dfx/hiappevent_event.h @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_EVENT_H +#define HIVIEWDFX_HIAPPEVENT_EVENT_H + +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief Provides APIs for implementing the application event logging function. + * + * This function allows your application to record fault events, statistics events, security events, and + * user behavior events reported during system running. Based on the event information, you can analyze + * the operating status of your application. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent_event.h + * + * @brief Defines the names of all predefined events. + * + * In addition to custom events associated with specific applications, you can use predefined events for logging. + * + * Example: + *
    + *     ParamList list = OH_HiAppEvent_CreateParamList();
    + *     OH_HiAppEvent_AddInt32Param(list, PARAM_USER_ID, 123);
    + *     int res = OH_HiAppEvent_Write("user_domain", EVENT_USER_LOGIN, BEHAVIOR, list);
    + *     OH_HiAppEvent_DestroyParamList(list);
    + * 
    + * + * @since 8 + * @version 1.0 + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief User login event. + * + * @since 8 + * @version 1.0 + */ +#define EVENT_USER_LOGIN "hiappevent.user_login" + +/** + * @brief User logout event. + * + * @since 8 + * @version 1.0 + */ +#define EVENT_USER_LOGOUT "hiappevent.user_logout" + +/** + * @brief Distributed service event. + * + * @since 8 + * @version 1.0 + */ +#define EVENT_DISTRIBUTED_SERVICE_START "hiappevent.distributed_service_start" + +/** + * @brief Application crash event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_CRASH "APP_CRASH" + +/** + * @brief Application freeze event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_FREEZE "APP_FREEZE" + +/** + * @brief Application loading event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_LAUNCH "APP_LAUNCH" + +/** + * @brief Event indicating application freeze during swiping. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_SCROLL_JANK "SCROLL_JANK" + +/** + * @brief Event indicating high CPU usage of an application. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_CPU_USAGE_HIGH "CPU_USAGE_HIGH" + +/** + * @brief Application power usage event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_BATTERY_USAGE "BATTERY_USAGE" + +/** + * @brief Application resource threshold-crossing event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_RESOURCE_OVERLIMIT "RESOURCE_OVERLIMIT" + +/** + * @brief OS scope. + * + * @since 12 + * @version 1.0 + */ +#define DOMAIN_OS "OS" + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_EVENT_H diff --git a/en/native_sdk/dfx/hiappevent_param.h b/en/native_sdk/dfx/hiappevent_param.h new file mode 100644 index 00000000..c72b6faa --- /dev/null +++ b/en/native_sdk/dfx/hiappevent_param.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_PARAM_H +#define HIVIEWDFX_HIAPPEVENT_PARAM_H + +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief Provides APIs for implementing the application event logging function. + * + * This function allows your application to record fault events, statistics events, security events, and + * user behavior events reported during system running. Based on the event information, you can analyze + * the operating status of your application. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent_param.h + * + * @brief Defines the names of all predefined event parameters. + * + * In addition to custom events associated with specific applications, you can use predefined events + * for logging. + * + * Example: + *
    + *     ParamList list = OH_HiAppEvent_CreateParamList();
    + *     OH_HiAppEvent_AddInt32Param(list, PARAM_USER_ID, 123);
    + *     int res = OH_HiAppEvent_Write("user_domain", EVENT_USER_LOGIN, BEHAVIOR, list);
    + *     OH_HiAppEvent_DestroyParamList(list);
    + * 
    + * + * @since 8 + * @version 1.0 + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief User ID. + * + * @since 8 + * @version 1.0 + */ +#define PARAM_USER_ID "user_id" + +/** + * @brief Distributed service name. + * + * @since 8 + * @version 1.0 + */ +#define PARAM_DISTRIBUTED_SERVICE_NAME "ds_name" + +/** + * @brief Distributed service instance ID. + * + * @since 8 + * @version 1.0 + */ +#define PARAM_DISTRIBUTED_SERVICE_INSTANCE_ID "ds_instance_id" + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_PARAM_H diff --git a/en/native_sdk/dfx/hidebug.h b/en/native_sdk/dfx/hidebug.h new file mode 100644 index 00000000..2d9f0d29 --- /dev/null +++ b/en/native_sdk/dfx/hidebug.h @@ -0,0 +1,131 @@ +/* + * 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 HIVIEWDFX_HIDEBUG_H +#define HIVIEWDFX_HIDEBUG_H +/** + * @addtogroup HiDebug + * @{ + * + * @brief Provides the debugging function. + * + * The functions of this module can be used to obtain information such as the CPU usage, memory, + * heap, and capture trace. + * + * @since 12 + */ + +/** + * @file hideug.h + * + * @brief Defines the debugging function of the HiDebug module. + * + * @library libohhidebug.so + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + +#include +#include "hidebug_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Obtains the CPU usage of the system. + * + * @return CPU usage of the system. + * @since 12 + */ +double OH_HiDebug_GetSystemCpuUsage(); + +/** + * @brief Obtains the CPU usage of a process. + * + * @return CPU usage of a process. + * @since 12 + */ +double OH_HiDebug_GetAppCpuUsage(); + +/** + * @brief Obtains the CPU usage of all threads of an application. + * + * @return CPU usage of all threads. For details, see {@link HiDebug_ThreadCpuUsagePtr}. + * @since 12 + */ +HiDebug_ThreadCpuUsagePtr OH_HiDebug_GetAppThreadCpuUsage(); + +/** + * @brief Releases the thread data structure. + * + * @param threadCpuUsage CPU usage of all threads of an application. For details, + * see {@link HiDebug_ThreadCpuUsagePtr}. + * @since 12 + */ +void OH_HiDebug_FreeThreadCpuUsage(HiDebug_ThreadCpuUsagePtr *threadCpuUsage); + +/** + * @brief Obtains system memory information. + * + * @param systemMemInfo System memory information, which points to {@link HiDebug_SystemMemInfo}. + * @since 12 + */ +void OH_HiDebug_GetSystemMemInfo(HiDebug_SystemMemInfo *systemMemInfo); + +/** + * @brief Obtains the memory information of an application process. + * + * @param nativeMemInfo Native memory information, which points to {@link HiDebug_NativeMemInfo}. + * @since 12 + */ +void OH_HiDebug_GetAppNativeMemInfo(HiDebug_NativeMemInfo *nativeMemInfo); + +/** + * @brief Obtains the memory limit of an application process. + * + * @param memoryLimit Memory limit, which points to {@link HiDebug_MemoryLimit}. + * @since 12 + */ +void OH_HiDebug_GetAppMemoryLimit(HiDebug_MemoryLimit *memoryLimit); + +/** + * @brief Starts application trace collection. + * + * @param flag Flag for thread trace collection. + * @param tags Tags for trace collection scenarios. + * @param limitSize Maximum size of a trace file, in bytes. The maximum size is 500 MB. + * @param fileName Output trace file name. + * @param length Length of the trace file name. + * @return {@code HIDEBUG_SUCCESS} if the operation is successful. For details, see {@link HiDebug_ErrorCode}. + * @since 12 + */ +HiDebug_ErrorCode OH_HiDebug_StartAppTraceCapture(HiDebug_TraceFlag flag, uint64_t tags, uint32_t limitSize, + char* fileName, uint32_t length); + +/** + * @brief Stops application trace collection. + * + * @return {@code HIDEBUG_SUCCESS} if the operation is successful. For details, see {@link HiDebug_ErrorCode}. + * @since 12 + */ +HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); + +#ifdef __cplusplus +} +#endif +/** @} */ + +#endif // HIVIEWDFX_HIDEBUG_H diff --git a/en/native_sdk/dfx/hidebug_type.h b/en/native_sdk/dfx/hidebug_type.h new file mode 100644 index 00000000..2cfcceee --- /dev/null +++ b/en/native_sdk/dfx/hidebug_type.h @@ -0,0 +1,373 @@ +/* + * 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 HIVIEWDFX_HIDEBUG_TYPE_H +#define HIVIEWDFX_HIDEBUG_TYPE_H +/** + * @addtogroup HiDebug + * @{ + * + * @brief Provides definitions for the HiDebug module. + * + * The functions of this module can be used to obtain information such as the CPU usage, memory, + * heap, and capture trace. + * + * @since 12 + */ + +/** + * @file hideug_type.h + * + * @brief Defines the code structure of the HiDebug module. + * + * @library libohhidebug.so + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates result codes. + * + * @since 12 + */ +typedef enum HiDebug_ErrorCode { + /** Success */ + HIDEBUG_SUCCESS = 0, + /** Invalid parameters */ + HIDEBUG_INVALID_ARGUMENT = 401, + /** Repeated collection */ + HIDEBUG_TRACE_CAPTURED_ALREADY = 11400102, + /** No file write permission */ + HIDEBUG_NO_PERMISSION = 11400103, + /** Abnormal trace status */ + HIDEBUG_TRACE_ABNORMAL = 11400104 +} HiDebug_ErrorCode; + +/** + * @brief Defines the structure for the CPU usage of all threads of an application. + * + * @since 12 + */ +typedef struct HiDebug_ThreadCpuUsage { + /** + * Thread ID. + */ + uint32_t threadId; + /** + * Thread CPU usage, in percentage. + */ + double cpuUsage; + /** + * Usage of the next thread. + */ + struct HiDebug_ThreadCpuUsage *next; +} HiDebug_ThreadCpuUsage; + +/** + * @brief Defines the pointer to HiDebug_ThreadCpuUsage. + * + * @since 12 + */ +typedef HiDebug_ThreadCpuUsage* HiDebug_ThreadCpuUsagePtr; + +/** + * @brief Defines the structure for the system memory information. + * + * @since 12 + */ +typedef struct HiDebug_SystemMemInfo { + /** + * Total memory of the system, in KB. + */ + uint32_t totalMem; + /** + * Free memory of the system, in KB. + */ + uint32_t freeMem; + /** + * Available memory of the system, in KB. + */ + uint32_t availableMem; +} HiDebug_SystemMemInfo; + +/** + * @brief Defines the structure for the local memory information of the application process. + * + * @since 12 + */ +typedef struct HiDebug_NativeMemInfo { + /** + * Proportional set size, in KB. + */ + uint32_t pss; + /** + * Virtual memory size, in KB. + */ + uint32_t vss; + /** + * Resident set size, in KB. + */ + uint32_t rss; + /** + * Size of the shared dirty memory, in KB. + */ + uint32_t sharedDirty; + /** + * Size of the private dirty memory, in KB. + */ + uint32_t privateDirty; + /** + * Size of the shared clean memory, in KB. + */ + uint32_t sharedClean; + /** + * Size of the private clean memory, in KB. + */ + uint32_t privateClean; +} HiDebug_NativeMemInfo; + +/** + * @brief Defines the structure for the memory limit of the application process. + * + * @since 12 + */ +typedef struct HiDebug_MemoryLimit { + /** + * Limit on the resident set size, in KB. + */ + uint64_t rssLimit; + /** + * Limit on the virtual memory size, in KB. + */ + uint64_t vssLimit; +} HiDebug_MemoryLimit; + +/** + * @brief Thread type for trace collection. + * + * @since 12 + */ +typedef enum HiDebug_TraceFlag { + /** Only the main thread of the current application */ + HIDEBUG_TRACE_FLAG_MAIN_THREAD = 1, + /** All threads of the current application */ + HIDEBUG_TRACE_FLAG_ALL_THREADS = 2 +} HiDebug_TraceFlag; +#ifdef __cplusplus +} +#endif + +/** + * @brief FFRT task tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_FFRT (1ULL << 13) +/** + * @brief Public library subsystem tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_COMMON_LIBRARY (1ULL << 16) +/** + * @brief HDF subsystem tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_HDF (1ULL << 18) +/** + * @brief Network tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_NET (1ULL << 23) +/** + * @brief NWeb tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_NWEB (1ULL << 24) +/** + * @brief Distributed audio tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_AUDIO (1ULL << 27) +/** + * @brief File management tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_FILE_MANAGEMENT (1ULL << 29) +/** + * @brief OHOS universal tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_OHOS (1ULL << 30) +/** + * @brief Ability Manager tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_ABILITY_MANAGER (1ULL << 31) +/** + * @brief Camera module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_CAMERA (1ULL << 32) +/** + * @brief Media module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_MEDIA (1ULL << 33) +/** + * @brief Image module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_IMAGE (1ULL << 34) +/** + * @brief Audio module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_AUDIO (1ULL << 35) +/** + * @brief Distributed data manager module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_DATA (1ULL << 36) +/** + * @brief Image module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_GRAPHICS (1ULL << 38) +/** + * @brief ArkUI development framework tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_ARKUI (1ULL << 39) +/** + * @brief Notification module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_NOTIFICATION (1ULL << 40) +/** + * @brief MISC module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_MISC (1ULL << 41) +/** + * @brief Multimodal input module tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_MULTIMODAL_INPUT (1ULL << 42) +/** + * @brief RPC tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_RPC (1ULL << 46) +/** + * @brief JSVM VM tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_ARK (1ULL << 47) +/** + * @brief Window manager tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_WINDOW_MANAGER (1ULL << 48) +/** + * @brief Distributed screen tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCREEN (1ULL << 50) +/** + * @brief Distributed camera tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_CAMERA (1ULL << 51) +/** + * @brief Distributed hardware framework tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_FRAMEWORK (1ULL << 52) +/** + * @brief Global resource manager tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_GLOBAL_RESOURCE_MANAGER (1ULL << 53) +/** + * @brief Distributed hardware device manager tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_HARDWARE_DEVICE_MANAGER (1ULL << 54) +/** + * @brief SA tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_SAMGR (1ULL << 55) +/** + * @brief Power manager tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_POWER_MANAGER (1ULL << 56) +/** + * @brief Distributed scheduler tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_SCHEDULER (1ULL << 57) +/** + * @brief Distributed input tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_DISTRIBUTED_INPUT (1ULL << 59) +/** + * @brief Bluetooth tag. + * + * @since 12 + */ +#define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60) + +/** @} */ + +#endif // HIVIEWDFX_HIDEBUG_TYPE_H -- Gitee From d2dd029998d3fc56e656e37d15888fe6b4d19663 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 15 Mar 2024 16:54:24 +0800 Subject: [PATCH 0392/2135] update doc Signed-off-by: shawn_he --- en/native_sdk/dfx/hiappevent.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/en/native_sdk/dfx/hiappevent.h b/en/native_sdk/dfx/hiappevent.h index 532cc3cf..390f952d 100644 --- a/en/native_sdk/dfx/hiappevent.h +++ b/en/native_sdk/dfx/hiappevent.h @@ -502,10 +502,10 @@ void OH_HiAppEvent_DestroyWatcher(HiAppEvent_Watcher* watcher); * the onTrigger callback. * @param timeOut Timeout value, in seconds. If the input value is greater than 0, the system checks the watcher for * newly received events based on the timeout interval. If there are any newly received events, the configured onTrigger - * callback is triggered. - * After the callback is complete, the system checks the watcher for newly received events when the timeout value expires. - * If the input value is less than or equal to 0, the timeout interval is not used as the condition to trigger the - * onTrigger callback. + * callback is triggered. + * After the callback is complete, the system checks the watcher for newly received events when the timeout value + * expires. If the input value is less than or equal to 0, the timeout interval is not used as the condition + * to trigger the onTrigger callback. * @return {@code 0} If the setting is successful; a negative value otherwise. * @since 12 * @version 1.0 -- Gitee From 3bb2b040823584e5e6f0d4217567ae4535b4d6ef Mon Sep 17 00:00:00 2001 From: "Gushuheng (Simon)" Date: Sat, 16 Mar 2024 10:34:11 +0800 Subject: [PATCH 0393/2135] NDK gesture APIs; Signed-off-by: gushuheng --- zh-cn/native_sdk/ace/native_gesture.h | 573 ++++++++++++++++++++++++ zh-cn/native_sdk/ace/native_interface.h | 19 +- 2 files changed, 588 insertions(+), 4 deletions(-) create mode 100644 zh-cn/native_sdk/ace/native_gesture.h diff --git a/zh-cn/native_sdk/ace/native_gesture.h b/zh-cn/native_sdk/ace/native_gesture.h new file mode 100644 index 00000000..51a94bc9 --- /dev/null +++ b/zh-cn/native_sdk/ace/native_gesture.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 提供ArkUI在Native侧的注册手势回调的能力。 + * + * @since 12 + */ + +/** + * @file native_gesture.h + * + * @brief 提供NativeGesture接口的类型定义。 + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_GESTTURE_H +#define ARKUI_NATIVE_GESTTURE_H + +#include "arkui/ui_input_event.h" +#include "arkui/native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief 提供手势组件实例对象定义。 + * + * @since 12 + */ +struct ArkUI_GestureRecognizer; + +/** + * @brief 提供手势打断数据类型对象定义。 + * + * @since 12 + */ +struct ArkUI_GestureInterruptInfo; + +/** + * @brief 提供手势事件数据类型对象定义。 + * + * @since 12 + */ +struct ArkUI_GestureEvent; + +/** + * @brief 定义手势事件类型。 + * + * @since 12 + */ +typedef enum { + /** 手势事件触发。 */ + GESTURE_EVENT_ACTION_ACCEPT = 0x01, + + /** 手势事件更新。 */ + GESTURE_EVENT_ACTION_UPDATE = 0x02, + + /** 手势事件结束。 */ + GESTURE_EVENT_ACTION_END = 0x04, + + /** 手势事件取消。 */ + GESTURE_EVENT_ACTION_CANCEL = 0x08, +} ArkUI_GestureEventActionType; + +/** + * @brief 定义手势事件类型集合 + * + * 例:ArkUI_GestureEventActionTypeMask actions = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE;\n + * + * @since 12 + */ +typedef uint32_t ArkUI_GestureEventActionTypeMask; + +/** + * @brief 定义手势事件模式 + * + * @since 12 + */ +typedef enum { + /** 正常手势。 */ + NORMAL = 0, + + /** 高优先级手势。 */ + PRIORITY = 1, + + /** 并发手势。 */ + PARALLEL = 2, +} ArkUI_GesturePriority; + +/** + * @brief 定义手势组事件模式。 + * + * @since 12 + */ +typedef enum { + /* 顺序手势模式,按照注册顺序识别手势,直到所有手势识别成功。若有识别失败,后续识别均失败。仅有最后一个手势响应结束事件。*/ + SEQUENCE_GROUP = 0, + + /** 并发手势模式,注册的手势同时识别,直到所有手势识别结束,手势识别互相不影响。*/ + PARALLEL_GROUP = 1, + + /** 互斥手势模式,注册的手势同时识别,若有一个手势识别成功,则结束手势识别。*/ + EXCLUSIVE_GROUP = 2, +} ArkUI_GroupGestureMode; + +/** + * @brief 定义滑动手势方向。 + * + * @since 12 + */ +typedef enum { + /** 所有方向。*/ + GESTURE_DIRECTION_ALL = 0b1111, + + /** 水平方向。*/ + GESTURE_DIRECTION_HORIZONTAL = 0b0011, + + /** 竖直方向。*/ + GESTURE_DIRECTION_VERTICAL = 0b1100, + + /** 向左方向。*/ + GESTURE_DIRECTION_LEFT = 0b0001, + + /** 向右方向。*/ + GESTURE_DIRECTION_RIGHT = 0b0010, + + /** 向上方向。*/ + GESTURE_DIRECTION_UP = 0b0100, + + /** 向下方向。*/ + GESTURE_DIRECTION_DOWN = 0b1000, + + /** 任何方向都不触发手势事件。*/ + GESTURE_DIRECTION_NONE = 0, +} ArkUI_GestureDirection; + +/** + * @brief 定义滑动手势方向集合。 + * + * 例:ArkUI_GestureDirectionMask directions = GESTURE_DIRECTION_LEFT | GESTURE_DIRECTION_RIGHT。\n + * directions 表明支持左右水平方向。\n + * + * @since 12 + */ +typedef uint32_t ArkUI_GestureDirectionMask; + +/** + * @brief 定义手势屏蔽模式 + * + * @since 12 + */ +typedef enum { + /** 不屏蔽子组件的手势,按照默认手势识别顺序进行识别。*/ + NORMAL_GESTURE_MASK = 0, + + /** 屏蔽子组件的手势,包括子组件上系统内置的手势。*/ + IGNORE_INTERNAL_GESTURE_MASK, +} ArkUI_GestureMask; + +/** + * @brief 定义手势类型 + * + * @since 12 + */ +typedef enum { + /** 敲击手势。*/ + TAP_GESTURE = 0, + + /** 长按手势。*/ + LONG_PRESS_GESTURE, + + /** 拖动手势。*/ + PAN_GESTURE, + + /** 捏合手势。*/ + PINCH_GESTURE, + + /** 旋转手势。*/ + ROTATION_GESTURE, + + /** 滑动手势。*/ + SWIPE_GESTURE, + + /** 手势组合。*/ + GROUP_GESTURE, +} ArkUI_GestureRecognizerType; + +/** + * @brief 定义手势打断结果。 + * + * @since 12 + */ +typedef enum { + /** 手势继续。*/ + GESTURE_INTERRUPT_RESULT_CONTINUE = 0, + + /** 手势打断。*/ + GESTURE_INTERRUPT_RESULT_REJECT, +} ArkUI_GestureInterruptResult; + +/** +* @brief 判断是否组件内置手势。 +* +* @param event 手势打断回调事件。 +* @return true: 系统内置手势; +* false: 非系统内置手势。 +* @since 12 +*/ +bool OH_ArkUI_GestureInterruptInfo_GetSystemFlag(const ArkUI_GestureInterruptInfo* event); + +/** +* @brief 返回被打断的手势指针。 +* +* @param event 打断回调事件。 +* @return 被打断的手势指针。 +* @since 12 +*/ +ArkUI_GestureRecognizer* OH_ArkUI_GestureInterruptInfo_GetRecognizer(const ArkUI_GestureInterruptInfo* event); + +/** +* @brief 返回打断的手势事件数据。 +* +* @param event 打断回调事件。 +* @return 打断的手势事件数据。 +* @since 12 +*/ +ArkUI_GestureEvent* OH_ArkUI_GestureInterruptInfo_GetGestureEvent(const ArkUI_GestureInterruptInfo* event); + +/** +* @brief 返回手势事件类型。 +* +* @param event 手势事件。 +* @return 手势事件类型。 +* @since 12 +*/ +ArkUI_GestureEventActionType OH_ArkUI_GestureEvent_GetActionType(const ArkUI_GestureEvent* event); + +/** +* @brief 返回手势输入。 +* +* @param event 手势事件。 +* @return 手势事件的原始输入事件。 +* @since 12 +*/ +const ArkUI_UIInputEvent* OH_ArkUI_GestureEvent_GetRawInputEvent(const ArkUI_GestureEvent* event); + +/** +* @brief 返回长按手势定时触发次数。 +* +* @param event 手势事件。 +* @return 长按手势定时触发次数。 +* @since 12 +*/ +int32_t OH_ArkUI_LongPress_GetRepeatNum(const ArkUI_GestureEvent* event); + +/** +* @brief 滑动手势返回手势主方向速度。 +* +* @param event 手势事件。 +* @return 当前手势主方向速度,为xy轴方向速度的平方和的算数平方根,单位px/秒。 +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetVelocity(const ArkUI_GestureEvent* event); + +/** +* @brief 滑动手势返回当前手势的x轴方向速度。 +* +* @param event 手势事件。 +* @return 当前手势的x轴方向速度,单位px/秒。 +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetVelocityX(const ArkUI_GestureEvent* event); + +/** +* @brief 滑动手势返回当前手势的y轴方向速度。 +* +* @param event 手势事件。 +* @return 当前手势的y轴方向速度,单位px/秒。 +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetVelocityY(const ArkUI_GestureEvent* event); + +/** +* @brief 滑动手势返回当前手势事件x轴相对偏移量。 +* +* @param event 手势事件。 +* @return 当前手势事件x轴相对偏移量,单位为px。 +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetOffsetX(const ArkUI_GestureEvent* event); + +/** +* @brief 滑动手势返回当前手势事件y轴相对偏移量。 +* +* @param event 手势事件。 +* @return 当前手势事件y轴相对偏移量,单位为px。 +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetOffsetY(const ArkUI_GestureEvent* event); + +/** +* @brief 滑动手势返回当前手势事件角度信息。 +* +* 角度计算方式:滑动手势被识别到后,连接两根手指之间的线被识别为起始线条,随着手指的滑动,手指之间的线条会发生旋转,\n +* 根据起始线条两端点和当前线条两端点的坐标,使用反正切函数分别计算其相对于水平方向的夹角,\n +* 最后arctan2(cy2-cy1,cx2-cx1)-arctan2(y2-y1,x2-x1)为旋转的角度。\n +* 以起始线条为坐标系,顺时针旋转为0到180度,逆时针旋转为-180到0度。\n +* +* @param event 手势事件。 +* @return 滑动手势的角度,即两根手指间的线段与水平方向的夹角变化的度数。 +* @since 12 +*/ +float OH_ArkUI_SwipeGesture_GetAngle(const ArkUI_GestureEvent* event); + +/** +* @brief 滑动手势场景中所有手指滑动平均速度。 +* +* @param event 手势事件。 +* @return 滑动手势速度,即所有手指滑动的平均速度,单位为px/秒。 +* @since 12 +*/ +float OH_ArkUI_SwipeGesture_GetVelocity(const ArkUI_GestureEvent* event); + +/** +* @brief 旋转手势返回当前手势事件角度信息。 +* +* @param event 手势事件。 +* @return 旋转角度。 +* @since 12 +*/ +float OH_ArkUI_RotationGesture_GetAngle(const ArkUI_GestureEvent* event); + +/** +* @brief 捏合手势返回当前手势事件缩放信息。 +* +* @param event 手势事件。 +* @return 缩放比例。 +* @since 12 +*/ +float OH_ArkUI_PinchGesture_GetScale(const ArkUI_GestureEvent* event); + +/** +* @brief 捏合手势中心点相对于当前组件元素左上角x轴坐标。 +* +* @param event 手势事件。 +* @return 捏合手势中心点相对于当前组件元素左上角x轴坐标,单位为px。 +* @since 12 +*/ +float OH_ArkUI_PinchGesture_GetCenterX(const ArkUI_GestureEvent* event); + +/** +* @brief 捏合手势中心点相对于当前组件元素左上角y轴坐标。 +* +* @param event 手势事件。 +* @return 捏合手势中心点相对于当前组件元素左上角y轴坐标,单位为px。 +* @since 12 +*/ +float OH_ArkUI_PinchGesture_GetCenterY(const ArkUI_GestureEvent* event); + +/** + * @brief 手势模块接口集合。 + * + * @since 12 + */ +typedef struct { + /** 结构版本号 = 1。*/ + int32_t version; + + /** + * @brief 创建敲击手势。 + * + * 1. 支持单击、双击和多次点击事件的识别。\n + * 2. 当配置多击时,上一次的最后一根手指抬起和下一次的第一根手指按下的超时时间为300毫秒。\n + * 3. 当上次点击的位置与当前点击的位置距离超过60vp等效像素点时,手势识别失败。\n + * 4. 当配置多指时,第一根手指按下后300毫秒内未有足够的手指数按下,手势识别失败,\n + * 第一根手指抬起后300毫秒内未有足够的手指抬起,手势识别失败。\n + * 5. 实际点击手指数超过配置值,手势识别成功。\n + * + * @param countNum 识别的连续点击次数。当设置的值小于1或不设置时,会被转化为默认值 1。 + * @param fingersNum 触发点击的手指数,最小为1指, 最大为10指。当设置小于1的值或不设置时,会被转化为默认值 1。 + * @return 返回创建的敲击手势指针。 + */ + ArkUI_GestureRecognizer* (*createTapGesture)(int32_t countNum, int32_t fingersNum); + + /** + * @brief 创建长按手势。 + * + * 1. 用于触发长按手势事件,触发长按手势的最少手指数为1,最短长按时间为500毫秒。\n + * 2. 当组件默认支持可拖拽时,如Text、TextInput、TextArea、HyperLink、Image和RichEditor等组件。\n + * 长按手势与拖拽会出现冲突,事件优先级如下:\n + * 长按触发时间 < 500ms,长按事件优先拖拽事件响应。\n + * 长按触发时间 >= 500ms,拖拽事件优先长按事件响应。\n + * 3. 手指按下后若发生超过15px的移动,则判定当前长按手势识别失败。\n + * + * @param fingersNum 触发长按的最少手指数,最小为1指, 最大取值为10指。 + * @param repeatResult 是否连续触发事件回调。 + * @param durationNum 触发长按的最短时间,单位为毫秒(ms)。设置小于等于0时,按照默认值500处理。 + * @return 返回创建的敲击手势指针。 + */ + ArkUI_GestureRecognizer* (*createLongPressGesture)(int32_t fingersNum, bool repeatResult, int32_t durationNum); + + /** + * @brief 创建拖动手势。 + * + * 1. 当滑动的最小距离超过设定的最小值时触发拖动手势事件。\n + * 2. Tabs组件滑动与该拖动手势事件同时存在时,可将distanceNum值设为1,使拖动更灵敏,避免造成事件错乱。\n + * + * @param fingersNum 用于指定触发拖动的最少手指数,最小为1指,最大取值为10指。当设置的值小于1或不设置时,会被转化为默认值 1。 + * @param directions 用于指定触发拖动的手势方向,此枚举值支持逻辑与(&)和逻辑或(|)运算。 + * @param distanceNum 用于指定触发拖动手势事件的最小拖动距离,单位为px。当设定的值小于等于0时,按默认值5px处理。 + * @return 返回创建的拖动手势指针。 + */ + ArkUI_GestureRecognizer* (*createPanGesture)( + int32_t fingersNum, ArkUI_GestureDirectionMask directions, double distanceNum); + + /** + * @brief 创建捏合手势。 + * + * 1. 触发捏合手势的最少手指为2指,最大为5指,最小识别距离为distanceNum 像素点。\n + * 2. 触发手势手指可以多于fingersNum数目,但只有先落下的与fingersNum相同数目的手指参与手势计算。\n + * + * @param fingersNum 触发捏合的最少手指数, 最小为2指,最大为5指。默认值:2。 + * @param distanceNum 最小识别距离,单位为px。当设置识别距离的值小于等于0时,会被转化为默认值5px处理。 + * @return 返回创建的手势指针。 + */ + ArkUI_GestureRecognizer* (*createPinchGesture)(int32_t fingersNum, double distanceNum); + + /** + * @brief 创建旋转手势。 + * + * 1. 触发旋转手势的最少手指为2指,最大为5指,最小改变度数为1度。\n + * 2. 触发手势手指可以多于fingers数目,但只有先落下的两指参与手势计算。\n + * + * @param fingersNum 触发旋转的最少手指数, 最小为2指,最大为5指。默认值:2。 + * @param angleNum 触发旋转手势的最小改变度数,单位为deg。默认值:1。当改变度数的值小于等于0或大于360时,会被转化为默认值 1。 + * @return 返回创建的手势指针。 + */ + ArkUI_GestureRecognizer* (*createRotationGesture)(int32_t fingersNum, double angleNum); + + /** + * @brief 创建滑动手势。 + * + * 1. 用于触发滑动事件,滑动速度大于speedNum px/s时可识别成功。\n + * + * @param fingersNum 触发滑动的最少手指数,默认为1,最小为1指,最大为10指。 + * @param directions 触发滑动手势的滑动方向。 + * @param speedNum 识别滑动的最小速度,单位 px/s。当设置滑动速度的值小于等于0时,会被转化为默认值100px/s。 + * @return 返回创建的手势指针。 + */ + ArkUI_GestureRecognizer* (*createSwipeGesture)( + int32_t fingersNum, ArkUI_GestureDirectionMask directions, double speedNum); + + /** + * @brief 创建手势组。 + * + * @param gestureMode 手势组模式。 + * @return 返回创建的手势组指针。 + */ + ArkUI_GestureRecognizer* (*createGroupGesture)(ArkUI_GroupGestureMode gestureMode); + + /** + * @brief 销毁手势,释放资源。 + * + * @param recognizer 需要被销毁的手势。 + */ + void (*dispose)(ArkUI_GestureRecognizer* recognizer); + + /** + * @brief 手势组增加子手势。 + * + * @param group 需要被关联子手势的手势组。 + * @param child 子手势。 + * @return 0 - 成功。 + * 401 - 参数错误。比如添加手势到非手势组对象内。 + */ + int32_t (*addChildGesture)(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child); + + /** + * @brief 删除子手势。 + * + * @param group 需要被删除子手势的手势组。 + * @param child 子手势。 + * @return 0 - 成功。 + * 401 - 参数错误。 + */ + int32_t (*removeChildGesture)(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child); + + /** + * @brief 创建手势关联回调方法。 + * + * @param recognizer 需要被绑定回调事件的各类手势指针。 + * @param actionTypeMask 需要相应的手势事件类型集合,一次性可以注册多个回调,在回调中区分回调事件类型。 + * 例:actionTypeMask = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE; + * @param extraParams targetReceiver 回调时传入的上下文数据。 + * @param targetReceiver 对应注册手势类型的事件回调处理, event 返回手势回调数据。 + * @return 0 - 成功。 + * 401 - 参数错误。 + */ + int32_t (*setGestureEventTarget)( + ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventActionTypeMask actionTypeMask, void* extraParams, + void (*targetReceiver)(ArkUI_GestureEvent* event, void* extraParams)); + + /** + * @brief 将手势添加到UI组件。 + * + * @param node 需要被绑定手势的ARKUI组件。 + * @param recognizer 绑定此节点的手势。 + * @param mode 标识此手势的模式(NORMAL_GESTURE, PARALLEL_GESTURE, PRIORITY_GESTURE)。 + * @param mask 手势屏蔽模式。 + * @return 0 - 成功。 + * 401 - 参数错误。 + */ + int32_t (*addGestureToNode)( + ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer, ArkUI_GesturePriority mode, ArkUI_GestureMask mask); + + /** + * @brief 在节点中移除手势。 + * + * @param node 需要被移除手势的节点。 + * @param recognizer 需要被移除的手势。 + * @return 0 - 成功。 + * 401 - 参数错误。 + */ + int32_t (*removeGestureFromNode)(ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer); + + /** + * @brief 设置节点手势打断回调。 + * + * @param node 需要被设置手势打断回调的ARKUI节点。 + * @param interrupter 打断回调, info 返回手势打断数据。 + * interrupter 返回 GESTURE_INTERRUPT_RESULT_CONTINUE, 手势正常进行; + 返回 GESTURE_INTERRUPT_RESULT_REJECT 手势打断。 + * @return 0 - 成功。 + * 401 - 参数错误。 + */ + int32_t (*setGestureInterrupterToNode)( + ArkUI_NodeHandle node, ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info)); + + /** + * @brief 获取手势类别。 + * + * @param recognizer 手势指针。 + * @return 手势类型。 + */ + ArkUI_GestureRecognizerType (*getGestureType)(ArkUI_GestureRecognizer* recognizer); +} ArkUI_NativeGestureAPI_1; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_GESTTURE_H +/** @} */ \ No newline at end of file diff --git a/zh-cn/native_sdk/ace/native_interface.h b/zh-cn/native_sdk/ace/native_interface.h index fac14071..e2daccf6 100644 --- a/zh-cn/native_sdk/ace/native_interface.h +++ b/zh-cn/native_sdk/ace/native_interface.h @@ -63,6 +63,8 @@ typedef struct { typedef enum { /** UI组件相关接口类型。*/ ARKUI_NATIVE_NODE, + /** 手势相关接口类型。*/ + ARKUI_NATIVE_GESTURE, /** 弹窗相关接口类型. */ ARKUI_NATIVE_DIALOG, } ArkUI_NativeAPIVariantKind; @@ -70,7 +72,7 @@ typedef enum { /** * @brief 定义ARKUI_NATIVE_NODE类型支持的版本号信息。 * - * @since 12 + * @since 12 */ typedef enum { /** ARKUI_NATIVE_NODE类型支持版本1的结构体{@link ArkUI_NativeNodeAPI_1}。*/ @@ -80,7 +82,7 @@ typedef enum { /** * @brief 获取指定版本的Native接口集合。 * - * @param type ArkUI提供的Native接口集合大类,例如UI组件接口类:ARKUI_NATIVE_NODE。 + * @param type ArkUI提供的Native接口集合大类,例如UI组件接口类:ARKUI_NATIVE_NODE, 手势类:ARKUI_NATIVE_GESTURE。 * @param version native接口结构体的版本信息,通过结构体定义的后缀获得,如版本1的UI组件结构体:ArkUI_NativeNodeAPI_1。 * @return ArkUI_AnyNativeAPI* 返回携带版本的Native接口抽象对象。 * @code {.cpp} @@ -91,6 +93,10 @@ typedef enum { * if (anyNativeAPI->version == 1) { * auto basicNodeApi = reinterpret_cast(anyNativeAPI); * } + * auto anyGestureAPI = OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_GESTURE, 1); + * if (anyNativeAPI->version == 1) { + * auto basicGestureApi = reinterpret_cast(anyGestureAPI); + * } * @endcode * @deprecated 从12版本开始废弃,使用{@link OH_ArkUI_QueryModuleInterface}接口替代。 * @since 12 @@ -100,8 +106,9 @@ ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32 /** * @brief 获取指定版本的Native模块接口集合。 * - * @param type ArkUI提供的Native接口集合大类,例如UI组件接口类:ARKUI_NATIVE_NODE。 - * @param version native接口结构体的版本信息,通过结构体支持的版本枚举获得,如ARKUI_NATIVE_NODE的可用版本{@link ArkUI_NativeNodeAPIVersion}。 + * @param type ArkUI提供的Native接口集合大类,例如UI组件接口类:ARKUI_NATIVE_NODE, 手势类:ARKUI_NATIVE_GESTURE。 + * @param version native接口结构体的版本信息,通过结构体支持的版本枚举获得,如ARKUI_NATIVE_NODE的可用版本 + * {@link ArkUI_NativeNodeAPIVersion}。ARKUI_NATIVE_GESTURE的可用版本{@link ArkUI_NativeGestureAPI_1}。 * @return ArkUI_AnyNativeAPI* 返回携带版本的Native接口抽象对象。 * @code {.cpp} * #include @@ -111,6 +118,10 @@ ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32 * if (anyNativeAPI->version == ARKUI_NATIVE_NODE_VERSION_1) { * auto nativeNodeApi = reinterpret_cast(anyNativeAPI); * } + * auto anyGestureAPI = OH_ArkUI_QueryModuleInterface(ARKUI_NATIVE_GESTURE, 1); + * if (anyNativeAPI->version == 1) { + * auto basicGestureApi = reinterpret_cast(anyGestureAPI); + * } * @endcode * * @since 12 -- Gitee From 2aecba44de73c5295a5ecb27bb29b22565270a24 Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Mon, 18 Mar 2024 14:56:27 +0800 Subject: [PATCH 0394/2135] Update docs (0318) Signed-off-by: ester.zhou --- en/native_sdk/ace/native_dialog.h | 20 + en/native_sdk/ace/native_gesture.h | 616 +++++++++++++++++++++++++++ en/native_sdk/ace/native_interface.h | 30 +- 3 files changed, 656 insertions(+), 10 deletions(-) create mode 100644 en/native_sdk/ace/native_gesture.h diff --git a/en/native_sdk/ace/native_dialog.h b/en/native_sdk/ace/native_dialog.h index 437f1320..3cff73df 100644 --- a/en/native_sdk/ace/native_dialog.h +++ b/en/native_sdk/ace/native_dialog.h @@ -13,6 +13,26 @@ * limitations under the License. */ +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief Provides UI capabilities of ArkUI on the native side, such as UI component creation and destruction, + * tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_dialog.h + * + * @brief Defines a set of custom dialog box APIs of the ArkUI on the native side. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + #ifndef ARKUI_NATIVE_DIALOG_H #define ARKUI_NATIVE_DIALOG_H diff --git a/en/native_sdk/ace/native_gesture.h b/en/native_sdk/ace/native_gesture.h new file mode 100644 index 00000000..999f6e63 --- /dev/null +++ b/en/native_sdk/ace/native_gesture.h @@ -0,0 +1,616 @@ +/* + * 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 Defines APIs for ArkUI to register gesture callbacks on the native side. + * + * @since 12 + */ + +/** + * @file native_gesture.h + * + * @brief Provides type definitions for NativeGesture APIs. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_GESTTURE_H +#define ARKUI_NATIVE_GESTTURE_H + +#include "arkui/ui_input_event.h" +#include "arkui/native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines a gesture recognizer. + * + * @since 12 + */ +struct ArkUI_GestureRecognizer; + +/** + * @brief Defines the gesture interruption information. + * + * @since 12 + */ +struct ArkUI_GestureInterruptInfo; + +/** + * @brief Defines the gesture event. + * + * @since 12 + */ +struct ArkUI_GestureEvent; + +/** + * @brief Enumerates gesture event types. + * + * @since 12 + */ +typedef enum { + /** Triggered. */ + GESTURE_EVENT_ACTION_ACCEPT = 0x01, + + /** Updated. */ + GESTURE_EVENT_ACTION_UPDATE = 0x02, + + /** Ended. */ + GESTURE_EVENT_ACTION_END = 0x04, + + /** Canceled. */ + GESTURE_EVENT_ACTION_CANCEL = 0x08, +} ArkUI_GestureEventActionType; + +/** + * @brief Defines a set of gesture event types. + * + * Example: ArkUI_GestureEventActionTypeMask actions = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE;\n + * + * @since 12 + */ +typedef uint32_t ArkUI_GestureEventActionTypeMask; + +/** + * @brief Enumerates gesture event modes. + * + * @since 12 + */ +typedef enum { + /** Normal. */ + NORMAL = 0, + + /** High-priority. */ + PRIORITY = 1, + + /** Parallel. */ + PARALLEL = 2, +} ArkUI_GesturePriority; + +/** + * @brief Enumerates gesture group modes. + * + * @since 12 + */ +typedef enum { + /* Sequential recognition. Gestures are recognized in the registration sequence until all gestures are recognized + * successfully. Once one gesture fails to be recognized, all subsequent gestures fail to be recognized. + * Only the last gesture in the gesture group can respond to the end event. */ + SEQUENCE_GROUP = 0, + + /** Parallel recognition. Registered gestures are recognized concurrently until all gestures are recognized. + * The recognition result of each gesture does not affect each other. */ + PARALLEL_GROUP = 1, + + /** Exclusive recognition. Registered gestures are identified concurrently. + * If one gesture is successfully recognized, gesture recognition ends. */ + EXCLUSIVE_GROUP = 2, +} ArkUI_GroupGestureMode; + +/** + * @brief Enumerates gesture directions. + * + * @since 12 + */ +typedef enum { + /** All directions. */ + GESTURE_DIRECTION_ALL = 0b1111, + + /** Horizontal direction. */ + GESTURE_DIRECTION_HORIZONTAL = 0b0011, + + /** Vertical direction. */ + GESTURE_DIRECTION_VERTICAL = 0b1100, + + /** Leftward. */ + GESTURE_DIRECTION_LEFT = 0b0001, + + /** Rightward. */ + GESTURE_DIRECTION_RIGHT = 0b0010, + + /** Upward. */ + GESTURE_DIRECTION_UP = 0b0100, + + /** Downward. */ + GESTURE_DIRECTION_DOWN = 0b1000, + + /** None. */ + GESTURE_DIRECTION_NONE = 0, +} ArkUI_GestureDirection; + +/** + * @brief Defines a set of gesture directions. + * + * Example: ArkUI_GestureDirectionMask directions = GESTURE_DIRECTION_LEFT | GESTURE_DIRECTION_RIGHT \n + * This example indicates that the leftward and rightward directions are supported. \n + * + * @since 12 + */ +typedef uint32_t ArkUI_GestureDirectionMask; + +/** + * @brief Enumerates gesture masking modes. + * + * @since 12 + */ +typedef enum { + /** The gestures of child components are enabled and recognized based on the default gesture recognition sequence.*/ + NORMAL_GESTURE_MASK = 0, + + /** The gestures of child components are disabled, including the built-in gestures. */ + IGNORE_INTERNAL_GESTURE_MASK, +} ArkUI_GestureMask; + +/** + * @brief Enumerates gesture types. + * + * @since 12 + */ +typedef enum { + /** Tap. */ + TAP_GESTURE = 0, + + /** Long press. */ + LONG_PRESS_GESTURE, + + /** Pan. */ + PAN_GESTURE, + + /** Pinch. */ + PINCH_GESTURE, + + /** Rotate. */ + ROTATION_GESTURE, + + /** Swipe. */ + SWIPE_GESTURE, + + /** A group of gestures. */ + GROUP_GESTURE, +} ArkUI_GestureRecognizerType; + +/** + * @brief Enumerates gesture interruption results. + * + * @since 12 + */ +typedef enum { + /** The gesture recognition process continues. */ + GESTURE_INTERRUPT_RESULT_CONTINUE = 0, + + /** The gesture recognition process is paused. */ + GESTURE_INTERRUPT_RESULT_REJECT, +} ArkUI_GestureInterruptResult; + +/** +* @brief Checks whether a gesture is a built-in gesture of the component. +* +* @param event Indicates the pointer to the gesture interruption information. +* @return Returns true if the gesture is a built-in gesture; returns false otherwise. + +* @since 12 +*/ +bool OH_ArkUI_GestureInterruptInfo_GetSystemFlag(const ArkUI_GestureInterruptInfo* event); + +/** +* @brief Obtains the pointer to interrupted gesture recognizer. +* +* @param event Indicates the pointer to the gesture interruption information. +* @return Returns the pointer to interrupted gesture recognizer. +* @since 12 +*/ +ArkUI_GestureRecognizer* OH_ArkUI_GestureInterruptInfo_GetRecognizer(const ArkUI_GestureInterruptInfo* event); + +/** +* @brief Obtains the pointer to the interrupted gesture event. +* +* @param event Indicates the pointer to the gesture interruption information. +* @return Returns the pointer to the interrupted gesture event. +* @since 12 +*/ +ArkUI_GestureEvent* OH_ArkUI_GestureInterruptInfo_GetGestureEvent(const ArkUI_GestureInterruptInfo* event); + +/** +* @brief Obtains the gesture event type. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the gesture event type. +* @since 12 +*/ +ArkUI_GestureEventActionType OH_ArkUI_GestureEvent_GetActionType(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains gesture input. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the pointer to the input event of the gesture event. +* @since 12 +*/ +const ArkUI_UIInputEvent* OH_ArkUI_GestureEvent_GetRawInputEvent(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the number of times that a long press gesture is triggered periodically. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the number of times that the long press gesture is triggered periodically. +* @since 12 +*/ +int32_t OH_ArkUI_LongPress_GetRepeatNum(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the velocity of a pan gesture along the main axis. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the velocity of the pan gesture along the main axis, in px/s. +* The value is the square root of the sum of the squares of the velocity on the x-axis and y-axis. +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetVelocity(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the velocity of a pan gesture along the x-axis. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the velocity of the pan gesture along the x-axis, in px/s. +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetVelocityX(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the velocity of a pan gesture along the y-axis. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the velocity of the pan gesture along the y-axis, in px/s. +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetVelocityY(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the relative offset of a pan gesture along the x-axis. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the relative offset of the gesture along the x-axis, in px. +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetOffsetX(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the relative offset of a pan gesture along the y-axis. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the relative offset of the gesture along the y-axis, in px. +* @since 12 +*/ +float OH_ArkUI_PanGesture_GetOffsetY(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the angle information of the swipe gesture. +* +* After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. +* As the fingers swipe, the line between the fingers rotates. \n +* Based on the coordinates of the initial line's and current line's end points, the arc tangent function is used to +* calculate the respective included angle of the points relative to the horizontal direction \n +* by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) - arctan2(y2-y1,x2-x1). \n +* The initial line is used as the coordinate system. Values from 0 to 180 degrees represent clockwise rotation, +* while values from –180 to 0 degrees represent counterclockwise rotation. \n +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the angle of the swipe gesture, which is the result obtained based on the aforementioned formula. +* @since 12 +*/ +float OH_ArkUI_SwipeGesture_GetAngle(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the average velocity of all fingers used in the swipe gesture. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the average velocity of all fingers used in the swipe gesture, in px/s. +* @since 12 +*/ +float OH_ArkUI_SwipeGesture_GetVelocity(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the angle information of a rotation gesture. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the rotation angle. +* @since 12 +*/ +float OH_ArkUI_RotationGesture_GetAngle(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the scale ratio of a pinch gesture. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the scale ratio. +* @since 12 +*/ +float OH_ArkUI_PinchGesture_GetScale(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the X coordinate of the center of the pinch gesture, in vp, +* relative to the upper left corner of the current component. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the X coordinate of the center of the pinch gesture, in vp, +* relative to the upper left corner of the current component. +* @since 12 +*/ +float OH_ArkUI_PinchGesture_GetCenterX(const ArkUI_GestureEvent* event); + +/** +* @brief Obtains the Y coordinate of the center of the pinch gesture, in vp, +* relative to the upper left corner of the current component. +* +* @param event Indicates the pointer to the gesture event. +* @return Returns the Y coordinate of the center of the pinch gesture, in vp, +* relative to the upper left corner of the current component. +* @since 12 +*/ +float OH_ArkUI_PinchGesture_GetCenterY(const ArkUI_GestureEvent* event); + +/** + * @brief Defines the gesture APIs. + * + * @since 12 + */ +typedef struct { + /** The struct version is 1. */ + int32_t version; + + /** + * @brief Creates a tap gesture. + * + * 1. This API is used to trigger a tap gesture with one, two, or more taps. \n + * 2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n + * 3. If the distance between the last tapped position and the current tapped position exceeds 60 vp, + * gesture recognition fails. \n + * 4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers + * touching the screen within 300 ms of the first finger touch is less than the required number, \n + * or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted + * is less than the required number. \n + * 5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n + * + * @param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, + * the default value 1 is used. + * @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges + * from 1 to 10. If the value is less than 1 or is not set, the default value 1 is used. + * @return Returns the pointer to the created gesture. + */ + ArkUI_GestureRecognizer* (*createTapGesture)(int32_t countNum, int32_t fingersNum); + + /** + * @brief Creates a long press gesture. + * + * 1. This API is used to trigger a long press gesture, which requires one or more fingers with a minimum + * The value ranges 500 ms hold-down time. \n + * 2. In components that support drag actions by default, such as , , + *