diff --git a/Readme-CN.md b/Readme-CN.md index 79e01a45041928659dc02a82a4893145401c6ea6..7405516a982a4d744139f6da517d5585a7e5e225 100755 --- a/Readme-CN.md +++ b/Readme-CN.md @@ -6,18 +6,18 @@ ## 文档目录结构 -- quick-start:[快速入门](quick-start/Readme-CN.md) -- get-code:[获取源码/获取工具](get-code/Readme-CN.md) -- driver:[驱动](driver/Readme-CN.md) -- kernel:[内核](kernel/Readme-CN.md) -- subsystems:[子系统](subsystems/Readme-CN.md) -- bundles:[组件开发](bundles/Readme-CN.md) -- guide:[设备开发](guide/Readme-CN.md) -- security:[安全](security/Readme-CN.md) -- api-LinkIoT:[联接类模组API](api/api-LinkIoT/Readme-CN.md) -- api-SmartVision-Devices:[智慧视觉设备API](api/api-SmartVision-Devices/Readme-CN.md) -- contribute:[贡献](contribute/参与贡献.md) -- term:[术语](term/术语.md) +- quick-start:[快速入门](quick-start/Readme-CN.md) +- get-code:[获取源码/获取工具](get-code/Readme-CN.md) +- driver:[驱动](driver/Readme-CN.md) +- kernel:[内核](kernel/Readme-CN.md) +- subsystems:[子系统](subsystems/Readme-CN.md) +- bundles:[组件开发](bundles/Readme-CN.md) +- guide:[设备开发](guide/Readme-CN.md) +- security:[安全](security/Readme-CN.md) +- api-LinkIoT:[联接类模组API](api/api-LinkIoT/Readme-CN.md) +- api-SmartVision-Devices:[智慧视觉设备API](api/api-SmartVision-Devices/Readme-CN.md) +- contribute:[贡献](contribute/参与贡献.md) +- term:[术语](term/术语.md) ## 贡献 @@ -26,4 +26,3 @@ 您可以对现有文档进行评价、简单更改、反馈文档质量问题、贡献您的原创内容,详细请参考[贡献文档](contribute/贡献文档.md)。 卓越贡献者将会在开发者社区文档贡献专栏表彰公示。 - diff --git a/api/api-LinkIoT/Broadcast.md b/api/api-LinkIoT/Broadcast.md index c7f2897538dbbe7d5d5e1d7d42bc7cc9fea65864..dc33012242f117f67128f3c14885ef63b885b0da 100755 --- a/api/api-LinkIoT/Broadcast.md +++ b/api/api-LinkIoT/Broadcast.md @@ -37,7 +37,7 @@ With this module, the [Service](Service.md), [Feature](Feature.md), or other m

Subscriber

-

Defines the subscriber for external interfaces to subsribe to events and data of a topic.

+

Defines the subscriber for external interfaces to subscribe to events and data of a topic.

diff --git "a/api/api-LinkIoT/IOT\306\275\314\250.md" b/api/api-LinkIoT/IOT.md old mode 100755 new mode 100644 similarity index 100% rename from "api/api-LinkIoT/IOT\306\275\314\250.md" rename to api/api-LinkIoT/IOT.md diff --git "a/bundles/\345\217\221\350\241\214\347\211\210.md" "b/bundles/\345\217\221\350\241\214\347\211\210.md" index 00640e559945546ce8b17badb65e388934290751..b2c470cbd1b88295ddf64668d62ea51069baeecb 100755 --- "a/bundles/\345\217\221\350\241\214\347\211\210.md" +++ "b/bundles/\345\217\221\350\241\214\347\211\210.md" @@ -18,7 +18,7 @@ 编译执行使用如下命令: ``` -hpm dist +hpm dist ``` 重新定义一个发行版所具有的功能是一个复杂的过程,所以系统允许对发行版进行继承,从而在现有功能的基础上进行定制。继承发行版需要在bundle.json中定义base字段。 @@ -53,4 +53,3 @@ hpm dist ``` 依赖被移除后,就不会参入组件的构建过程。只有标记为可选的依赖才能够被移除,强行移除未被标记的依赖会出现错误提示。 - diff --git a/contribute/OpenHarmony-JavaScript-coding-style-guide.md b/contribute/OpenHarmony-JavaScript-coding-style-guide.md index 32ee51d4ca0e942c14b38945fa38e5c084dcb990..074ee9ba77c4ecbd15967dc9d4f7a74a6aaa7950 100755 --- a/contribute/OpenHarmony-JavaScript-coding-style-guide.md +++ b/contribute/OpenHarmony-JavaScript-coding-style-guide.md @@ -694,7 +694,7 @@ console.log(sum2); // 输出:0.6。所以对于二进制浮点数,(a + b) + ```javascript const arr1 = new Array(x1, x2, x3); const arr2 = new Array(x1, x2); -const arr3 = new Array(x3); +const arr3 = new Array(x1); const arr4 = new Array(); ``` @@ -751,7 +751,7 @@ for (let number in numbers) { ```javascript let numbers = [1, 2, 3, 4]; let sum = 0; -for (let number in numbers) { +for (let number of numbers) { sum += number; } // sum === 10 diff --git a/contribute/faq-template.md b/contribute/faq-template.md new file mode 100644 index 0000000000000000000000000000000000000000..6ded2b7b48211d84ebbaa554c0a8329b6c540071 --- /dev/null +++ b/contribute/faq-template.md @@ -0,0 +1,36 @@ +# FAQ:标题(简要描述问题关键信息) + +FAQ页面介绍开发过程中遇到的各类问题及解决方法,帮助更多开发者快速消除此类开发障碍。 + +## 简单类问题写作模板 + +简要描述在完成哪些操作时,遇到的问题现象,以及解决方法。 + +## 复杂类问题写作模板 + +**现象描述** + +- 使用的系统软件、硬件版本? +- 在完成哪些操作时,遇到了什么样的问题? + +- 可能显示什么错误消息? + +- 如果可能,请提供屏幕截图。 + + +**可能原因** + +分析哪些原因导致此问题,如果有多个原因,请使用项目列表一一列举。 + +1. XXX +2. XXX + +**处理步骤** + +- 如果有多个解决方案,请按照复杂性排序,并提供什么场景下选择哪种解决方案。 +- 如果可能,请提供屏幕截图,帮助理解步骤完成标准。 +- 代码如有打印输出,请提示打印输出内容_,帮助理解步骤完成标准_。 + +1. XXX +2. XXX + diff --git a/contribute/tutorial-title-task-name.md b/contribute/tutorial-title-task-name.md new file mode 100644 index 0000000000000000000000000000000000000000..c3d29f63c70dc14424a3607a462e5e55899eca06 --- /dev/null +++ b/contribute/tutorial-title-task-name.md @@ -0,0 +1,48 @@ +# 教程:标题(对应的任务名称) + +教程页面介绍如何完成一个复杂的任务开发、功能开发、APP开发。通常教程页面会将开发过程拆解为多个小节,每个小节由一系列步骤组成。同时,教程中一般需要提供代码示例并进行介绍,便于用户了解具体的功能实现。 + +对于教程中可能涉及到的基本概念,简单的概念可以直接介绍,更深度的概念和主题推荐查阅文档对应专题。 + +撰写教程页面时,在“others“目录下面创建新的MarkDown文件。 + +## 总览 + +_写作内容:介绍开发者学习本教程后将完成什么样的任务,实现什么样的功能和效果。__例如,可以是移植教程、实现一个功能开发教程等。_如果可实现多个目标,建议使用项目符号列表。 + +_如果可能,请提供图片或短视频展示实现效果。_ + +## 开发准备 + +- _完成该功能需要的软件、硬件、工具及对应版本信息。_ +- _需要获取的相关权限说明。_ + +## XXX(关键任务一) + +_将教程分解为几个顺序的关键任务或并列不同的场景任务。_ + +1. XXXX。 + + ``` + //代码示例 + ``` + +2. XXXX。 + +_所有的操作步骤,遵循如下写作要求:_ + +1. _步骤明确操作场景和目的,__步骤中执行的主体要描述清楚。_ +2. _步骤中如果涉及接口调用,需要清晰给出使用的接口及其使用说明,示例代码。_ +3. _涉及到工具界面的步骤,可以提供界面截图,帮助理解步骤完成标准。_ +4. _保证代码的逻辑和语法的正确性。_ +5. _代码中关键步骤要有注释说明。_ +6. 代码如有打印输出,请单独提示打印输出内容_,帮助理解步骤完成标准_。 + +## XXX(关键任务二) + +1. XXXX。 + +## 下一步 + +介绍本教程可能关联的后续开发任务,如果没有请删除此内容。 + diff --git "a/contribute/\347\255\276\347\275\262CLA--\344\270\252\344\272\272\347\213\254\347\253\213\350\264\241\347\214\256\350\200\205.md" "b/contribute/\347\255\276\347\275\262CLA--\344\270\252\344\272\272\347\213\254\347\253\213\350\264\241\347\214\256\350\200\205.md" index 3270e883397957180a65271da123542ec42d5bfb..47e0325c72ec6fcc03d1172a65074acf9ee9f955 100755 --- "a/contribute/\347\255\276\347\275\262CLA--\344\270\252\344\272\272\347\213\254\347\253\213\350\264\241\347\214\256\350\200\205.md" +++ "b/contribute/\347\255\276\347\275\262CLA--\344\270\252\344\272\272\347\213\254\347\253\213\350\264\241\347\214\256\350\200\205.md" @@ -1,6 +1,6 @@ # 签署CLA--个人独立贡献者 -通过签署贡献协议(“本协议”),签署的“贡献者”同意接受“本协议”并受“本协议”约束。“本协议”适用于“贡献者”提交给OpenHarmony区 (“社区”)的全部项目(后称“项目”)的“贡献”,无论“贡献”是在签署日期之前,签署时还是之后提供。 +通过签署贡献协议(“本协议”),签署的“贡献者”同意接受“本协议”并受“本协议”约束。“本协议”适用于“贡献者”提交给OpenHarmony社区 (“社区”)的全部项目(后称“项目”)的“贡献”,无论“贡献”是在签署日期之前,签署时还是之后提供。 **“贡献”** 是指受版权法保护的,由“贡献者”有意“提交”以包含在“项目”所分发软件中任何作品。“提交”是指以电子,口头或书面交流的任何形式送给“社区”管理方(即开放原子开源基金会)或其代表,包括但不限于“社区”管理方为管理的为讨论和改进项目所提供的电子邮件列表上的交流,源代码控制系统以及由“社区”管理方或其代表管理的问题跟踪系统,但不包括由“我”明确标记或以书面形式指定为“非贡献”的交流。 diff --git "a/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" "b/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" index 6c7530085e8f2c3cdab30fed87b0508cd2546dea..ce6d44c138c302186c604bdbbe4502142b1a1ff8 100755 --- "a/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" +++ "b/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" @@ -52,8 +52,8 @@ 鼓励开发者在学习、开发过程中,总结经验并创建技术内容帮助更多开发者快速上手。推荐输出各类How to教程、常见问题FAQ等。请参考如下写作模板: -- [How to教程](zh-cn_topic_0000001050785644.md) -- [FAQ](zh-cn_topic_0000001051065413.md) +- [How to教程](tutorial-title-task-name.md) +- [FAQ](faq-template.md) 内容写作模板归档在Docs文档仓下contribute文件夹中。 diff --git "a/contribute/\350\264\241\347\214\256\346\265\201\347\250\213.md" "b/contribute/\350\264\241\347\214\256\346\265\201\347\250\213.md" index 985ea98861f90e8adc8722c3e3727315ab8f3fdc..c3774e1e1bce08a91dc630bfa6f3f8b9948068e7 100755 --- "a/contribute/\350\264\241\347\214\256\346\265\201\347\250\213.md" +++ "b/contribute/\350\264\241\347\214\256\346\265\201\347\250\213.md" @@ -11,7 +11,7 @@ - 针对Git的安装、环境配置及使用方法,请参考码云帮助中心的Git知识大全:[https://gitee.com/help/categories/43](https://gitee.com/help/categories/43) - 注册SSH公钥,请参考码云帮助中心的公钥管理:[https://gitee.com/help/articles/4181](https://gitee.com/help/articles/4181) -- 在开展Gitee的工作流之前,您需要先在OpenHarmony的代码托管平台的上找到您感兴趣的Repository。 +- 在开展Gitee的工作流之前,您需要先在OpenHarmony的代码托管平台上找到您感兴趣的Repository。 ## 代码下载 diff --git a/docs-en/get-code/source-code-acquisition.md b/docs-en/get-code/source-code-acquisition.md index fdd4154d06f41b75c26baba33cbebcc75dde7055..521b65baad6c6ea749403f604d339a92db82b77c 100755 --- a/docs-en/get-code/source-code-acquisition.md +++ b/docs-en/get-code/source-code-acquisition.md @@ -36,16 +36,16 @@ You can download the source code or the corresponding solutions from the image l

1.0

-

Site 1, Site 2

+

Site

-

SHA-256 Verification Code

+

SHA-256 Verification Code

Hi3861 solutions (binary)

1.0

-

Site 1, Site 2

+

Site

SHA-256 Verification Code

@@ -54,25 +54,25 @@ You can download the source code or the corresponding solutions from the image l

1.0

-

Site 1, Site 2

+

Site

-

SHA-256 Verification Code

+

SHA-256 Verification Code

Hi3516 solutions (binary)

1.0

-

Site 1, Site 2

+

Site

-

SHA-256 Verification Code

+

SHA-256 Verification Code

RELEASE-NOTES

1.0

-

Site 1

+

Site

-

diff --git a/docs-en/get-code/tool-acquisition.md b/docs-en/get-code/tool-acquisition.md index 5fa7b5267ec77e9c5113d0a073d90ea4f29ddf68..90ed477644c39785b999bd1112b1a638967af480 100755 --- a/docs-en/get-code/tool-acquisition.md +++ b/docs-en/get-code/tool-acquisition.md @@ -21,7 +21,7 @@ Download the compilation toolchain from image sites listed in the following tabl

9.0.0-34042

-

Site 1 Site 2

+

Site

64a518b50422b6f1ba8f6f56a5e303fb8448a311211ba10c385ad307a1d2546f

@@ -30,7 +30,7 @@ Download the compilation toolchain from image sites listed in the following tabl

7.3.0

-

Site 1 Site 2

+

Site

614ee086ead1a4fd7384332b85dd62707801f323de60dfdb61503f473d470a24

@@ -39,7 +39,7 @@ Download the compilation toolchain from image sites listed in the following tabl

1523

-

Site 1 Site 2

+

Site

50a5a5ba5877dd0ec8afcb23d3dd4d966a16403c29cd80a4002230241d32ef34

@@ -48,7 +48,7 @@ Download the compilation toolchain from image sites listed in the following tabl

1.9.0

-

Site 1 Site 2

+

Site

b4a4ba21e94ff77634e1f88697a00b6f498fdbc0b40d7649df1b246b285874f9

@@ -57,7 +57,7 @@ Download the compilation toolchain from image sites listed in the following tabl

0.65

-

Site 1 Site 2

+

Site

fcfee489371947a464fe41a4b45a897b9a44155891a957f15bad2e157c750162

diff --git a/docs-en/quick-start/developing-the-first-driver-running-on-hi3516.md b/docs-en/quick-start/developing-the-first-driver-running-on-hi3516.md index 1d64e5ebbea49f5cce47f106ae5492a4a8988aa3..3fe79a1f4923ea2ff121e00fa50cc67d2a338291 100755 --- a/docs-en/quick-start/developing-the-first-driver-running-on-hi3516.md +++ b/docs-en/quick-start/developing-the-first-driver-running-on-hi3516.md @@ -419,6 +419,9 @@ Compile and burn images by referring to [Compiling Code](developing-the-first-e 1. Connect to a serial port. + >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >If the sconnection fails, rectify the fault by referring to problem 5 in the [FAQs](faqs-0.md) section. + **Figure 1** Serial port connection @@ -428,12 +431,12 @@ Compile and burn images by referring to [Compiling Code](developing-the-first-e 2. Enter the serial port number "com11" and press **Enter** until **hisillicon** is displayed. 3. Go to step 2 if the board is started for the first time or the startup parameters need to be modified; go to step 3 otherwise. -2. \(Mandatory when the board is started for the first time\) Modify the bootcmd and bootargs parameters of U-Boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset. +2. \(Mandatory when the board is started for the first time\) Modify the bootcmd and bootargs parameters of U-boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset. >![](public_sys-resources/icon-notice.gif) **NOTICE:** - >The default waiting time in the U-Boot is 2s. You can press **Enter** to interrupt the waiting and run the **reset** command to restart the system after "hisillicon" is displayed. + >The default waiting time in the U-boot is 2s. You can press **Enter** to interrupt the waiting and run the **reset** command to restart the system after "hisillicon" is displayed. - **Table 1** Startup parameters of the U-Boot + **Table 1** Startup parameters of the U-boot diff --git a/docs-en/quick-start/developing-the-first-example-program-running-on-hi3516.md b/docs-en/quick-start/developing-the-first-example-program-running-on-hi3516.md index 024eb2b7153fd47ab2107c191c55a79a3905f870..428ced4f97d8daa3df587577b48a3d3de585faa9 100755 --- a/docs-en/quick-start/developing-the-first-example-program-running-on-hi3516.md +++ b/docs-en/quick-start/developing-the-first-example-program-running-on-hi3516.md @@ -4,7 +4,7 @@ This section describes how to modify, compile, burn, and run the first program, ## Acquiring Source Code -You need to acquire [Hi3516 source code](http://tools.harmonyos.com/mirrors/os/1.0/code-1.0.tar.gz) and download it on a Linux server. For more obtaining methods, see [Source Code Acquisition](../get-code/source-code-acquisition.md). +You need to acquire [Hi3516 source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz) and download it on a Linux server. For more obtaining methods, see [Source Code Acquisition](../get-code/source-code-acquisition.md). ## Modifying a Program @@ -114,6 +114,9 @@ This method applies only to development boards that have network ports, for exam 1. Connect to a serial port. + >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >If the sconnection fails, rectify the fault by referring to problem 5 in the [FAQs](faqs-0.md) section. + **Figure 9** Serial port connection @@ -123,12 +126,12 @@ This method applies only to development boards that have network ports, for exam 2. Enter the serial port number "com11" and press **Enter** until **hisillicon** is displayed. 3. Go to step 2 if the board is started for the first time or the startup parameters need to be modified; go to step 3 otherwise. -2. \(Mandatory when the board is started for the first time\) Modify the bootcmd and bootargs parameters of U-Boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset. +2. \(Mandatory when the board is started for the first time\) Modify the bootcmd and bootargs parameters of U-boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset. >![](public_sys-resources/icon-notice.gif) **NOTICE:** - >The default waiting time in the U-Boot is 2s. You can press **Enter** to interrupt the waiting and run the **reset** command to restart the system after "hisillicon" is displayed. + >The default waiting time in the U-boot is 2s. You can press **Enter** to interrupt the waiting and run the **reset** command to restart the system after "hisillicon" is displayed. - **Table 1** Startup parameters of the U-Boot + **Table 1** Startup parameters of the U-boot

Command

@@ -453,7 +456,7 @@ Compile and burn images by referring to [Compiling Code](developing-the-first-e

rootaddr=10 M, rootsize=15 M rw indicates the start address and size of the rootfs.img file to be burnt, respectively. The file size must be the same as that of the compiled file in the IDE.

saveenv means to save the current configuration.

reset means to reset the board.

-

(Optional) go 0x80000000 indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press Enter in the countdown phase of the U-Boot startup to interrupt the automatic startup.

+

(Optional) go 0x80000000 indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press Enter in the countdown phase of the U-boot startup to interrupt the automatic startup.

@@ -162,7 +165,7 @@ This method applies only to development boards that have network ports, for exam ![](figures/qi1.png) -## Run a Program +## Running a Program In the root directory, run the **./bin/camera\_app** command to operate the demo program. The following figure shows the compilation result. diff --git a/docs-en/quick-start/developing-the-first-example-program-running-on-hi3518.md b/docs-en/quick-start/developing-the-first-example-program-running-on-hi3518.md index 9aebee65819eb0cd804e7bd6afd9db8a4c1ac822..c089ebe8c505fb96a49ec77e69acec50e21f255c 100755 --- a/docs-en/quick-start/developing-the-first-example-program-running-on-hi3518.md +++ b/docs-en/quick-start/developing-the-first-example-program-running-on-hi3518.md @@ -4,7 +4,7 @@ This section describes how to modify, compile, burn, and run the first program o ## Acquiring Source Code -You need to acquire [Hi3518 source code](http://tools.harmonyos.com/mirrors/os/1.0/code-1.0.tar.gz) and download it on a Linux server. For details, see [Source Code Acquisition](../get-code/source-code-acquisition.md). +You need to acquire [Hi3518 source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz) and download it on a Linux server. For details, see [Source Code Acquisition](../get-code/source-code-acquisition.md). ## Modifying a Program @@ -71,14 +71,14 @@ Burn images to the Hi3518EV300 board over the serial port. ## Running an Image -1. Connect to the serial port. After the images are burnt successfully, start the terminal, click **Settings**, set **View Title** to **Terminal 11** and **Port** to **COM7**, and click **OK** to open the serial port. You have logged in to the U-Boot if **hisilicon \#** is displayed. +1. Connect to the serial port. After the images are burnt successfully, start the terminal, click **Settings**, set **View Title** to **Terminal 11** and **Port** to **COM7**, and click **OK** to open the serial port. You have logged in to the U-boot if **hisilicon \#** is displayed. **Figure 6** Serial port connection ![](figures/serial-port-connection.png "serial-port-connection") -2. \(Mandatory for the first burning\) Modify the **bootcmd** and **bootargs** parameters of U-Boot. This step is a fixed operation and the result can be saved. However, you need to perform the following steps again if U-Boot needs to be reburnt. +2. \(Mandatory for the first burning\) Modify the **bootcmd** and **bootargs** parameters of U-boot. This step is a fixed operation and the result can be saved. However, you need to perform the following steps again if U-boot needs to be reburnt. - **Table 1** Parameters of the Hi3518EV300 U-Boot + **Table 1** Parameters of the Hi3518EV300 U-boot

Command

@@ -148,7 +151,7 @@ This method applies only to development boards that have network ports, for exam

rootaddr=10 M, rootsize=15 M rw indicates the start address and size of the rootfs.img file to be burnt, respectively. The file size must be the same as that of the compiled file in the IDE.

saveenv means to save the current configuration.

reset means to reset the board.

-

(Optional) go 0x80000000 indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press Enter in the countdown phase of the U-Boot startup to interrupt the automatic startup.

+

(Optional) go 0x80000000 indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press Enter in the countdown phase of the U-boot startup to interrupt the automatic startup.

diff --git a/docs-en/quick-start/setting-up-a-development-environment-1.md b/docs-en/quick-start/setting-up-a-development-environment-1.md index 1c66dcca365d8398495355965d01491689c117c8..1c51e40f99c7b67441dc81b2bc49f40c358ea3e3 100755 --- a/docs-en/quick-start/setting-up-a-development-environment-1.md +++ b/docs-en/quick-start/setting-up-a-development-environment-1.md @@ -58,61 +58,61 @@ The following table describes the common tools required for Linux and how to obt **Table 2** Development tools and obtaining methods -

Command

@@ -92,7 +92,7 @@ Burn images to the Hi3518EV300 board over the serial port.

setenv bootcmd "sf probe 0;sf read 0x40000000 0x100000 0x600000;go 0x40000000";

Run this command to set the content of bootcmd. Select the flash whose number is 0, and read content that has a size of 0x600000 and a start address of 0x100000 to memory address 0x40000000.

-

(Optional) go 0x40000000 indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press Enter in the countdown phase of the U-Boot startup to interrupt the automatic startup.

+

(Optional) go 0x40000000 indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press Enter in the countdown phase of the U-boot startup to interrupt the automatic startup.

setenv bootargs "console=ttyAMA0,115200n8 root=flash fstype=jffs2 rw rootaddr=7 M rootsize=8 M";

In this command, bootargs is set to the serial port output, the baud rate is 115200, the data bit is 8, and the rootfs is mounted to the flash memory. The file system type is set to jffs2 rw, which provides the read-write attribute for the JFFS2 file system.

rootaddr=7 M rootsize=8 M indicates the actual start address and length of the rootfs.img file to be burnt. The size must be the same as that of the compiled files in the HiTool.

@@ -115,5 +115,5 @@ Burn images to the Hi3518EV300 board over the serial port. ## Follow-up Learning -Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](en-us_topic_0000001055366100.md). +Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/camera-control.md). diff --git a/docs-en/quick-start/developing-the-first-example-program-running-on-hi3861.md b/docs-en/quick-start/developing-the-first-example-program-running-on-hi3861.md index 88734f1912abde6108a7ec38fb6738811a6973b2..2093cee18a07929ea7b2ff0480e6f880d4db9c76 100755 --- a/docs-en/quick-start/developing-the-first-example-program-running-on-hi3861.md +++ b/docs-en/quick-start/developing-the-first-example-program-running-on-hi3861.md @@ -4,7 +4,7 @@ This example shows how to use attention \(AT\) commands to complete WLAN module ## Acquiring Source Code -You need to acquire [Hi3861 source code](http://tools.harmonyos.com/mirrors/os/1.0/code-1.0.tar.gz) and download it on a Linux server. For more obtaining methods, see [Source Code Acquisition](../get-code/source-code-acquisition.md). +You need to acquire [Hi3861 source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz) and download it on a Linux server. For more obtaining methods, see [Source Code Acquisition](en-us_topic_0000001050769927.md). ## Compiling Source Code diff --git a/docs-en/quick-start/developing-the-second-example-program-running-on-hi3861.md b/docs-en/quick-start/developing-the-second-example-program-running-on-hi3861.md index e8358ef045cd3c8fb9ba289fd5f28d2c743edcdc..31f1b5d87dba44252b069875b76c262dd1e7f5c3 100755 --- a/docs-en/quick-start/developing-the-second-example-program-running-on-hi3861.md +++ b/docs-en/quick-start/developing-the-second-example-program-running-on-hi3861.md @@ -144,5 +144,5 @@ wifi init success! ## Follow-up Learning -Congratulations! You have finished all steps! You are advised to go on learning how to develop [WLAN-connected products](../guide/overview.md). +Congratulations! You have finished all steps! You are advised to go on learning how to develop [WLAN-connected products](en-us_topic_0000001054530966.md). diff --git a/docs-en/quick-start/faqs-0.md b/docs-en/quick-start/faqs-0.md index f29b798342873d20273b181bff09caf8b2db0292..12610762aaa2b6fdc3817b3ee45220e1a65e6f91 100755 --- a/docs-en/quick-start/faqs-0.md +++ b/docs-en/quick-start/faqs-0.md @@ -117,3 +117,57 @@ ![](figures/en-us_image_0000001054875562.png) +**Problem 5:** **What should I do when no command output is displayed?** + +- **Symptom** + + The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when you press **Enter**. + +- **Possible Causes** + - The serial port is connected incorrectly. + - The U-boot of the board is damaged. + +- **Solutions** + + **Solution 1: Change the serial port number.** + + Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If not, perform the following steps to change the serial port number. + + **Figure 10** Procedure for changing the serial port number + ![](figures/procedure-for-changing-the-serial-port-number.png "procedure-for-changing-the-serial-port-number") + + +1. Disconnect from the current serial port. +2. Click **Settings**. +3. Change the serial port number in the dialog box and click **OK**. +4. Press **Enter** in the dialog box to check whether any command output is displayed after the connection is established. + +**Solution 2: Burn the U-boot.** + +If the fault persists after you perform the preceding operations, the U-boot of the board may be damaged. You can burn the U-boot by performing the following steps: + +1. Obtain the U-boot file. + + >![](public_sys-resources/icon-notice.gif) **NOTICE:** + >The U-boot file of the board can be obtained from **vendor\\hisi\\hi35xx\\hi3516dv300\\uboot\\out\\boot\\u-boot-hi3516dv300.bin** in the open-source package. + +2. Use HiTool to burn the U-boot. + + **Figure 11** Procedure for burning the U-boot using HiTool + + + ![](figures/未命名图片11111.png) + + 1. Select the COM7 serial port. + 2. Select **Serial** for **Transfer Mode**. + 3. Select **Burn Fastboot**. + 4. Select **spi nor** for **Flash Type**. + 5. Click **Browse** and select the corresponding U-boot file. + 6. Click **Burn** to start burning. + +3. Power off the board and then power it on. Connect the serial port after the burning is complete. Serial ports shown in the following figure are displayed after the U-boot is burnt. + + **Figure 12** Serial port displayed after the U-boot is burnt + ![](figures/serial-port-displayed-after-the-u-boot-is-burnt.png "serial-port-displayed-after-the-u-boot-is-burnt") + + diff --git a/docs-en/quick-start/faqs-2.md b/docs-en/quick-start/faqs-2.md index ffc8060fc952ba6597b823b3074bac12e9e774ad..feb6b39d5cd0b5b64fa2ca606ae2921b739b9879 100755 --- a/docs-en/quick-start/faqs-2.md +++ b/docs-en/quick-start/faqs-2.md @@ -8,14 +8,16 @@ - **Possible Causes** - The serial port is connected incorrectly. - - The U-Boot of the board is damaged. + - The U-boot of the board is damaged. - **Solutions** + **Solution 1: Change the serial port number.** + Start **Device Manager** to check whether the serial port connected to the board is the same as that connected to the terminal device. If not, perform the following steps to change the serial port number. **Figure 1** Procedure for changing the serial port number - ![](figures/procedure-for-changing-the-serial-port-number.png "procedure-for-changing-the-serial-port-number") + ![](figures/procedure-for-changing-the-serial-port-number-4.png "procedure-for-changing-the-serial-port-number-4") 1. Disconnect from the current serial port. @@ -23,32 +25,34 @@ 3. Change the serial port number in the dialog box and click **OK**. 4. Press **Enter** in the dialog box to check whether any command output is displayed after the connection is established. -If the fault persists after you perform the preceding operations, the U-Boot of the board may be damaged. You can burn the U-Boot by performing the following steps: +**Solution 2: Burn the U-boot.** + +If the fault persists after you perform the preceding operations, the U-boot of the board may be damaged. You can burn the U-boot by performing the following steps: -1. Obtain the U-Boot file. +1. Obtain the U-boot file. >![](public_sys-resources/icon-notice.gif) **NOTICE:** - >The U-Boot file of the board can be obtained from **vendor\\hisi\\hi35xx\\hi3518ev300\\uboot\\out\\boot\\u-boot-hi3518ev300.bin** in the open-source package. + >The U-boot file of the board can be obtained from **vendor\\hisi\\hi35xx\\hi3518ev300\\uboot\\out\\boot\\u-boot-hi3518ev300.bin** in the open-source package. -2. Use HiTool to burn the U-Boot. +2. Use HiTool to burn the U-boot. - **Figure 2** Procedure for burning the U-Boot using HiTool + **Figure 2** Procedure for burning the U-boot using HiTool ![](figures/procedure-for-burning-the-u-boot-using-hitool.png "procedure-for-burning-the-u-boot-using-hitool") 1. Select the COM7 serial port. 2. Select **Serial** for **Transfer Mode**. 3. Select **Burn Fastboot**. 4. Select **spi nor** for **Flash Type**. - 5. Click **Browse** and select the corresponding U-Boot file. + 5. Click **Browse** and select the corresponding U-boot file. 6. Click **Burn** to start burning. -3. Power off the board and then power it on. Connect the serial port after the burning is complete. Serial ports shown in the following figure are displayed after the U-Boot is burnt. +3. Power off the board and then power it on. Connect the serial port after the burning is complete. Serial ports shown in the following figure are displayed after the U-boot is burnt. - **Figure 3** Serial port displayed after the U-Boot is burnt - ![](figures/serial-port-displayed-after-the-u-boot-is-burnt.png "serial-port-displayed-after-the-u-boot-is-burnt") + **Figure 3** Serial port displayed after the U-boot is burnt + ![](figures/serial-port-displayed-after-the-u-boot-is-burnt-5.png "serial-port-displayed-after-the-u-boot-is-burnt-5") -**Problem 2: What should I do when an error is reported when the U-Boot is burnt using HiTool?** +**Problem 2: What should I do when an error is reported when the U-boot is burnt using HiTool?** - **Symptom** diff --git a/docs-en/quick-start/figures/adding-the-hi3516dv300-board.png b/docs-en/quick-start/figures/adding-the-hi3516dv300-board.png index 81a2b496aacb056d6003d0fe440e9d1dfe8f96e8..2d807c348ffdb802b239e295abb7b7e079e213e5 100755 Binary files a/docs-en/quick-start/figures/adding-the-hi3516dv300-board.png and b/docs-en/quick-start/figures/adding-the-hi3516dv300-board.png differ diff --git a/docs-en/quick-start/figures/appearance-of-hi3861-wlan-module.png b/docs-en/quick-start/figures/appearance-of-hi3861-wlan-module.png index df3f85daabb08e137bafd8a098c6f882f1a5776b..ccc714eadc965fc4b29703c3156e730f84c97596 100755 Binary files a/docs-en/quick-start/figures/appearance-of-hi3861-wlan-module.png and b/docs-en/quick-start/figures/appearance-of-hi3861-wlan-module.png differ diff --git a/docs-en/quick-start/figures/procedure-for-changing-the-serial-port-number-4.png b/docs-en/quick-start/figures/procedure-for-changing-the-serial-port-number-4.png new file mode 100644 index 0000000000000000000000000000000000000000..f699204d10d39eb088c0ecc7aa08ba134ec4b6b6 Binary files /dev/null and b/docs-en/quick-start/figures/procedure-for-changing-the-serial-port-number-4.png differ diff --git a/docs-en/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt-5.png b/docs-en/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt-5.png new file mode 100644 index 0000000000000000000000000000000000000000..4e2a2794e63f64341e448313968b6f82d237543d Binary files /dev/null and b/docs-en/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt-5.png differ diff --git a/docs-en/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt.png b/docs-en/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt.png index 4e2a2794e63f64341e448313968b6f82d237543d..ad4fd618860ca9f79e9bdc39436c3b2f9cdb72de 100755 Binary files a/docs-en/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt.png and b/docs-en/quick-start/figures/serial-port-displayed-after-the-u-boot-is-burnt.png differ diff --git "a/docs-en/quick-start/figures/\346\234\252\345\221\275\345\220\215\345\233\276\347\211\20711111.png" "b/docs-en/quick-start/figures/\346\234\252\345\221\275\345\220\215\345\233\276\347\211\20711111.png" new file mode 100644 index 0000000000000000000000000000000000000000..4b8caa20e71b5a592b82a625d9f022a29667427d Binary files /dev/null and "b/docs-en/quick-start/figures/\346\234\252\345\221\275\345\220\215\345\233\276\347\211\20711111.png" differ diff --git a/docs-en/quick-start/introduction-to-the-hi3861-development-board.md b/docs-en/quick-start/introduction-to-the-hi3861-development-board.md index 0cbcbe583033866e300b75bd797b708e8b8a231c..8fb93d867301459da72cecec565d434d12411515 100755 --- a/docs-en/quick-start/introduction-to-the-hi3861-development-board.md +++ b/docs-en/quick-start/introduction-to-the-hi3861-development-board.md @@ -43,9 +43,9 @@ As the Hi3861 only offers 2 MB Flash and 352 KB RAM, use them efficiently when c

General specifications

  • Operates over 1×1 2.4 GHz frequency band (ch1-ch14).
  • The physical layer (PHY) complies with the IEEE 802.11b/g/n protocol.
  • The media access control (MAC) layer complies with the IEEE802.11 d/e/h/i/k/v/w protocol.
-
  • Includes the built-in public address (PA) and local area network (LAN); integrates transmit-receive (Tx/Rx) switch and Balun.
  • Supports the station (STA) and access point (AP) modes. When the Hi3861 WLAN module functions as an AP, a maximum of six STAs are supported.
  • Supports WPA and WPA2 from WFA (personal), and WPS 2.0.
  • Supports three kinds of packet traffic arbiter (PTA) (2- , 3- , or 4-wire PTA), each of which coexists with the BT or BLE chip.
  • The input voltage ranges from 2.3 V to 3.6 V.
+
  • Includes the built-in public address (PA) and local area network (LAN); integrates transmit-receive (Tx/Rx) switch and Balun.
  • Supports the station (STA) and access point (AP) modes. When the Hi3861 WLAN module functions as an AP, a maximum of six STAs are supported.
  • Supports WPA and WPA2 from WFA (personal), and WPS 2.0.
  • Supports three kinds of packet traffic arbiter (PTA) (2-, 3-, or 4-wire PTA), each of which coexists with the BT or BLE chip.
  • The input voltage ranges from 2.3 V to 3.6 V.
  • The input/output (I/O) power voltage can be 1.8 V or 3.3 V.
-
  • Supports self-calibration for RF hardware.
  • Performs with low power consumption:
    • Ultra deep sleep mode: 5 μA@3.3
    • VDTIM1: 1.5mA@3.3V
    • DTIM3: 0.8mA@3.3V
    +
    • Supports self-calibration for RF hardware.
    • Performs with low power consumption:
      • Ultra deep sleep mode: 5 μA @ 3.3 V
      • DTIM1: 1.5 mA @ 3.3 V
      • DTIM3: 0.8 mA @ 3.3 V
- - - - - - - @@ -188,7 +188,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 查看shell是否为bash,在终端运行如下命令 -``` +```bash ls -l /bin/sh ``` @@ -196,13 +196,13 @@ ls -l /bin/sh **方法一**:在终端运行如下命令,然后选择 no。 -``` +```bash sudo dpkg-reconfigure dash ``` **方法二**:先删除sh,再创建软链接。 -``` +```bash rm -rf /bin/sh sudo ln -s /bin/bash /bin/sh ``` @@ -228,7 +228,7 @@ sudo ln -s /bin/bash /bin/sh - 安装Python包管理工具,运行“sudo apt-get install python3-setuptools python3-pip -y”命令。(需root/sudo权限安装),升级pip3运行"sudo pip3 install --upgrade pip"。 - + 或按官网方式安装Python包管理工具:下载"curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py"后,再执行"python get-pip.py" @@ -257,7 +257,7 @@ sudo ln -s /bin/bash /bin/sh 1. 运行“sudo pip3 install pycryptodome-xxx.whl”命令(例如:sudo pip3 install pycryptodome-3.7.3-cp37-cp37m-manylinux1\_x86\_64.whl),安装.whl文件(需root/sudo权限安装)。 - + 安装完成后界面会提示“Successfully installed pycryptodome-3.7.3”。 6. 安装six。运行"sudo pip3 install six --upgrade --ignore-installed six"或者按照以下方式安装: @@ -268,7 +268,7 @@ sudo ln -s /bin/bash /bin/sh 1. 运行“sudo pip3 install six-xxx.whl”命令(例如:sudo pip3 install six-1.12.0-py2.py3-none-any.whl),安装.whl文件(需root/sudo权限安装)。 - + 安装完成后界面会提示“Successfully installed six-1.12.0”。 7. 安装ecdsa。运行"sudo pip3 install ecdsa"或者按照以下方式安装: @@ -279,7 +279,7 @@ sudo ln -s /bin/bash /bin/sh 1. 运行“sudo pip3 install ecdsa-xxx.whl”命令(例如:sudo pip3 install ecdsa-0.14.1-py2.py3-none-any.whl),安装.whl文件(需root/sudo权限安装)。 - + 安装完成后界面会提示“Successfully installed ecdsa-0.14.1”。 @@ -310,7 +310,7 @@ sudo ln -s /bin/bash /bin/sh ## 安装gn 1. 打开Linux编译服务器终端。 -2. [下载gn工具](http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar)。 +2. [下载gn工具](https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar)。 3. 解压gn安装包至\~/gn路径下:"tar -xvf gn.1523.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:"export PATH=\~/gn:$PATH"。 5. 生效环境变量:"source \~/.bashrc"。 @@ -318,7 +318,7 @@ sudo ln -s /bin/bash /bin/sh ## 安装ninja 1. 打开Linux编译服务器终端 -2. [下载ninja工具](http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar)。 +2. [下载ninja工具](https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar)。 3. 解压ninja安装包至\~/ninja路径下:"tar -xvf ninja.1.9.0.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:"export PATH=\~/ninja:$PATH"。 5. 生效环境变量:"source \~/.bashrc"。 @@ -329,8 +329,8 @@ sudo ln -s /bin/bash /bin/sh >Hi3861平台仅支持使用libgcc运行时库的静态链接,**不建议开发者使用libgcc运行时库的动态链接,会导致商业分发时被GPL V3污染。** 1. 打开Linux编译服务器终端。 -2. [下载gcc\_riscv32工具](http://tools.harmonyos.com/mirrors/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz)。 -3. 解压gcc\_riscv32安装包至/opt/gcc\_riscv32路径下:"tar -xvf gcc\_riscv32-linux-7.3.0.tar.gz -C \~/"。 +2. [下载gcc\_riscv32工具](https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz)。 +3. 解压gcc\_riscv32安装包至\~/gcc\_riscv32路径下:"tar -xvf gcc\_riscv32-linux-7.3.0.tar.gz -C \~/"。 4. 设置环境变量:"vim \~/.bashrc",新增:"export PATH=\~/gcc\_riscv32/bin:$PATH"。 5. 生效环境变量:"source \~/.bashrc"。 6. Shell命令行中输入“riscv32-unknown-elf-gcc -v”,如果能正确显示编译器版本号,表明编译器安装成功。 diff --git "a/readme/DFX\345\255\220\347\263\273\347\273\237README.md" "b/readme/DFX\345\255\220\347\263\273\347\273\237README.md" index 85fef3ad83bb4211394f8fa4096644393ffaa831..0cec4d8ad95b49ad41a974cc6e745d17bff69aae 100755 --- "a/readme/DFX\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/DFX\345\255\220\347\263\273\347\273\237README.md" @@ -2,14 +2,13 @@ ## 简介 -该仓库用于存放DFX框架的代码。主要包含DFR(可靠性)和DFT(可测试性)特性。 +该仓库用于存放DFX框架的代码。主要包含DFR(Design for Reliability,可靠性)和DFT(Design for Testability,可测试性)特性。 由于芯片平台资源有限,且硬件平台多样,因此需要针对不同硬件架构和资源提供组件化且可定制的DFX框架。根据RISC-V、Cortex-M、Cortex-A不同硬件平台,提供两种不同的轻量级DFX框架,以下简称mini、featured。 -- mini框架:针对处理架构为Cortex-M或同等处理能力的硬件平台,系统内存一般低于512KB,无文件系统或者仅提供一个可有限使用的轻量级文件系统,遵循CMSIS接口规范。 - -- featured框架:处理架构为Cortex-A或同等处理能力的硬件平台,内存资源大于512KB,文件系统完善,可存储大量数据,遵循POSIX接口规范。 +- mini框架:针对处理架构为Cortex-M或同等处理能力的硬件平台,系统内存一般低于512KB,无文件系统或者仅提供一个可有限使用的轻量级文件系统,遵循CMSIS接口规范。 +- featured框架:处理架构为Cortex-A或同等处理能力的硬件平台,内存资源一般大于512KB,文件系统完善,可存储大量数据,遵循POSIX接口规范。 ## 目录 @@ -64,7 +63,7 @@ - - @@ -102,18 +101,18 @@ ## 约束 -mini框架整体代码使用标准C开发,对外的接口依赖统一通过util封装,如软硬件平台不同需要适配,需要在vendor下实现适配处理。 +mini框架整体代码使用标准C开发。 ## 使用-mini框架 DFX-mini是一套简单小巧的DFX设计,对外提供log功能: -- **以下以A模块为例说明如何添加模块并进行日志打印。** - 1. **第一步添加模块ID** +- **以下以A模块为例说明如何添加模块并进行日志打印。** + 1. **第一步添加模块ID** 在interfaces/kits/hilog\_lite/hiview\_log.h的HiLogModuleDef中添加HILOG\_MODULE\_A定义。 - ``` + ```c++ typedef enum { /** DFX */ HILOG_MODULE_HIVIEW = 0, @@ -124,26 +123,22 @@ DFX-mini是一套简单小巧的DFX设计,对外提供log功能: } HiLogModuleType; ``` - 1. **第二步模块注册** - + 在A模块的初始化流程中添加如下代码,注册模块到日志框架中: - + ``` - HiLogRegisterModule(HILOG_MODULE_SAMGR, "A"); + HiLogRegisterModule(HILOG_MODULE_A, "A"); ``` - 1. **第三步调整DFX框架静态配置** - - 根据需要调整 - + + 根据需要调整如下文件的g\_hiviewConfig全局参数配置。默认情况下不用修改,日志默认输出到串口。 + ``` utils/lite/hiview_config.c ``` - - 的g\_hiviewConfig全局参数配置。默认情况下不用修改,日志默认输出到串口。 - +

Development Tool

+ - - - - - - - - - - - - - - - - - - - - - - - @@ -140,7 +140,7 @@ The following table describes the common tools required for Linux and how to obt - @@ -246,7 +246,7 @@ sudo ln -s /bin/bash /bin/sh ## Installing gn 1. Start a Linux server. -2. Download [gn](https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest). +2. Download [gn](https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar). 3. Decompress the **gn** installation package to the **tar -xvf gn.1523.tar -C \~/** in **\~/gn** directory. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/gn:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. @@ -254,7 +254,7 @@ sudo ln -s /bin/bash /bin/sh ## Installing ninjah 1. Start a Linux server. -2. Download [ninja](https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip). +2. Download [ninja](https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar). 3. Decompress the **ninja** installation package to **tar -xvf ninja.1.9.0.tar -C \~/** in **\~/ninja** directory. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/ninja:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. @@ -262,7 +262,7 @@ sudo ln -s /bin/bash /bin/sh ## Installing the LLVM Toolchain 1. Start a Linux server. -2. Download [http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar](http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar). +2. Download [LLVM](http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar). 3. Decompress the LLVM installation package to the **\~/llvm** path by running **"tar -xvf llvm-linux-9.0.0-34042.tar -C \~/"**. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/llvm/bin:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. @@ -270,8 +270,8 @@ sudo ln -s /bin/bash /bin/sh ## Installing hc-gen 1. Start a Linux server. -2. Download [http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar](http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar). -3. Decompress the hc-gen installation package to the **\~/hc-gen** directory on the Linux server. +2. Download [hc-gen](https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar). +3. Decompress the hc-gen installation package to **tar -xvf hc-gen-0.65-linux.tar -C \~/** in **\~/hc-gen** on the Linux. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/hc-gen:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. diff --git a/docs-en/quick-start/setting-up-a-development-environment.md b/docs-en/quick-start/setting-up-a-development-environment.md index 59c381943bc927389a9347ee8475a3c2ccf344e9..95e689004c9b0970d06ad93bdd0d70751855d4c6 100755 --- a/docs-en/quick-start/setting-up-a-development-environment.md +++ b/docs-en/quick-start/setting-up-a-development-environment.md @@ -67,7 +67,7 @@ The following table describes the tools required for setting up the general envi - - - @@ -298,7 +298,7 @@ sudo ln -s /bin/bash /bin/sh ## Installing gn 1. Start a Linux server. -2. Download [gn](https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest). +2. Download [gn](https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar). 3. Decompress the **gn** installation package to the **tar -xvf gn.1523.tar -C \~/** in **\~/gn** directory. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/gn:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. @@ -306,7 +306,7 @@ sudo ln -s /bin/bash /bin/sh ## Installing ninjah 1. Start a Linux server. -2. Download [ninja](https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip). +2. Download [ninja](https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar). 3. Decompress the **ninja** installation package to **tar -xvf ninja.1.9.0.tar -C \~/** in **\~/ninja** directory. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/ninja:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. @@ -317,7 +317,7 @@ sudo ln -s /bin/bash /bin/sh >The Hi3861 platform supports only the static link of the libgcc library. **The dynamic link is not recommended because version 3 of the GNU General Public License \(GPLv3\) will be polluted during commercial distribution.** 1. Start a Linux server. -2. Download [gcc\_riscv32](http://tools.harmonyos.com/mirrors/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz). +2. Download [gcc\_riscv32](https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz). 3. Decompress the gcc\_riscv32 installation package to **tar -xvf gcc\_riscv32-linux-7.3.0.tar.gz -C \~/** in **/opt/gcc\_riscv32**. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/gcc\_riscv32/bin:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. diff --git a/docs-en/quick-start/setting-up-a-hi3516-board-environment.md b/docs-en/quick-start/setting-up-a-hi3516-board-environment.md index 5a399f6c3a4150b0a914d5b0e244527db9bc5bdd..205948a0587106616ca431e9accfa1175eb0e3f0 100755 --- a/docs-en/quick-start/setting-up-a-hi3516-board-environment.md +++ b/docs-en/quick-start/setting-up-a-hi3516-board-environment.md @@ -63,61 +63,61 @@ The following table describes the common tools required for Linux and how to obt **Table 2** Development tools and obtaining methods -

Development Tool

Description

+

Description

How to Obtain

+

How to Obtain

Python3.7+

+

Python3.7+

Runs the compilation scripts.

+

Runs the compilation scripts.

https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz

+

https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz

bash

+

bash

Executes commands.

+

Executes commands.

Internet

+

Internet

gn

+

gn

Generates ninja compilation scripts.

+

Generates ninja compilation scripts.

http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar

ninja

+

ninja

Executes ninja compilation scripts.

+

Executes ninja compilation scripts.

http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar

LLVM

+

LLVM

Functions as the compiler toolchain.

+

Functions as the compiler toolchain.

http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

hc-gen

+

hc-gen

Configures and compiles files.

+

Configures and compiles files.

http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

IPOP, PuTTY, or other HyperTerminal software

+

IPOP, PuTTY, or other HyperTerminal software

Connects to the Linux server (choose one of the terminals).

+

Connects to the Linux server (choose one of the terminals).

Internet (for example, https://www.putty.org/)

+

Internet (for example, https://www.putty.org/)

HiTool

Burns the images and the U-Boot.

+

Burns the images and the U-boot.

http://www.hihope.org/download

Executes script cross compilation.

http://tools.harmonyos.com/mirrors/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz

+

https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz

Python3.7+

@@ -102,14 +102,14 @@ The following table describes the tools required for setting up the general envi

Generates ninja compilation scripts.

http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar

ninja

Executes ninja compilation scripts.

http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar

- - - - - - - - - - @@ -45,13 +40,13 @@ The source code directory structure of the Distributed Scheduler is as follows: │ ├── distributed_schedule_service.h # Header file for the open APIs provided by the Distributed Scheduler │ ├── dmslite_check_remote_permission.h # Header file for the permission management module of the Distributed Scheduler │ ├── dmslite_famgr.h # Header file for the FA management module of the Distributed Scheduler -│ ├── dmslite_inner_common.h # Header file for the service files of the Distributed Scheduler -│ ├── dmslite.h # Header file for the implementation of the Distributed Scheduler +│ ├── dmslite_inner_common.h # Internal common file for the Distributed Scheduler +│ ├── dmslite.h # Header file for the implementation of the Distributed Scheduler Service │ ├── dmslite_log.h # Header file for the log module -│ ├── dmslite_msg_parser.h # Header file for communication data deserialization +│ ├── dmslite_msg_parser.h # Header file for the distributed message parsing module │ ├── dmslite_tlv_common.h # Header file for the TLV data parsing module -│ └── dmslite_session.h # Header file for enabling cross-device communication -├── README.md +│ └── dmslite_session.h # Header file for the inter-device communication module +├── readme.md ├── LICENSE ├── source ├── distributed_schedule_service.c @@ -65,69 +60,59 @@ The source code directory structure of the Distributed Scheduler is as follows: ## Constraints -- Language: C -- Networking: Devices must be on the same LAN. -- Operating system: OpenHarmony +**Language**: C or C++ + +**Networking environment**: The primary and secondary devices must be on the same LAN and can ping each other. + +**Operating system**: OpenHarmony **Limitations and constraints on remote startup**: - Only FAs can be started remotely. Remote startup is unavailable to abilities using the Service template. -- Before the remote startup, ensure that the primary and secondary devices are on the same network segment and can ping each other. Otherwise, the remote startup fails. +- Before the remote startup, ensure that the distributed networking between the primary and secondary devices is successful. Otherwise, the remote startup fails. ## Usage -**Compiling the Distributed Scheduler** +- **Compiling the Distributed Scheduler** -The distributed scheduler uses some feature macros to customize the function code to be compiled on different platforms. The function code is stored in **build\\lite\\config\\subsystem\\distributedschedule\\**. The directory structure is as follows: +The code of the Distributed Scheduler is stored in the following directory: ``` -build/lite/config/subsystem/distributedschedule -├── BUILD.gn +foundation/distributedschedule/services/dtbschedmgr_lite ``` -Modify the **BUILD.gn** file when compiling code for different platforms. The following code snippet uses code compilation for the Hi3518EV300 and Hi3516DV300 development boards as an example: +When compiling the code for a specific platform, you need to specify the target platform. The following code snippet uses code compilation for the Hi3516DV300 platform as an example: ``` -zlite_subsystem("distributedschedule") { - subsystem_components = [ - "//foundation/distributedschedule/services/samgr_lite:samgr", - ] - if (board_name == "hi3518ev300" || board_name == "hi3516dv300") { - subsystem_components += [ - "//foundation/distributedschedule/services/safwk_lite:safwk_lite", - "//foundation/distributedschedule/services/dtbschedmgr_lite:dtbschedmgr", // Configure the distributed scheduler. - ] - } -} +python build.py ipcamera -p hi3516dv300_liteos_a ``` -**\* Primary device development** \(taking FA startup as an example\) +- **Primary device development** \(taking FA startup as an example\) -Create a **Want** instance. You should first create an **ElementName** object with **deviceId**, **bundleName**, and **abilityName** specified and add this object to the **Want** instance. Then, set the multi-device startup flag **Want.FLAG\_ABILITYSLICE\_MULTI\_DEVICE** to the **Want** instance to enable remote FA startup. +Create a **Want** instance to set the remote device ID, bundle name, and ability class name of the target FA and set the **Want.FLAG\_ABILITYSLICE\_MULTI\_DEVICE** flag to enable distributed startup. ``` -// Import related header files. import ohos.aafwk.ability.Ability; import ohos.aafwk.content.Want; import ohos.bundle.ElementName; -// Start the remote FA on the secondary device. -Want want = new Want(); // Create a Want instance that encapsulates information about the remote FA to start. -ElementName name = new ElementName("remote_device_id", "com.huawei.remote_package_name", "remote_class_name"); +// Create a Want instance that will be passed to the startAbility method. +Want want = new Want(); +ElementName name = new ElementName(remote_device_id, "com.huawei.remote_bundle_name", "remote_ability_name"); want.setElement(name); // Add information about the target FA for startup to the Want instance. want.setFlags(Want.FLAG_ABILITYSLICE_MULTI_DEVICE); // Set the multi-device startup flag. If this flag is not set, remote FA startup will be unavailable. + +// Start the remote FA on the secondary device. startAbility(want); // Start the specified FA based on the want parameter. If the name and type of the want parameter are different from those used in the IDE, use the parameter name and type in the IDE. ``` -**\* Prerequisites** - -**Networking between the primary and secondary devices**: Before the remote startup, ensure that the two devices are on the same network segment and can ping each other. Otherwise, the remote startup fails. +- **Prerequisites** -**FA installation on the secondary device**: Before the remote startup, ensure that the target FA has been installed on the secondary device. +The target FA with the specified bundle name must have been installed on the secondary device. -**\* Execution** \(taking FA startup as an example\) +- **Execution** \(taking FA startup as an example\) -Call **startAbility** on the primary device \(smart TV\) to start the FA of the secondary device \(memory-constrained device such as a lite wearable\). +Call the **startAbility** method on the primary device to start the target FA on the secondary device. ## Repositories Involved diff --git a/docs-en/readme/driver-subsystem.md b/docs-en/readme/driver-subsystem.md index 25b63a72dd2a9e5a74edf553b21948ce89c31d4e..40031eeb443e9bec8f6874c323520c0e22437e6f 100755 --- a/docs-en/readme/driver-subsystem.md +++ b/docs-en/readme/driver-subsystem.md @@ -75,22 +75,22 @@ The OpenHarmony driver framework adopts the primary/secondary mode and is develo - - - - - - - - - - - - - - - - - - @@ -179,7 +174,7 @@ None ![](figures/en-us_image_0000001052764349.png) -Driver loading is mostly done by the driver framework, and you only need to register and configure required APIs. The driver framework will load and initialize the driver based on the parsing result. +Driver loading is mostly done by the driver framework, and you only need to register and configure required APIs. The driver framework will load and initialize the driver based on the parsing content. Driver development based on the HDF consists of the following three parts: @@ -191,7 +186,7 @@ Driver development based on the HDF consists of the following three parts: The driver mainly aims to develop the functions. -The first part that catches your eyes is the driver entry, which is described through **DriverEntry** alignment. +The first part that catches your eyes is the driver entry, which is described through **DriverEntry**. Three APIs are available, namely **bind**, **init**, and **release**. @@ -216,9 +211,7 @@ int32_t SampleDriverBind(struct HdfDeviceObject *deviceObject) } ``` -**Init**: When devices are successfully bound, the framework calls **Init** to initialize the driver. After initialization is complete, the driver framework will determine whether to create external service APIs based on the configuration file. - -If the driver fails to be initialized, the driver framework will automatically release the created device API. +Description of Init: When devices are successfully bound, the framework calls Init to initialize the driver. After initialization is complete, the driver framework will determine whether to create external service interfaces based on the configuration file. If the driver fails to be initialized, the driver framework will automatically release the created device interface. ``` int32_t SampleDriverInit(struct HdfDeviceObject *deviceObject) @@ -249,7 +242,7 @@ The OpenHarmony driver is mainly deployed in the kernel space using the static l ## Repositories Involved -drivers\_hdf\_frameworks +[drivers\_hdf\_frameworks](https://openharmony.gitee.com/openharmony/drivers_hdf_frameworks) -drivers\_hdf\_lite +[drivers\_hdf\_lite](https://openharmony.gitee.com/openharmony/drivers_hdf_lite) diff --git a/docs-en/readme/figures/access-policy-structure.png b/docs-en/readme/figures/access-policy-structure.png deleted file mode 100755 index 19042a9bd4da73c5640e9006b1ba23911bc2e932..0000000000000000000000000000000000000000 Binary files a/docs-en/readme/figures/access-policy-structure.png and /dev/null differ diff --git "a/docs-en/readme/figures/bms\347\255\226\347\225\245\344\270\276\344\276\213.png" "b/docs-en/readme/figures/bms\347\255\226\347\225\245\344\270\276\344\276\213.png" new file mode 100644 index 0000000000000000000000000000000000000000..fb9c3d8c66673f5c5b69718f59bb09dab16e48a9 Binary files /dev/null and "b/docs-en/readme/figures/bms\347\255\226\347\225\245\344\270\276\344\276\213.png" differ diff --git a/docs-en/readme/figures/declaring-permissions.png b/docs-en/readme/figures/declaring-permissions.png deleted file mode 100755 index cb34dac621d30de96efeef18f8b5d4519ab3de8e..0000000000000000000000000000000000000000 Binary files a/docs-en/readme/figures/declaring-permissions.png and /dev/null differ diff --git a/docs-en/readme/figures/en-us_image_0000001053044331.png b/docs-en/readme/figures/en-us_image_0000001053044331.png index 86c79b27c6bdda3439edcb612b837af464b56fbc..13c697a6e38addbc9b6b2b5717fa2b2a5770d092 100755 Binary files a/docs-en/readme/figures/en-us_image_0000001053044331.png and b/docs-en/readme/figures/en-us_image_0000001053044331.png differ diff --git a/docs-en/readme/figures/en-us_image_0000001054941316.png b/docs-en/readme/figures/en-us_image_0000001054941316.png new file mode 100644 index 0000000000000000000000000000000000000000..5c36589713f0264b5d3f87e3af9b63b05dda17d7 Binary files /dev/null and b/docs-en/readme/figures/en-us_image_0000001054941316.png differ diff --git a/docs-en/readme/figures/en-us_image_0000001055103250.png b/docs-en/readme/figures/en-us_image_0000001055103250.png new file mode 100644 index 0000000000000000000000000000000000000000..1123a2ad54538e66721419518ac33c94a6eaa5d3 Binary files /dev/null and b/docs-en/readme/figures/en-us_image_0000001055103250.png differ diff --git a/docs-en/readme/figures/en-us_image_0000001055199362.png b/docs-en/readme/figures/en-us_image_0000001055199362.png deleted file mode 100755 index 91ee8f2b429c045f5f3fc57a09c76bb9c6c8bc14..0000000000000000000000000000000000000000 Binary files a/docs-en/readme/figures/en-us_image_0000001055199362.png and /dev/null differ diff --git a/docs-en/readme/figures/en-us_image_0000001055267336.png b/docs-en/readme/figures/en-us_image_0000001055267336.png new file mode 100644 index 0000000000000000000000000000000000000000..c329d1d02d83435acfa6dbf1629f5649541f3b42 Binary files /dev/null and b/docs-en/readme/figures/en-us_image_0000001055267336.png differ diff --git a/docs-en/readme/figures/example-feature-policy.png b/docs-en/readme/figures/example-feature-policy.png deleted file mode 100755 index 257a2c2f27bf509820566feb43c7d92b632c2649..0000000000000000000000000000000000000000 Binary files a/docs-en/readme/figures/example-feature-policy.png and /dev/null differ diff --git a/docs-en/readme/figures/registering-a-feature-policy.png b/docs-en/readme/figures/registering-a-feature-policy.png deleted file mode 100755 index 9a4c306a5f8247805f21e2f054e62693874a8086..0000000000000000000000000000000000000000 Binary files a/docs-en/readme/figures/registering-a-feature-policy.png and /dev/null differ diff --git "a/docs-en/readme/figures/\345\205\250\345\261\200\347\255\226\347\225\2452.png" "b/docs-en/readme/figures/\345\205\250\345\261\200\347\255\226\347\225\2452.png" new file mode 100644 index 0000000000000000000000000000000000000000..c40fd5e3f15cbd316c43dce31020740396c57d3f Binary files /dev/null and "b/docs-en/readme/figures/\345\205\250\345\261\200\347\255\226\347\225\2452.png" differ diff --git "a/docs-en/readme/figures/\347\255\226\347\225\245\347\261\273\345\236\2132.png" "b/docs-en/readme/figures/\347\255\226\347\225\245\347\261\273\345\236\2132.png" new file mode 100644 index 0000000000000000000000000000000000000000..1ad38251b4d9abba2076bfc2df91fa14c81ac07d Binary files /dev/null and "b/docs-en/readme/figures/\347\255\226\347\225\245\347\261\273\345\236\2132.png" differ diff --git a/docs-en/readme/js-application-framework.md b/docs-en/readme/js-application-framework.md index d1e8b4a14c903554c38f434ff468db3281286f67..9ee7551091544df338b574d4f94a81611e33259e 100755 --- a/docs-en/readme/js-application-framework.md +++ b/docs-en/readme/js-application-framework.md @@ -2,7 +2,7 @@ ## Introduction -The JS application framework allows you to develop web-like applications across platforms. The framework uses Toolkit to pack your **.hml**, **.css**, and **.js** files to a JavaScript bundle, parses the bundle, and renders it with view components of the C++ native UI. You can use the declarative APIs to develop applications. This allows data to drive view changes and avoids a large number of view operations, greatly simplifying application development. +The JS application framework allows you to develop web-like applications across platforms. The framework uses Toolkit to pack your **.hml**, **.css**, and **.js** files to a JavaScript bundle, parses the bundle, generates the native UI view component tree, and then renders it for display. You can use the declarative APIs to develop applications. This allows data to drive view changes and avoids a large number of view operations, greatly simplifying application development. The following figure shows the framework modules. @@ -14,37 +14,37 @@ The source code of the framework is stored in **/foundation/ace**. The followin ``` /foundation/ace -├── frameworks #Framework code +├── frameworks # Framework code │ └── lite -│ ├── examples #Sample code -│ ├── include #Exposed header files -│ ├── packages #JavaScript implementation - │ ├── src #Source code -│ ├── targets #Configuration file of each target device - │ └── tools #Tool code -├── interfaces #APIs exposed externally -│ └── innerkits #Header files of internal subsystems -│ └── builtin #JavaScript third-party module APIs exposed by the JS application framework +│ ├── examples # Sample code +│ ├── include # Exposed header files +│ ├── packages # JavaScript implementation +│ ├── src # Source code +│ ├── targets # Configuration file of each target device +│ └── tools # Tool code +├── interfaces # APIs exposed externally +│ └── innerkits # Header files of internal subsystems +│ └── builtin # JavaScript third-party module APIs exposed by the JS application framework ``` ## Constraints -- Language version +- Language versions: - C++11 or later - - JavaScript ES5.1 or later + - JavaScript ES5.1 - Framework runtime memory consists of: - - Pre-allocated memory for running the JavaScript engine. The memory size is adjustable and depends on the complexity of the device application. Generally, 64 KB to 512 KB is recommended. - - Memory for the framework itself. For devices whose memory capacity exceeds 100 KB, the framework memory can be managed by a pre-allocated memory pool, which can be shared with the native UI framework. The memory pool manages objects and heap memory in a unified manner. + - Runtime memory for the JavaScript engine: The memory size is adjustable and depends on the complexity of the device application. Generally, 64 KB to 512 KB is recommended. + - Native memory for the framework itself: For devices whose memory capacity exceeds 100 KB, it is recommended that a pre-allocated memory pool be used for native memory management. The memory pool is shared with the native UI framework. -- The framework provides different specifications for various chip platforms and underlying OS capabilities. +- The framework provides different specifications for various chip platforms and underlying OS capabilities: - Cortex-M RAM and ROM - JavaScript engine memory pool: greater than 48 KB \(recommended\) - RAM: memory pool shared with the native UI \(recommended\). The size must be greater than 80 KB. - ROM: greater than 300 KB \(for the JS application framework and related subsystems, such as native UI and JavaScript engine\) - - Cortex-A RAM and ROM + - Cortex-A RAM/ROM - JavaScript engine memory pool: greater than 128 KB \(recommended\) - RAM: greater than 512 KB \(recommended\) - ROM: greater than 2 MB \(for the JS application framework and related subsystems, such as native UI and JavaScript engine\) @@ -53,7 +53,10 @@ The source code of the framework is stored in **/foundation/ace**. The followin ## Using targets -The implementation of the JS application framework consists of two parts: native and JavaScript. The native part is developed by C++ and is the main body of the framework. The JavaScript part supports the runtime environment of JavaScript files, and supports the interaction between the JavaScript runtime and native framework through some global functions or objects exposed to the JavaScript engine. +The implementation of the JS application framework consists of the following two parts: + +- Native part: The native part is developed in C++ and is the main body of the framework. +- JavaScript part: The JavaScript part supports the runtime environment of JavaScript files, and supports the interaction between the JavaScript runtime and native framework through some global functions or objects exposed to the JavaScript engine. The framework uses feature macros to customize function code to be compiled on different platforms. The feature macros are stored in header files in **foundation/ace/frameworks/lite/targets**. The directory structure is as follows: @@ -61,70 +64,74 @@ The framework uses feature macros to customize function code to be compiled on d /foundation/ace/frameworks/lite/targets ├── default/ │ └── acelite_config.h -├── linux/ #Linux environment configuration files +├── linux/ # Linux environment configuration files │ └── acelite_config.h -├── liteos_a/ #Environment configuration files for LiteOS Cortex-A +├── liteos_a/ # Environment configuration files for LiteOS Cortex-A │ └── acelite_config.h -├── liteos_m/ #Environment configuration files for LiteOS Cortex-M +├── liteos_m/ # Environment configuration files for LiteOS Cortex-M │ └── acelite_config.h ├── platform_adapter.cpp ├── platform_adapter.h -└── simulator/ #Simulator environment configuration files +└── simulator/ # Simulator environment configuration files └── win/ └── acelite_config.h* ``` When compiling for different platform targets, use the **acelite\_config.h** file in the corresponding platform directory. You can configure the header file searching path for compilation to locate the file to use. The following takes **ninja** and **cmake** build tools as examples: -ninja: +- ninja: -``` - if (hos_kernel_type == "liteos_a" || hos_kernel_type == "liteos_m" || - hos_kernel_type == "liteos_riscv") {// Select different header file searching paths based on the target kernel platform. - include_dirs += [ "targets/liteos-a" ] - } else if (hos_kernel_type == "linux") { - include_dirs += [ "targets/linux" ] - } -``` + ``` + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type== "liteos_m" || + ohos_kernel_type == "liteos_riscv") { // Select different header file searching paths based on the target kernel platform. + include_dirs += [ "targets/liteos-a" ] + } else if (ohos_kernel_type == "linux") { + include_dirs += [ "targets/linux" ] + } + ``` -cmake: -``` -...... -set(ACE_LITE_CONFIG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/targets/simulator/win") -set(JSFWK_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/include") -set(JSFWK_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/core") -set(UIKIT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ui") -set(THIRTY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party") -set(JSFWK_SIMULATOR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../tools/simulator") -set(JS_API_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../api/emui_band/MoltenCore/application/framework/ace/api") -set(JSFWK_SIMULATOR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../tools/simulator") -set(AAFWK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../aafwk") - -# header files -include_directories( - ${ACE_LITE_CONFIG_PATH} - ${JSFWK_INCLUDE_PATH}/async - ${JSFWK_INCLUDE_PATH}/base - ${JSFWK_INCLUDE_PATH}/context - ${JSFWK_INCLUDE_PATH}/jsi - ${JSFWK_SOURCE_PATH} +- cmake: + + ``` ...... -``` + set(ACE_LITE_CONFIG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/targets/simulator/win") # Set the simulator search path to targets/simulator/win. + set(JSFWK_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/include") + set(JSFWK_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/core") + set(UIKIT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ui") + set(THIRTY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party") + set(JSFWK_SIMULATOR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../tools/simulator") + set(JS_API_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../api/emui_band/MoltenCore/application/framework/ace/api") + set(JSFWK_SIMULATOR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../tools/simulator") + set(AAFWK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../aafwk") + + # header files + include_directories( + ${ACE_LITE_CONFIG_PATH} + ${JSFWK_INCLUDE_PATH}/async + ${JSFWK_INCLUDE_PATH}/base + ${JSFWK_INCLUDE_PATH}/context + ${JSFWK_INCLUDE_PATH}/jsi + ${JSFWK_SOURCE_PATH} + ...... + ``` + The **acelite\_config.h** file is used to enable or disable the feature macros of different platforms. It can also be used to define constants for shielding platform differences. For example, platform file systems are different, and the names of some fixed directories might be different. These constants can be defined as follows: -**liteos-a/acelite\_config.h** +- liteos-a/acelite\_config.h -``` -#define JS_FRAMEWORK_PATH "//system/ace/bin/" -``` + ``` + #define JS_FRAMEWORK_PATH "//system/ace/bin/" + ``` -**simulator/win/acelite\_config.h** -``` -#define JS_FRAMEWORK_PATH "..\\..\\..\\jsfwk\\packages\\runtime-core\\build" -``` +- **simulator/win/acelite\_config.h** + + ``` + #define JS_FRAMEWORK_PATH "..\\..\\..\\jsfwk\\packages\\runtime-core\\build" + ``` + ## Using Runtime-core @@ -133,30 +140,30 @@ Runtime-core is a JavaScript-based simple data hijacking framework provided by t ``` /foundation/ace/frameworks/lite/packages └── runtime-core - ├── .babelrc #Babel configuration file - ├── .editorconfig #IDE configuration file - ├── .eslintignore #Configuration file of the ESLint tool. You can set a directory or files that will not be scanned by the ESLint tool. - ├── .eslintrc.js #ESLint configuration file for scanning rules. + ├── .babelrc # Babel configuration file + ├── .editorconfig # IDE configuration file + ├── .eslintignore # Configuration file of the ESLint tool. You can set a directory or files that will not be scanned by the ESLint tool. + ├── .eslintrc.js # ESLint configuration file for scanning rules ├── .gitignore - ├── package.json #NPM file - ├── package-lock.json #NPM dependency lock file - ├── .prettierrc #Configuration file for code formatting rules - ├── scripts #Directory for compilation scripts - │ ├── build.js #Compilation script - │ └── configs.js #Rollup configuration file + ├── package.json # NPM file + ├── package-lock.json # NPM dependency lock file + ├── .prettierrc # Configuration file for code formatting rules + ├── scripts # Directory for compilation scripts + │ ├── build.js # Compilation script + │ └── configs.js # Rollup configuration file ├── .size-snapshot.json - └── src #Source code - ├── core #ViewModel core implementation code + └── src # Source code + ├── core # ViewModel core implementation code │ └── index.js ├── index.js - ├── observer #Data hijacking implementation code + ├── observer # Data hijacking implementation code │ ├── index.js │ ├── observer.js │ ├── subject.js │ └── utils.js - ├── profiler #profiler directory + ├── profiler # profiler directory │ └── index.js - └── __test__ #Test cases + └── __test__ # Test cases └── index.test.js ``` @@ -164,7 +171,7 @@ The following NPM commands are supported: - **npm run build** - The JavaScript engine integrated in the JS application framework supports ES5.1 syntax only. However, the runtime-core is implemented using JavaScript ES6. Therefore, you should use Babel for ES6 code degradation and use Rollup to package the code. Run the **npm run build** command, and the packaged files are output to the **build** directory. + The JavaScript engine integrated in the JS application framework supports ES5.1 syntax only. However, the runtime-core is implemented using JavaScript ES6. Therefore, you should use Babel for syntax degradation and use Rollup to package the code. Run the **npm run build** command, and the packaged files are output to the **build** directory. ``` build/ @@ -184,4 +191,3 @@ The following NPM commands are supported: ace\_lite\_jsfwk ace\_interfaces\_innerkits\_builtin - diff --git a/docs-en/readme/kernel-subsystem.md b/docs-en/readme/kernel-subsystem.md index 032eef563c4f5690492c401f8ce6d96c4e909bd9..eef0aba845a9f7d693c8af7967e36774b6a6fc72 100755 --- a/docs-en/readme/kernel-subsystem.md +++ b/docs-en/readme/kernel-subsystem.md @@ -4,11 +4,13 @@ The OpenHarmony kernel is a real-time OS kernel developed by Huawei for IoT devices. It is as lightweight as RTOS and as easy-to-use as Linux. -The kernel repository is used to store the source code of the OpenHarmony kernel components, including process and thread scheduling, memory management, IPC mechanism, and timer management, as well as the version package compilation information. +The OpenHarmony kernel includes basic kernel functions such as process and thread scheduling, memory management, IPC mechanism, and timer management. + +The source code of the OpenHarmony kernel consists of two repositories: the [`kernel_liteos_a`](https://gitee.com/openharmony/kernel_liteos_a) repository for Cortex-A processors and the [`kernel_liteos_m`](https://gitee.com/openharmony/kernel_liteos_m) repository for Cortex-M processors. The directory structures of the two repositories are similar. The following describes the directory structure of kernel_liteos_a. ## Directory Structure -**Table 1** Directory structure of the OpenHarmony lightweight kernel source code +**Table 1** Directory structure of the OpenHarmony kernel source code

Development Tool

+ - - - - - - - - - - - - - - - - - - - - - - - @@ -152,6 +152,13 @@ The following table describes the common tools required for Linux and how to obt + + + +

Development Tool

Description

+

Description

How to Obtain

+

How to Obtain

Python3.7+

+

Python3.7+

Runs the compilation scripts.

+

Runs the compilation scripts.

https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz

+

https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz

bash

+

bash

Executes commands.

+

Executes commands.

Internet

+

Internet

gn

+

gn

Generates ninja compilation scripts.

+

Generates ninja compilation scripts.

http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar

ninja

+

ninja

Executes ninja compilation scripts.

+

Executes ninja compilation scripts.

http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar

LLVM

+

LLVM

Functions as the compiler toolchain.

+

Functions as the compiler toolchain.

http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

hc-gen

+

hc-gen

Configures and compiles files.

+

Configures and compiles files.

http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

IPOP, PuTTY, or other HyperTerminal software

+

IPOP, PuTTY, or other HyperTerminal software

Connects to the Linux server (choose one of the terminals).

+

Connects to the Linux server (choose one of the terminals).

Internet (for example, https://www.putty.org/)

+

Internet (for example, https://www.putty.org/)

https://device.harmonyos.com/cn/ide

HiTool

+

Burns the images and the U-boot.

+

http://www.hihope.org/download

+
@@ -253,7 +260,7 @@ sudo ln -s /bin/bash /bin/sh ## Installing gn 1. Start a Linux server. -2. Download [gn](https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest). +2. Download [gn](https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar). 3. Decompress the **gn** installation package to the **tar -xvf gn.1523.tar -C \~/** in **\~/gn** directory. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/gn:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. @@ -261,7 +268,7 @@ sudo ln -s /bin/bash /bin/sh ## Installing ninjah 1. Start a Linux server. -2. Download [ninja](https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip). +2. Download [ninja](https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar). 3. Decompress the **ninja** installation package to **tar -xvf ninja.1.9.0.tar -C \~/** in **\~/ninja** directory. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/ninja:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. @@ -269,7 +276,7 @@ sudo ln -s /bin/bash /bin/sh ## Installing the LLVM Toolchain 1. Start a Linux server. -2. Download [http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar](http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar). +2. Download [LLVM](http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar). 3. Decompress the LLVM installation package to the **\~/llvm** path by running **"tar -xvf llvm-linux-9.0.0-34042.tar -C \~/"**. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/llvm/bin:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. @@ -277,8 +284,8 @@ sudo ln -s /bin/bash /bin/sh ## Installing hc-gen 1. Start a Linux server. -2. Download [http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar](http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar). -3. Decompress the hc-gen installation package to the **\~/hc-gen** directory on the Linux server. +2. Download [hc-gen](https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar). +3. Decompress the hc-gen installation package to **tar -xvf hc-gen-0.65-linux.tar -C \~/** in **\~/hc-gen** on the Linux. 4. Open the **\~/.bashrc** file in Vim and add a line of **export PATH=\~/hc-gen:$PATH** to set an environment variable. 5. Run **source \~/.bashrc** to validate the environment variable. diff --git a/docs-en/readme/application-framework.md b/docs-en/readme/application-framework.md index 13bcf46ac37350cee9141ddad6c60eb8924544ad..4be927597534f1da62449ea6cedf10abaf33f249 100755 --- a/docs-en/readme/application-framework.md +++ b/docs-en/readme/application-framework.md @@ -7,9 +7,9 @@ The application framework of OpenHarmony consists of two modules: **ability man **1. Ability management framework**: This framework is provided by OpenHarmony for you to develop OpenHarmony applications. The following figure shows the modules in the ability management framework. **Figure 1** Architecture of the Ability management framework -![](figures/architecture-of-the-ability-management-framework.png "architecture-of-the-ability-management-framework") +![](figures/en-us_image_0000001054941316.png) -- **AbilityKit** is a development kit provided by the ability management framework. You can use this kit to develop applications based on the **Ability** component. There are two types of applications developed based on the **Ability** component: **JS Ability** developed using the JavaScript language and **Native Ability** developed using the C/C++ language. The **ACE** framework encapsulates JavaScript UI components on the basis of the AbilityKit and is used to help you quickly develop JS Ability-based applications. +- **AbilityKit** is a development kit provided by the ability management framework. You can use this kit to develop applications based on the **Ability** component. There are two types of applications developed based on the **Ability** component: **JS Ability** developed using the JavaScript language and **Native Ability** developed using the C/C++ language. The **JS application development framework** encapsulates JavaScript UI components on the basis of the AbilityKit and is used to help you quickly develop JS Ability-based applications. - **Ability** is the minimum unit for the system to schedule applications. It is a component that can implement an independent functionality. An application can contain one or more **Ability** instances. There are two types of templates that you can use to create an **Ability** instance: Page and Service. - An **Ability using the Page template** \(Page ability for short\) provides a UI for interacting with users. - An **Ability using the Service template** does not have a UI and is used for running background tasks. @@ -80,7 +80,7 @@ The following table describes the source code directory structure of the applica

foundation/aafwk/frameworks/ability_lite

Core code of the ability management framework

+

Core code for AbilityKit

foundation/aafwk/frameworks/abilitymgr_lite

@@ -95,12 +95,12 @@ The following table describes the source code directory structure of the applica

foundation/aafwk/interfaces/kits/abilitykit_lite

External APIs of the ability management framework

+

APIs provided by AbilityKit for developers

foundation/aafwk/interfaces/innerkits/abilitymgr_lite

APIs provided by the Ability Manager Service to other subsystems

+

APIs provided by the Ability Manager Service for other subsystems

foundation/aafwk/interfaces/kits/want_lite

@@ -115,12 +115,12 @@ The following table describes the source code directory structure of the applica

foundation/appexecfwk/interfaces/kits/bundle_lite

External bundle management APIs provided by the bundle management framework

+

APIs provided by BundleKit for developers

foundation/appexecfwk/interfaces/innerkits/bundlemgr_lite

APIs provided by the Bundle Manager Service to other subsystems

+

Core code for AbilityKit and APIs provided by the Bundle Manager Service for other subsystems

foundation/appexecfwk/frameworks/bundle_lite

@@ -147,13 +147,13 @@ The following table describes the source code directory structure of the applica - C++11 or later - The specifications of the application framework vary depending on the System-on-a-Chip \(SoC\) and underlying OS capabilities. - - Cortex-M RAM and ROM: + - Cortex-M RAM and ROM - RAM: greater than 20 KB \(recommended\) - - ROM: greater than 300 KB \(for the ACE framework and related subsystems, such as UIKit and engine\) + - ROM: greater than 300 KB \(for the JS application development framework and related subsystems, such as UIKit and engine\) - Cortex-A RAM and ROM - RAM: greater than 2 MB \(recommended\) - - ROM: greater than 2 MB \(for the ACE framework and related subsystems, such as UIKit and engine\) + - ROM: greater than 2 MB \(for the JS application development framework and related subsystems, such as UIKit and engine\) @@ -231,7 +231,7 @@ The following table describes the source code directory structure of the applica - After the preceding configurations are complete, run the following command to compile the entire system: ``` -python build.py ipcamera -p hi3516dv300_liteos_a -b debug +python build.py ipcamera_hi3516dv300 -b debug ``` ## Running the Two Services in the Application Framework @@ -253,78 +253,93 @@ deps = [ ## Running an Ability Developed Based on AbilityKit -- The demo code of the ability developed based on AbilityKit is stored in the **foundation/aafwk/frameworks/kits/ability\_lite/test** directory. If you need to modify the functionality, modify the code in the **unittest** file or add a code file, and update the configuration in **BUILD.gn** accordingly. -- Run the following command in the shell to compile the demo. After the compilation is successful, the **libLauncher.so** file is generated in **out/ipcamera\_hi3516dv300\_liteos\_a**. +- The demo code of the ability developed based on AbilityKit is stored in the **foundation/aafwk/frameworks/ability\_lite/example** directory. If you need to modify the functionality, modify the code in the **entry/src/main/cpp** files or add a new code file, and update the configuration in **BUILD.gn** accordingly. +- Add the configuration for the ability demo for compilation in the **build/lite/config/subsystem/aafwk/BUILD.gn** file. ``` - python build.py ipcamera -p hi3516dv300_liteos_a -T //foundation/aafwk/frameworks/kits/ability_lite/test:Launcher + import("//build/lite/config/subsystem/lite_subsystem.gni") + + lite_subsystem("aafwk") { + subsystem_components = [ + "......", + "//foundation/aafwk/frameworks/ability_lite/example:hiability", + "......", + ] + } ``` -- Modify the **config.json** file. The example content is as follows: +- Run the following command in the shell to compile the demo. After the compilation is successful, the **libhiability.so** file is generated in **out/ipcamera\_hi3516dv300\_liteos\_a/dev\_tools/example**. -``` -{ - "app": { - "bundleName": "com.huawei.launcher", - "vendor": "huawei", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 3, - "target": 3 - } - }, - "deviceConfig": { - "default": { - "keepAlive": false - }, - }, - "module": { - "deviceType": [ - "smartVision" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "Launcher", - "moduleType": "entry" - }, - "abilities": [{ - "name": "MainAbility", - "icon": "assets/entry/resources/base/media/icon.png", - "label": "test app 1", - "launchType": "standard", - "type": "page", - "visible": true + ``` + python build.py ipcamera_hi3516dv300 -b debug + ``` + +- Compile the **config.json** file. For details, see the **config.json** file in the **foundation/aafwk/frameworks/ability\_lite/example** directory. The file content is as follows: + + ``` + { + "app": { + "bundleName": "com.huawei.hiability", + "vendor": "huawei", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 3, + "target": 3 + } }, - { - "name": "SecondAbility", - "icon": "assets/entry/resources/base/media/icon.png", - "label": "test app 2", - "launchType": "standard", - "type": "page", - "visible": true + "deviceConfig": { + "default": { + "keepAlive": false + }, }, - { - "name": "ServiceAbility", - "icon": "", - "label": "test app 2", - "launchType": "standard", - "type": "service", - "visible": true + "module": { + "deviceType": [ + "smartVision" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "hiability", + "moduleType": "entry" + }, + "abilities": [{ + "name": "MainAbility", + "icon": "assets/entry/resources/base/media/icon.png", + "label": "test app 1", + "launchType": "standard", + "type": "page", + "visible": true + }, + { + "name": "SecondAbility", + "icon": "", + "label": "test app 2", + "launchType": "standard", + "type": "page", + "visible": true + }, + { + "name": "ServiceAbility", + "icon": "", + "label": "test app 2", + "launchType": "standard", + "type": "service", + "visible": true + } + ] } - ] } -} -``` + ``` + - Generate a HAP. - Add resource files to the **assets/entry/resources/base/media** directory based on the following directory structure. - ![](figures/en-us_image_0000001055712348.png) + ![](figures/en-us_image_0000001055267336.png) - - Compress the preceding files into a ZIP package and change the file name extension to **.hap**, for example, **Launcher.hap**. + - Compress the preceding files into a ZIP package and change the file name extension to **.hap**, for example, **hiability.hap**. - Install the HAP. @@ -332,13 +347,13 @@ deps = [ - Run the following command to install the HAP: ``` - ./bin/bm install -p /nfs/hap/Launcher.hap + ./bin/bm install -p /nfs/hap/hiability.hap ``` - After the installation is complete, run the following command to run the demo: ``` -./bin/aa start -p com.huawei.launcher -n MainAbility +./bin/aa start -p com.huawei.hiability -n MainAbility ``` ## Repositories Involved diff --git a/docs-en/readme/dfx.md b/docs-en/readme/dfx.md index 90b3da09d6bed2bd66b1963480e1c3e148285640..01e84be97eef5ab9a5f8fc32a05c0046909aad97 100755 --- a/docs-en/readme/dfx.md +++ b/docs-en/readme/dfx.md @@ -8,7 +8,7 @@ As chip resources are limited and hardware platforms are diversified, component- - mini: This framework is intended for hardware platforms with Cortex-M or equivalent processing capabilities. The system memory is generally less than 512 KB. There is only one lightweight file system that can be used in limited scenarios, or no file system at all. The mini framework complies with the Cortex Microcontroller Software Interface Standard \(CMSIS\). -- featured: This framework is intended for hardware platforms with Cortex-A or equivalent processing capabilities. The system memory is greater than 512 KB. There is a comprehensive file system for storing a large amount of data. The featured framework complies with the Portable Operating System Interface \(POSIX\) specifications. +- featured: This framework is intended for hardware platforms with Cortex-A or equivalent processing capabilities. The system memory is generally greater than 512 KB. There is a comprehensive file system for storing a large amount of data. The featured framework complies with the Portable Operating System Interface \(POSIX\) specifications. ## Directory Structure @@ -130,7 +130,7 @@ The mini framework is a simple and compact DFX design that provides the logging Add the following code to the initialization process of Module A to register it with the logging framework: ``` - HiLogRegisterModule(HILOG_MODULE_SAMGR, "A"); + HiLogRegisterModule(HILOG_MODULE_A, "A"); ``` @@ -155,7 +155,6 @@ The mini framework is a simple and compact DFX design that provides the logging

OUTPUT_OPTION_DEBUG: Logs are directly output to the serial port without cross-task scheduling. This value is used only for temporary debugging.

OUTPUT_OPTION_FLOW (default value): Logs are output as data flow to the serial port.

OUTPUT_OPTION_TEXT_FILE: Logs are output as text files.

-

OUTPUT_OPTION_BIN_FILE (to be supported): Logs are output as binary files.

level

@@ -189,7 +188,7 @@ The mini framework is a simple and compact DFX design that provides the logging Include **\#include "log.h"** in the **.c** file where logs need to be printed, call the following function: - HILOG\_INFO\(HILOG\_MODULE\_SAMGR, "log test: %d", 88\); + HILOG\_INFO\(HILOG\_MODULE\_A, "log test: %d", 88\); Parameter description: @@ -248,7 +247,11 @@ The featured framework provides comprehensive DFX features and logging APIs. Available hilog APIs: ``` -HILOGD(fmt,...) HILOGI(fmt,...) HILOGW(fmt,...) HILOGE(fmt,...) +HILOG_DEBUG(type, ...) +HILOG_INFO(type, ...) +HILOG_WARN(type, ...) +HILOG_ERROR(type, ...) +HILOG_FATAL(type, ...) ``` Usage guidelines: @@ -310,7 +313,7 @@ Parameter description: **Viewing logs** -1. Go to the **/storage/data/log/hilogs** directory to view hilog logs for debugging purpose. +1. Go to the **/storage/data/log/** directory to view hilog logs for debugging purpose. 2. Run the **hilogcat** command to view hilog logs in real time. diff --git a/docs-en/readme/distributed-scheduler.md b/docs-en/readme/distributed-scheduler.md index 799453b3065a685d200f972d83d30265e97473c9..28435bba82faf265731673538bb511a9d3733ae4 100755 --- a/docs-en/readme/distributed-scheduler.md +++ b/docs-en/readme/distributed-scheduler.md @@ -2,9 +2,9 @@ ## Overview -The Distributed Scheduler sets up a distributed service platform in OpenHarmony by using a proxy between the primary and secondary devices. With the distributed scheduler, the primary device \(OpenHarmony-powered smart TV\) can start a Feature Ability \(FA\) deployed on the secondary device \(a memory-constrained OpenHarmony device such as a lite wearable\). The following figure shows the components of the Distributed Scheduler. +The Distributed Scheduler is used for cross-device component management. It allows the local device to access or control remote components, and enables application collaboration in distributed scenarios. The following figure shows the modules in the Distributed Scheduler. -![](figures/en-us_image_0000001055199362.png) +![](figures/en-us_image_0000001055103250.png) ## Directory Structure @@ -21,17 +21,12 @@ The following table describes the directory structure of the Distributed Schedul

dtbschedmgr_lite

Implementation logic of the Distributed Scheduler

+

Implementation of the Distributed Scheduler

safwk_lite

Implementation logic of system service processes

-

samgr_lite

-

Implementation logic of local service management

+

Implementation of the foundation process

Indicates the OpenHarmony driver framework.

hdf\frameworks

+

hdf/frameworks

Provides the source code to develop the driver frameworks, driver models, and capability model libraries.

hdf\frameworks\ability

+

hdf/frameworks/ability

Provides functional capabilities for the driver development, such as the message model libraries.

hdf\frameworks\core

+

hdf/frameworks/core

Provides the core code to implement the OpenHarmony driver framework.

hdf\frameworks\core\host

+

hdf/frameworks/core/host

Provides functions of the driver host environment framework, including:

1. Loading and starting a driver, and dispatching device nodes.

@@ -99,7 +99,7 @@ The OpenHarmony driver framework adopts the primary/secondary mode and is develo

4. Managing the common driver resource configurations.

hdf\frameworks\core\manager

+

hdf/frameworks/core/manager

Provides the management modules of the driver framework, including:

1. Driver API management module.

@@ -109,58 +109,53 @@ The OpenHarmony driver framework adopts the primary/secondary mode and is develo

5. Fault management module.

hdf\frameworks\core\shared

+

hdf/frameworks/core/shared

Provides shared code for the host and manager.

hdf\frameworks\model

+

hdf/frameworks/model

Provides a universal framework model for drivers.

hdf\frameworks\model\network

+

hdf/frameworks/model/network

Provides network device models for drivers.

hdf\frameworks\support\

+

hdf/frameworks/support

Provides drivers with system APIs and hardware, such as GPIO, I2C, and SPI capabilities.

Some interfaces can be migrated across platforms.

hdf\frameworks\support\osal

-

Provides platforms with common adaptation interfaces, such as memory, thread, and mutex.

-

hdf\frameworks\support\platform

+

hdf/frameworks/support/platform

Provides APIs that support the common hardware of platforms, such as GPIO, I2C, and SPI capabilities.

hdf\frameworks\tools

+

hdf/frameworks/tools

Provides the driver capability libraries, such as the tool that configures and compiles the HCS (HDF Configuration Source).

hdf\frameworks\utils

+

hdf/frameworks/utils

Provides basic data structures and algorithms.

hdf\lite\adapter

+

hdf/lite/adapter

Adapts to kernel operation APIs and provides abstract APIs.

hdf\lite\include

+

hdf/lite/include

Provides driver APIs for lightweight devices.

hdf\lite\hdi

+

hdf/lite/hdi

Provides APIs of the OpenHarmony driver.

- - - - @@ -87,7 +84,7 @@ The kernel repository is used to store the source code of the OpenHarmony kernel ## Constraints -By default, the JFFS2 file system is used during system startup. This file system is read-write. If other file systems need to be used, the configurations of the file systems must be added accordingly. +Hi3518EV300 uses the JFFS2 file system by default, and Hi3516DV300 uses the VFAT file system by default. If other file systems need to be used, the configurations of the file systems must be added accordingly. ## Usage @@ -95,11 +92,11 @@ For details, see [Kernel Usage Guidelines](../kernel/Readme-EN.md). ## Repositories Involved -drivers\_liteos +[drivers_liteos](https://gitee.com/openharmony/drivers_liteos) -kernel\_liteos\_a +[kernel_liteos_a](https://gitee.com/openharmony/kernel_liteos_a) -kernel\_liteos\_a\_huawei\_proprietary\_fs\_proc +[kernel_liteos_a_huawei_proprietary_fs_proc](https://gitee.com/openharmony/kernel_liteos_a_huawei_proprietary_fs_proc) -kernel\_liteos\_m +[kernel_liteos_m](https://gitee.com/openharmony/kernel_liteos_m) diff --git a/docs-en/readme/media-subsystem.md b/docs-en/readme/media-subsystem.md index 438ddd7605260326eddbf5843ebfc4bc4e21a5a6..d201b0d76516a02f3c223edd74b164cadab1a4cb 100755 --- a/docs-en/readme/media-subsystem.md +++ b/docs-en/readme/media-subsystem.md @@ -1,20 +1,18 @@ -# Media Subsystem +# Multimedia Subsystem ## Overview -This repository stores source code information of the multimedia subsystem. It provides unified interfaces for you to develop media applications. With this repository, you can easily obtain media resources and focus on service development. +This repository stores source code information of the multimedia subsystem. It provides unified interfaces for you to develop media applications. With this repository, you can easily obtain media resources and focus on service development. The following two figures show the framework and service flow of the multimedia subsystem, respectively. -Based on code information about this repository, the device configuration file is stored in **test\\lite\\devini**. When using the configuration file, you can place it in the **/data** directory of the development board in use. You use the configuration file for the adaption to the sensor, resolution, frame rate, and more. +**Figure 1** Subsystem architecture +![](figures/en-us_image_0000001055193837.png "subsystem-architecture") -Subsystem architecture +As shown in Figure 1, the multimedia framework supports the camera, recording, and playback functions. These functions support the development of HarmonyOS JavaScript applications and various kit modules that use media capabilities. The multimedia framework consists of the framework and core service layers. The framework layer provides native APIs and corresponding service implementation for applications. It implements audio/video input and output, audio/video encoding and decoding, as well as video file packing and demultiplexing for camera, recording, and playback services. The core service layer leverages the capabilities provided by the hardware platform to use the underlying hardware and related drivers. In addition, the core server implements file management, storage management, and log management. -![](figures/en-us_image_0000001055193837.png) +**Figure 2** Multimedia service flow +![](figures/en-us_image_0000001055193731.png "multimedia-service-flow") -Service process - -![](figures/en-us_image_0000001055193731.png) - -As shown in these figures, the multimedia subsystem consists of camera, recorder, and player modules. The camera module provides YUV or RGB, JPEG, and H.264 or H.265 data, which is stored in the surface \(shared memory\); the recorder module packs H.264 or H.265 and AAC data in the surface into MP4 files; the player module demultiplexes the MP4 files into audio and video data, sends the data to corresponding decoders, and then plays the audio and video. +As shown in Figure 2, the multimedia subsystem consists of camera, recorder, and player modules. The camera module provides YUV or RGB, JPEG, and H.264 or H.265 data, which is stored in the surface \(shared memory\); the recorder module packs H.264 or H.265 and AAC data in the surface into MP4 files; the player module demultiplexes the MP4 files into audio and video data, sends the data to corresponding decoders, and then plays the audio and video. ## Directory Structure @@ -27,29 +25,29 @@ As shown in these figures, the multimedia subsystem consists of camera, recorder - - - - - - - @@ -58,20 +56,24 @@ As shown in these figures, the multimedia subsystem consists of camera, recorder ## Constraints - C++11 or later -- Currently, Hi3516DV300 and Hi3518EV300 are supported, and only Hi3516DV300 supports the playback function. +- Hi3516DV300 and Hi3518EV300 are supported, and only Hi3516DV300 supports the playback function. +- By default, Hi3516DV300 supports Sony IMX335, and Hi3518EV300 supports crystalline phase JXF23. ## Installation - Load the kernel and related drivers before installing the repository. For details, see readme files of kernel and driver subsystems. -- Modify required configuration files, such as those in **test/devini**. For details, see the _Configuration File Description_. Currently, only IMX335 and IMX327 sensors are supported. For other sensors, seek help from the open source community. -- For details about how to invoke native APIs, see the demonstration in the **test** directory. +- Configure a proper configuration file. For details, see the configuration file in **applications/sample/camera/media** directory. If you want to adapt to other sensors, seek help from the open source community. Ensure that the configuration file is stored in the **/storage/data** directory of the development board in use. You can use this configuration file to adapt to the sensor, resolution, and frame rate. + +## Usage -## Use Case +For details about how to call native APIs, see the demo in the **applications/sample/camera/media** directory. -You can use media APIs to record, preview, and play audios and videos. Before using these resources, create a **CameraKit** object and register various callbacks to respond to many events in the media module. You create a **Camera** object to operate camera resources, for example, to start preview, recording, and stream capturing, and set related parameters. +For details about how to call multimedia APIs to implement the video recording, preview, and playback, see _Multimedia Development Guide_. The following example overrides the event class: +Create a **CameraKit** object and register various callbacks to respond to many events in the media module. Then, create a **Camera** object to operate camera resources, for example, to start preview, recording, and stream capturing, and set related parameters. + ``` /* * Copyright (c) 2020 Huawei Device Co., Ltd. @@ -429,6 +431,7 @@ EXIT: cout << "Camera sample end." << endl; return 0; } + ``` ## Repositories Involved @@ -453,5 +456,4 @@ multimedia\_interfaces\_kits\_player\_lite multimedia\_services\_media\_lite -multimedia\_utils\_lite - +multimedia\_utils\_lite \ No newline at end of file diff --git a/docs-en/readme/security-subsystem.md b/docs-en/readme/security-subsystem.md index a0908cdfd7f270bb108d7a4302c36bc065c68a3b..d47af078c927dc5748cf4e5210f0ebcf1db7e8b2 100755 --- a/docs-en/readme/security-subsystem.md +++ b/docs-en/readme/security-subsystem.md @@ -6,8 +6,6 @@ This section provides samples about how to use existing security mechanisms to i ## Directory Structure -**Directory 1** - ``` security ├── framework @@ -31,18 +29,6 @@ security │ ├── secure_os Secure OS ``` -**Directory 2** - -``` -kernel/liteos-a/security/ -├── cap Capability mechanism -│ ├── BUILD.gn -│ ├── capability_api.h -│ ├── capability.c -│ ├── capability_type.h -│ └── Makefile -``` - ## Constraints C programming language is used. The preceding security features are mainly used on Cortex-A or devices with equivalent processing capabilities. On Cortex-M or devices with equivalent processing capabilities, only HUKS and HiChain are available. @@ -53,14 +39,9 @@ To generate a x509 image package, perform compilation to generate the required b ## Application Permission Management -Application permissions are used to control access to system resources and features. These include personal privacy-related features or data in some scenarios, for example, hardware features of personal devices such as cameras and microphones, and personal data such as contacts and calendar data. OpenHarmony protects such data and features through application permission management. +Application permissions are used to control access to system resources and features related to personal privacy, for example, accessing hardware features of personal devices such as cameras and microphones, and reading and writing media files. The OS protects such data and features through application permission management. -To declare the permissions required by an application, edit **req-permissions** in the **HarmonyProfile.json** file in the installation bundle. The following figure shows an example. - -**Figure 1** Declaring permissions -![](figures/declaring-permissions.png "declaring-permissions") - -Field descriptions +The following table describes fields in a permission.

Directory

@@ -72,14 +74,9 @@ The kernel repository is used to store the source code of the OpenHarmony kernel

System calls

test

-

Kernel and user-space test cases

-

tools

Code related to compilation configuration and menuconfig

+

Building tool as well as related configuration and code

foundation\multimedia\frameworks

+

foundation/multimedia/frameworks

Internal framework implementation, including Audio, Camera, and Player.Recorder

+

Internal framework implementation, including Audio, Camera, Player, and Recorder.

foundation\multimedia\interfaces\kits

+

foundation/multimedia/interfaces/kits

External header files

foundation\multimedia\services\media_lite

+

foundation/multimedia/services/media_lite

Underlying service implementation

foundation\multimedia\utils\lite

+

foundation/multimedia/utils/lite

Common module implementation

foundation\multimedia\test\lite

+

foundation/multimedia/hals

API testing code

+

Header files of multimedia adaptation APIs related to the hardware platform

@@ -104,46 +84,55 @@ Field descriptions ## IPC Authentication - If system services registered with Samgr provide APIs for other processes to access the services through IPC, access control policies must be configured; otherwise, access to the system services will be denied. -- You can configure access control policies in **base/security/services/iam\_lite/include/policy\_preset.h**. You need to configure the policy for each feature and then add the policies of features to the global policy. +- You can configure access control policies in **base/security/services/iam\_lite/ipc\_auth/include/policy\_preset.h**. + + 1. Define the policies for each feature. + + 2. Add the feature policies to the global policy. + For example, to configure an access policy for the BMS service, whose service registered with Samgr is **bundlems** and whose registered feature is **BmsFeature**, perform the following operations: -1. Define the feature policy. You can configure multiple features and configure multiple access policies for each feature. +1. Define feature policies. You can configure multiple features and configure multiple access policies for each feature. + +**Figure 1** Example feature policy + -**Figure 2** Example feature policy -![](figures/example-feature-policy.png "example-feature-policy") +![](figures/bms策略举例.png) There are three types of access policies: -**Figure 3** Access policy structure -![](figures/access-policy-structure.png "access-policy-structure") +**Figure 2** Access policy structure + + +![](figures/策略类型2.png) - **RANGE**: Processes with a UID within a specified range are allowed to access **BmsFeature**. **uidMin** and **uidMax** need to be specified. - **FIXED**: Processes with specified UIDs are allowed to access **BmsFeature**. **fixedUid** needs to be specified. A maximum number of eight UIDs can be configured. - **BUNDLENAME**: Only a specified application is allowed to access **BmsFeature**. **bundleName** needs to be specified. -2. Add the defined feature policy to the global policy. You need to configure the number of features. +2. Add the defined feature policies to the global policy. You need to configure the number of features. -**Figure 4** Registering a feature policy -![](figures/registering-a-feature-policy.png "registering-a-feature-policy") +**Figure 3** Registering a feature policy + + +![](figures/全局策略2.png) UID allocation rules: -Init/foundation process: 0 +1. Init process: 0 appspawn process: 1 Shell process: 2 -kitfw process: 3 +4. Other built-in system services: less than or equal to 99 -Other built-in services: 4–99 +5. System applications \(such as settings, home screen, and camera\): 100–999 -System applications \(such as settings\): 100–999 +6. Preset applications: 1000–9999 -Preset applications \(such as Wallet and Taobao\): 1000–9999 - -Common third-party applications: 10000 to **INT\_MAX** +7. Common third-party applications: 10000 to **INT\_MAX** ## HUKS @@ -193,7 +182,7 @@ When an IoT controller and an IoT device communicate with each other after estab ## Application Signature Verification -To ensure the integrity of application content, HarmonyOS uses application signatures and profiles to manage application sources. Only pre-installed applications and applications from HUAWEI AppGallery can be installed on devices. +To ensure the integrity of application content, OpenHarmony uses application signatures and profiles to manage application sources. Only pre-installed applications and applications from HUAWEI AppGallery can be installed on devices. **Basic Concepts** @@ -232,20 +221,19 @@ Unique identifier of an application, which consists of the application bundle na - **Application debugging scenario** -To develop and debug applications for HarmonyOS devices, you need to apply for becoming an authorized application developer on HUAWEI AppGallery. You need to generate a public/private key pair and upload the public key to HUAWEI AppGallery. HUAWEI AppGallery creates a developer certificate based on your identity information and the uploaded public key, and issues the certificate through the developer certificate CA. You also need to upload the application information and debugging device ID for creating an application debugging profile, which contains the HUAWEI AppGallery signature and cannot be tampered with. Upon obtaining the developer certificate and application debugging profile, you can install and debug applications signed with the private key on a specified HarmonyOS device. +To develop and debug applications for OpenHarmony devices, you need to apply for becoming an authorized application developer on HUAWEI AppGallery. You need to generate a public/private key pair and upload the public key to HUAWEI AppGallery. HUAWEI AppGallery creates a developer certificate based on your identity information and the uploaded public key, and issues the certificate through the developer certificate CA. You also need to upload the application information and debugging device ID for creating an application debugging profile, which contains the HUAWEI AppGallery signature and cannot be tampered with. Upon obtaining the developer certificate and application debugging profile, you can install and debug applications signed with the private key on a specified OpenHarmony device. -The application installation service of HarmonyOS verifies the application signature to ensure application integrity. In addition, the service verifies the developer certificate, application debugging profile, and the mapping between them to ensure the validity of your identity and the application. +The application installation service of OpenHarmony verifies the application signature to ensure application integrity. In addition, the service verifies the developer certificate, application debugging profile, and the mapping between them to ensure the validity of your identity and the application. ![](figures/en-us_image_0000001051282241.png) - **Application publishing** - To publish applications in HUAWEI AppGallery, you need to use the application publishing certificate and profile issued by HUAWEI AppGallery to sign the applications. As shown in the following figure, the procedure of applying for the application publishing certificate and profile is similar to that of applying for the developer certificate and application debugging profile \(you can use the same public/private key pair\). Applications signed by the application publishing certificate cannot be directly installed on devices. Instead, the applications must be published in HUAWEI AppGallery for review. After the applications are reviewed and approved, HUAWEI AppGallery uses the publishing certificate to re-sign the applications. The re-signed applications can be downloaded and installed by users. - - The application installation service of HarmonyOS verifies the application signature to ensure application integrity. In addition, the service checks whether the signature certificate is from HUAWEI AppGallery to ensure that the application is trusted. +To publish applications in HUAWEI AppGallery, you need to use the application publishing certificate and profile issued by HUAWEI AppGallery to sign the applications. As shown in the following figure, the procedure of applying for the application publishing certificate and profile is similar to that of applying for the developer certificate and application debugging profile \(you can use the same public/private key pair\). Applications signed by the application publishing certificate cannot be directly installed on devices. Instead, the applications must be published in HUAWEI AppGallery for review. After the applications are reviewed and approved, HUAWEI AppGallery uses the publishing certificate to re-sign the applications. The re-signed applications can be downloaded and installed by users. - ![](figures/en-us_image_0000001051562162.png) +The application installation service of OpenHarmony verifies the application signature to ensure application integrity. In addition, the service checks whether the signature certificate is from HUAWEI AppGallery to ensure that the application is trusted. +![](figures/en-us_image_0000001051562162.png) ## Repositories Involved diff --git a/docs-en/readme/testing-subsystem.md b/docs-en/readme/testing-subsystem.md index bb2f779f1cf101b84231dbcad536c875cd9d7a40..0b25654affbe06d0905e2f8790f26c5a75cb5f60 100755 --- a/docs-en/readme/testing-subsystem.md +++ b/docs-en/readme/testing-subsystem.md @@ -2,11 +2,11 @@ ## Overview -The test-driven development mode is used during the development process. You can develop new cases or modify existing cases to test new or enhanced system features. The self-test helps you develop high-quality code in the development phase. +The test-driven development mode is used during the development process. You can develop new cases or modify existing cases to test new or enhanced system features. The test helps you develop high-quality code in the development phase. ## Directory Structure -**Table 1** Directory structure of the source code for self-test tools +**Table 1** Directory structure of the source code for test tools

Field

@@ -83,7 +64,6 @@ Field descriptions

Multi-language string ID

Purpose of requesting the permission.

-

The purposes include reviewing requests for publishing applications, pop-up authorization, and permission management by users.

used-scene{

@@ -95,7 +75,7 @@ Field descriptions

when: inuse and always

Scene where the APIs controlled by this permission are called.

-

This field declares the components that call the APIs controlled by this permission and whether the APIs are called from the foreground or from both the foreground and background.

+

This field declares what components can call the APIs controlled by this permission in the specified scene (foreground/background).

- - - @@ -130,13 +130,13 @@ Test tool environment dependency Depend on the Python environment. -Install the serial port plugins **pyserial** and **readline** on the local Python, and run the **pip intall pyserial** and **sudo apt-get install libreadline-dev** commands on the shell. The following figure is displayed when the installation is complete. +Install the serial port plugins **pyserial** and **readline** on the local Python, and run the **pip install pyserial** and **sudo apt-get install libreadline-dev** commands on the shell. The following figure is displayed when the installation is complete. ![](figures/en-us_image_0000001052278423.png) ## Compiling Test Cases -- Self-test case specifications +- Test case specifications - Naming rules The source file name of the test case must be consistent with the test suite content. The relationship between the test suite and the test case is 1:N and the test suite and the test source file is 1:1. Each source file is globally unique and named in the format of \[Feature\]\_\[Function\]\_\[Subfunction 1\]\_\[Subfunction 1.1\]. Subfunctions can be further divided. @@ -145,18 +145,18 @@ Install the serial port plugins **pyserial** and **readline** on the local P - Test case coding specifications - The self-test cases must comply with the feature code coding specifications. In addition, necessary case description information must be added. For details, see [\#li2069415903917](#li2069415903917). + The test cases must comply with the feature code coding specifications. In addition, necessary case description information must be added. For details, see [\#li2069415903917](#li2069415903917). - Test case compilation and configuration specifications The test cases are compiled in GN mode. The configuration must comply with the compilation guide of the open source project. For details, see [en-us\_topic\_0000001051580775.md](en-us_topic_0000001051580775.md). -- Self-test case template +- Test case template For details, see the test case **demo** developertest/example/cxx\_demo/test/unittest/common/calc\_subtraction\_test.cpp. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](public_sys-resources/icon-note.gif) **NOTE:** >Feature: Description of the tested feature >Function: Function of the tested feature >SubFunction: Subfunction of the tested feature @@ -165,7 +165,7 @@ Install the serial port plugins **pyserial** and **readline** on the local P >CaseDescription: Test case description >step: Procedure for executing the test case when the complex logic is tested -- Directory plan for self-test cases +- Directory plan for test cases ``` subsystem (subsystem, system component) @@ -188,21 +188,21 @@ Install the serial port plugins **pyserial** and **readline** on the local P ├── common ├── liteos ├── linux - + ``` - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](public_sys-resources/icon-note.gif) **NOTE:** >The LiteOS and Linux are used as examples only for different device models. For the same feature on different development boards, if the test cases are the same, they are stored in the **common** directory. For the same feature, if the test cases are used to distinguish different device models and may include kernel differences and chip platform differences, the test cases are distinguished by directory. -- Procedure for compiling self-test cases - 1. Add the comment information of the case header file. +- Procedure for compiling test cases + 1. Add comments to the test case header file. 2. Reference the **gtest** header file and **ext** namespace. 3. Add the header file to test. 4. Define test suites \(test classes\). 5. Implement specific test cases of the test suite, including test case comments and logic implementation. 6. Compile the test case compilation configuration. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](public_sys-resources/icon-note.gif) **NOTE:** >\* Example: developertest/example/cxx\_demo/test/unittest/common/calc\_subtraction\_test.cpp >Notes: >- **SetUp** and **TearDown** are the processing logic before and after each test case in the test suite is executed. @@ -213,26 +213,26 @@ Install the serial port plugins **pyserial** and **readline** on the local P - Compile a test case compilation file. - Define test case compilation and building objectives. - 1. Add comments to the case compilation header file. + 1. Add comments to the test case compilation header file. 2. Import the test case compilation template file. 3. Specify the output path of the test case file. 4. Configure the directory contained in the test case compilation dependency. - 5. Specify the name of the case execution file generated by the case compilation target. + 5. Specify the file name generated by the test case compilation target. 6. Compile a specific test case compilation script and add the source files, configurations, and dependencies involved in the compilation. - 7. Group the target case files by condition. The group name is fixed to **unittest/moduletest**. + 7. Group the target test case files by condition. The group name is fixed to **unittest/moduletest**. - If there are multiple test suites, define the common compilation configuration. - Add test cases to the build system. - >![](public_sys-resources/icon-note.gif) **NOTE:** + >![](public_sys-resources/icon-note.gif) **NOTE:** >\* Example: developertest/example/cxx\_demo/test/unittest/common/BUILD.gn - Test case level definition - - Basic \(Level 1\): < 1s - - Major \(Level 2\): < 10s - - Minor \(Level 3\): < 5 min - - Uncommon \(Level 4\): \> 5 min + - Basic \(Level 1\) + - Major \(Level 2\) + - Minor \(Level 3\) + - Uncommon \(Level 4\) ## Using Test Framework @@ -292,7 +292,7 @@ Install the serial port plugins **pyserial** and **readline** on the local P ``` -- Check the environment before executing the self-test cases. +- Check the environment before executing the test cases. - The system image and file system have been burnt to a development board and are running properly on the development board. In system mode, for example, the device prompt **OHOS\#** is displayed during shell login. - The development host is properly connected to the serial port of the development board, and the development host is properly connected to the serial port of the development board. - The IP addresses of the development host and development board are in the same network segment and can ping each other. @@ -318,25 +318,29 @@ Install the serial port plugins **pyserial** and **readline** on the local P Configure device models based on the actual development board, for example, **developertest/src/core/resource/config/framework\_config.xml**. - Run the test command. - 1. The following example shows how to run the test command. **-t ut** is mandatory, and **-ss** and **-tm** are optional. + 1. To query the subsystems, modules, product forms, and test types supported by test cases, run the **show** command. + + ``` + usage: + show productlist Querying Supported Product Forms + show typelist Querying the Supported Test Type + show subsystemlist Querying Supported Subsystems + show modulelist Querying Supported Modules + ``` + + 2. The following example shows how to run the test command. **-t** is mandatory, and **-ss** and **-tm** are optional. ``` run -t ut -ss test -tm example ``` - 2. Specify the parameters that can be used to execute the test suite corresponding to a specific feature or module. + 3. Specify the parameters that can be used to execute the test suite corresponding to a specific feature or module. ``` - usage: __main__.py [-h] [-p PRODUCTFORM] [-t [TESTTYPE [TESTTYPE ...]]] + usage: run [-h] [-p PRODUCTFORM] [-t [TESTTYPE [TESTTYPE ...]]] [-ss SUBSYSTEM] [-tm TESTMODULE] [-ts TESTSUIT] - [-tc TESTCASE] [-tl TESTLEVEL] [-os TARGET_OS_NAME] - [-bv BUILD_VARIANT] [-b [BUILD [BUILD ...]]] - [-cov COVERAGE] [-tf TESTFILE] [-res RESOURCE] - [-sn DEVICE_SN] [-c CONFIG] [-rp REPORTPATH] [-e EXECTYPE] - [-td TEST_DRIVER] - action Specify test para.positional arguments: - action Specify action - + [-tc TESTCASE] [-tl TESTLEVEL] + optional arguments: -h, --help show this help message and exit -p PRODUCTFORM, --productform PRODUCTFORM Specified product form @@ -347,16 +351,6 @@ Install the serial port plugins **pyserial** and **readline** on the local P -ts TESTSUIT, --testsuit TESTSUIT Specify test suit -tc TESTCASE, --testcase TESTCASE Specify test case -tl TESTLEVEL, --testlevel TESTLEVEL Specify test level - -bv BUILD_VARIANT, --build_variant BUILD_VARIANT Specify build variant(release,debug) - -b [BUILD [BUILD ...]], --build [BUILD [BUILD ...]] - Specify build values(version,testcase) - -tf TESTFILE, --testfile TESTFILE Specify test suites list file - -res RESOURCE, --resource RESOURCE Specify test resource - -sn DEVICE_SN, --device_sn DEVICE_SN Specify device serial number - -c CONFIG, --config CONFIG Specify test config file - -rp REPORTPATH, --reportpath REPORTPATH Specify test report path - -e EXECTYPE, --exectype EXECTYPE Specify test execute type - -td TEST_DRIVER, --testdriver TEST_DRIVER Specify test driver id ``` @@ -371,7 +365,7 @@ Install the serial port plugins **pyserial** and **readline** on the local P - Exit the self-test platform. - - Run the following command to exit the self-test platform: + - Run the following command to exit the test platform: ``` quit diff --git a/docs-en/readme/utils-library.md b/docs-en/readme/utils-library.md index f1a779ea0fbeb6ecc7f7f36055058385d47360fc..e825caf83791854ea29892aebb240490d234004b 100755 --- a/docs-en/readme/utils-library.md +++ b/docs-en/readme/utils-library.md @@ -6,40 +6,40 @@ The Utils library stores basic components of OpenHarmony. These basic components The Utils library provides the following capabilities on different platforms: -- LiteOS-M platform: KV stores, file operations, timers, and IoT peripheral control -- LiteOS-A platform: KV stores, timers, and ACE JavaScript APIs +- LiteOS Cortex-M \(Hi3861 platform\): KV stores, file operations, timers, and IoT peripheral control +- LiteOS Cortex-A \(Hi3516 and Hi3518 platforms\): KV stores, timers, and ACE JavaScript APIs ## Directory Structure ``` -utils/native/lite/ # Root directory of the Utils library -├── file # Implementation of the file interface -├── hals # HAL directory -│ └── file # Header files of the hardware abstraction layer for file operations -├── include # Files of external interfaces provided by the Utils library +utils/native/lite/ # Root directory of the Utils library +├── file # Implementation of the file interface +├── hals # HAL directory +│ └── file # Header files of the hardware abstraction layer for file operations +├── include # Files of external interfaces provided by the Utils library ├── js # ACE JavaScript API directory │ └── builtin │ ├── common │ ├── deviceinfokit # Device information kit │ ├── filekit # File kit │ └── kvstorekit # KV store kit -├── kal # KAL directory -│ └── timer # KAL implementation of the timer - ├── kv_store # KV store implementation -│ ├── innerkits # Internal KV store interfaces -│ └── src # KV store source file -└── timer_task # Timer implementation - -base/iot_hardware # IoT peripheral control +├── kal # KAL directory +│ └── timer # KAL implementation of the timer +├── kv_store # KV store implementation +│ ├── innerkits # Internal KV store interfaces +│ └── src # KV store source file +└── timer_task # Timer implementation + +base/iot_hardware # IoT peripheral control ├── frameworks -│ └── wifiiot_lite # Implementation of the IoT peripheral control module +│ └── wifiiot_lite # Implementation of the IoT peripheral control module ├── hals -│ └── wifiiot_lite # HAL interfaces +│ └── wifiiot_lite # HAL interfaces └── interfaces - └── kits # Interfaces of the IoT peripheral control module + └── kits # Interfaces of the IoT peripheral control module vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware # HAL for IoT peripheral control -└── wifiiot_lite # Implementation of the interfaces at the HAL +└── wifiiot_lite # Implementation of the interfaces at the HAL ``` ## Constraints @@ -61,7 +61,7 @@ The Utils library is developed using the C language. - @@ -70,7 +70,7 @@ The Utils library is developed using the C language. - @@ -79,7 +79,7 @@ The Utils library is developed using the C language. - @@ -88,7 +88,7 @@ The Utils library is developed using the C language. - @@ -101,12 +101,12 @@ The Utils library is developed using the C language. - **KV store** - Obtaining an interface - ``` + Obtaining an interface char key1[] = "rw.sys.version"; char value1[32] = {0}; int ret = UtilsGetValue(key1, value1, 32); + Setting the interface char key14[] = "key_14"; ret = UtilsSetValue(key14, defValue); @@ -121,10 +121,12 @@ The Utils library is developed using the C language. printf("file handle = %d\n", fd); int ret = UtilsFileWrite(fd, def, strlen(def)); printf("write ret = %d\n", ret); + // stat int fileLen = 0; ret = UtilsFileStat(fileName, &fileLen); printf("file size = %d\n", fileLen); + // seek int fd1 = UtilsFileOpen(fileName, O_RDWR_FS, 0); ret = UtilsFileSeek(fd1, 5, SEEK_SET_FS); @@ -133,6 +135,7 @@ The Utils library is developed using the C language. int readLen = UtilsFileRead(fd1, buf, 32); ret = UtilsFileClose(fd1); printf("read len = %d : buf = %s\n", readLen, buf); + // delete ret = UtilsFileDelete(fileName); printf("delete ret = %d\n", ret); diff --git a/docs-en/readme/x-test-suite-certification-subsystem.md b/docs-en/readme/x-test-suite-certification-subsystem.md index 909dd514696a1599243b843f665e37402f3d673d..d0bec47e1201841a1e0e88b055bd389862528806 100755 --- a/docs-en/readme/x-test-suite-certification-subsystem.md +++ b/docs-en/readme/x-test-suite-certification-subsystem.md @@ -7,7 +7,7 @@ X test suite is a set of OpenHarmony certification test suites, including the cu The **test/xts** repository contains the **acts** directory and **tools** software package. - The **acts** directory stores the source code and configuration files of ACTS test cases. The ACTS helps device vendors detect the software incompatibility as early as possible and ensures that the software is compatible to OpenHarmony during the entire development process. -- The **tools** software package provides the test case development framework where ACTS code is compiled. +- The **tools** software package stores the test case development framework related to **acts**. ## Directory Structure @@ -17,9 +17,7 @@ The directory structure of the **test/xts** repository is as follows: │ ├── BUILD.gn \#Compilation configuration of test cases -│ └── testing\_subsystem\_A\_lite \#Test case source code of A - -│ └── testing\_subsystem\_B\_lite \#Test case source code of B +│ └── subsystem\_lite \# Test case source code └── tools @@ -49,13 +47,13 @@ The HCTest framework supports the C language and allows you to execute your test │ ├── BUILD.gn -│ └── Testing\_subsystem\_lite +│ └──subsystem\_lite -│ │ └── Testing\_module\_hal +│ │ └── module\_hal │ │ │ └── BUILD.gn -│ │ │ └── src \#Test case source code +│ │ │ └── src 2. Write the test case stored in the **src** directory. @@ -171,16 +169,16 @@ hctest_suite("ActsDemoTest") { 4. Add compilation options to the **BUILD.gn** file in the **acts** directory. -To add test code to the compilation file, you need to add the test module to the **test/xts/acts/BUILD.gn** script in the **acts** directory. +You need to add the test module to the **test/xts/acts/BUILD.gn** script in the **acts** directory. ``` -lite_component("acts") { +lite_component("acts") { ... if(board_name == "liteos_riscv") { - features += [ + features += [ ... - "//xts/acts/testing_subsystem_lite/testing_module_hal:ActsDemoTest" - ] + "//xts/acts/subsystem_lite/module_hal:ActsDemoTest" + ] } } ``` @@ -203,13 +201,13 @@ The HCPP Test framework is enhanced and adapted based on the open-source googlet │ ├── BUILD.gn -│ └── Testing\_subsystem\_lite +│ └──subsystem\_lite -│ │ └── Testing\_module\_posix +│ │ └── module\_posix │ │ │ └── BUILD.gn -│ │ │ └── src \(Test case source code\) +│ │ │ └── src 2. Write the test case stored in the **src** directory. @@ -339,15 +337,15 @@ hcpptest_suite("ActsDemoTest") { 4. Add compilation options to the **BUILD.gn** file in the **acts** directory. -To add the test code to the version compilation, you need to add the test module to the **test/xts/acts/BUILD.gn** script in the **acts** directory. +You need to add the test module to the **test/xts/acts/BUILD.gn** script in the **acts** directory. ``` - lite_component("acts") { + lite_component("acts") { ... else if(board_name == "liteos_a") { features += [ ... - "//xts/acts/testing_subsystem_lite/testing_module_posix:ActsDemoTest" + "//xts/acts/subsystem_lite/module_posix:ActsDemoTest" ] } } diff --git "a/get-code/\346\272\220\347\240\201\350\216\267\345\217\226.md" "b/get-code/\346\272\220\347\240\201\350\216\267\345\217\226.md" index 4a9dbd455c5876eb87fa60ac32eb9858a0a72127..a75d7b3d839f408dd31434ec2c53cc3712a591f3 100755 --- "a/get-code/\346\272\220\347\240\201\350\216\267\345\217\226.md" +++ "b/get-code/\346\272\220\347\240\201\350\216\267\345\217\226.md" @@ -36,16 +36,16 @@ OpenHarmony是HarmonyOS的开源版,由华为捐赠给开放原子开源基金 - - - @@ -54,25 +54,25 @@ OpenHarmony是HarmonyOS的开源版,由华为捐赠给开放原子开源基金 - - - - - @@ -138,59 +138,59 @@ OpenHarmony是HarmonyOS的开源版,由华为捐赠给开放原子开源基金 通过命令行获取,需要先安装Node.js和hpm命令行工具,安装步骤如下: -1. 安装Node.js。 +1. 安装Node.js。 - 官网下载并在本地安装Node.js. + 官网下载并在本地安装Node.js. - 推荐安装 [Node.js](https://nodejs.org/) 12.x \(包含 npm 6.14.4\)或更高版本 \(推荐 12.13.0+\)。 + 推荐安装 [Node.js](https://nodejs.org/) 12.x \(包含 npm 6.14.4\)或更高版本 \(推荐 12.13.0+\)。 -2. 通过Node.js自带的npm安装hpm命令行工具。 +2. 通过Node.js自带的npm安装hpm命令行工具。 - 打开CMD,执行以下命令: + 打开CMD,执行以下命令: - ``` - npm install -g @ohos/hpm-cli - ``` + ```bash + npm install -g @ohos/hpm-cli + ``` -3. 安装完成后执行如下命令,显示hpm版本,即安装成功。 +3. 安装完成后执行如下命令,显示hpm版本,即安装成功。 - ``` - hpm -V 或 hpm --version - ``` + ```bash + hpm -V 或 hpm --version + ``` -4. 如果升级hpm的版本,请执行如下命令: +4. 如果升级hpm的版本,请执行如下命令: - ``` - npm update -g @ohos/hpm-cli - ``` + ```bash + npm update -g @ohos/hpm-cli + ``` ## 操作 接下来将组件添加到开发项目中,假定要获取的组件名为@ohos/demo,具体操作如下: -1. 进入开发目录,执行如下命令,采用默认模板创建一个开发项目。 +1. 进入开发目录,执行如下命令,采用默认模板创建一个开发项目。 - ``` - hpm init -t default - ``` + ```bash + hpm init -t default + ``` -2. 执行如下命令,安装组件@ohos/demo +2. 执行如下命令,安装组件@ohos/demo - ``` - hpm install @ohos/demo - ``` + ```bash + hpm install @ohos/demo + ``` -3. 工具会自动从服务器下载所有依赖的组件,下载成功则显示Install successfully! +3. 工具会自动从服务器下载所有依赖的组件,下载成功则显示Install successfully! - ``` - $ hpm install @ohos/demo - Requesting: https://url.foo.bar/hpm/registry/api/bundles/@ohos/demo - downloading @ohos/demo - Requesting: https://lfcontentcenterdev....../bMAlLrYISLqdUTFFFCdgzA.tgz - extract D:\demo\ohos_bundles\@ohos\demo\@ohos-demo-1.0.7.tgz - Install successfully! - ``` + ```bash + $ hpm install @ohos/demo + Requesting: https://url.foo.bar/hpm/registry/api/bundles/@ohos/demo + downloading @ohos/demo + Requesting: https://lfcontentcenterdev....../bMAlLrYISLqdUTFFFCdgzA.tgz + extract D:\demo\ohos_bundles\@ohos\demo\@ohos-demo-1.0.7.tgz + Install successfully! + ``` ## 获取方式4:从代码仓库获取 @@ -210,39 +210,39 @@ OpenHarmony是HarmonyOS的开源版,由华为捐赠给开放原子开源基金 ## 准备 -1. 注册码云gitee账号。 -2. 注册码云SSH公钥,请参考码云帮助中心的公钥管理:[https://gitee.com/help/articles/4181](https://gitee.com/help/articles/4181) -3. 安装git客户端并配置用户信息。 +1. 注册码云gitee账号。 +2. 注册码云SSH公钥,请参考码云帮助中心的公钥管理:[https://gitee.com/help/articles/4181](https://gitee.com/help/articles/4181) +3. 安装git客户端并配置用户信息。 - ``` - git config --global user.name "yourname" - git config --global user.email "your-email-address" - git config --global credential.helper store - ``` + ```bash + git config --global user.name "yourname" + git config --global user.email "your-email-address" + git config --global credential.helper store + ``` -4. 安装码云repo工具,可以执行如下命令。 +4. 安装码云repo工具,可以执行如下命令。 - ``` - curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo - chmod a+x /usr/local/bin/repo - pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests - ``` + ```bash + curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo + chmod a+x /usr/local/bin/repo + pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests + ``` ## 操作 方式一(推荐):通过repo下载 -``` +```bash repo init -u https://gitee.com/openharmony/manifest.git -b master repo sync -c ``` 方式二:通过git clone单个代码仓库 -进入代码仓库主页:[https://gitee.com/openharmony](https://gitee.com/openharmony),选择需要克隆的代码仓库,执行命令,如: +进入代码仓库主页:https://gitee.com/openharmony,选择需要克隆的代码仓库,执行命令,如: -``` +```bash git clone https://gitee.com/openharmony/manifest.git -b master ``` @@ -253,6 +253,7 @@ git clone https://gitee.com/openharmony/manifest.git -b master **表 2** 源码目录的说明 +

Name

@@ -17,7 +17,7 @@ The test-driven development mode is used during the development process. You can

developertest

Development self-test framework

+

Development test framework

developertest/src

@@ -107,12 +107,12 @@ The test-driven development mode is used during the development process. You can

developertest/start.bat

Developer self-test entry (Windows)

+

Developer test entry (Windows)

developertest/start.sh

Developer self-test entry (Linux)

+

Developer test entry (Linux)

KV store

LiteOS-M and LiteOS-A platforms

+

LiteOS Cortex-M and LiteOS Cortex-A

Provides KV storage for applications.

File operation

LiteOS-M platform

+

LiteOS Cortex-M

Provides unified file operation interfaces that can be used on different underlying chip components.

Timer

LiteOS-M and LiteOS-A platforms

+

LiteOS Cortex-M and LiteOS Cortex-A

Provides unified timer operation interfaces that can be used on different underlying chip components.

IoT peripheral control

LiteOS-M platform

+

LiteOS Cortex-M

Provides the capability of performing operations for peripherals.

1.0

站点1站点2

+

站点

SHA256 校验码

+

SHA256 校验码

Hi3861解决方案(二进制)

1.0

站点1站点2

+

站点

SHA256 校验码

1.0

站点1站点2

+

站点

SHA256 校验码

+

SHA256 校验码

Hi3516解决方案(二进制)

1.0

站点1站点2

+

站点

SHA256 校验码

+

SHA256 校验码

RELEASE-NOTES

1.0

站点1

+

站点

-

- @@ -30,7 +30,7 @@ - @@ -39,7 +39,7 @@ - @@ -48,7 +48,7 @@ - @@ -57,7 +57,7 @@ - diff --git "a/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" "b/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" index 89674363b8c2b4c96472fc4e1d7bd5de5ec7b050..a49845520255fd114d73a83a456c1322dfc7be92 100755 --- "a/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" +++ "b/guide/\345\270\270\350\247\201\351\227\256\351\242\230.md" @@ -8,7 +8,7 @@ 通过ref属性获取dom中的元素,详细示例如下图所示;获取的元素只能使用它的方法,不能改变属性。 - ``` + ```javascript
diff --git "a/guide/\347\244\272\344\276\213\345\274\200\345\217\221-2.md" "b/guide/\347\244\272\344\276\213\345\274\200\345\217\221-2.md" index 239ed9ccbd7588243a4d6a200b7f16433aea0d14..f468854771f1d7def8baaa038e8d66c6f74275da 100755 --- "a/guide/\347\244\272\344\276\213\345\274\200\345\217\221-2.md" +++ "b/guide/\347\244\272\344\276\213\345\274\200\345\217\221-2.md" @@ -1,6 +1,6 @@ # 示例开发 -相机开发基本概念可参考:[相机开发概述](zh-cn_topic_0000001051690589.md)。 +相机开发基本概念可参考:[相机开发概述](../subsystems/相机开发概述.md)。 若开发者想先查看示例效果,可先跳过本节,进入[应用实例](应用实例-5.md)。如需自定义应用行为,可参考本节描述对示例代码进行修改。 diff --git "a/guide/\347\244\272\344\276\213\345\274\200\345\217\221.md" "b/guide/\347\244\272\344\276\213\345\274\200\345\217\221.md" index ac7f0267fc7d340b8705fd082595789a4e5335e7..02a8888db1eea3313a4dec00aa714d84e40060e2 100755 --- "a/guide/\347\244\272\344\276\213\345\274\200\345\217\221.md" +++ "b/guide/\347\244\272\344\276\213\345\274\200\345\217\221.md" @@ -1,6 +1,6 @@ # 示例开发 -相机开发基本概念可参考:[相机开发概述](zh-cn_topic_0000001051690589.md)。 +相机开发基本概念可参考:[相机开发概述](../subsystems/相机开发概述.md)。 若开发者想先查看示例效果,可先跳过本节,进入[应用实例](应用实例.md)。如需自定义应用行为,可参考本节描述对示例代码进行修改。 diff --git "a/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" "b/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" index 17b493752d2ac9383cd6748cb9947421409df7ba..2ff7cf9d2fcc5c52e74b84dd51ed930b6ce26ca2 100755 --- "a/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" +++ "b/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\344\273\213\347\273\215.md" @@ -137,7 +137,7 @@ OpenHarmony基于Hi3861平台提供了多种开放能力,提供的关键组件
- - - - - + + + +

目录名

描述

diff --git "a/get-code/\350\216\267\345\217\226\345\267\245\345\205\267.md" "b/get-code/\350\216\267\345\217\226\345\267\245\345\205\267.md" index 007211fe4331a40176d812912a5ec7a01e7f01a6..820fc481049f43773ceac25d13dc7d9024f12e47 100755 --- "a/get-code/\350\216\267\345\217\226\345\267\245\345\205\267.md" +++ "b/get-code/\350\216\267\345\217\226\345\267\245\345\205\267.md" @@ -21,7 +21,7 @@

9.0.0-34042

站点1 站点2

+

站点

64a518b50422b6f1ba8f6f56a5e303fb8448a311211ba10c385ad307a1d2546f

7.3.0

站点1 站点2

+

站点

614ee086ead1a4fd7384332b85dd62707801f323de60dfdb61503f473d470a24

1523

站点1 站点2

+

站点

50a5a5ba5877dd0ec8afcb23d3dd4d966a16403c29cd80a4002230241d32ef34

1.9.0

站点1 站点2

+

站点

b4a4ba21e94ff77634e1f88697a00b6f498fdbc0b40d7649df1b246b285874f9

0.65

站点1 站点2

+

站点

fcfee489371947a464fe41a4b45a897b9a44155891a957f15bad2e157c750162

DFX

提供DFX能力。包括:流水日志、时间打点等。

+

提供DFX能力。包括:流水日志、事件打点等。

XTS

diff --git "a/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\347\254\254\344\270\200\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" "b/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\347\254\254\344\270\200\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" index 076e5b7d9334ff3373744047e559eaa9ea5d734d..38f43f223e4217d404ce2c9e1334474df683179d 100755 --- "a/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\347\254\254\344\270\200\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" +++ "b/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\347\254\254\344\270\200\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" @@ -4,7 +4,7 @@ ## 源码获取 -开发者需要在Linux服务器上下载一套源代码,获取Hi3861源码([下载链接](http://tools.harmonyos.com/mirrors/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)。 +开发者需要在Linux服务器上下载一套源代码,获取Hi3861源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)。 ## 源码编译 @@ -66,7 +66,7 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, 1. 在Baud rate中选择合适的波特率,波特率越高烧写速度越快,此处建议使用921600。 2. 在Data bit中选择数据位,WLAN模组默认为8,此处与其保持一致即可。 - 3. 选择版本包路径“./out/wifiiot/Hi3861\_wifiiot\_app\_allinone.bin”。 + 3. 选择版本包路径“./out/wifiiot/Hi3861\_wifiiot\_app\_allinone.bin”,选择Mode为“Hiburn”。 4. 点击Save保存配置。 **图 8** 波特率和数据位配置示意图 @@ -75,7 +75,7 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, **图 9** 烧录包路径示意图 - ![](figures/zh-cn_image_0000001054087868.png) + ![](figures/zh-cn_image_0000001055427138.png) 4. 在DecEco工具界面中单击“烧录”按钮![](figures/zh-cn_image_0000001054443694.png),然后选择烧录串口“COM11”。 @@ -97,24 +97,34 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, ## WLAN模组联网 -完成版本构建及烧录后,下面开始介绍如何在DevEco的串口终端上执行AT命令,使WLAN模组联网。 +完成版本构建及烧录后,下面开始介绍如何在串口终端上执行AT命令,使WLAN模组联网。 -1. 保持Windows工作台和WLAN模组的连接状态,在DevEco工具最下方,点击“Serial port”按钮,弹出串口终端的配置界面。 +>![](public_sys-resources/icon-note.gif) **说明:** +>- DevEco串口连接功能待上线,敬请期待。 +>- 该样例中使用IPOP(或其他)串口工具进行演示,IPOP工具请开发者通过互联网获取。 - **图 13** 打开DevEco串口终端示意图 - ![](figures/打开DevEco串口终端示意图.png "打开DevEco串口终端示意图") +1. 通过USB线,连接Windows工作台和Hi3861开发板,确认待连接串口为COM11,如下图所示。 -2. 选择串口,并完成参数配置。根据实际情况输入串口号,此处为“COM11”;波特率、数据位、停止位使用默认值;由于AT命令输入需要以“\\r\\n”结尾,否则输入无效,所以结束符处输入“1”。 + **图 13** 设备管理器的COM示意图 + + + ![](figures/zh-cn_image_0000001055268090.png) + +2. 在Windows工作台上,使用IPOP工具,连接WLAN模组串口(COM11),并配置好波特率115200,同时勾选Newline,确保输入字符串以"\\r\\n"结尾,避免AT命令无法输入。 + + **图 14** IPOP连接配置示意图 + + + ![](figures/zh-cn_image_0000001055427946.png) - **图 14** 串口参数配置示意图 - ![](figures/串口参数配置示意图.png "串口参数配置示意图") +3. 复位WLAN模组,终端界面显示“ready to OS start”,则启动成功。 -3. 复位WLAN模组,观察到终端界面“ready to OS start”日志打印,启动成功。 + **图 15** WLAN复位成功示意图 + - **图 15** 复位WLAN模组示意图 - ![](figures/复位WLAN模组示意图.png "复位WLAN模组示意图") + ![](figures/zh-cn_image_0000001055148043.png) -4. 在DevEco的串口终端,依次执行如下AT命令,完成启动STA,连接指定AP,开启dhcp。 +4. 在IPOP串口终端中,依次执行如下AT命令,启动STA模式,连接指定AP热点,并开启DHCP功能。 ``` AT+STARTSTA - 启动STA模式 @@ -125,9 +135,16 @@ Hi3861 WLAN模组的镜像烧录可以通过OpenHarmony IDE工具DevEco完成, AT+DHCP=wlan0,1 - 通过DHCP向AP请求wlan0的IP地址 ``` -5. 接口已分配IP,并与网关联通正常。 +5. 查看WLAN模组与网关联通是否正常,如下图所示。 + + ``` + AT+IFCFG - 查看模组接口IP + AT+PING=X.X.X.X - 检查模组与网关的联通性,其中X.X.X.X需替换为实际的网关地址 + ``` + + **图 16** WLAN模组联网成功示意图 + - **图 16** WLAN模组联网成功示意图 - ![](figures/WLAN模组联网成功示意图.png "WLAN模组联网成功示意图") + ![](figures/zh-cn_image_0000001055428072.png) diff --git "a/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\347\254\254\344\272\214\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" "b/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\347\254\254\344\272\214\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" index bb21aabc5fa19eaae0e372ceb0e37c79a5d408c2..7eb016e88c0938cd482b149c092da8162c0fd875 100755 --- "a/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\347\254\254\344\272\214\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" +++ "b/quick-start/Hi3861\345\274\200\345\217\221\346\235\277\347\254\254\344\272\214\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" @@ -28,7 +28,7 @@ bugfix和新增业务两种情况,涉及源码修改。下面以新增业务 在hello\_world.c中新建业务入口函数HelloWorld,并实现业务逻辑。并在代码最下方,使用OpenHarmony启动恢复模块接口SYS\_RUN\(\)启动业务。(SYS\_RUN定义在ohos\_init.h文件中) - ``` + ```c++ #include "ohos_init.h" #include "ohos_types.h" @@ -43,13 +43,13 @@ bugfix和新增业务两种情况,涉及源码修改。下面以新增业务 如[步骤1](#li5479332115116)所述,BUILD.gn文件由三部分内容(目标、源文件、头文件路径)构成,需由开发者完成填写。以my\_first\_app为例,需要创建./applications/sample/wifi-iot/app/my\_first\_app/BUILD.gn,并完如下配置。 - ``` + ```c++ static_library("myapp") { sources = [ "hello_world.c" ] include_dirs = [ - "//utils/native/liteos/include" + "//utils/native/lite/include" ] } ``` @@ -62,7 +62,7 @@ bugfix和新增业务两种情况,涉及源码修改。下面以新增业务 配置./applications/sample/wifi-iot/app/BUILD.gn文件,在features字段中增加索引,使目标模块参与编译。features字段指定业务模块的路径和目标,以my\_first\_app举例,features字段配置如下。 - ``` + ```c++ import("//build/lite/config/component/lite_component.gni") lite_component("app") { @@ -86,7 +86,7 @@ bugfix和新增业务两种情况,涉及源码修改。下面以新增业务 代码中增加printf维测,信息会直接打印到串口上。开发者可在业务关键路径或业务异常位置增加日志打印,如下所示。 -``` +```c++ void HelloWorld(void) { printf("[DEMO] Hello world.\n"); diff --git "a/quick-start/figures/HiTool\345\267\245\345\205\267U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272-4.png" "b/quick-start/figures/HiTool\345\267\245\345\205\267U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272-4.png" new file mode 100644 index 0000000000000000000000000000000000000000..4e2a2794e63f64341e448313968b6f82d237543d Binary files /dev/null and "b/quick-start/figures/HiTool\345\267\245\345\205\267U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272-4.png" differ diff --git "a/quick-start/figures/HiTool\345\267\245\345\205\267U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272.png" "b/quick-start/figures/HiTool\345\267\245\345\205\267U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272.png" index 4e2a2794e63f64341e448313968b6f82d237543d..ad4fd618860ca9f79e9bdc39436c3b2f9cdb72de 100755 Binary files "a/quick-start/figures/HiTool\345\267\245\345\205\267U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272.png" and "b/quick-start/figures/HiTool\345\267\245\345\205\267U-boot\347\203\247\345\206\231\345\256\214\346\210\220\344\270\262\345\217\243\346\230\276\347\244\272.png" differ diff --git a/quick-start/figures/zh-cn_image_0000001055148043.png b/quick-start/figures/zh-cn_image_0000001055148043.png new file mode 100644 index 0000000000000000000000000000000000000000..d8f0f95d6e464a7af8e81ef8466fedd7f760a75d Binary files /dev/null and b/quick-start/figures/zh-cn_image_0000001055148043.png differ diff --git a/quick-start/figures/zh-cn_image_0000001055268090.png b/quick-start/figures/zh-cn_image_0000001055268090.png new file mode 100644 index 0000000000000000000000000000000000000000..dfc4a7bd9438664d3fe1cade7738ba72e68c586d Binary files /dev/null and b/quick-start/figures/zh-cn_image_0000001055268090.png differ diff --git a/quick-start/figures/zh-cn_image_0000001055427138.png b/quick-start/figures/zh-cn_image_0000001055427138.png new file mode 100644 index 0000000000000000000000000000000000000000..8c1b5d1af9f49d9d8a00602e0a658fcb6123cd71 Binary files /dev/null and b/quick-start/figures/zh-cn_image_0000001055427138.png differ diff --git a/quick-start/figures/zh-cn_image_0000001055427946.png b/quick-start/figures/zh-cn_image_0000001055427946.png new file mode 100644 index 0000000000000000000000000000000000000000..c25b5c13128538f063fe0875c66191fe88802590 Binary files /dev/null and b/quick-start/figures/zh-cn_image_0000001055427946.png differ diff --git a/quick-start/figures/zh-cn_image_0000001055428072.png b/quick-start/figures/zh-cn_image_0000001055428072.png new file mode 100644 index 0000000000000000000000000000000000000000..3e305a77258d959459ee9a052d17edf0669314cc Binary files /dev/null and b/quick-start/figures/zh-cn_image_0000001055428072.png differ diff --git "a/quick-start/figures/\344\277\256\346\224\271\344\270\262\345\217\243\345\217\267\345\233\276\347\244\272-3.png" "b/quick-start/figures/\344\277\256\346\224\271\344\270\262\345\217\243\345\217\267\345\233\276\347\244\272-3.png" new file mode 100644 index 0000000000000000000000000000000000000000..f699204d10d39eb088c0ecc7aa08ba134ec4b6b6 Binary files /dev/null and "b/quick-start/figures/\344\277\256\346\224\271\344\270\262\345\217\243\345\217\267\345\233\276\347\244\272-3.png" differ diff --git "a/quick-start/figures/\346\234\252\345\221\275\345\220\215\345\233\276\347\211\20711111.png" "b/quick-start/figures/\346\234\252\345\221\275\345\220\215\345\233\276\347\211\20711111.png" new file mode 100644 index 0000000000000000000000000000000000000000..4b8caa20e71b5a592b82a625d9f022a29667427d Binary files /dev/null and "b/quick-start/figures/\346\234\252\345\221\275\345\220\215\345\233\276\347\211\20711111.png" differ diff --git "a/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-1.md" "b/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-1.md" index d02d3aaedee9af6f07c3ac01d50abbdd8043c2dc..c965171893c2900f855c16847e733a7a813ed48e 100755 --- "a/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-1.md" +++ "b/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-1.md" @@ -108,7 +108,7 @@ usr/bin目录下没有python软链接,请运行以下命令: - ``` + ```bash # cd /usr/bin/ # which python3 # ln -s /usr/local/bin/python3 python @@ -120,3 +120,57 @@ ![](figures/zh-cn_image_0000001054875562.png) +**问题 5:串口无回显。** + +- **现象描述** + + 串口显示已连接,重启单板后,回车无任何回显。 + +- **可能原因** + - 串口连接错误。 + - 单板U-boot被损坏。 + +- **解决办法** + + **解决办法1:修改串口号** + + 请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按步骤修改串口号。 + + **图 10** 修改串口号图示 + ![](figures/修改串口号图示.png "修改串口号图示") + + +1. 断开当前串口。 +2. 点击设置按钮。 +3. 在弹框中修改串口号并点击OK。 +4. 连接后在对话框中输入回车查看是否存在回显。 + +**解决办法2:烧写U-boot** + +若上述步骤依旧无法连接串口,可能由于单板U-boot损坏,按下述步骤烧写U-boot。 + +1. 获取引导文件U-boot。 + + >![](public_sys-resources/icon-notice.gif) **须知:** + >单板的U-boot文件请在开源包中获取,路径为vendor\\hisi\\hi35xx\\hi3516dv300\\uboot\\out\\boot\\u-boot-hi3516dv300.bin + +2. 使用HiTool工具按照标号选择U-boot烧写选项,点击烧写按钮。 + + **图 11** HiTool工具U-boot烧写步骤图 + + + ![](figures/未命名图片11111.png) + + 1. 选择单板串口COM7。 + 2. 选择Transfer Mode为Serial。 + 3. 选择Burn Fastboot标签。 + 4. 选择Flash Type为spi nor。 + 5. 选择Browse,找到对应U-boot文件。 + 6. 点击Burn开始烧写。 + +3. 提示下电并给单板重新上电,烧写完成后,连接串口,如下图所示。 + + **图 12** HiTool工具U-boot烧写完成串口显示 + ![](figures/HiTool工具U-boot烧写完成串口显示.png "HiTool工具U-boot烧写完成串口显示") + + diff --git "a/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-3.md" "b/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-3.md" index f5616e23bd14656e89e53ed9030ab3751965b511..e64fccc19393ec9f6f7f6915bfa062849faecd0f 100755 --- "a/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-3.md" +++ "b/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230-3.md" @@ -12,10 +12,12 @@ - **解决办法** + **解决办法1:修改串口号** + 请查看设备管理器,确认连接单板的串口与终端中连接串口是否一致,若不一致,请按步骤修改串口号。 **图 1** 修改串口号图示 - ![](figures/修改串口号图示.png "修改串口号图示") + ![](figures/修改串口号图示-3.png "修改串口号图示-3") 1. 断开当前串口。 @@ -23,7 +25,9 @@ 3. 在弹框中修改串口号并点击OK。 4. 连接后在对话框中输入回车查看是否存在回显。 -若上述步骤依旧无法连接串口,可能由于单板U-boot损坏,按下述步骤烧写U-Boot。 +**解决办法2:烧写U-boot** + +若上述步骤依旧无法连接串口,可能由于单板U-boot损坏,按下述步骤烧写U-boot。 1. 获取引导文件U-boot。 @@ -39,13 +43,13 @@ 2. 选择Transfer Mode为Serial。 3. 选择Burn Fastboot标签。 4. 选择Flash Type为spi nor。 - 5. 选择Browse,找到对应U-Boot文件。 + 5. 选择Browse,找到对应U-boot文件。 6. 点击Burn开始烧写。 3. 提示下电并给单板重新上电,烧写完成后,连接串口,如下图所示。 **图 3** HiTool工具U-boot烧写完成串口显示 - ![](figures/HiTool工具U-boot烧写完成串口显示.png "HiTool工具U-boot烧写完成串口显示") + ![](figures/HiTool工具U-boot烧写完成串口显示-4.png "HiTool工具U-boot烧写完成串口显示-4") **问题 2:HiTool工具烧写时上报如下错误。** @@ -94,7 +98,7 @@ usr/bin目录下没有python软链接,请运行以下命令: - ``` + ```bash # cd /usr/bin/ # which python3 # ln -s /usr/local/bin/python3 python diff --git "a/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230.md" "b/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230.md" index cb7ec5029838868e20e72df23186c8980eb90a29..3af0795e96ff3d55335bb6c1f7caaeec6bcb333b 100755 --- "a/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230.md" +++ "b/quick-start/\345\270\270\350\247\201\351\227\256\351\242\230.md" @@ -209,7 +209,7 @@ usr/bin目录下没有python软链接,请运行以下命令: - ``` + ```bash # cd /usr/bin/ # which python3 # ln -s /usr/local/bin/python3 python diff --git "a/quick-start/\345\274\200\345\217\221Hi3516\347\254\254\344\270\200\344\270\252\345\272\224\347\224\250\347\250\213\345\272\217\347\244\272\344\276\213.md" "b/quick-start/\345\274\200\345\217\221Hi3516\347\254\254\344\270\200\344\270\252\345\272\224\347\224\250\347\250\213\345\272\217\347\244\272\344\276\213.md" index 15801a72dd750930e6f28fd4c962d94e190156e6..1b08e545ff896f9b59fbc5507f959408bfb28809 100755 --- "a/quick-start/\345\274\200\345\217\221Hi3516\347\254\254\344\270\200\344\270\252\345\272\224\347\224\250\347\250\213\345\272\217\347\244\272\344\276\213.md" +++ "b/quick-start/\345\274\200\345\217\221Hi3516\347\254\254\344\270\200\344\270\252\345\272\224\347\224\250\347\250\213\345\272\217\347\244\272\344\276\213.md" @@ -4,13 +4,13 @@ ## 获取源码 -开发者需要在Linux服务器上下载一套源代码,获取Hi3516源码([下载链接](http://tools.harmonyos.com/mirrors/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)。 +开发者需要在Linux服务器上下载一套源代码,获取Hi3516源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)。 ## 修改应用程序 源码目录applications/sample/camera/app/src内**helloworld.c**代码如下所示,用户可以自定义修改打印内容(例如:修改OHOS为World)。当前应用程序可支持标准C及C++的代码开发。 -``` +```c++ #include #include "los_sample.h" @@ -30,7 +30,7 @@ int main(int argc, char **argv) 在linux服务器上,进入源码包根目录,目录内存放有build.py编译脚本,执行如下脚本编译源码包。结果文件生成在out/ipcamera\_hi3516dv300目录下。 -``` +```bash python build.py ipcamera_hi3516dv300 -b debug ``` @@ -114,6 +114,9 @@ python build.py ipcamera_hi3516dv300 -b debug 1. 连接串口。 + >![](public_sys-resources/icon-notice.gif) **须知:** + >若无法连接串口,请参考常见问题5进行排查。 + **图 9** 连接串口图 diff --git "a/quick-start/\345\274\200\345\217\221Hi3516\347\254\254\344\270\200\344\270\252\351\251\261\345\212\250\347\250\213\345\272\217\347\244\272\344\276\213.md" "b/quick-start/\345\274\200\345\217\221Hi3516\347\254\254\344\270\200\344\270\252\351\251\261\345\212\250\347\250\213\345\272\217\347\244\272\344\276\213.md" index d913c11639e2cbcbd382e23c6d382a4bfe8ca878..9ee89c9cc2d536a4ccdb05edcd44cb23f0174146 100755 --- "a/quick-start/\345\274\200\345\217\221Hi3516\347\254\254\344\270\200\344\270\252\351\251\261\345\212\250\347\250\213\345\272\217\347\244\272\344\276\213.md" +++ "b/quick-start/\345\274\200\345\217\221Hi3516\347\254\254\344\270\200\344\270\252\351\251\261\345\212\250\347\250\213\345\272\217\347\244\272\344\276\213.md" @@ -62,7 +62,7 @@ 基于HDF框架注册UART驱动的入口HdfDriverEntry,代码如下: - ``` + ```c++ // 绑定UART驱动接口到HDF框架 static int32_t HdfUartSampleBind(struct HdfDeviceObject *device) { @@ -237,7 +237,7 @@ HDF框架提供了UART驱动接口的模板方法UartHostMethod,实现UART驱动接口的代码如下: - ``` + ```c++ static int32_t SampleInit(struct UartHost *host) { HDF_LOGI("%s: Enter", __func__); @@ -358,7 +358,7 @@ UART驱动成功初始化后,会创建/dev/uartdev-5设备节点,通过设备节点与UART驱动交互的代码如下: - ``` + ```c++ #include #include #include @@ -393,7 +393,7 @@ 在build/lite/product/ipcamera\_hi3516dv300.json产品配置的hdf子系统下增加hello\_uart\_sample组件,代码如下: - ``` + ```json { "subsystem": [ { @@ -419,6 +419,9 @@ 1. 连接串口。 + >![](public_sys-resources/icon-notice.gif) **须知:** + >若无法连接串口,请参考常见问题5进行排查。 + **图 1** 连接串口图 diff --git "a/quick-start/\345\274\200\345\217\221Hi3518\347\254\254\344\270\200\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" "b/quick-start/\345\274\200\345\217\221Hi3518\347\254\254\344\270\200\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" index 1397fff09f0ecb4c98dfd9a2e33dd9c4a6637a32..53840ffe62ff882ef61fe50aca4d7bd26bb6014e 100755 --- "a/quick-start/\345\274\200\345\217\221Hi3518\347\254\254\344\270\200\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" +++ "b/quick-start/\345\274\200\345\217\221Hi3518\347\254\254\344\270\200\344\270\252\347\244\272\344\276\213\347\250\213\345\272\217.md" @@ -4,13 +4,13 @@ ## 获取源码 -开发者需要在Linux服务器上下载一套源代码,获取Hi3518源码([下载链接](http://tools.harmonyos.com/mirrors/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)。 +开发者需要在Linux服务器上下载一套源代码,获取Hi3518源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,请见[源码获取](../get-code/源码获取.md)。 ## 修改应用程序 源码applications/sample/camera/app/src目录内helloworld.c代码如下所示,用户可以自定义修改打印内容(例如:修改OHOS为World)。当前应用程序可支持ISO C及C++的代码开发。 -``` +```c++ #include #include "los_sample.h" @@ -32,7 +32,7 @@ int main(int argc, char **argv) Hi3518EV300 -``` +```bash python build.py ipcamera_hi3518ev300 -b debug ``` @@ -115,5 +115,5 @@ Hi3518EV300单板请使用串口烧写。 ## 下一步学习 -恭喜您,已完成Hi3518的快速上手!建议您下一步进入[无屏摄像头产品开发](zh-cn_topic_0000001055366100.md)的学习 。 +恭喜您,已完成Hi3518的快速上手!建议您下一步进入[无屏摄像头产品开发](../guide/摄像头控制.md)的学习 。 diff --git "a/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203-0.md" "b/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203-0.md" index 55d0bf8f5b02ded06ee33d362e7a71fa44efb5ac..d89d19e289d1a6ddc9ef9a7338b86c14b360a0e7 100755 --- "a/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203-0.md" +++ "b/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203-0.md" @@ -89,28 +89,28 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示

产生ninja编译脚本

http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar

ninja

执行ninja编译脚本

http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar

LLVM

编译工具链

http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

hc-gen

驱动配置编译工具

http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

IPOP、PuTTY或其他超级终端

@@ -152,6 +152,13 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示

https://device.harmonyos.com/cn/ide

HiTool工具

+

U-boot,镜像文件烧写工具

+

http://www.hihope.org/download

+
@@ -182,7 +189,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 查看shell是否为bash,在终端运行如下命令 -``` +```bash ls -l /bin/sh ``` @@ -190,13 +197,13 @@ ls -l /bin/sh **方法一**:在终端运行如下命令,然后选择 no。 -``` +```bash sudo dpkg-reconfigure dash ``` **方法二**:先删除sh,再创建软链接。 -``` +```bash rm -rf /bin/sh sudo ln -s /bin/bash /bin/sh ``` @@ -222,7 +229,7 @@ sudo ln -s /bin/bash /bin/sh - 安装Python包管理工具,运行“sudo apt-get install python3-setuptools python3-pip -y”命令。(需root/sudo权限安装),升级pip3运行"sudo pip3 install --upgrade pip"。 - + 或按官网方式安装Python包管理工具:下载"curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py"后,再执行"python get-pip.py" @@ -256,7 +263,7 @@ sudo ln -s /bin/bash /bin/sh ## 安装gn 1. 打开Linux编译服务器终端。 -2. [下载gn工具](http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar)。 +2. [下载gn工具](https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar)。 3. 解压gn安装包至\~/gn路径下:"tar -xvf gn.1523.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:"export PATH=\~/gn:$PATH"。 5. 生效环境变量:"source \~/.bashrc"。 @@ -264,7 +271,7 @@ sudo ln -s /bin/bash /bin/sh ## 安装ninja 1. 打开Linux编译服务器终端 -2. [下载ninja工具](http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar)。 +2. [下载ninja工具](https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar)。 3. 解压ninja安装包至\~/ninja路径下:"tar -xvf ninja.1.9.0.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:"export PATH=\~/ninja:$PATH"。 5. 生效环境变量:"source \~/.bashrc"。 @@ -272,7 +279,7 @@ sudo ln -s /bin/bash /bin/sh ## 安装LLVM编译工具链 1. 打开Linux编译服务器终端。 -2. [下载LLVM工具](http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar)。 +2. [下载LLVM工具](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar)。 3. 解压LLVM安装包至\~/llvm路径下:"tar -xvf llvm-linux-9.0.0-34042.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:export PATH=\~/llvm/bin:$PATH。 5. 生效环境变量:"source \~/.bashrc"。 @@ -280,8 +287,8 @@ sudo ln -s /bin/bash /bin/sh ## 安装hc-gen 1. 打开Linux编译服务器终端。 -2. [下载hc-gen工具](http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar)。 -3. 解压hc-gen安装包到Linux服务器\~/hc-gen路径下。 +2. [下载hc-gen工具](https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar)。 +3. 解压hc-gen安装包到Linux服务器\~/hc-gen路径下:"tar -xvf hc-gen-0.65-linux.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:export PATH=\~/hc-gen:$PATH。 5. 生效环境变量:"source \~/.bashrc"。 diff --git "a/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203-2.md" "b/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203-2.md" index 2b1a264c5d476a88f7151529261b160b95f5b2d8..ceb2c2eb5e4225a8901703a0fd43d92e80ed718e 100755 --- "a/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203-2.md" +++ "b/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203-2.md" @@ -84,28 +84,28 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示

产生ninja编译脚本

http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar

ninja

执行ninja编译脚本

http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar

LLVM

编译工具链

http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

hc-gen

驱动配置编译工具

http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

IPOP、PuTTY或其他超级终端

@@ -175,7 +175,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示 查看shell是否为bash,在终端运行如下命令 -``` +```bash ls -l /bin/sh ``` @@ -183,13 +183,13 @@ ls -l /bin/sh **方法一**:在终端运行如下命令,然后选择 no。 -``` +```bash sudo dpkg-reconfigure dash ``` **方法二**:先删除sh,再创建软链接。 -``` +```bash rm -rf /bin/sh sudo ln -s /bin/bash /bin/sh ``` @@ -207,7 +207,7 @@ sudo ln -s /bin/bash /bin/sh 2. 获取[python3.8.5安装包](https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz),将其放至linux服务器中,运行 : - "tar -xvzf Python-3.8.5.tgz && cd Python-3.8.5 && sudo ./configure && make && sudo make install" + "tar -xvzf Python-3.8.5.tgz && cd Python-3.8.5 && sudo ./configure && sudo make && sudo make install" 3. 确定Python-3.8.5安装好后,运行"which python3.8",将回显路径链接到"/usr/bin/python",示例: @@ -215,7 +215,7 @@ sudo ln -s /bin/bash /bin/sh - 安装Python包管理工具,运行“sudo apt-get install python3-setuptools python3-pip -y”命令。(需root/sudo权限安装),升级pip3运行"sudo pip3 install --upgrade pip"。 - + 或按官网方式安装Python包管理工具:下载"curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py"后,再执行"python get-pip.py" @@ -249,7 +249,7 @@ sudo ln -s /bin/bash /bin/sh ## 安装gn 1. 打开Linux编译服务器终端。 -2. [下载gn工具](http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar)。 +2. [下载gn工具](https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar)。 3. 解压gn安装包至\~/gn路径下:"tar -xvf gn.1523.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:"export PATH=\~/gn:$PATH"。 5. 生效环境变量:"source \~/.bashrc"。 @@ -257,7 +257,7 @@ sudo ln -s /bin/bash /bin/sh ## 安装ninja 1. 打开Linux编译服务器终端 -2. [下载ninja工具](http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar)。 +2. [下载ninja工具](https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar)。 3. 解压ninja安装包至\~/ninja路径下:"tar -xvf ninja.1.9.0.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:"export PATH=\~/ninja:$PATH"。 5. 生效环境变量:"source \~/.bashrc"。 @@ -265,7 +265,7 @@ sudo ln -s /bin/bash /bin/sh ## 安装LLVM编译工具链 1. 打开Linux编译服务器终端。 -2. [下载LLVM工具](http://tools.harmonyos.com/mirrors/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar)。 +2. [下载LLVM工具](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar)。 3. 解压LLVM安装包至\~/llvm路径下:"tar -xvf llvm-linux-9.0.0-34042.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:export PATH=\~/llvm/bin:$PATH。 5. 生效环境变量:"source \~/.bashrc"。 @@ -273,8 +273,8 @@ sudo ln -s /bin/bash /bin/sh ## 安装hc-gen 1. 打开Linux编译服务器终端。 -2. [下载hc-gen工具](http://tools.harmonyos.com/mirrors/hc-gen/0.65/linux/hc-gen-0.65-linux.tar)。 -3. 解压hc-gen安装包到Linux服务器\~/hc-gen路径下。 +2. [下载hc-gen工具](https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar)。 +3. 解压hc-gen安装包到Linux服务器\~/hc-gen路径下:"tar -xvf hc-gen-0.65-linux.tar -C \~/"。 4. 设置环境变量:"vim \~/.bashrc", 新增:export PATH=\~/hc-gen:$PATH。 5. 生效环境变量:"source \~/.bashrc"。 diff --git "a/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203.md" "b/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203.md" index 675c8dc1ec1b17a3cad90597dbc9d27209c452d0..08c0856803c506d1cb568994cc1796217866a322 100755 --- "a/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203.md" +++ "b/quick-start/\346\220\255\345\273\272\347\216\257\345\242\203.md" @@ -67,7 +67,7 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示

交叉编译工具

http://tools.harmonyos.com/mirrors/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz

+

https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz

Python3.7+

@@ -102,14 +102,14 @@ Linux服务器通用环境配置需要的工具及其获取途径如下表所示

产生ninja编译脚本

http://tools.harmonyos.com/mirrors/gn/1523/linux/gn.1523.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar

ninja

执行ninja编译脚本

http://tools.harmonyos.com/mirrors/ninja/1.9.0/linux/ninja.1.9.0.tar

+

https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar

services/hiview_lite

DFX框架服务化注册

+

DFX mini框架服务化注册

frameworks/ddrdump_lite

@@ -94,7 +93,7 @@

utils/lite

公共基础操作定义实现。包含了miini框架的config配置

+

公共基础操作定义实现。包含了mini框架的config配置

@@ -157,7 +152,6 @@ DFX-mini是一套简单小巧的DFX设计,对外提供log功能:

OUTPUT_OPTION_DEBUG 日志不进行跨任务调度直接输出到串口,仅适合临时调测使用。

OUTPUT_OPTION_FLOW 日志流式输出到串口(默认设置)

OUTPUT_OPTION_TEXT_FILE 日志输出为文本文件

-

OUTPUT_OPTION_BIN_FILE 日志输出为二进制文件(后续支持)

-

配置项

level

@@ -180,21 +174,21 @@ DFX-mini是一套简单小巧的DFX设计,对外提供log功能:

eventSwitch

事件功能开关。编译前关闭则不再初始化DUMP组件。默认关闭。取值如下:

+

事件功能开关。编译前关闭则不再初始化Event组件。默认关闭。取值如下:

HIVIEW_FEATURE_ON/ HIVIEW_FEATURE_OFF

- + 2. **第四步日志打印** - + 在需要打印日志的.c文件中 \#include "log.h",调用如下接口: - - HILOG\_INFO\(HILOG\_MODULE\_SAMGR, “log test: %d”, 88\); - + + HILOG\_INFO\(HILOG\_MODULE\_A,“log test: %d”, 88\); + 接口参数说明: - + @@ -239,29 +233,31 @@ DFX-mini是一套简单小巧的DFX设计,对外提供log功能:

参数名

- - ## 使用-featured框架 DFX featured框架提供完整的DFX特性,对外提供log接口: -**Native C/C++**接口 +**Native C/C++** 接口 hilog 可用API ``` -HILOGD(fmt,...) HILOGI(fmt,...) HILOGW(fmt,...) HILOGE(fmt,...) +HILOG_DEBUG(type, ...) +HILOG_INFO(type, ...) +HILOG_WARN(type, ...) +HILOG_ERROR(type, ...) +HILOG_FATAL(type, ...) ``` 使用介绍 -首先需要定义TAG,DOMAIN需要找DFT申请,未经申请的DOMAIN,日志打印不出来。 +1. 首先需要定义TAG。 -本地调试,可以临时使用domain数值 0。 +2. 本地调试,可以临时使用domain数值 0。 -包含头文件:\#include +3. 包含头文件:\#include -在BUILD.gn中添加依赖库 libhilog。 +4. 在BUILD.gn中添加依赖库 libhilog。 接口规则介绍: @@ -273,9 +269,8 @@ HILOGD(fmt,...) HILOGI(fmt,...) HILOGW(fmt,...) HILOGE(fmt,...) 4. %\{public\}标识的参数是非隐私 HILOGI\("Age is %\{public\}d\\n", 10\); \>\>Age is 10 -接口参数介绍 +接口参数介绍 - - - @@ -70,7 +69,7 @@ vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware #IoT外设控制HAL层 - @@ -79,7 +78,7 @@ vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware #IoT外设控制HAL层 - @@ -88,7 +87,7 @@ vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware #IoT外设控制HAL层 - @@ -101,12 +100,12 @@ vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware #IoT外设控制HAL层 - **KV存储** + ```C++ 获取接口 - - ``` char key1[] = "rw.sys.version"; char value1[32] = {0}; int ret = UtilsGetValue(key1, value1, 32); + 设置接口 char key14[] = "key_14"; ret = UtilsSetValue(key14, defValue); @@ -114,17 +113,19 @@ vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware #IoT外设控制HAL层 - **文件操作** - ``` + ```C++ // open && write char fileName[] = "testfile"; int fd = UtilsFileOpen(fileName, O_RDWR_FS | O_CREAT_FS | O_TRUNC_FS, 0); printf("file handle = %d\n", fd); int ret = UtilsFileWrite(fd, def, strlen(def)); printf("write ret = %d\n", ret); + // stat int fileLen = 0; ret = UtilsFileStat(fileName, &fileLen); printf("file size = %d\n", fileLen); + // seek int fd1 = UtilsFileOpen(fileName, O_RDWR_FS, 0); ret = UtilsFileSeek(fd1, 5, SEEK_SET_FS); @@ -133,6 +134,7 @@ vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware #IoT外设控制HAL层 int readLen = UtilsFileRead(fd1, buf, 32); ret = UtilsFileClose(fd1); printf("read len = %d : buf = %s\n", readLen, buf); + // delete ret = UtilsFileDelete(fileName); printf("delete ret = %d\n", ret); diff --git "a/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237README.md" "b/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237README.md" index 07553c0ff75cf7174333f5e30583e999fe45b261..03ba49855c51a8fcf87b4ec850f0570bc3cf2ca2 100755 --- "a/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\345\206\205\346\240\270\345\255\220\347\263\273\347\273\237README.md" @@ -2,13 +2,15 @@ ## 简介 -OpenHarmony内核是华为推出的面向IoT领域的实时操作系统内核,它具备类似RTOS般轻快和Linux般易用的特点。 +OpenHarmony内核是华为推出面向IoT领域的实时操作系统内核,它同时具备RTOS轻快和Linux易用的特点。 -这个仓库用于存放OpenHarmony内核的源代码。包括功能组件部分:进程和线程调度、内存管理、IPC机制、timer管理等操作系统基础组件,版本包编译信息。 +OpenHarmony内核主要包括进程和线程调度、内存管理、IPC机制、timer管理等内核基本功能。 + +OpenHarmony内核的源代码分为 [`kernel_liteos_a`](https://gitee.com/openharmony/kernel_liteos_a) 和 [`kernel_liteos_m`](https://gitee.com/openharmony/kernel_liteos_m) 这2个代码仓库,其中`kernel_liteos_a`主要针对Cortex-A系列处理器,而`kernel_liteos_m`则主要针对Cortex-M系列处理器,两者目录结构非常相似,所以下面主要针对`kernel_liteos_a`代码仓库进行介绍。 ## 目录 -**表 1** OpenHarmony轻内核源代码目录结构 +**表 1** OpenHarmony内核源代码目录结构

参数名字

参数含义

@@ -284,7 +279,7 @@ HILOGD(fmt,...) HILOGI(fmt,...) HILOGW(fmt,...) HILOGE(fmt,...)

domain

领域标识ID,需要找DFT申请,未经申请的domain会出现日志打印不出来的问题

+

领域标识ID

tag

@@ -312,34 +307,36 @@ HILOGD(fmt,...) HILOGI(fmt,...) HILOGW(fmt,...) HILOGE(fmt,...) **日志查看** -1. debug版本hilog日志会保存到/storage/data/log/hilogs 目录下面。 - -2. 可以执行hilogcat实时查看hilog日志。 +1. debug版本hilog日志会保存到/storage/data/log/目录下面。 +2. 可以执行hilogcat实时查看hilog日志。 **日志系统架构** -![](figures/zh-cn_image_0000001052080708.png) +![](figures/zh-cn_image_0000001054762887.png) -1. hilogtask流水日志的内核任务。 - - 此功能是一个linux内核的任务或者线程,在系统启动时初始化。 - - 当内核中一个模块调用它的日志接口,将格式化好的日志内容传输给改任务,并将其存储在一个环形缓冲区中 。 - - 当用户态调用日志接口,将格式化好的日志内容通过ioctl调用写入驱动节点,驱动节点再将日志内容发送到hilogtask,hilogtask将日志内容存储到环形缓冲区中。 +1. hilogtask流水日志的内核任务。 + - 此功能是一个linux内核的任务或者线程,在系统启动时初始化。 + - 当内核中一个模块调用它的日志接口,将格式化好的日志内容传输给改任务,并将其存储在一个环形缓冲区中 。 + - 当用户态调用日志接口,将格式化好的日志内容通过ioctl调用写入驱动节点,驱动节点再将日志内容发送到hilogtask,hilogtask将日志内容存储到环形缓冲区中。 -2. hilogcatd用户态日志存储服务。 - - 这是一个用户态的进程,负责定时将内核的ringbuffer读取出来,存储到日志文件中。 - - 日志文件输出支持gzip压缩,使用zlib - - 每个类型的ringbuffer分开存储。 - - 存储文件的单个文件大小,文件个数可在编译时配置。 +2. hilogcatd用户态日志存储服务。 + - 这是一个用户态的进程,负责定时将内核的ringbuffer读取出来,存储到日志文件中。 + - 日志文件输出支持gzip压缩,使用zlib + - 存储文件的单个文件大小,文件个数可在编译时配置。 -3. hilogcat日志查看命令行工具。 +3. hilogcat日志查看命令行工具。 从内核驱动接口读取ringbuffer内容,输出到标准输出。 -4. 支持日志缓冲区可配置。 - - 编译时可以配置日志缓冲区的大小。 - - 编译时可以指定日志缓冲区的类型,类型个数就是ringbuffer的个数。 +4. 支持日志缓冲区可配置。 +<<<<<<< HEAD +======= + - 编译时可以配置日志缓冲区的大小。 +>>>>>>> e9c42d63d4344e99bafce5d1103487fb08edd7b5 + + - 编译时可以配置日志缓冲区的大小。 ## 涉及仓 @@ -362,4 +359,3 @@ hiviewdfx\_services\_hiview\_lite hiviewdfx\_services\_hilogcat\_lite hiviewdfx\_utils\_lite - diff --git "a/readme/JS\345\272\224\347\224\250\345\274\200\345\217\221\346\241\206\346\236\266README.md" "b/readme/JS\345\272\224\347\224\250\345\274\200\345\217\221\346\241\206\346\236\266README.md" index 1d001b0f6763e1d8b98607d75e9cb1bbd2c4b3ed..78fb08c85e452c9cb97a7b1c616304cc1b1943a1 100755 --- "a/readme/JS\345\272\224\347\224\250\345\274\200\345\217\221\346\241\206\346\236\266README.md" +++ "b/readme/JS\345\272\224\347\224\250\345\274\200\345\217\221\346\241\206\346\236\266README.md" @@ -2,7 +2,7 @@ ## 简介 -JS应用开发框架,提供了一套跨平台的类web应用开发框架,通过Toolkit将开发者编写的HML、CSS和JS 文件编译打包成JS Bundle,然后再将JS Bundle解析运行成C++ native UI的View 组件进行渲染。通过支持三方开发者使用声明式的API进行应用开发,以数据驱动视图变化,避免了大量的视图操作,大大降低了应用开发难度,提升开发者开发体验。 +JS应用开发框架,提供了一套跨平台的类web应用开发框架,通过Toolkit将开发者编写的HML、CSS和JS 文件编译打包成JS Bundle,解析运行JS Bundle,生成native UI View组件树并进行渲染显示。通过支持三方开发者使用声明式的API进行应用开发,以数据驱动视图变化,避免大量的视图操作,大大降低应用开发难度,提升开发者开发体验。 JS应用框架模块组成如下图所示: @@ -14,37 +14,37 @@ JS应用开发框架源代码在/foundation/ace下,目录结构如下图所示 ``` /foundation/ace -├── frameworks #框架代码 +├── frameworks # 框架代码 │ └── lite -│ ├── examples #示例代码目录 -│ ├── include #对外暴露头文件存放目录 -│ ├── packages #框架JS实现存放目录 -│ ├── src #源代码存放目录 -│ ├── targets #各目标设备配置文件存放目录 -│ └── tools #工具代码存放目录 -├── interfaces #对外接口存放目录 -│ └── innerkits #对内部子系统暴露的头文件存放目录 +│ ├── examples # 示例代码目录 +│ ├── include # 对外暴露头文件存放目录 +│ ├── packages # 框架JS实现存放目录 +│ ├── src # 源代码存放目录 +│ ├── targets # 各目标设备配置文件存放目录 +│ └── tools # 工具代码存放目录 +├── interfaces # 对外接口存放目录 +│ └── innerkits # 对内部子系统暴露的头文件存放目录 │ └── builtin # JS应用框架对外暴露JS三方module API接口存放目录 ``` ## 约束 -- 语言版本 +- 语言版本: - C++11版本或以上 - - JavaScript ES5.1+ + - JavaScript ES5.1 - 框架运行内存通常分为如下组成部分: - - 运行时引擎的预分配内存,该内存值可调,取决于具体设备应用复杂度,通常建议64K\~512K - - 框架本身内存,在百K级的内存设备上,通常通过预分配一个内存池进行管理,可以和native UI共用一个内存池,包含了对象和堆内存统一管理 + - JS引擎运行时内存:可调,取决于具体设备应用复杂度,通常建议64K\~512K + - 框架本身native内存:在百K级的内存设备上,建议预分配一个与native UI共用的内存池,用于native内存的管理 -- 框架针对不同的芯片平台和底层OS能力,规格有所区别 - - Cortex-M RAM/ROM: +- 框架针对不同的芯片平台和底层OS能力,规格有所区别: + - Cortex-M RAM/ROM - JS引擎内存池: 建议大于48K - RAM:建议与native UI共用内存池,大于80K - ROM: \> 300K (包含JS应用框架,以及native UI和JS引擎等强相关子系统) - - Cortex-A RAM/ROM: + - Cortex-A RAM/ROM - JS引擎内存池: 建议大于128K - RAM:建议大于512K - ROM:\> 2M (包含JS应用框架,以及native UI和JS引擎等强相关子系统) @@ -53,7 +53,10 @@ JS应用开发框架源代码在/foundation/ace下,目录结构如下图所示 ## 使用**targets** -JS应用框架实现主要包含两部分,native和JavaScript,native部分为C++,为框架的主体实现,JavaScript部分实现提供JS应用框架对用户JS文件的运行时支持,并通过向引擎暴露一些全局方法或对象,支撑JS运行时与native框架之间的交互。 +JS应用框架实现主要包含两部分: + +- native部分:使用C++进行编写,是框架主体实现; +- JavaScript部分:提供JS应用框架对用户JS文件的运行时支持,并通过向引擎暴露一些全局方法和对象,支撑JS运行时与native框架之间的交互。 JS应用框架通过一些特性宏来定制不同平台上参与编译的功能代码,该部分特性宏定义在 foundation/ace/frameworks/lite/targets 目录下头文件内,目录结构如下: @@ -61,70 +64,74 @@ JS应用框架通过一些特性宏来定制不同平台上参与编译的功能 /foundation/ace/frameworks/lite/targets ├── default/ │ └── acelite_config.h -├── linux/ #linux环境配置文件目录 +├── linux/ # linux环境配置文件目录 │ └── acelite_config.h -├── liteos_a/ #LiteOS A核环境配置文件目录 +├── liteos_a/ # LiteOS A核环境配置文件目录 │ └── acelite_config.h -├── liteos_m/ #LiteOS M核环境配置文件目录 +├── liteos_m/ # LiteOS M核环境配置文件目录 │ └── acelite_config.h ├── platform_adapter.cpp ├── platform_adapter.h -└── simulator/ #模拟器环境配置文件目录 +└── simulator/ # 模拟器环境配置文件目录 └── win/ └── acelite_config.h* ``` -在编译不同的平台目标时,需要使用对应平台目录下的acelite\_config.h 头文件,这可以通过配置编译时的搜索路径来进行,以下以 ninja和cmake 构建工具为例进行示例: +在编译不同的平台目标时,需要使用对应平台目录下的acelite\_config.h头文件,这可以通过配置编译时的搜索路径来进行,以下以ninja和cmake构建工具为例进行示例: -ninja: +- ninja: -``` - if (hos_kernel_type == "liteos_a" || hos_kernel_type == "liteos_m" || - hos_kernel_type == "liteos_riscv") { // 通过目标内核平台选择不同的头文件搜索路径 - include_dirs += [ "targets/liteos-a" ] - } else if (hos_kernel_type == "linux") { - include_dirs += [ "targets/linux" ] - } -``` + ```c++ + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type== "liteos_m" || + ohos_kernel_type == "liteos_riscv") { // 通过目标内核平台选择不同的头文件搜索路径 + include_dirs += [ "targets/liteos-a" ] + } else if (ohos_kernel_type == "linux") { + include_dirs += [ "targets/linux" ] + } + ``` -cmake: -``` -...... -set(ACE_LITE_CONFIG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/targets/simulator/win") -set(JSFWK_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/include") -set(JSFWK_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/core") -set(UIKIT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ui") -set(THIRTY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party") -set(JSFWK_SIMULATOR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../tools/simulator") -set(JS_API_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../api/emui_band/MoltenCore/application/framework/ace/api") -set(JSFWK_SIMULATOR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../tools/simulator") -set(AAFWK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../aafwk") - -# header files -include_directories( - ${ACE_LITE_CONFIG_PATH} - ${JSFWK_INCLUDE_PATH}/async - ${JSFWK_INCLUDE_PATH}/base - ${JSFWK_INCLUDE_PATH}/context - ${JSFWK_INCLUDE_PATH}/jsi - ${JSFWK_SOURCE_PATH} +- cmake: + + ``` ...... -``` + set(ACE_LITE_CONFIG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/targets/simulator/win") # 模拟器编译搜索路径使用targets/simulator/win + set(JSFWK_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/include") + set(JSFWK_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/core") + set(UIKIT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ui") + set(THIRTY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party") + set(JSFWK_SIMULATOR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../tools/simulator") + set(JS_API_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../api/emui_band/MoltenCore/application/framework/ace/api") + set(JSFWK_SIMULATOR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../tools/simulator") + set(AAFWK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../aafwk") + + # header files + include_directories( + ${ACE_LITE_CONFIG_PATH} + ${JSFWK_INCLUDE_PATH}/async + ${JSFWK_INCLUDE_PATH}/base + ${JSFWK_INCLUDE_PATH}/context + ${JSFWK_INCLUDE_PATH}/jsi + ${JSFWK_SOURCE_PATH} + ...... + ``` -acelite\_config.h主要用于对应平台的特性宏开关,也可用来进行一些屏蔽平台差异的定义,如不同平台由于使用的文件系统不一致,可能存在一些固定目录路径名不一样的情况,这些有区别的常量可以放在这里进行定义,如下: -liteos-a/acelite\_config.h +acelite\_config.h主要用于对应平台的特性宏开关,也可用来进行一些屏蔽平台差异的定义。如不同平台由于使用的文件系统不一致,可能存在一些固定目录路径名不一样的情况,这些有区别的常量可以放在这里进行定义,如下: -``` -#define JS_FRAMEWORK_PATH "//system/ace/bin/" -``` +- liteos-a/acelite\_config.h -simulator/win/acelite\_config.h + ``` + #define JS_FRAMEWORK_PATH "//system/ace/bin/" + ``` + + +- simulator/win/acelite\_config.h + + ``` + #define JS_FRAMEWORK_PATH "..\\..\\..\\jsfwk\\packages\\runtime-core\\build" + ``` -``` -#define JS_FRAMEWORK_PATH "..\\..\\..\\jsfwk\\packages\\runtime-core\\build" -``` ## 使用runtime-core @@ -133,38 +140,38 @@ simulator/win/acelite\_config.h ``` /foundation/ace/frameworks/lite/packages └── runtime-core - ├── .babelrc #babel配置文件 - ├── .editorconfig #IDE配置文件 - ├── .eslintignore #ESLint配置文件,可以设置不进行ESLint扫描的目录或文件 - ├── .eslintrc.js #ESLint配置文件,可以配置扫描规则 + ├── .babelrc # babel配置文件 + ├── .editorconfig # IDE配置文件 + ├── .eslintignore # ESLint配置文件,可以设置不进行ESLint扫描的目录或文件 + ├── .eslintrc.js # ESLint配置文件,可以配置扫描规则 ├── .gitignore - ├── package.json #NPM包管理文件 - ├── package-lock.json #NPM依赖版本锁定文件 - ├── .prettierrc #代码格式化规则配置文件 - ├── scripts #编译脚本存放目录 - │ ├── build.js #编译脚本 - │ └── configs.js #Rollup配置文件 + ├── package.json # NPM包管理文件 + ├── package-lock.json # NPM依赖版本锁定文件 + ├── .prettierrc # 代码格式化规则配置文件 + ├── scripts # 编译脚本存放目录 + │ ├── build.js # 编译脚本 + │ └── configs.js # Rollup配置文件 ├── .size-snapshot.json - └── src #源代码 - ├── core #ViewModel核心实现目录 + └── src # 源代码 + ├── core # ViewModel核心实现目录 │ └── index.js ├── index.js - ├── observer #数据劫持部分代码实现目录 + ├── observer # 数据劫持部分代码实现目录 │ ├── index.js │ ├── observer.js │ ├── subject.js │ └── utils.js - ├── profiler #profiler目录 + ├── profiler # profiler目录 │ └── index.js - └── __test__ #测试用例目录 + └── __test__ # 测试用例目录 └── index.test.js ``` 支持的NPM 命令有: -- npm run build +- `npm run build` - JS应用框架所集成的JS 引擎仅支持ES5.1语法,runtime-core源代码是使用ES6源码书写的。因此选择使用rollup做为打包工具,配合babel实现对JavaScript语法进行降级处理。只要命令行中执行命令npm run build,会在build目录下输出打包结果,输出结果如下所示: + JS应用框架所集成的JS引擎仅支持ES5.1语法,runtime-core源代码是使用ES6语法书写的。因此选择使用rollup做为打包工具,配合babel实现对语法进行降级处理。命令行中执行npm run build,会在build目录下输出打包结果,输出结果如下所示: ``` build/ @@ -174,7 +181,7 @@ simulator/win/acelite\_config.h └── framework.min.js // 生产环境使用的框架代码(已压缩混淆) ``` -- npm run test +- `npm run test` runtime-core使用jest进行单元测试,在命令行中执行npm run test即可触发。 diff --git "a/readme/XTS\350\256\244\350\257\201\345\255\220\347\263\273\347\273\237README.md" "b/readme/XTS\350\256\244\350\257\201\345\255\220\347\263\273\347\273\237README.md" index eb36cf6c5996c7ca16579e1666d3d56151d2f033..8b480e677135851e1e45936adfc502897374a586 100755 --- "a/readme/XTS\350\256\244\350\257\201\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/XTS\350\256\244\350\257\201\345\255\220\347\263\273\347\273\237README.md" @@ -7,7 +7,7 @@ XTS是OpenHarmony生态认证测试套件的集合,当前包括acts(applicat test/xts仓当前包括acts与tools软件包: - acts,存放acts相关测试用例源码与配置文件,其目的是帮助终端设备厂商尽早发现软件与OpenHarmony的不兼容性,确保软件在整个开发过程中满足OpenHarmony的兼容性要求。 -- tools,提供acts编写与编译所依赖的测试用例开发框架。 +- tools,存放acts相关测试用例开发框架。 ## 目录 @@ -17,9 +17,7 @@ test/xts源代码目录结构: │ ├── BUILD.gn 测试用例编译配置 -│ └── A测试子系统\_lite A测试子系统测试用例源码 - -│ └── B测试子系统\_lite B测试子系统测试用例源码 +│ └── subsystem\_lite 子系统测试用例源码 └── tools @@ -39,7 +37,7 @@ test/xts源代码目录结构: ## 编写联接类模组acts测试用例 -当前使用的测试框架是hctest测试框架。 +当前使用的测试框架是hctest。 hctest测试框架支持使用C语言编写测试用例,在联接类模组上执行,是在开源测试框架unity的基础上进行增强和适配。 @@ -49,13 +47,13 @@ hctest测试框架支持使用C语言编写测试用例,在联接类模组上 │ ├── BUILD.gn -│ └──测试子系统\_lite +│ └──subsystem\_lite -│ │ └── 测试模块\_hal +│ │ └── module\_hal │ │ │ └── BUILD.gn -│ │ │ └── src 存放测试用例源码 +│ │ │ └── src **2,src目录下用例编写样例:** @@ -67,7 +65,7 @@ hctest测试框架支持使用C语言编写测试用例,在联接类模组上 (2)使用宏定义LITE\_TEST\_SUIT定义子系统、模块、测试套件名称 -``` +```c++ /** * @brief register a test suit named "IntTestSuite" * @param test subsystem name @@ -91,7 +89,7 @@ Setup与TearDown必须存在,可以为空函数。 “Level0”,“Level1”,“Level2”,“Level3”,“Level4”。 -``` +```c++ LITE_TEST_CASE(IntTestSuite, TestCase001, Level0) { //do something @@ -157,7 +155,7 @@ RUN_TEST_SUITE(IntTestSuite); 每个测试模块目录下新建BUILD.gn编译文件,用于指定编译后静态库的名称、依赖的头文件、依赖的库等;具体写法如下: -``` +```c++ import("//test/xts/tools/build/suite_lite.gni") hctest_suite("ActsDemoTest") { suite_name = "acts" @@ -171,15 +169,15 @@ hctest_suite("ActsDemoTest") { **4,acts下BUILD.gn增加编译选项** -如何将编写的测试代码加入到版本编译中,需要将测试模块加入到acts目录下的编译脚本中,编译脚本为:test/xts/acts/BUILD.gn。 +需要将测试模块加入到acts目录下的编译脚本中,编译脚本路径:test/xts/acts/BUILD.gn。 -``` +```C++ lite_component("acts") { ... if(board_name == "liteos_riscv") { features += [ ... - "//xts/acts/测试子系统_lite/测试模块_hal:ActsDemoTest" + "//xts/acts/subsystem_lite/module_hal:ActsDemoTest" ] } } @@ -203,13 +201,13 @@ hcpptest测试框架是在开源的googletest测试框架的基础上进行的 │ ├── BUILD.gn -│ └──测试子系统\_lite +│ └──subsystem\_lite -│ │ └── 测试模块\_posix +│ │ └── module\_posix │ │ │ └── BUILD.gn -│ │ │ └── src 存放测试用例源码 +│ │ │ └── src **2,测试模块src下用例编写样例:** @@ -217,26 +215,26 @@ hcpptest测试框架是在开源的googletest测试框架的基础上进行的 需要引用gtest.h 如:\#include "gtest/gtest.h" -``` +```C++ #include "gtest/gtest.h" ``` (2)定义Setup与TearDown -``` +```C++ class TestSuite: public testing::Test { protected: -// SetUpTestCase:测试套预置动作,在第一个TestCase之前执行 +// Preset action of the test suite, which is executed before the first test case static void SetUpTestCase(void){ } -// TearDownTestCase:测试套清理动作,在最后一个TestCase之后执行 +// Test suite cleanup action, which is executed after the last test case static void TearDownTestCase(void){ } -// 用例的预置动作 +// Preset action of the test case virtual void SetUp() { } -// 用例的清理动作 +// Cleanup action of the test case virtual void TearDown() { } @@ -255,7 +253,7 @@ virtual void TearDown() “Level0”,“Level1”,“Level2”,“Level3”,“Level4”。 -``` +```C++ HWTEST_F(TestSuite, TestCase_0001, Level0) { // do something } @@ -316,7 +314,7 @@ HWTEST_F(TestSuite, TestCase_0001, Level0) { 举例: -``` +```C++ import("//test/xts/tools/build/suite_lite.gni") hcpptest_suite("ActsDemoTest") { @@ -337,17 +335,17 @@ hcpptest_suite("ActsDemoTest") { ``` -4**,acts目录下增加编译选项(BUILD.gn)** +**4,acts目录下增加编译选项(BUILD.gn)** -如何将编写的测试代码加入到版本编译中,需要将测试模块加入到acts目录下的编译脚本中,编译脚本为:test/xts/acts/BUILD.gn。 +需要将测试模块加入到acts目录下的编译脚本中,编译脚本为:test/xts/acts/BUILD.gn。 -``` +```C++ lite_component("acts") { ... else if(board_name == "liteos_a") { features += [ ... - "//xts/acts/测试子系统_lite/测试模块_posix:ActsDemoTest" + "//xts/acts/subsystem_lite/module_posix:ActsDemoTest" ] } } @@ -357,13 +355,13 @@ else if(board_name == "liteos_a") { 1.1 hi3518ev300 : -1)命令:python build.py ipcamera\_hi3518ev300 -b debug +1)命令:`python build.py ipcamera\_hi3518ev300 -b debug` 2)输出:out/ipcamera\_hi3518ev300 1.2 hi3516dv300: -1\) 命令:python build.py ipcamera\_hi3516dv300 -b debug +1\) 命令:`python build.py ipcamera\_hi3516dv300 -b debug` 2)输出:out/ipcamera\_hi3516dv300 @@ -406,11 +404,10 @@ else if(board_name == "liteos_a") { 举例: - ``` + ```bash mount 192.168.1.10:/nfs /nfs nfs ``` - **2,用例执行** (1)基于串口打印日志进行分析; diff --git a/readme/figures/zh-cn_image_0000001052204863.gif "b/readme/figures/Ability\344\270\216AbilitySlice\347\232\204\345\205\263\347\263\273\345\233\276.gif" old mode 100755 new mode 100644 similarity index 100% rename from readme/figures/zh-cn_image_0000001052204863.gif rename to "readme/figures/Ability\344\270\216AbilitySlice\347\232\204\345\205\263\347\263\273\345\233\276.gif" diff --git a/readme/figures/zh-cn_image_0000001051366141.png "b/readme/figures/Ability\347\224\237\345\221\275\345\221\250\346\234\237\346\265\201\350\275\254\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from readme/figures/zh-cn_image_0000001051366141.png rename to "readme/figures/Ability\347\224\237\345\221\275\345\221\250\346\234\237\346\265\201\350\275\254\345\233\276.png" diff --git "a/readme/figures/bms\347\255\226\347\225\245\344\270\276\344\276\213.png" "b/readme/figures/bms\347\255\226\347\225\245\344\270\276\344\276\213.png" new file mode 100644 index 0000000000000000000000000000000000000000..fb9c3d8c66673f5c5b69718f59bb09dab16e48a9 Binary files /dev/null and "b/readme/figures/bms\347\255\226\347\225\245\344\270\276\344\276\213.png" differ diff --git a/readme/figures/zh-cn_image_0000001052000128.png b/readme/figures/zh-cn_image_0000001052000128.png deleted file mode 100755 index 358d81d549c226fcdf48e06e50c9ac60f395f0a4..0000000000000000000000000000000000000000 Binary files a/readme/figures/zh-cn_image_0000001052000128.png and /dev/null differ diff --git a/readme/figures/zh-cn_image_0000001052201483.png b/readme/figures/zh-cn_image_0000001052201483.png deleted file mode 100755 index 37864e1836ef8e1e98c3ac064e318829de2c643f..0000000000000000000000000000000000000000 Binary files a/readme/figures/zh-cn_image_0000001052201483.png and /dev/null differ diff --git a/readme/figures/zh-cn_image_0000001053044331.png b/readme/figures/zh-cn_image_0000001053044331.png index a49d6b0eed4d6f44f1a2073bdda0a0e4a3f9a525..13c697a6e38addbc9b6b2b5717fa2b2a5770d092 100755 Binary files a/readme/figures/zh-cn_image_0000001053044331.png and b/readme/figures/zh-cn_image_0000001053044331.png differ diff --git a/readme/figures/zh-cn_image_0000001054762887.png b/readme/figures/zh-cn_image_0000001054762887.png new file mode 100644 index 0000000000000000000000000000000000000000..fee686d5a816b82f3d0d455d2134819976d33613 Binary files /dev/null and b/readme/figures/zh-cn_image_0000001054762887.png differ diff --git a/readme/figures/zh-cn_image_0000001054941316.png b/readme/figures/zh-cn_image_0000001054941316.png new file mode 100644 index 0000000000000000000000000000000000000000..37b1f5215e362c156ca5de27145c3711cc14083b Binary files /dev/null and b/readme/figures/zh-cn_image_0000001054941316.png differ diff --git a/readme/figures/zh-cn_image_0000001055103250.png b/readme/figures/zh-cn_image_0000001055103250.png new file mode 100644 index 0000000000000000000000000000000000000000..e1732f4dd9bb12a8abf040fba4b92dafab7df01e Binary files /dev/null and b/readme/figures/zh-cn_image_0000001055103250.png differ diff --git a/readme/figures/zh-cn_image_0000001055267336.png b/readme/figures/zh-cn_image_0000001055267336.png new file mode 100644 index 0000000000000000000000000000000000000000..c329d1d02d83435acfa6dbf1629f5649541f3b42 Binary files /dev/null and b/readme/figures/zh-cn_image_0000001055267336.png differ diff --git a/readme/figures/zh-cn_image_0000001055712348.png b/readme/figures/zh-cn_image_0000001055712348.png new file mode 100644 index 0000000000000000000000000000000000000000..fa3b3160f094a3dddfa8d46047dfc9da2bb96fcc Binary files /dev/null and b/readme/figures/zh-cn_image_0000001055712348.png differ diff --git "a/readme/figures/\345\205\250\345\261\200\347\255\226\347\225\2452.png" "b/readme/figures/\345\205\250\345\261\200\347\255\226\347\225\2452.png" new file mode 100644 index 0000000000000000000000000000000000000000..c40fd5e3f15cbd316c43dce31020740396c57d3f Binary files /dev/null and "b/readme/figures/\345\205\250\345\261\200\347\255\226\347\225\2452.png" differ diff --git "a/readme/figures/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" "b/readme/figures/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..594c3e1d9db95b3149ee3da9c11d9cea350d4d1d Binary files /dev/null and "b/readme/figures/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237\346\241\206\346\236\266\345\233\276.png" differ diff --git "a/readme/figures/\347\255\226\347\225\245\347\261\273\345\236\2132.png" "b/readme/figures/\347\255\226\347\225\245\347\261\273\345\236\2132.png" new file mode 100644 index 0000000000000000000000000000000000000000..1ad38251b4d9abba2076bfc2df91fa14c81ac07d Binary files /dev/null and "b/readme/figures/\347\255\226\347\225\245\347\261\273\345\236\2132.png" differ diff --git "a/readme/\345\205\254\345\205\261\345\237\272\347\241\200README.md" "b/readme/\345\205\254\345\205\261\345\237\272\347\241\200README.md" index 6d3220d47f40f56d32625b19c1263e0c968727fd..4fe69eee8a1e98eadd7929fa0f80c99b56c31247 100755 --- "a/readme/\345\205\254\345\205\261\345\237\272\347\241\200README.md" +++ "b/readme/\345\205\254\345\205\261\345\237\272\347\241\200README.md" @@ -6,40 +6,39 @@ 公共基础库在不同平台上提供的能力: -- LiteOS-M平台:KV存储、文件操作、定时器、IoT外设控制 -- LiteOS-A平台:KV存储、定时器、ACE JS API +- LiteOS-M内核(Hi3861平台):KV存储、文件操作、定时器、IoT外设控制 +- LiteOS-A内核(Hi3516、Hi3518平台):KV存储、定时器、ACE JS API ## 目录 ``` -utils/native/lite/ # 公共基础库根目录 -├── file # 文件接口实现 -├── hals # HAL目录 -│ └── file # 文件操作硬件抽象层头文件 -├── include # 公共基础库对外接口文件 -├── js # ACE JS API目录 -│ └── builtin +utils/native/lite/ # 公共基础库根目录 +├── file # 文件接口实现 +├── hals # HAL目录 +│ └── file # 文件操作硬件抽象层头文件 +├── include # 公共基础库对外接口文件 +├── js # ACE JS API目录 +│ └── builtin │ ├── common -│ ├── deviceinfokit # 设备信息Kit -│ ├── filekit # 文件Kit -│ └── kvstorekit # KV存储Kit -├── kal # KAL目录 -│ └── timer # Timer的KAL实现 -├── kv_store # KV存储实现 -│ ├── innerkits # KV存储内部接口 -│ └── src # KV存储源文件 -└── timer_task # Timer实现 - -base/iot_hardware #IoT外设控制 -├── frameworks -│ └── wifiiot_lite #IoT外设控制模块实现 +│ ├── deviceinfokit # 设备信息Kit +│ ├── filekit # 文件Kit +│ └── kvstorekit # KV存储Kit +├── kal # KAL目录 +│ └── timer # Timer的KAL实现 +├── kv_store # KV存储实现 +│ ├── innerkits # KV存储内部接口 +│ └── src # KV存储源文件 +└── timer_task # Timer实现 + +base/iot_hardware #IoT外设控制 +├── frameworks +│ └── wifiiot_lite #IoT外设控制模块实现 ├── hals -│ └── wifiiot_lite #HAL适配层接口 +│ └── wifiiot_lite #HAL适配层接口 └── interfaces - └── kits #IoT外设控制模块接口 - + └── kits #IoT外设控制模块接口 vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware #IoT外设控制HAL层 -└── wifiiot_lite #HAL适配层接口实现 +└── wifiiot_lite #HAL适配层接口实现 ``` ## 约束 @@ -61,7 +60,7 @@ vendor/hisi/hi3861/hi3861_adapter/hals/iot_hardware #IoT外设控制HAL层

KV存储

LiteOS-M平台、LiteOS-A平台

+

LiteOS-M内核、LiteOS-A内核

为应用程序提供KV存储机制。

文件操作

LiteOS-M平台

+

LiteOS-M内核

提供统一的文件操作接口,屏蔽对底层不同芯片组件的差异。

定时器

LiteOS-M平台、LiteOS-A平台

+

LiteOS-M内核、LiteOS-A内核

提供统一的定时器操作接口,屏蔽对底层不同芯片组件的差异。

IoT外设控制

LiteOS-M平台

+

LiteOS-M内核

IoT外设控制模块提供对外围设备的操作能力。

- - - - @@ -87,7 +84,7 @@ OpenHarmony内核是华为推出的面向IoT领域的实时操作系统内核, ## 约束 -系统启动默认使用jffs2的文件系统,该文件系统支持可读可写,若要使用其他文件系统,需要适配新增。 +Hi3518EV300默认使用jffs2文件系统,Hi3516DV300默认使用vfat文件系统。若要使用其他文件系统,需要新增适配。 ## 使用 @@ -95,11 +92,11 @@ OpenHarmony内核是华为推出的面向IoT领域的实时操作系统内核, ## 涉及仓 -drivers\_liteos +[drivers_liteos](https://gitee.com/openharmony/drivers_liteos) -kernel\_liteos\_a +[kernel_liteos_a](https://gitee.com/openharmony/kernel_liteos_a) -kernel\_liteos\_a\_huawei\_proprietary\_fs\_proc +[kernel_liteos_a_huawei_proprietary_fs_proc](https://gitee.com/openharmony/kernel_liteos_a_huawei_proprietary_fs_proc) -kernel\_liteos\_m +[kernel_liteos_m](https://gitee.com/openharmony/kernel_liteos_m) diff --git "a/readme/\345\210\206\345\270\203\345\274\217\344\273\273\345\212\241\350\260\203\345\272\246\345\255\220\347\263\273\347\273\237README.md" "b/readme/\345\210\206\345\270\203\345\274\217\344\273\273\345\212\241\350\260\203\345\272\246\345\255\220\347\263\273\347\273\237README.md" index 6cf4b30117466a7473e650710da510b3b3bf01c2..689a03f479ec53f02f0c00f692ff2fee6792556a 100755 --- "a/readme/\345\210\206\345\270\203\345\274\217\344\273\273\345\212\241\350\260\203\345\272\246\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\345\210\206\345\270\203\345\274\217\344\273\273\345\212\241\350\260\203\345\272\246\345\255\220\347\263\273\347\273\237README.md" @@ -2,15 +2,15 @@ ## 简介 -分布式任务调度模块,通过主(智慧屏设备)从设备(运动手表等小内存设备)服务代理机制,在异构操作系统上建立起分布式服务平台,支持OpenHarmony智慧屏与拉起其它OpenHarmony设备FA的能力。轻量分布式调度模块组成如下图所示: +分布式任务调度模块负责跨设备组件管理,提供访问和控制远程组件的能力,支持分布式场景下的应用协同。分布式调度模块组成如下图所示: -![](figures/zh-cn_image_0000001055199362.png) +![](figures/zh-cn_image_0000001055103250.png) ## 目录 分布式任务调度源代码目录结构如下表所示: -**表1 **主要源代码目录结构 +**表1 ** 主要源代码目录结构

名称

@@ -72,14 +74,9 @@ OpenHarmony内核是华为推出的面向IoT领域的实时操作系统内核,

系统调用。

test

-

内核和用户态的测试用例。

-

tools

编译配置和menuconfig相关的代码。

+

构建工具及相关配置和代码。

- - - - - @@ -42,16 +37,16 @@ ``` ├── BUILD.gn ├── include -│ ├── distributed_schedule_service.h # 分布式调度对外接口文件 +│ ├── distributed_schedule_service.h # 分布式调度对外接口 │ ├── dmslite_check_remote_permission.h # 分布式调度权限管理模块 │ ├── dmslite_famgr.h # 分布式调度FA管理模块 -│ ├── dmslite_inner_common.h # 分布式调度服务文件 -│ ├── dmslite.h # 分布式调度实现 +│ ├── dmslite_inner_common.h # 分布式调度内部通用文件 +│ ├── dmslite.h # 分布式调度服务实现 │ ├── dmslite_log.h # 日志模块 -│ ├── dmslite_msg_parser.h # 通讯数据反序列化 +│ ├── dmslite_msg_parser.h # 分布式消息解析模块 │ ├── dmslite_tlv_common.h # TLV格式数据解析模块 -│ └── dmslite_session.h # 跨设备通信辅助文件 -├── README.md +│ └── dmslite_session.h # 跨设备通信收发模块 +├── readme.md ├── LICENSE ├── source ├── distributed_schedule_service.c @@ -65,67 +60,59 @@ ## 约束 -语言限制:C语言。 组网环境:必须确保设备在同一个局域网中。操作系统限制:OpenHarmony操作系统。 +**语言限制**:C/C++语言 + +**组网环境**:必须确保设备在同一个局域网中,主从设备能互相ping通 + +**操作系统限制**:OpenHarmony操作系统 **远程启动的约束与限制:** -- 支持远程启动FA,不支持远程启动SA。 -- 远程启动前必须确保主设备(智慧屏设备)与从设备间(运动手表等小内存设备)分布式组网成功(需要在同一网段内,可互相ping通),否则无法远程启动。 +- 支持远程启动FA,不支持远程启动SA +- 远程启动前必须确保主设备与从设备间分布式组网成功,否则无法远程启动 ## 使用 -**轻量级分布式调度模块编译** +- **轻量级分布式调度模块编译** -轻量级分布式调度模块通过一些特性宏来定制不同平台上参与编译的功能代码,该部分代码位于build\\lite\\config\\subsystem\\distributedschedule\\目录下,目录结构如下: +轻量级分布式调度模块,其代码所在目录如下: ``` -build/lite/config/subsystem/distributedschedule -├── BUILD.gn +foundation/distributedschedule/services/dtbschedmgr_lite ``` -在编译不同的平台目标时,需要使用对BUILD.gn进行修改,以下以平台hi3518ev300和hi3516dv300为例: +在针对不同平台进行编译时,需要在指定目标平台,以下以hi3516dv300为例: -``` -zlite_subsystem("distributedschedule") { - subsystem_components = [ - "//foundation/distributedschedule/services/samgr_lite:samgr", - ] - if (board_name == "hi3518ev300" || board_name == "hi3516dv300") { - subsystem_components += [ - "//foundation/distributedschedule/services/safwk_lite:safwk_lite", - "//foundation/distributedschedule/services/dtbschedmgr_lite:dtbschedmgr", // 轻量级分布式调度模块配置 - ] - } -} +```bash +python build.py ipcamera -p hi3516dv300_liteos_a ``` -**\* 主设备程序开发**(以拉起FA为例) +- **主设备程序开发**(以拉起FA为例) -构造want,首先使用ElementName类表明需要启动的远端设备ID,包名,元能力类名,传入want中,然后设置want中的分布式标志位Want.FLAG\_ABILITYSLICE\_MULTI\_DEVICE表示需要远程启动。 +构造意图参数want,设置需要启动的远端设备ID,包名,元能力类名信息,以及分布式标志位Want.FLAG\_ABILITYSLICE\_MULTI\_DEVICE以使能分布式启动 -``` -// 引入相关头文件 +```C++ import ohos.aafwk.ability.Ability; import ohos.aafwk.content.Want; import ohos.bundle.ElementName; -// 启动远程设备FA -Want want = new Want(); // 封装启动远端FA的Want -ElementName name = new ElementName("remote_device_id", "com.huawei.remote_package_name","remote_class_name"); +// 构造want参数 +Want want = new Want(); +ElementName name = new ElementName(remote_device_id, "com.huawei.remote_bundle_name", "remote_ability_name"); want.setElement(name); // 将待启动的FA信息添加到Want中 want.setFlags(Want.FLAG_ABILITYSLICE_MULTI_DEVICE); // 设置分布式标记,若不设置将无法使用分布式能力 -startAbility(want); // 按照Want启动指定FA,Want参数命名以实际开发平台API为准 -``` -**\* 预置条件** +// 启动远程设备FA +startAbility(want); // 按照Want启动指定FA,want参数命名以实际开发平台API为准 +``` -**主从设备间组网**:远程启动前必须确保主从设备分布式组网成功(需要在同一网段内,可互相ping通),否则无法远程启 +- **预置条件** -**从设备FA安装:**安装测试或者自开发的FA到从设备 +从设备侧需安装对应包名的FA -**\* 运行**(以拉起FA为例) +- **运行**(以拉起FA为例) -执行主设备(智慧屏)侧的startAbility即可拉起从设备(运动手表等小内存设备)FA +执行主设备侧的startAbility即可拉起从设备FA ## 涉及仓 diff --git "a/readme/\345\210\206\345\270\203\345\274\217\351\200\232\344\277\241\345\255\220\347\263\273\347\273\237README.md" "b/readme/\345\210\206\345\270\203\345\274\217\351\200\232\344\277\241\345\255\220\347\263\273\347\273\237README.md" index 6561d9df8fb968c7b48ca760ccb7f8d3cb4b637d..ddacd483bd4cb78fbd4a00ca5e4765dfe4ea808d 100755 --- "a/readme/\345\210\206\345\270\203\345\274\217\351\200\232\344\277\241\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\345\210\206\345\270\203\345\274\217\351\200\232\344\277\241\345\255\220\347\263\273\347\273\237README.md" @@ -14,7 +14,7 @@ softbus\_lite源代码目录结构如下图所示: -**表1 **softbus\_lite源代码目录结构 +**表1 ** softbus\_lite源代码目录结构

名称

@@ -21,17 +21,12 @@

dtbschedmgr_lite

轻量级分布式任务调度实现。

+

分布式任务调度实现

safwk_lite

系统服务进程实现。

-

samgr_lite

-

本地服务管理实现。

+

foundation进程实现

- - - - - - - - - - @@ -59,20 +57,24 @@ - C++11版本或以上 - 目前支持3516dv300、3518ev300开发板,其中仅3516dv300支持播放功能 +- 当前3516dv300开发板默认支持索尼imx335、3518ev300默认支持晶相jxf23。 ## 安装 - 请提前加载内核及相关驱动,参考内核及驱动子系统readme。 -- 配置合适的配置文件,可以参考test/devini下配置文件,说明参见《配置文件说明文档》,当前仅支持imx335和imx327sensor,如果适配其他sensor可在开源社区中求助。 -- 北向接口调用参见test下demo实现。 +- 配置合适的配置文件,可以参考applications/sample/camera/media下配置文件,如果适配其他sensor可在开源社区中求助。用户使用时将配置文件放入到开发板/storage/data目录,开发者通过该配置文件可以去适配sensor及分辨率、帧率等能力。 ## 使用 -开发者使用多媒体接口用于录像、预览和播放音视频等资源,使用这些资源前先创建camerakit组件对象,注册各种事件回调,这些事件回调是用户实现用来响应多媒体模块中事件响应的,之后调用创建camera就可以创建一个操作camera资源的对象,使用这个对象可以启动预览、录像或抓拍取流,及设置取流的相关参数。 +Native应用接口调用可以参考applications/sample/camera/media下demo实现 + +应用开发者使用多媒体接口实现录像、预览和播放音视频,使用可以参考《多媒体开发指南》。 例:下面是用户重写事件类的实例 -``` +用户先创建camerakit组件对象,注册各种事件回调,这些事件回调是用户实现用来响应多媒体模块中事件响应的,之后调用创建camera就可以创建一个操作camera资源的对象,使用这个对象可以启动预览、录像或抓拍取流,及设置取流的相关参数。 + +```C++ /* * Copyright (c) 2020 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -456,3 +458,5 @@ multimedia\_services\_media\_lite multimedia\_utils\_lite + + diff --git "a/readme/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237README.md" "b/readme/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237README.md" index 8138f6596c8cac2f197bb234938cccf9cef51149..ec7b36ea2b5463497aeb5631cc1133dfa7b6bd6d 100755 --- "a/readme/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237README.md" @@ -39,7 +39,7 @@ x509镜像包生成:参考编译构建子系统编译方式,执行编译生 ## 应用权限管理 -应用权限是软件用来访问系统资源和使用系统能力的一种通行方式,存在涉及个人隐私相关功能和数据的场景,例如:访问个人设备的硬件特性,如摄像头、麦克风,以及获取个人数据,如通讯录,日历等存储的信息等。操作系统通过应用权限管理来保护这些数据以及能力。 +应用权限是软件用来访问系统资源和使用系统能力的一种通行方式,存在涉及个人隐私相关功能和数据的场景,例如:访问个人设备的硬件特性,如摄像头、麦克风,以及读写媒体文件等。操作系统通过应用权限管理来保护这些数据以及能力。 权限定义字段说明: @@ -64,7 +64,6 @@ x509镜像包生成:参考编译构建子系统编译方式,执行编译生 @@ -85,19 +84,28 @@ x509镜像包生成:参考编译构建子系统编译方式,执行编译生 ## IPC通信鉴权 - 在Samgr中注册的系统服务如果通过进程间通信的方式暴露接口给其他进程访问,需要配置相应的访问控制策略。若不进行相关配置,访问会被拒绝。 -- 配置方式:在头文件base/security/services/iam\_lite/include/policy\_preset.h中配置访问策略。1. 定义各个Feature的策略 2. 将Feature的策略加到全局策略中 +- 配置方式:在头文件base/security/services/iam\_lite/ipc\_auth/include/policy\_preset.h中配置访问策略。 + + 1. 定义各个Feature的策略 + + 2. 将Feature的策略加到全局策略中 + Eg. 比如当前需要为BMS服务配置访问策略,BMS在Samgr中注册的service为bundlems,注册的Feature为BmsFeature。 -一、首先定义Feature的策略,可配置多个Feature,每个Feature可以配置多个访问策略,策略的声明方式参考图2 +一、首先定义Feature的策略,可配置多个Feature,每个Feature可以配置多个访问策略,策略的声明方式参考图1 **图 1** Feature策略示例 -![](figures/Feature策略示例.png "Feature策略示例") + + +![](figures/bms策略举例.png) 访问策略有三种类型: **图 2** 访问策略结构体 -![](figures/访问策略结构体.png "访问策略结构体") + + +![](figures/策略类型2.png) 1. type为RANGE类型:允许某个特定范围UID的进程访问,需要指定uidMin和uidMax @@ -105,38 +113,38 @@ Eg. 比如当前需要为BMS服务配置访问策略,BMS在Samgr中注册的s 3. type为BUNDLENAME类型:只允许特定的应用访问,需要指定bundleName(包名) -二、将定义的Feature的策略加配到全局策略中,需要配置feature数量,注册参考图4 +二、将定义的Feature的策略加配到全局策略中,需要配置feature数量,注册参考图3 **图 3** feature策略注册 -![](figures/feature策略注册.png "feature策略注册") + + +![](figures/全局策略2.png) UID分配规则 -1. Init/foundation进程:0 +1. Init进程:0 2. appspawn进程:1 3. Shell进程:2 -4. kitfw进程:3 +4. 其他内置系统服务UID <= 99 -5. 其他内置服务向后递增…最多到99 +5. 系统应用(如设置、桌面、相机):100 \~ 999 -6. 系统应用(如settings):100 \~ 999 +6. 预置厂商应用:1000 \~ 9999 -7. 预置厂商应用(如钱包、淘宝):1000 \~ 9999 - -8. 普通三方应用:10000 \~ INT\_MAX +7. 普通三方应用:10000 \~ INT\_MAX ## HUKS -在分布式场景下,不同终端设备的硬件能力和运行系统环境都不尽相同,这些设备在分布式场景下,均需要建立信任关系,最典型的应用即是HiChain可信互联。那么就需要这样一个统一的密钥管理服务,来做到接口一致,密钥数据格式一致,同时提供业界标准的加解密算法实现。HUKS基于此来提供统一的密钥管理、加解密等能力。 +在分布式场景下,不同终端设备的硬件能力和运行系统环境都不尽相同。这些设备在分布式场景下均需要建立信任关系,最典型的应用即是HiChain可信互联,那么就需要这样一个统一的密钥管理服务来做到接口一致,密钥数据格式一致,同时提供业界标准的加解密算法实现。HUKS基于此来提供统一的密钥管理、加解密等能力。 HUKS模块整体分为北向接口,南向适配层,以及核心的功能模块: -1. HUKS 北向接口:提供统一的对外API,用C语言实现,保持所有设备一致;主要包括密钥生成API、加解密API等; -2. HUKS Core Module:依赖HAL层,提供核心功能:加解密、签名验签、密钥存储等; -3. HUKS HAL层:屏蔽底层硬件和OS的差异,定义HUKS需要的统一底层API。主要包括平台算法库、IO和LOG等; +1. HUKS 北向接口:提供统一的对外API,用C语言实现,保持所有设备一致,主要包括密钥生成API、加解密API等; +2. HUKS Core Module:依赖HAL层,提供核心功能,如加解密、签名验签、密钥存储等; +3. HUKS HAL层:屏蔽底层硬件和OS的差异,定义HUKS需要的统一底层API,主要包括平台算法库、IO和LOG等。 ## HiChain @@ -232,12 +240,11 @@ OpenHarmony应用安装服务通过校验应用签名验证应用完整性,通 - **应用发布场景** - 开发者向华为应用市场发布应用,需要用应用市场签发的应用软件发布证书和应用软件发布profile对应用进行签名。如下图,应用软件发布证书和发布profile的申请方式类似于开发者证书和调试profile申请(支持使用调试场景同一对公私钥对)。使用应用发布证书签名的应用不允许直接在设备中安装,需要上架应用市场审核。审核通过的应用,应用市场将使用应用市场发布证书对应用进行重签名,重签名后的应用才可以被用户下载、安装。 - - OpenHarmony应用安装服务通过验证应用签名,保证应用软件完整性,通过校验签名证书是否为华为应用市场应用签名证书,保证应用来源可信。 +开发者向华为应用市场发布应用,需要用应用市场签发的应用软件发布证书和应用软件发布profile对应用进行签名。如下图,应用软件发布证书和发布profile的申请方式类似于开发者证书和调试profile申请(支持使用调试场景同一对公私钥对)。使用应用发布证书签名的应用不允许直接在设备中安装,需要上架应用市场审核。审核通过的应用,应用市场将使用应用市场发布证书对应用进行重签名,重签名后的应用才可以被用户下载、安装。 - ![](figures/zh-cn_image_0000001051562162.png) +OpenHarmony应用安装服务通过验证应用签名,保证应用软件完整性,通过校验签名证书是否为华为应用市场应用签名证书,保证应用来源可信。 +![](figures/zh-cn_image_0000001051562162.png) ## 涉及仓 diff --git "a/readme/\346\265\213\350\257\225\345\255\220\347\263\273\347\273\237README.md" "b/readme/\346\265\213\350\257\225\345\255\220\347\263\273\347\273\237README.md" index d02604e98a8be295814b48938983761a5cefad55..6f728d62a8bc2c90baeba16ad50b9c2e15fa717f 100755 --- "a/readme/\346\265\213\350\257\225\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\346\265\213\350\257\225\345\255\220\347\263\273\347\273\237README.md" @@ -2,11 +2,11 @@ ## 简介 -开发过程采用测试驱动开发模式,开发者基于系统新增特性可以通过开发者自己开发用例保证,对于系统已有特性的修改,也可通过修改项目中原有自测试用例保证,开发者自测试旨在帮助开发者在开发阶段就能开发出高质量代码 +开发过程采用测试驱动开发模式,开发者基于系统新增特性可以通过开发者自己开发用例保证,对于系统已有特性的修改,也可通过修改项目中原有的测试用例保证,开发者测试旨在帮助开发者在开发阶段就能开发出高质量代码 ## 目录 -**表 1** 开发者自测试工具源代码目录结构 +**表 1** 开发者测试工具源代码目录结构

名称

@@ -64,7 +64,7 @@ softbus\_lite源代码目录结构如下图所示: 被发现端接口使用示例如下: -``` +```C++ // 回调函数声明: void onSuccess(int publishId) { @@ -94,9 +94,9 @@ PublishService("cxx", &info, &cb); 传输主要代码示例如下: -``` +```C++ // 定义业务自身的业务名称,会话名称及相关回调 -const char *g_pkgName = "BUSINESS_NAME"; +const char *g_moduleName = "BUSINESS_NAME"; const char *g_sessionName = "SESSION_NAME"; struct ISessionListener * g_sessionCallback= NULL; @@ -141,7 +141,7 @@ int StartSessionServer() g_sessionCallback->onBytesReceived = OnBytesReceivedTest; g_sessionCallback->onSessionOpened = OnSessionOpenedEventTest; g_sessionCallback->onSessionClosed = OnSessionClosedEventTest; - int ret = CreateSessionServer(g_pkgName, g_sessionName, g_sessionCallback); + int ret = CreateSessionServer(g_moduleName, g_sessionName, g_sessionCallback); if (ret < 0) { printf("Failed to create session server!\n"); free(g_sessionCallback); @@ -153,7 +153,7 @@ int StartSessionServer() // 从SoftBus中删除业务会话服务及其回调 void StopSessionServer() { - int ret = RemoveSessionServer(g_pkgName, g_sessionName); + int ret = RemoveSessionServer(g_moduleName, g_sessionName); if (ret < 0) { printf("Failed to remove session server!\n"); return; diff --git "a/readme/\345\220\257\345\212\250\346\201\242\345\244\215README.md" "b/readme/\345\220\257\345\212\250\346\201\242\345\244\215README.md" index 96725f0b5634104b0817673fa42eb755baf5f257..d5d7f7050a67e7c33e48d6a38a255a39153e3cd6 100755 --- "a/readme/\345\220\257\345\212\250\346\201\242\345\244\215README.md" +++ "b/readme/\345\220\257\345\212\250\346\201\242\345\244\215README.md" @@ -2,7 +2,7 @@ ## 简介 -启动恢复负责在内核启动之后,应用启动之前的操作系统中间层的启动。涉及以下模块: +启动恢复负责在内核启动之后到应用启动之前的系统关键进程和服务的启动过程。涉及以下模块: - init启动引导 @@ -112,7 +112,7 @@ base │ ├── include 应用孵化模块头文件目录 │ ├── LICENSE 开源LICENSE文件 │ ├── moduletest 应用孵化模块自测试代码目录 - │ └── src 应用孵化木块源文件目录 + │ └── src 应用孵化模块源文件目录 ├── bootstrap_lite 启动服务模块 │ ├── BUILD.gn 启动服务模块编译配置 │ ├── LICENSE 开源LICENSE文件 @@ -139,11 +139,11 @@ vendor - init启动引导的配置文件 -启动引导模块配置文件包含了所有需要由init进程启动的系统关键服务的服务名、可执行文件路径、权限和其他属性信息,该文件位于代码仓库/vendor/huawei/camera/init\_configs/目录,部署在/etc/下,文件名称为init.cfg,采用json格式,文件大小目前限制在10KB以内。 +启动引导模块配置文件包含了所有需要由init进程启动的系统关键服务的服务名、可执行文件路径、权限和其他属性信息,该文件位于代码仓库/vendor/huawei/camera/init\_configs/目录,部署在/etc/下,文件名称为init.cfg,采用json格式,文件大小目前限制在100KB以内。 init进程启动后首先读取/etc/init.cfg,然后解析其json内容,并根据解析结果依次加载系统服务。配置文件格式和内容说明如下所示: -``` +```json { "jobs" : [{ "name" : "pre-init", -------- 在init之前执行的job,可以放置一些启动进程之前的预操作(如新建文件夹等) @@ -249,7 +249,7 @@ init进程启动后首先读取/etc/init.cfg,然后解析其json内容,并 Hi3516DV300,Hi3518EV300开发板需要修改vendor/huawei/camera/hals/utils/sys\_param目录下源文件: - ``` + ```C++ static const char HOS_PRODUCT_TYPE[] = {"****"}; static const char HOS_MANUFACTURE[] = {"****"}; static const char HOS_BRAND[] = {"****"}; @@ -266,7 +266,7 @@ init进程启动后首先读取/etc/init.cfg,然后解析其json内容,并 Hi3861开发板需要修改vendor/huawei/wifi-iot/hals/utils/sys\_param目录下源文件: - ``` + ```C++ static const char HOS_PRODUCT_TYPE[] = {"****"}; static const char HOS_MANUFACTURE[] = {"****"}; static const char HOS_BRAND[] = {"****"}; @@ -283,7 +283,7 @@ init进程启动后首先读取/etc/init.cfg,然后解析其json内容,并 - 获取默认系统属性 - ``` + ```C++ char* value1 = GetProductType(); printf("Product type =%s\n", value1); free(value1); @@ -297,7 +297,7 @@ init进程启动后首先读取/etc/init.cfg,然后解析其json内容,并 - 设置获取自定义系统属性 - ``` + ```C++ const char* defSysParam = "data of sys param ***..."; char key[] = "rw.parameter.key"; char value[] = "OEM-hisi-10.1.0"; diff --git "a/readme/\345\252\222\344\275\223\345\255\220\347\263\273\347\273\237README.md" "b/readme/\345\252\222\344\275\223\345\255\220\347\263\273\347\273\237README.md" index 781942e0002162f2ef4847cab3fca85bd924039e..e02283a215284054b29aab8d6f9dee02ca4d1309 100755 --- "a/readme/\345\252\222\344\275\223\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\345\252\222\344\275\223\345\255\220\347\263\273\347\273\237README.md" @@ -2,21 +2,19 @@ ## 简介 -该仓主要用于存放媒体子系统的源码信息,旨在为多媒体应用开发者开发者提供统一的开发接口,使得开发者可以专注于应用业务的开发,轻松使用多媒体的资源。 +该仓主要用于存放媒体子系统的源码信息,旨在为多媒体应用开发者开发者提供统一的开发接口,使得开发者可以专注于应用业务的开发,轻松使用多媒体的资源。下图分别展现媒体子系统的框架及业务流程。 -本次开源基于本仓代码信息将相关设备配置文件放入到test\\lite\\devini内,用户使用时将配置文件放入到开发板/data目录,通过该配置文件可以方便去适配sensor及分辨率帧率等能力。 +**图 1** 框架图 +![](figures/zh-cn_image_0000001051720802.png "框架图") -多媒体子系统框架 +如图1,多媒体框架支持相机、录像和播放业务功能,这些功能支持鸿蒙JS应用开发及各种使用媒体能力的KIT模块开发,系统框架包括framework层,framework对外提供应用调用的native接口及其对应的业务实现,针对相机、录像及播放业务,framework实现了音视频输入输出,音视频编解码,视频文件的打包及解复用等功能。core service层,core service利用平台提供的能力去实现对底层硬件及相关驱动使用,另外core server实现文件管理,存储管理及日志管理。 -![](figures/zh-cn_image_0000001051720802.png) +**图 2** 多媒体业务流程图 +![](figures/zh-cn_image_0000001052440794.png "多媒体业务流程图") -多媒体子系统系统业务流程图 +如图2,多媒体包括camera,recorder和player,camera提供YUV、RGB、JPEG以及H264,H265数据到共享内存surface中,recorder模块将surface中h264/h265数据和音频aac数据打包成mp4文件,player模块把mp4文件解复用成音频和视频数据,分别送入对应编码器解码,然后进行播放。 -![](figures/zh-cn_image_0000001052440794.png) - -如上图,多媒体包括camera,recorder和player,camera提供yuv/rgb,jpeg以及H264,H265数据到共享内存surface中,recorder模块将surface中h264/h265数据和音频aac数据打包成mp4文件,player模块把mp4文件解复用成音频和视频数据,分别送入对应编码器解码,然后进行播放。 - -## 目录 +## 目录结构 **表 1** 轻量级多媒体子系统源代码目录结构 @@ -27,29 +25,29 @@

foundation\multimedia\frameworks

+

foundation/multimedia/frameworks

北向接口内部框架实现,包括audio,camera,player.recorder

+

内部框架实现,包括audio,camera,player.recorder

foundation\multimedia\interfaces\kits

+

foundation/multimedia/interfaces/kits

北向接口对外头文件

+

应用接口对外头文件

foundation\multimedia\services\media_lite

+

foundation/multimedia/services/media_lite

北向接口底层服务实现

+

应用接口底层服务实现

foundation\multimedia\utils\lite

+

foundation/multimedia/utils/lite

北向接口通用模块实现

+

应用接口通用模块实现

foundation\multimedia\test\lite

+

foundation/multimedia/hals

北向接口测试代码。

+

硬件平台相关媒体适配接口头文件

多语言字符串id

应用申请此权限的目的。

-

上架审核、弹框授权、用户管理权限时使用到

used-scene{

@@ -76,7 +75,7 @@ x509镜像包生成:参考编译构建子系统编译方式,执行编译生

when:inuse, always

调用受此权限管控的接口的场景。

-

声明在哪些组件下、以及是否前台还是前后台都会去调用受权限管控的接口

+

声明在哪些组件和场景(前台/后台)下调用受管控的接口。

- - - - @@ -130,31 +130,31 @@ 依赖python环境: -需要本地的python安装串口插件pyserial,在shell界面执行安装命令pip intall pyserial,安装成功如下图 +需要本地的python安装串口插件pyserial以及readline,在shell界面执行安装命令分别为pip intall pyserial和sudo apt-get install libreadline-dev,安装成功如下图 ![](figures/zh-cn_image_0000001052278423.png) ## 编写测试用例 -- 自测试用例规范 +- 测试用例规范 - 命名规范 测试用例源文件名称和测试套内容保持一致,测试套与用例之间关系1:N,测试套与测试源文件之间关系1:1,每个源文件全局唯一,格式:\[特性\]\_\[功能\]\_\[子功能1\]\_\[子功能1.1\],子功能支持向下细分。 - 文件命名采用大驼峰方式命名,以Test结尾,如demo用例:developertest/example/cxx\_demo + 文件命名采用全小写+下划线方式命名,以test结尾,如demo用例:developertest/example/cxx\_demo - - 用例编码规范 + - 测试用例编码规范 - 开发者自测试用例原则上与特性代码编码规范保持一致,另外需要添加必要的用例描述信息,详见[•自测试用例模板](#li2069415903917) + 开发者测试用例原则上与特性代码编码规范保持一致,另外需要添加必要的用例描述信息,详见[•自测试用例模板](#li2069415903917) - 测试用例编译配置规范 - 用例采用GN方式编译,配置遵循本开源项目的编译指导[使用](zh-cn_topic_0000001051580775.md) + 测试用例采用GN方式编译,配置遵循本开源项目的编译指导[使用](zh-cn_topic_0000001051580775.md) -- 自测试用例模板 +- 测试用例模板 - 详见测试demo用例developertest/example/cxx\_demo/test/unittest/common/calc\_subtraction\_test.cpp + 详见测试demo用例:developertest/example/cxx\_demo/test/unittest/common/calc\_subtraction\_test.cpp >![](public_sys-resources/icon-note.gif) **说明:** >Feature: 被测特性的描述 @@ -165,7 +165,7 @@ >CaseDescription:测试用例描述 >step:测试复杂逻辑时注明用例执行的步骤 -- 自测试用例目录规划 +- 测试用例目录规划 ``` subsystem(子系统,系统组件) @@ -194,13 +194,13 @@ >![](public_sys-resources/icon-note.gif) **说明:** >其中liteos和Linux仅不同设备形态举例,对于同一特性在不同开发板上,如果用例没有差异,则用例放置common目录下,如果同一特性,用例区分不同设备形态,可能包含内核差异,芯片平台差异,则用例以目录区分 -- 编写自测试用例步骤 - 1. 添加用例文件头注释说明 +- 编写测试用例步骤 + 1. 添加测试用例文件头注释信息 2. 引用gtest头文件和ext命名空间 - 3. 添加被测试类头文件 + 3. 添加被测试类的头文件 4. 定义测试套(测试类) 5. 实现该测试套具体的测试用例,包括用例注释和用例逻辑实现 - 6. 编写用例编译配置 + 6. 编写测试用例编译配置 >![](public_sys-resources/icon-note.gif) **说明:** >\*样例参考:developertest/example/cxx\_demo/test/unittest/common/calc\_subtraction\_test.cpp @@ -211,15 +211,15 @@ >d、使用printf函数打印日志 -- 编写用例编译文件 - - 定义用例编译构建目标 - 1. 添加用例编译文件头注释信息 - 2. 导入用例编译模板文件 - 3. 指定用例文件输出路径 - 4. 配置用例编译依赖包含目录 - 5. 指定用例编译目标输出的用例执行文件名称 - 6. 编写具体的用例编译脚本(添加需要参与编译的源文件、配置和依赖 ) - 7. 对目标用例文件进行条件分组(分组名称固定为:unittest/moduletest\) +- 编写测试用例编译文件 + - 定义测试用例编译构建目标 + 1. 添加测试用例编译文件头注释信息 + 2. 导入测试用例编译模板文件 + 3. 指定测试用例文件的输出路径 + 4. 配置测试用例编译依赖包含目录 + 5. 指定测试用例编译目标输出的文件名称 + 6. 编写具体的测试用例编译脚本(添加需要参与编译的源文件、配置和依赖 ) + 7. 对目标测试用例文件进行条件分组(分组名称固定为:unittest/moduletest\) - 如果存在多个测试套,定义公共编译配置 - 将测试用例添加到构建系统中 @@ -229,19 +229,19 @@ - 测试用例级别定义 - - 基本(Level1):<1s - - 重要(Level2):<10s - - 一般(Level3):<5min - - 生僻(Level4):\>5min + - 基本(Level1) + - 重要(Level2) + - 一般(Level3) + - 生僻(Level4) ## 使用测试框架 - 安装xdevice基础框架 - 1. 以Windows环境为例,打开xdevice安装目录:test\\xdevice + 1. 以Windows环境为例,打开xdevice安装目录:test/xdevice 2. 打开控制台窗口,执行如下命令 - ``` + ```bash python setup.py install ``` @@ -292,50 +292,54 @@ ``` -- 执行自测试用例前的环境检查 - - 系统镜像与文件系统已烧录进开发板,开发板上系统正常运行,在系统模式下,如shell登录时设备提示符OHOS\# - - 开发主机和开发板串口连接正常,网口连接正常 - - 开发主机IP与开发板IP处在同一小网网段,相互可以ping通 - - 开发主机侧创建空目录用于开发板通过NFS挂载测试用例,并且NFS服务启动正常 +- 执行测试用例前的环境检查 + - 系统镜像与文件系统已烧录进开发板,开发板上系统正常运行,在系统模式下,如shell登录时设备提示符OHOS\# + - 开发主机和开发板串口连接正常,网口连接正常 + - 开发主机IP与开发板IP处在同一小网网段,相互可以ping通 + - 开发主机侧创建空目录用于开发板通过NFS挂载测试用例,并且NFS服务启动正常 -- 运行测试套 - - 启动测试框架 - 1. Windows环境启动测试框架 +- 运行测试套 + - 启动测试框架,打开test/developertest目录 + 1. Windows环境启动测试框架 - ``` - start.bat - ``` + ``` + start.bat + ``` - 2. Linux环境启动测试框架 + 2. Linux环境启动测试框架 - ``` - ./strat.sh - ``` + ``` + ./strat.sh + ``` - 设备形态选择 - + 根据实际的开发板选择,设备形态配置:developertest/src/core/resource/config/framework\_config.xml - + - 执行测试指令 - 1. 执行测试指令示例,其中-t ut为必选,-ss和-tm为可选字段 - + 1. 查询测试用例支持的子系统,模块,产品形态以及测试类型,使用show命令 + + ``` + usage: + show productlist Querying Supported Product Forms + show typelist Querying the Supported Test Type + show subsystemlist Querying Supported Subsystems + show modulelist Querying Supported Modules + ``` + + 2. 执行测试指令示例,其中-t为必选,-ss和-tm为可选字段 + ``` run -t ut -ss test -tm example ``` - - 2. 参数说明:指定参数可以执行特定特性、模块对应的测试套 - + + 3. 参数说明:指定参数可以执行特定特性、模块对应的测试套 + ``` usage: run [-h] [-p PRODUCTFORM] [-t [TESTTYPE [TESTTYPE ...]]] [-ss SUBSYSTEM] [-tm TESTMODULE] [-ts TESTSUIT] - [-tc TESTCASE] [-tl TESTLEVEL] [-os TARGET_OS_NAME] - [-bv BUILD_VARIANT] [-b [BUILD [BUILD ...]]] - [-cov COVERAGE] [-tf TESTFILE] [-res RESOURCE] - [-sn DEVICE_SN] [-c CONFIG] [-rp REPORTPATH] [-e EXECTYPE] - [-td TEST_DRIVER] - action Specify test para.positional arguments: - action Specify action + [-tc TESTCASE] [-tl TESTLEVEL] optional arguments: -h, --help show this help message and exit @@ -360,6 +364,15 @@ +- 退出自测试平台 + - 退出自测试平台,使用如下命令退出测试平台 + + ``` + quit + ``` + + + ## 测试结果与日志 - 通过在测试框架中执行测试指令,即可以生成测试日志和测试报告 diff --git "a/readme/\347\224\250\346\210\267\347\250\213\345\272\217\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237README.md" "b/readme/\347\224\250\346\210\267\347\250\213\345\272\217\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237README.md" index 1b5ca1f8c58d9f42bd683a05317e9f1cfa487773..4724c0b16f3121c4025a225de90cf3760129d162 100755 --- "a/readme/\347\224\250\346\210\267\347\250\213\345\272\217\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\347\224\250\346\210\267\347\250\213\345\272\217\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237README.md" @@ -2,87 +2,69 @@ ## 简介 -用户程序框架子系统包含两个大的模块:元能力子系统和包管理子系统。 +用户程序框架子系统包含两个大的模块:**Ability子系统**和**包管理子系统**。 -**元能力子系统**,是OpenHarmony为开发者提供的一套开发OpenHarmony应用的开发框架。元能力子系统由如下模块组成: +**1. Ability子系统**,是OpenHarmony为开发者提供的一套开发OpenHarmony应用的框架。Ability子系统各模块如下图1所示: -**图1** 元能力子系统框架图 +**图 1** Ability子系统框架图 -![](figures/zh-cn_image_0000001052000128.png) -Ability是应用所具备的能力的抽象,一个应用可以包含一个或多个Ability。Ability分为两种类型:FA(Feature Ability)和AA(Atomic Ability)。 +![](figures/zh-cn_image_0000001054941316.png) -- **FA**:由三方基于元能力框架开发的、实现单一功能的有UI界面的程序实体,用于支持与用户交互的能力。一个Page实例可以包含一组相关页面,每个页面用一个AbilitySlice实例表示。Page模板是Feature Ability唯一支持的模板。用户可以基于JavaScript语言开发FA,也可以基于C/C++语言开发FA。 +- **AbilityKit**是Ability框架提供给开发者的开发包,开发者基于该开发包可以开发出基于Ability组件的应用。基于Ability组件开发的应用有两种类型:基于Javascript语言开发的Ability(**JS Ability**)和基于C/C++语言开发的Ability(**Native Ability**)。**JS应用开发框架**是开发者开发JS Ability所用到框架,是在AbilityKit基础封装的包含js UI组件的一套方便开发者能够迅速开发Ability应用的框架。 +- **Ability**是系统调度应用的最小单元,是能够完成一个独立功能的组件,一个应用可以包含一个或多个Ability。Ability分为两种类型:Page类型的Ability和Service类型的Ability + - **Page类型的Ability**:带有界面,为用户提供人机交互的能力。 + - **Service类型的Ability**:不带界面,为用户提供后台任务机制。 - - Page模板的Ability的生命周期流转图 +- **AbilitySlice**是单个页面及其控制逻辑的总和,是Page类型Ability特有的组件,一个Page类型的Ability可以包含多个AbilitySlice,此时,这些页面提供的业务能力应当是高度相关的。Page类型的Ability和AbilitySlice的关系如下图2所示: - **图2** Ability生命周期流转图 + **图 2** Ability与AbilitySlice的关系图 + ![](figures/Ability与AbilitySlice的关系图.gif "Ability与AbilitySlice的关系图") - ![](figures/zh-cn_image_0000001051366141.png)Page模板的Ability生命周期各状态解析 - - **UNINITIALIZED**:未初始状态,为临时状态,Ability创建后会直接调用Init初始化,进入INITIAL状态; +- **生命周期**是Ability被调度到启动、激活、隐藏和退出等各个状态的的统称。Ability各生命周期流转如下图3所示: - - **INITIAL**:初始化状态,也表示停止状态,表示当前Ability未运行,调用Start后进入INACTIVE,同时回调开发者的OnSatrt生命周期回调; + **图 3** Ability生命周期流转图 + ![](figures/Ability生命周期流转图.png "Ability生命周期流转图") - - **INACTIVE**:未激活状态,表示当前窗口已显示但是无焦点状态,由于Window暂未支持焦点的概念,当前状态与ACTIVE一致。调用Active后进入ACTIVE,同时回调开发者的OnActive生命周期回调;调用Background后进入BACKGROUND,同时回调开发者的OnBackground生命周期回调; + Ability生命周期各状态解析: - - **ACTIVE**:前台激活状态,表示当前窗口已显示,并获取焦点。调用Inactive后进入INACTIVE; + - **UNINITIALIZED**:未初始状态,为临时状态,Ability被创建后会由UNINITIALIZED状态进入INITIAL状态; - - **BACKGROUND**: 后台状态,表示当前Ability退到后台。调用Active后进入ACTIVE,同时回调开发者的OnActive生命周期回调;调用Stop后进入INITIAL,同时回调开发者的OnStop生命周期回调; + - **INITIAL**:初始化状态,也表示停止状态,表示当前Ability未运行,调用Start后进入INACTIVE,同时回调开发者的OnStart生命周期回调; - - **AbilitySlice** + - **INACTIVE**:未激活状态,表示当前窗口已显示但是无焦点状态,由于Window暂未支持焦点的概念,当前状态与ACTIVE一致。 - 一个使用Page模板的Ability由AbilitySlice构成,AbilitySlice是单个页面及其控制逻辑的总和。一个Page可以包含多个AbilitySlice,此时,这些页面提供的业务能力应当是高度相关的。Page模板的Ability与AbilitySlice的关系如下图: + - **ACTIVE**:前台激活状态,表示当前窗口已显示,并获取焦点,Ability在退到后台之前先由ACTIVE状态进入INACTIVE状态; - **图3 **Ability与AbilitySlice的关系图 + - **BACKGROUND**: 后台状态,表示当前Ability退到后台,Ability在被销毁后由BACKGROUND状态进入INITIAL状态,或者重新被激活后由BACKGROUND状态进入ACTIVE状态。 - ![](figures/zh-cn_image_0000001052204863.gif) +- **AbilityLoader**负责注册和加载开发者Ability的模块。开发者开发的Ability先要调用AbilityLoader的注册接口注册到框架中,接着Ability启动时会被实例化。 +- **AbilityManager**负责AbilityKit和Ability管理服务进行IPC的通信。 +- **EventHandler**是AbilityKit提供给开发者的用于在Ability中实现线程间通信的一个模块。 +- **Ability运行管理服务**是用于协调各Ability运行关系、及生命周期进行调度的系统服务。其中,**服务启动**模块负责Ability管理服务的启动、注册等。**服务接口管理模块**负责Ability管理服务对外能力的管理。**进程管理模块**负责Ability应用所在进程的启动和销毁、及其进程信息维护等功能。**Ability栈管理模块**负责维护各个Ability之间跳转的先后关系。**生命周期调度模块**是Ability管理服务根据系统当前的操作调度Ability进入相应的状态的模块**。连接管理模块**是Ability管理服务对Service类型Ability连接管理的模块。 +- **AppSpawn**是负责创建Ability应用所在进程的系统服务,该服务有较高的权限,为Ability应用设置相应的权限,并预加载一些通用的模块,加速应用的启动。 -- **AA**:由三方基于元能力框架开发的、实现单一功能的无UI界面的支持后台任务的程序实体。AA与FA的区别是,AA无UI界面。仅对系统服务有依赖关系,AA之间不存在依赖关系 。Service模板是AA支持的模板。 -- **注册Ability** +**2. 包管理子系统**,是OpenHarmony为开发者提供的安装包管理框架。包管理子系统的由如下图4模块组成: - Ability的模板通过在清单文件中注册时指定。如下所示,开发者可以配置Ability元素的type属性,其取值page、service分别代表Page模板、Service模板。 +**图 4** 包管理子系统框架图 +![](figures/包管理子系统框架图.png "包管理子系统框架图") - ``` - "module": { - ...... - "abilities": [ - { - "name": "default", - "type": "pages", - "label": "sdfasf" - } - ], ’ - ...... - } - ``` - - -- **AbilityKit**:元能力的开发框架,运行在开发者的应用程序进程中,和AbilityMs通过IPC通信,开发者基于该框架开发自己的Ability。 - -- **AbilityMs**:元能力运行管理服务,元能力生命周期的调度统一由AbilityMs管理。 -- **AppSpawn:**进程孵化器,元能力进程由AppSpawn负责孵化并拉起。 - -**包管理子系统**,是OpenHarmony为开发者提供的安装包管理框架。包管理子系统的由如下模块组成: +- **BundleKit**:是包管理服务对外提供的接口,有安装/卸载接口、包信息查询接口、包状态变化监听接口。 +- **包扫描器**:用来解析本地预制或者安装的安装包,提取里面的各种信息,供管理子模块进行管理,持久化。 -**图4** 包管理子系统框架图 +- **包安装子模块**:安装,卸载,升级一个包;**包安装服务**一个单独进程的用于创建删除安装目录,具有较高的权限。 -![](figures/zh-cn_image_0000001052201483.png) +- **包管理子模块**:管理安装包相关的信息,存储持久化包信息。 -- **包扫描器**:用来解析本地预制或者安装的安装包,提取里面的各种信息,供管理子模块进行管理,持久化 - -- **包安装子模块**:安装,卸载,升级一个包;Installed一个单独进程的用于创建删除安装目录,具有较高的权限。 - -- **包管理子模块**:管理安装包相关的信息 - -- **安全子模块**:签名检查、权限授予、权限管理 +- **包安全管理子模块**:签名检查、权限授予、权限管理。 ## 目录 -轻量用户程序框架子系统源代码目录结构如下图所示: +用户程序框架子系统源代码目录结构如下表1所示: -**表 1** 轻量用户程序用户程序框架子系统源代码目录结构 +**表 1** 用户程序框架子系统源代码目录结构

名称

@@ -17,7 +17,7 @@

developertest

开发自测试框架

+

开发测试框架

developertest/src

@@ -32,7 +32,7 @@

developertest/src/core/build

自测试用例编译

+

测试用例编译

developertest/src/core/command

@@ -107,12 +107,12 @@

developertest/start.bat

开发者自测试入口(Windows)

+

开发者测试入口(Windows)

developertest/start.sh

开发者自测试入口(Linux)

+

开发者测试入口(Linux)

- - - - - - - - - - - - - - - + + + - - - @@ -157,11 +144,11 @@ Ability是应用所具备的能力的抽象,一个应用可以包含一个或 - 框架针对不同的芯片平台和底层OS能力,规格有所区别 - Cortex-M RAM/ROM: - RAM:建议大于20K - - ROM: \> 300K (包含ACE,UIKit及引擎等强相关子系统) + - ROM: \> 300K (包含JS应用开发框架,UIKit及引擎等强相关子系统) - Cortex-A RAM/ROM: - RAM:建议大于2M - - ROM:\> 2M (包含ACE,UIKit及引擎等强相关子系统) + - ROM:\> 2M (包含JS应用开发框架,UIKit及引擎等强相关子系统) @@ -171,7 +158,7 @@ Ability是应用所具备的能力的抽象,一个应用可以包含一个或 - 在build/lite/platform/hi3516dv300\_liteos\_a/platform.json中的subsystem\_list字段下面添加appexecfwk和aafwk,代码如下: - ``` + ```json { "name":"aafwk", "project":"hmf/aafwk/services/abilitymgr_lite", @@ -196,7 +183,7 @@ Ability是应用所具备的能力的抽象,一个应用可以包含一个或 - 在build/lite/platform/hi3516dv300\_liteos\_a/template/ipcamera.json的“template\_subsystem\_list”字段下面添加"appexecfwk"和"aafwk",代码如下: - ``` + ```json "template_subsystem_list" : [ ...... "distributedschedule", @@ -209,7 +196,7 @@ Ability是应用所具备的能力的抽象,一个应用可以包含一个或 - 在build/lite/config/subsystem/aafwk/BUILD.gn和/build/lite/config/subsystem/appexecfwk/BUILD.gn中添加对用户程序框架中具体组件的编译,如下: - ``` + ```C++ import("//build/lite/config/subsystem/lite_subsystem.gni") lite_subsystem("aafwk") { @@ -223,7 +210,7 @@ Ability是应用所具备的能力的抽象,一个应用可以包含一个或 } ``` - ``` + ```C++ import("//build/lite/config/subsystem/lite_subsystem.gni") lite_subsystem("appexecfwk") { @@ -238,17 +225,17 @@ Ability是应用所具备的能力的抽象,一个应用可以包含一个或 - 添加完上述的配置后,执行如下命令编译整个系统: -``` -python build.py ipcamera -p hi3516dv300_liteos_a -b release +```bash +python build.py ipcamera_hi3516dv300 -b debug ``` ## 运行用户程序框架子系统的两个服务 -- 用户程序框架有两个系统服务AbilityMs和BundleMs,两系统服务运行于foudation进程中。 -- AbilityMs和BundleMs注册到sa\_manager中,sa\_manager运行于foundation进程中,sa\_manager为AbilityMs和BundleMs创建线程运行环境。具体创建AbilityMs、BundleMs服务的方式以及使用该服务的方式,可参考[系统服务框架子系统](zh-cn_topic_0000001051589563.md)。 +- 用户程序框架有两个系统服务ability管理服务(abilityms)和(bundlems),两系统服务运行于foundation进程中。 +- abilityms和bundlems注册到sa\_manager中,sa\_manager运行于foundation进程中,sa\_manager为abilityms和bundlems创建线程运行环境。具体创建abilityms、bundlems服务的方式以及使用该服务的方式,可参考[系统服务框架子系统](zh-cn_topic_0000001051589563.md)。 - 在foundation/distributedschedule/services/safwk\_lite/BUILD.gn中添加对abilityms和bundlems,如下: -``` +```C++ deps = [ "//foundation/distributedschedule/services/samgr_lite/samgr_server:server", "//base/dfx/lite/liteos-a/source/log:hilog_a_shared", @@ -261,92 +248,107 @@ deps = [ ## 运行基于AbilityKit开发的Ability -- 基于AbilityKit开发的Ability的Demo代码位于foundation/aafwk/frameworks/kits/ability\_lite/test路径下,如有需要修改其中的功能,可在unittest的文件中修改代码或增加代码文件,并在BUILD.gn中做相应的修改。 -- 编译该Demo,在shell中执行如下命令,编译成功后,在out/ipcamera\_hi3516dv300\_liteos\_a下面生成libLauncher.so文件: +- 基于AbilityKit开发的Ability的Demo代码位于foundation/aafwk/frameworks/ability\_lite/example路径下,如有需要修改其中的功能,可在entry/src/main/cpp的文件中修改代码或增加代码文件,并在BUILD.gn中做相应的修改。 +- 在build/lite/config/subsystem/aafwk/BUILD.gn中添加对ability Demo编译配置: ``` - python build.py ipcamera -p hi3516dv300_liteos_a -T //foundation/aafwk/frameworks/kits/ability_lite/test:Launcher + import("//build/lite/config/subsystem/lite_subsystem.gni") + + lite_subsystem("aafwk") { + subsystem_components = [ + "......", + "//foundation/aafwk/frameworks/ability_lite/example:hiability", + "......", + ] + } + ``` + +- 编译该Demo,在shell中执行如下命令,编译成功后,在out/ipcamera\_hi3516dv300\_liteos\_a/dev\_tools/example下面生成libhiability.so文件: + + ```bash + python build.py ipcamera_hi3516dv300 -b debug ``` -- 编写config.json,内容如下: +- 编写config.json,参见foundation/aafwk/frameworks/ability\_lite/example路径下的config.josn,内容如下: -``` -{ - "app": { - "bundleName": "com.huawei.launcher", - "vendor": "huawei", - "version": { - "code": 1, - "name": "1.0" - } - }, - "deviceConfig": { - "default": { - "reqSdk": { - "compatible": "zsdk 1.0.0", - "target": "zsdk 1.0.1" + ```json + { + "app": { + "bundleName": "com.huawei.hiability", + "vendor": "huawei", + "version": { + "code": 1, + "name": "1.0" }, - "keepAlive": false - }, - }, - "module": { - "deviceType": [ - "smartCamera" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "Launcher", - "moduleType": "entry" + "apiVersion": { + "compatible": 3, + "target": 3 + } }, - "abilities": [{ - "name": "MainAbility", - "icon": "res/drawable/phone.png", - "label": "test app 1", - "launchType": "standard", - "type": "page", - "visible": true - }, - { - "name": "SecondAbility", - "icon": "res/drawable/phone.png", - "label": "test app 2", - "launchType": "standard", - "type": "page", - "visible": true + "deviceConfig": { + "default": { + "keepAlive": false + }, }, - { - "name": "ServiceAbility", - "icon": "res/drawable/phone.png", - "label": "test app 2", - "launchType": "standard", - "type": "service", - "visible": true + "module": { + "deviceType": [ + "smartVision" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "hiability", + "moduleType": "entry" + }, + "abilities": [{ + "name": "MainAbility", + "icon": "assets/entry/resources/base/media/icon.png", + "label": "test app 1", + "launchType": "standard", + "type": "page", + "visible": true + }, + { + "name": "SecondAbility", + "icon": "", + "label": "test app 2", + "launchType": "standard", + "type": "page", + "visible": true + }, + { + "name": "ServiceAbility", + "icon": "", + "label": "test app 2", + "launchType": "standard", + "type": "service", + "visible": true + } + ] } - ] } -} -``` + ``` -- 生成hap包 - - 按照如下目录结构存放文件,res/drawable下面放置资源文件: - ![](figures/zh-cn_image_0000001052720858.png) +- 生成hap包 + - 按照如下目录结构存放文件,assets/entry/resources/base/media下面放置资源文件: - - 将上述文件打包生成zip包,修改后缀为.hap,例如Launcher.hap + ![](figures/zh-cn_image_0000001055267336.png) -- 安装hap包 + - 将上述文件打包生成zip包,修改后缀为.hap,例如hiability.hap - - 将上述hap包放置到指定目录下面 - - 执行安装命令,安装hap包: +- 安装hap包 - ``` - ./bin/bm install -p /nfs/hap/Launcher.hap + - 将上述hap包放置到指定目录下面 + - 执行安装命令,安装hap包: + + ```bash + ./bin/bm install -p /nfs/hap/hiability.hap ``` -- 安装完成后,通过如下命令,运行Demo +- 安装完成后,通过如下命令,运行Demo -``` -./bin/aa start -p com.huawei.launcher -n MainAbility +```bash +./bin/aa start -p com.huawei.hiability -n MainAbility ``` ## 涉及仓 diff --git "a/readme/\347\263\273\347\273\237\346\234\215\345\212\241\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237README.md" "b/readme/\347\263\273\347\273\237\346\234\215\345\212\241\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237README.md" index 8acae2fb4728d9efac20487a364fc80c02b68c30..e3979b1d1e904d3be38c32a9300baa5b4c55f17b 100755 --- "a/readme/\347\263\273\347\273\237\346\234\215\345\212\241\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\347\263\273\347\273\237\346\234\215\345\212\241\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237README.md" @@ -106,7 +106,7 @@ Samgr:做为中介者,管理Provider提供的能力,同时帮助Consumer 服务名和功能名必需使用常量字符串且长度小于16个字节。 -M核:系统依赖上bootstrap服务,在系统启动函数中调用HOS\_SystemInit\(\)函数。 +M核:系统依赖上bootstrap服务,在系统启动函数中调用OHOS\_SystemInit\(\)函数。 A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数。 @@ -114,7 +114,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 继承并重新定义服务: - ``` + ```C++ typedef struct ExampleService { INHERIT_SERVICE; INHERIT_IUNKNOWNENTRY(DefaultFeatureApi); @@ -124,7 +124,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 实现服务的生命周期函数: - ``` + ```C++ static const char *GetName(Service *service) { return EXAMPLE_SERVICE; @@ -158,7 +158,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 创建服务对象: - ``` + ```C++ static ExampleService g_example = { .GetName = GetName, .Initialize = Initialize, @@ -173,7 +173,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 向SAMGR注册服务及接口: - ``` + ```C++ static void Init(void) { SAMGR_GetInstance()->RegisterService((Service *)&g_example); @@ -181,19 +181,18 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 } ``` -- 定义服务的初始化入口: +- 定义服务的初始化入口: - ``` - SYSEX_SERVICE_INIT(Init); - - ``` + ```C++ + SYSEX_SERVICE_INIT(Init); + ``` ## 开发服务的子功能 - 继承并重新定义功能: - ``` + ```C++ typedef struct DemoFeature { INHERIT_FEATURE; INHERIT_IUNKNOWNENTRY(DemoApi); @@ -204,7 +203,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 实现功能的生命周期函数: - ``` + ```C++ static const char *FEATURE_GetName(Feature *feature) { return EXAMPLE_FEATURE; @@ -248,7 +247,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 创建功能对象: - ``` + ```C++ static DemoFeature g_example = { .GetName = FEATURE_GetName, .OnInitialize = FEATURE_OnInitialize, @@ -266,26 +265,25 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 向SAMGR注册功能及接口: - ``` + ```C++ static void Init(void){ SAMGR_GetInstance()->RegisterFeature(EXAMPLE_SERVICE, (Feature *)&g_example); SAMGR_GetInstance()->RegisterFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE, GET_IUNKNOWN(g_example)); } ``` -- 定义功能的初始化入口: +- 定义功能的初始化入口: - ``` - SYSEX_FEATURE_INIT(Init); - - ``` + ```C++ + SYSEX_FEATURE_INIT(Init); + ``` ## 开发进程内对外接口 - 定义IUnknown接口: - ``` + ```C++ typedef struct DemoApi { INHERIT_IUNKNOWN; BOOL (*AsyncCall)(IUnknown *iUnknown, const char *buff); @@ -297,7 +295,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 定义IUnknown的引用对象: - ``` + ```C++ typedef struct DemoRefApi { INHERIT_IUNKNOWNENTRY(DemoApi); } DemoRefApi; @@ -305,7 +303,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 初始化接口对象: - ``` + ```C++ static DemoRefApi api = { DEFAULT_IUNKNOWN_ENTRY_BEGIN, .AsyncCall = AsyncCall, @@ -316,19 +314,18 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 }; ``` -- 注册服务接口: +- 注册服务接口: - ``` - SAMGR_GetInstance()->RegisterFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE, GET_IUNKNOWN(api)); - - ``` + ```C++ + SAMGR_GetInstance()->RegisterFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE, GET_IUNKNOWN(api)); + ``` ## 调用进程内服务 - 获取服务的对外接口: - ``` + ```C++ DemoApi *demoApi = NULL; IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE); if (iUnknown == NULL) { @@ -342,26 +339,25 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 接口调用: - ``` + ```C++ if (demoApi->AsyncCallBack == NULL) { return NULL; } demoApi->AsyncCallBack((IUnknown *)demoApi, "I wanna async call callback good result!", AsyncHandler); ``` -- 释放接口: +- 释放接口: - ``` - int32 ref = demoApi->Release((IUnknown *)demoApi); - - ``` + ```C++ + int32 ref = demoApi->Release((IUnknown *)demoApi); + ``` ## 开发跨进程间对外接口 - 继承IServerProxy替代继承IUnknown:INHERIT\_SERVER\_IPROXY - ``` + ```C++ typedef struct DemoFeatureApi { INHERIT_SERVER_IPROXY; BOOL (*AsyncCall)(IUnknown *iUnknown, const char *buff); @@ -373,7 +369,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 初始化IServerProxy的Invoke函数: - ``` + ```C++ static DemoFeature g_example = { SERVER_IPROXY_IMPL_BEGIN, .Invoke = Invoke, @@ -387,7 +383,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 实现Invoke函数来处理Ipc消息: - ``` + ```C++ static int32 Invoke(IServerProxy *iProxy, int funcId, void *origin, IpcIo *req, IpcIo *reply) { DemoFeatureApi *api = (DemoFeatureApi *)iProxy; @@ -424,19 +420,18 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 } ``` -- 注册接口:与进程内接口注册一致 +- 注册接口:与进程内接口注册一致 - ``` - SAMGR_GetInstance()->RegisterFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE, GET_IUNKNOWN(g_example)); - - ``` + ```C++ + SAMGR_GetInstance()->RegisterFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE, GET_IUNKNOWN(g_example)); + ``` ## 调用跨进程间服务 - 获取跨进程服务的对外接口: - ``` + ```C++ IClientProxy *demoApi = NULL; IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE); if (iUnknown == NULL) { @@ -450,25 +445,24 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 调用Ipc消息接口: - ``` + ```C++ IpcIo request;char data[250]; IpcIoInit(&request, data, sizeof(data), 0); demoApi->Invoke(demoApi, 0, &request, NULL, NULL); ``` -- 释放接口: +- 释放接口: - ``` - int32 ref = demoApi->Release((IUnknown *)demoApi); - - ``` + ```C++ + int32 ref = demoApi->Release((IUnknown *)demoApi); + ``` ## 开发跨进程间服务调用客户端代理 - 定义IPC接口客户端代理: - ``` + ```C++ typedef struct DemoClientProxy { INHERIT_CLIENT_IPROXY; BOOL (*AsyncCall)(IUnknown *iUnknown, const char *buff); @@ -483,7 +477,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 实现客户端代理封装Ipc消息接口: - ``` + ```C++ static BOOL AsyncCall(IUnknown *iUnknown, const char *buff) { DemoClientProxy *proxy = (DemoClientProxy *)iUnknown; @@ -556,7 +550,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 实现客户端代理的工厂方法: - ``` + ```C++ void *DEMO_CreatClient(const char *service, const char *feature, uint32 size) { (void)service; @@ -585,13 +579,13 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 将客户端代理的工厂方法注册到SAMGR: - ``` + ```C++ SAMGR_RegisterFactory(EXAMPLE_SERVICE, EXAMPLE_FEATURE, DEMO_CreatClient, DEMO_DestroyClient); ``` - 获取跨进程服务的对外接口: - ``` + ```C++ DemoClientProxy *demoApi = NULL; IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE); if (iUnknown == NULL) { @@ -605,7 +599,7 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 调用跨进程服务的客户端代理接口: - ``` + ```C++ if (demoApi->AsyncCallBack == NULL) { return NULL; } @@ -615,14 +609,14 @@ A核:系统依赖samgr库,在main函数中调用SAMGR\_Bootstrap\(\)函数 - 释放接口: - ``` + ```C++ int32 ref = demoApi->Release((IUnknown *)demoApi); ``` ## 涉及仓 -distributedschedule\_interfaces\_innerkits\_samgr\_lite +distributedschedule\_interfaces\_kits\_samgr\_lite distributedschedule\_services\_samgr\_lite diff --git "a/readme/\347\274\226\350\257\221\346\236\204\345\273\272\345\255\220\347\263\273\347\273\237README.md" "b/readme/\347\274\226\350\257\221\346\236\204\345\273\272\345\255\220\347\263\273\347\273\237README.md" index e3e878a3950e0382d5d0cf68fca18efe27bd0ad3..f3d85c1b59199e79c0b6a455c5e63f3439df07ab 100755 --- "a/readme/\347\274\226\350\257\221\346\236\204\345\273\272\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\347\274\226\350\257\221\346\236\204\345\273\272\345\255\220\347\263\273\347\273\237README.md" @@ -2,22 +2,22 @@ ## 简介 -编译构建提供了一个在GN与ninja基础上的编译构建框架。支持以下功能: +编译构建提供了一个在GN和ninja基础上的编译构建框架。支持以下功能: -1. 构建不同芯片平台的产品。如:Hi3518EV300平台的ipcamera产品,Hi3516DV300平台的ipcamera产品,Hi3861平台的wifi模组产品。 +1. 构建不同芯片平台的产品。如:Hi3518EV300平台的ipcamera产品,Hi3516DV300平台的ipcamera产品,Hi3861平台的WLAN模组产品。 2. 构建HPM包管理配置生成的自定义产品。 ## 目录 ``` -build/lite # 编译构建主目录 -├── config # 编译相关的配置项 -│ ├── boards # 开发板相关的变量定义。包括:开发板名、目标架构、目标CPU等 -│ ├── component # OpenHarmony组件相关的模板定义。包括:静态库、动态库、扩展组件、模拟器库等 -│ ├── kernel # OpenHarmony内核的编译变量定义与配置参数 -│ └── subsystem # OpenHarmony子系统列表 -├── ndk # NDK相关编译脚本与配置参数 -├── platform # 平台相关的配置文件 +build/lite # 编译构建主目录 +├── config # 编译相关的配置项 +│ ├── boards # 开发板相关的变量定义。包括:开发板名、目标架构、目标CPU等 +│ ├── component # OpenHarmony组件相关的模板定义。包括:静态库、动态库、扩展组件、模拟器库等 +│ ├── kernel # OpenHarmony内核的编译变量定义与配置参数 +│ └── subsystem # OpenHarmony子系统列表 +├── ndk # NDK相关编译脚本与配置参数 +├── platform # 平台相关的配置文件 │ ├── hi3516dv300_liteos_a # hi3516dv300, liteos_a平台。包括:平台全量配置表,启动文件。 │ ├── hi3518ev300_liteos_a # hi3518ev300, liteos_a平台。包括:平台全量配置表,启动文件。 │ └── hi3861v100_liteos_riscv # hi3861v100, liteos_riscv平台。包括:平台全量配置表,启动文件。 @@ -76,18 +76,18 @@ python build.py ipcamera_hi3516dv300 使用lite\_library模板,可以编译出动态库与静态库。示例如下: - ``` + ```C++ # helloworld动态库编译示例 # helloworld的Build.gn文件 lite_library("helloworld_lib") { - target_type = "shared_library" # 编译动态库 - #target_type = "static_library" # 编译静态库 + target_type = "shared_library" # 编译动态库 + #target_type = "static_library" # 编译静态库 sources = [ "src/helloworld1.c" ] include_dirs = [ "include", - "../feature2_example/include" # 如果依赖 feature2_example 可以加入该include + "../feature2_example/include" # 如果依赖 feature2_example 可以加入该include ] } ``` @@ -96,7 +96,7 @@ python build.py ipcamera_hi3516dv300 使用gn自带模板executable,可编译出可执行文件。示例如下: - ``` + ```C++ #编译可执行.bin文件 executable("hello_world_bin") { sources = [ @@ -114,7 +114,7 @@ python build.py ipcamera_hi3516dv300 ``` 第三步:编写example/BUILD.gn,组件gn脚本 - ``` + ```C++ import("//build/lite/config/component/lite_component.gni") #工程全篇使用BUILD.gn脚本编译 lite_component("example_gn") { @@ -149,7 +149,7 @@ python build.py ipcamera_hi3516dv300 举例:ohos\_kernel\_type的使用,component\_example/feature2\_example/BUILD.gn - ``` + ```C++ lite_library("helloworld") { if (ohos_kernel_type == "liteos_a") { target_type = "shared_library" @@ -181,18 +181,18 @@ python build.py ipcamera_hi3516dv300 ``` out/ - └── wifiiot # 产品名 - ├── args.gn # gn编译,用户自定义变量 - ├── build.log # 编译日志 + └── wifiiot # 产品名 + ├── args.gn # gn编译,用户自定义变量 + ├── build.log # 编译日志 ├── build.ninja ├── build.ninja.d ├── gen - ├── Hi3861_boot_signed_B.bin # 带签名的bootloader备份文件 - ├── Hi3861_boot_signed.bin # 带签名的bootloader文件 - ├── Hi3861_loader_signed.bin # 烧写工具使用的加载文件 - ├── Hi3861_wifiiot_app_allinone.bin # 产线工装烧写文件(已经包含独立烧写程序和loader程序) - ├── Hi3861_wifiiot_app.asm # Kernel asm文件 - ├── Hi3861_wifiiot_app_burn.bin # 烧写文件 + ├── Hi3861_boot_signed_B.bin # 带签名的bootloader备份文件 + ├── Hi3861_boot_signed.bin # 带签名的bootloader文件 + ├── Hi3861_loader_signed.bin # 烧写工具使用的加载文件 + ├── Hi3861_wifiiot_app_allinone.bin # 产线工装烧写文件(已经包含独立烧写程序和loader程序) + ├── Hi3861_wifiiot_app.asm # Kernel asm文件 + ├── Hi3861_wifiiot_app_burn.bin # 烧写文件 ├── Hi3861_wifiiot_app_flash_boot_ota.bin # Flash Boot升级文件 ├── Hi3861_wifiiot_app.map # Kernel map文件 ├── Hi3861_wifiiot_app_ota.bin # Kernel 升级文件 diff --git "a/readme/\351\251\261\345\212\250\345\255\220\347\263\273\347\273\237README.md" "b/readme/\351\251\261\345\212\250\345\255\220\347\263\273\347\273\237README.md" index 1a5b0330a52d365901a91de7682ec55767f1ba81..685c4be63cca080fea78b96dff77edecf46faa38 100755 --- "a/readme/\351\251\261\345\212\250\345\255\220\347\263\273\347\273\237README.md" +++ "b/readme/\351\251\261\345\212\250\345\255\220\347\263\273\347\273\237README.md" @@ -18,7 +18,7 @@ OpenHarmony驱动子系统采用C面向对象编程模型构建,通过平台 - 组件化的驱动模型: - 支持组件化的驱动模型,开发者提供更精细化的驱动管理,开发者可以对驱动进行组件化拆分,使得驱动开发者可以更多关注驱动与硬件交互部分。 + 支持组件化的驱动模型,为开发者提供更精细化的驱动管理,开发者可以对驱动进行组件化拆分,使得驱动开发者可以更多关注驱动与硬件交互部分。 同时系统也预置了部分模板化的驱动模型组件,如网络设备模型等。 @@ -52,10 +52,10 @@ OpenHarmony驱动框架采用主从架构设计模式,围绕着框架、模型 - 驱动工具 - 位于frameworks/tools目录 - 提供HDI接口转换、驱动配置编译等工具。 -- 驱动接口 - 位于lite/hdi +- 驱动接口 - 位于lite/hdi目录 - 提供规范化的驱动接口。 -- Support - 位于frameworks/support目录, +- Support - 位于frameworks/support目录 - 提供规范化的平台驱动接口和系统接口抽象能力。 @@ -130,11 +130,6 @@ OpenHarmony驱动框架采用主从架构设计模式,围绕着框架、模型

该接口部分与平台无关可支持跨平台迁移。

- - -

名称

@@ -91,59 +73,64 @@ Ability是应用所具备的能力的抽象,一个应用可以包含一个或

foundation/aafwk/frameworks/kits/ability_lite

+

foundation/aafwk/frameworks/ability_lite

元能力框架核心代码

+

AbilityKit实现的核心代码

foundation/aafwk/frameworks/kits/content_lite

+

foundation/aafwk/frameworks/abilitymgr_lite

元能力之间通信的实体

+

管理AbilityKit与Ability管理服务通信的客户端代码

foundation/aafwk/frameworks/kits/tools_lite

+

foundation/aafwk/frameworks/want_lite

元能力调测工具

+

Ability之间交互的信息载体的实现代码

foundation/aafwk/interfaces/innerkits/abilitykit_lite

+

foundation/aafwk/interfaces/kits/abilitykit_lite

元能力框架对外接口

+

AbilityKit为开发者提供的接口

foundation/aafwk/interfaces/innerkits/abilitymgr_lite

元能力运行管理服务对外接口

+

Ability管理服务为其它子系统提供的接口

foundation/aafwk/interfaces/innerkits/intent_lite

+

foundation/aafwk/interfaces/kits/want_lite

元能力之间通信的实体对外接口

+

Ability之间交互的信息载体的对外接口

foundation/aafwk/services/abilitymgr_lite

元能力运行管理服务

+

Ability管理服务的实现代码

foundation/appexecfwk/interfaces/innerkits/appexecfwk_lite

+

foundation/appexecfwk/interfaces/kits/bundle_lite

用户程序运行的包信息、元能力信息、异步事件处理等基本接口

+

BundleKit为开发者提供的接口

foundation/appexecfwk/interfaces/innerkits/bundlemgr_lite

用户程序包管理服务对外接口

+

BundleKit实现的核心代码,及包管理服务为其它子系统提供的接口

+

foundation/appexecfwk/frameworks/bundle_lite

+

管理BundleKit与包管理服务通信的客户端代码

foundation/appexecfwk/kits/appkit_lite

+

foundation/appexecfwk/utils/bundle_lite

用户程序运行的包信息、元能力信息、异步事件处理机制的实现逻辑

+

包管理服务实现中用到的工具性的代码

foundation/appexecfwk/services/bundlemgr_lite

用户程序包管理服务实现逻辑

+

包管理服务的实现代码

hdf/frameworks/support/osal

-

提供通用平台适配接口,如内存、线程、锁等资源。

-

hdf/frameworks/support/platform

提供通用平台硬件资源支撑接口,如GPIO、I2C、SPI等能力。

@@ -183,19 +178,19 @@ OpenHarmony驱动框架采用主从架构设计模式,围绕着框架、模型 开发者基于HDF驱动框架开发的驱动主要包含三大部分: -1、驱动程序部分 - 完成驱动的功能逻辑 +1、驱动程序部分 - 完成驱动的功能逻辑。 -2、驱动配置信息 - 指示驱动的加载信息内容 +2、驱动配置信息 - 指示驱动的加载信息内容。 3、驱动资源配置 - 配置驱动的硬件配置信息。 驱动程序主要是完成驱动功能的开发部分: -对于开发者首先看到的是驱动入口部分,驱动入口部分通过DriverEntry对齐进行描述。 +对于开发者首先看到的是驱动入口部分,驱动入口部分通过DriverEntry对其进行描述。 其中主要包含bind, init 和release三个接口。 -``` +```C++ struct HdfDriverEntry g_deviceSample = { .moduleVersion = 1, .moduleName = "sample_driver", @@ -207,30 +202,28 @@ struct HdfDriverEntry g_deviceSample = { Bind接口描述:该接口的作用主要是完成驱动设备和设备服务接口的bind动作。 -``` +```C++ int32_t SampleDriverBind(struct HdfDeviceObject *deviceObject) { - //TODO: Bind device service to device object. - //And you can also initialize device resources here. + // TODO: Bind device service to device object. + // And you can also initialize device resources here. return HDF_SUCCESS; } ``` -Init接口描述:当框架完成设备绑定动作后,就开始调用驱动初始化接口,当初始化成功后,驱动框架根据配置文件决定是否对外创建设备服务 +Init接口描述:当框架完成设备绑定动作后,就开始调用驱动初始化接口,当初始化成功后,驱动框架根据配置文件决定是否对外创建设备服务接口,还是只是对当前服务接口可见。如果Init初始化失败的话,驱动框架就会主动释放创建的设备接口等信息。 -接口,还是只是对当前服务接口可见。如果Init初始化失败的话,驱动框架就会主动释放创建的设备接口等信息。 - -``` +```C++ int32_t SampleDriverInit(struct HdfDeviceObject *deviceObject) { - //TODO: Init hardware or other resources here. - return HDF_SUCCESS; + // TODO: Init hardware or other resources here. + return HDF_SUCCESS; } ``` Release接口描述:当用户需要卸载驱动时,驱动框架先通过该接口通知驱动程序释放资源。然后在执行其他内部资源释放。 -``` +```C++ void SampleDriverRelease(struct HdfDeviceObject *deviceObject) { // Release all resources. diff --git "a/security/\351\232\220\347\247\201\344\277\235\346\212\244.md" "b/security/\351\232\220\347\247\201\344\277\235\346\212\244.md" index f27edad5e9ae1c6af194f7c39e4e6ca5a8ef3f11..52be20c24ba50fbb381d44abb0833bc3009a658a 100755 --- "a/security/\351\232\220\347\247\201\344\277\235\346\212\244.md" +++ "b/security/\351\232\220\347\247\201\344\277\235\346\212\244.md" @@ -6,49 +6,48 @@ **基本概念** -- **个人数据(Personal Data)** +- **个人数据(Personal Data)** 与一个身份已被识别或者身份可被识别的自然人(“数据主体”)相关的任何信息;身份可识别的自然人是指其身份可以通过诸如姓名、身份证号、位置数据等识别码或者通过一个或多个与自然人的身体、生理、精神、经济、文化或者社会身份相关的特定因素来直接或者间接地被识别。个人数据包括:自然人的email地址、电话号码、生物特征(指纹)、位置数据、IP地址、医疗信息、宗教信仰、社保号、婚姻状态等。 -- **敏感个人数据(Sensitive Personal Data)** +- **敏感个人数据(Sensitive Personal Data)** 敏感个人数据是个人数据的一个重要子集,指的是涉及数据主体的最私密领域的信息或者一旦泄露可能会给数据主体造成重大不利影响的数据。欧盟等国家和地区法律定义的敏感个人数据包括种族、政治观点、宗教和哲学信仰、工会成员资格、基因数据、生物信息、健康和性生活状况、性取向等。 根据业界最佳实践,敏感个人数据还包括可与自然人身份相关联的银行卡号、身份证号、护照号、口令等。敏感个人数据的处理需要更多更严格的保护措施。 -- **公开个人数据(Public available Personal Data)** +- **公开个人数据(Public available Personal Data)** 数据主体主动公开的个人数据,或公开网页/应用上可访问的个人数据,包括论坛公开的发帖、评论等。 -- **用户画像(User Profile)** +- **用户画像(User Profile)** 指对个人数据采取的任何自动化处理的方式,包括评估某个自然人特定方面的情况,尤其是为了分析和预测该自然人的工作表现、经济状况、健康、个人喜好、兴趣、可信度、行为举止、所在位置或行迹。 -- **数据控制者(Data Controller)** +- **数据控制者(Data Controller)** 单独或者与他人共同确定个人数据处理的目的和手段的自然人、法人、公共机构、政府部门或其他机构。 -- **数据处理者(Data Processor)** +- **数据处理者(Data Processor)** 指代表数据控制者处理个人数据的自然人、法人、公共机构、政府部门或其他机构。数据处理者必须按照数据控制者的要求对个人数据进行充分的保护 -- **明示同意(Explicit consent)** +- **明示同意(Explicit consent)** 如下几种情形GDPR法律提到可以通过数据主体明示同意的方式合法地处理数据: - - 处理敏感个人数据。 - - 自动化决策,包括进行用户画像。 - - 向不具备充分保护水平的国家转移个人数据,并以同意作为合法性基础。 + - 处理敏感个人数据。 + - 自动化决策,包括进行用户画像。 + - 向不具备充分保护水平的国家转移个人数据,并以同意作为合法性基础。 实现明示同意的方式有: - - 在隐私声明中用加粗放大的字体展示通知内容,并就该内容单独要求数据主体授予同意。 - - 在收集特定数据时,弹出隐私声明告知个人数据处理相关事项,提供勾选框但不默认勾选,让数据主体勾选“我同意以上述方式处理我的个人数据”,或提供“我同意”的按钮让用户主动点击。 - - 以书面的方式明确表达同意,数据主体在书面陈述上签字。 - - 要求数据主体在系统中上传带有其签名的电子表格。 - - 采取双重验证的方式,要求数据主体邮件形式回复同意后,再次点击用于验证的邮件链接或是输入SMS验证码。 - - 用户主动输入的场景,例如用户主动输入身份证和银行卡号绑卡等场景。 - + - 在隐私声明中用加粗放大的字体展示通知内容,并就该内容单独要求数据主体授予同意。 + - 在收集特定数据时,弹出隐私声明告知个人数据处理相关事项,提供勾选框但不默认勾选,让数据主体勾选“我同意以上述方式处理我的个人数据”,或提供“我同意”的按钮让用户主动点击。 + - 以书面的方式明确表达同意,数据主体在书面陈述上签字。 + - 要求数据主体在系统中上传带有其签名的电子表格。 + - 采取双重验证的方式,要求数据主体邮件形式回复同意后,再次点击用于验证的邮件链接或是输入SMS验证码。 + - 用户主动输入的场景,例如用户主动输入身份证和银行卡号绑卡等场景。 ## 数据分类分级 @@ -125,56 +124,54 @@ 采集个人数据时,应清晰、明确地告知用户,并确保告知用户的个人信息将被如何使用。 -- 针对不同等级的个人数据需要制定针对性的隐私处理策略。 - - 敏感个人数据的采集需要获取数据主体明示同意。 - - 一般个人数据的采集需要数据主体同意或基于其他合法授权。 - - 非个人数据与中、高或极高级别个人数据关联采集,需要数据主体同意或其他合法授权,并在隐私声明中呈现。 +- 针对不同等级的个人数据需要制定针对性的隐私处理策略。 + - 敏感个人数据的采集需要获取数据主体明示同意。 + - 一般个人数据的采集需要数据主体同意或基于其他合法授权。 + - 非个人数据与中、高或极高级别个人数据关联采集,需要数据主体同意或其他合法授权,并在隐私声明中呈现。 -- 应制定并遵从适当的隐私政策。在收集、使用留存和第三方分享用户个人数据时需要符合所有适用法律、政策和规定。需充分告知用户处理个人数据的种类、目的、处理方式、保留期限等,满足数据主体权利相关要求。 +- 应制定并遵从适当的隐私政策。在收集、使用留存和第三方分享用户个人数据时需要符合所有适用法律、政策和规定。需充分告知用户处理个人数据的种类、目的、处理方式、保留期限等,满足数据主体权利相关要求。 根据以上原则,我们设计了正确示例以供参考。隐私通知/声明的参考示例如下: **图 1** 隐私通知/声明示例图 ![](figures/隐私通知-声明示例图.png "隐私通知-声明示例图") -- 个人数据应当基于具体、明确、合法的目的收集,不应以与此目的不相符的方式作进一步处理。对于收集目的变更和用户撤销同意后再次重新使用的场景都需要用户重新确认。隐私声明变更和撤销的示例如下图: +- 个人数据应当基于具体、明确、合法的目的收集,不应以与此目的不相符的方式作进一步处理。对于收集目的变更和用户撤销同意后再次重新使用的场景都需要用户重新确认。隐私声明变更和撤销的示例如下图: **图 2** 隐私通知/声明变更示例图 ![](figures/隐私通知-声明变更示例图.png "隐私通知-声明变更示例图") **图 3** 撤销同意示例图 - ![](figures/zh-cn_image_0000001054853161.png) ![](figures/zh-cn_image_0000001055093076.png) 对用户系统软件、应用软件的下载或升级,涉及修改用户隐私空间,用户对于这类行为需要有知情权和控制权,必须给用户提示,并提供给用户同意和取消的选项。 - **数据收集及使用最小化** 个人数据收集应与数据处理目的相关,且是适当、必要的。开发者应尽可能对个人数据进行匿名或化名,降低对数据主体的风险。仅可收集和处理与特定目的相关且必需的个人数据,不能进行与特定目的不相关的进一步处理。 -- 敏感权限申请的时候要满足权限最小化的要求,在申请权限时,只申请获取必需的信息或资源所需要的权限。 -- 数据收集最小化:针对数据的收集要满足最小化要求,不收集与产品提供服务无关联的数据。 -- 数据使用的功能要求能够使用户受益,收集的数据不能用于一些与用户正常使用无关的功能。数据收集不能有其他与用户正常使用无关的功能存在。 +- 敏感权限申请的时候要满足权限最小化的要求,在申请权限时,只申请获取必需的信息或资源所需要的权限。 +- 数据收集最小化:针对数据的收集要满足最小化要求,不收集与产品提供服务无关联的数据。 +- 数据使用的功能要求能够使用户受益,收集的数据不能用于一些与用户正常使用无关的功能。数据收集不能有其他与用户正常使用无关的功能存在。 **数据处理选择和控制** 对个人数据处理必须要征得用户的同意,用户对其个人数据要有充分的控制权。 -- 申请获取用户系统权限的授权:产品弹窗提醒,向用户呈现需要获取的权限和权限使用目的、产品需要收集的数据和使用目的等,通过用户点击“确认”的方式完成用户授权,让用户对产品权限的授予和使用透明、可知、可控。 -- 用户可以修改、取消授予的权限:当用户不同意某一权限或者数据收集时,应当允许用户使用与这部分权限和数据收集不相关的功能。 -- 用户在产品使用过程中,针对录入个人数据的场景,需要给用户提供对个人数据的增加、删除、修改、查看的操作。 -- 需要给出硬件回收或返厂进行安全删除个人数据的机制或方法。 +- 申请获取用户系统权限的授权:产品弹窗提醒,向用户呈现需要获取的权限和权限使用目的、产品需要收集的数据和使用目的等,通过用户点击“确认”的方式完成用户授权,让用户对产品权限的授予和使用透明、可知、可控。 +- 用户可以修改、取消授予的权限:当用户不同意某一权限或者数据收集时,应当允许用户使用与这部分权限和数据收集不相关的功能。 +- 用户在产品使用过程中,针对录入个人数据的场景,需要给用户提供对个人数据的增加、删除、修改、查看的操作。 +- 需要给出硬件回收或返厂进行安全删除个人数据的机制或方法。 **数据安全** 从技术上保证数据处理活动的安全性,包括个人数据的加密存储、安全传输等安全机制,系统应默认开启或采取安全保护措施。 -- 对于个人数据的访问需要有保护机制,主要包括身份认证和访问控制。身份认证(如用户名、密码)限定只有经过认证的用户才能访问数据,可应用于多用户场景;访问控制(如权限控制)可应用于对应用程序的限制。 -- 分布式设备个人数据安全存储要满足密钥管理和存储服务(HUKS:Huawei Universal Keystore)的要求,包括:秘钥安全存储、数据安全存储。 -- 个人数据在分布式设备间传输要满足设备间的信任绑定关系和数据传输通道的安全性要求。 -- 认证凭证数据(密码、口令、指纹等)须加密存储。 +- 对于个人数据的访问需要有保护机制,主要包括身份认证和访问控制。身份认证(如用户名、密码)限定只有经过认证的用户才能访问数据,可应用于多用户场景;访问控制(如权限控制)可应用于对应用程序的限制。 +- 分布式设备个人数据安全存储要满足密钥管理和存储服务(HUKS:Huawei Universal Keystore)的要求,包括:秘钥安全存储、数据安全存储。 +- 个人数据在分布式设备间传输要满足设备间的信任绑定关系和数据传输通道的安全性要求。 +- 认证凭证数据(密码、口令、指纹等)须加密存储。 **本地化处理** @@ -237,4 +234,3 @@
- diff --git a/subsystems/Readme-CN.md b/subsystems/Readme-CN.md index db3cfea4de384ee90822eb49d1079141570135a6..2b10bc165c71ba79acd95be73a6492cb31a6f146 100755 --- a/subsystems/Readme-CN.md +++ b/subsystems/Readme-CN.md @@ -1,21 +1,20 @@ # 子系统开发指南 -- [分布式远程启动](分布式远程启动.md) -- [图形图像](图形图像.md) - - [图形图像概述](图形图像概述.md) - - [容器类组件开发指导](容器类组件开发指导.md) - - [布局容器类组件开发指导](布局容器类组件开发指导.md) - - [普通组件开发指导](普通组件开发指导.md) - - [动画开发指导](动画开发指导.md) +- [分布式远程启动](分布式远程启动.md) +- [图形图像](图形图像.md) + - [图形图像概述](图形图像概述.md) + - [容器类组件开发指导](容器类组件开发指导.md) + - [布局容器类组件开发指导](布局容器类组件开发指导.md) + - [普通组件开发指导](普通组件开发指导.md) + - [动画开发指导](动画开发指导.md) -- [相机](相机.md) - - [相机开发概述](相机开发概述.md) - - [拍照开发指导](拍照开发指导.md) - - [录像开发指导](录像开发指导.md) - - [预览开发指导](预览开发指导.md) - -- [音视频](音视频.md) - - [音视频开发概述](音视频开发概述.md) - - [音视频播放开发指导](音视频播放开发指导.md) - - [音视频录制开发指导](音视频录制开发指导.md) +- [相机](相机.md) + - [相机开发概述](相机开发概述.md) + - [拍照开发指导](拍照开发指导.md) + - [录像开发指导](录像开发指导.md) + - [预览开发指导](预览开发指导.md) +- [音视频](音视频.md) + - [音视频开发概述](音视频开发概述.md) + - [音视频播放开发指导](音视频播放开发指导.md) + - [音视频录制开发指导](音视频录制开发指导.md) diff --git "a/subsystems/\345\210\206\345\270\203\345\274\217\350\277\234\347\250\213\345\220\257\345\212\250.md" "b/subsystems/\345\210\206\345\270\203\345\274\217\350\277\234\347\250\213\345\220\257\345\212\250.md" index 90ccf3c9a67a2d5b41d609b8551833f610af36d8..97c2ea49bf21ded6f05b8c5931062fff3fe7f93e 100755 --- "a/subsystems/\345\210\206\345\270\203\345\274\217\350\277\234\347\250\213\345\220\257\345\212\250.md" +++ "b/subsystems/\345\210\206\345\270\203\345\274\217\350\277\234\347\250\213\345\220\257\345\212\250.md" @@ -73,7 +73,7 @@ 1. 打开DevEco Studio,完成智慧屏侧FA开发。 2. 获取目标在线从设备的设备ID。 - ``` + ```c++ // 引入设备选择头文件 import ohos.distributedschedule.interwork.DeviceInfo; import ohos.distributedschedule.interwork.DeviceManager; @@ -89,7 +89,7 @@ 3. 构造want,首先使用ElementName类表明需要启动的远端设备ID,包名,元能力类名,传入want中,然后设置want中的分布式标志位Want.FLAG\_ABILITYSLICE\_MULTI\_DEVICE表示需要远程启动。 - ``` + ```c++ // 引入相关头文件 import ohos.aafwk.ability.Ability; import ohos.aafwk.content.Want; diff --git "a/subsystems/\345\212\250\347\224\273\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\345\212\250\347\224\273\345\274\200\345\217\221\346\214\207\345\257\274.md" index a4efa69a9d44ae8ee3ca6e2c2265f2ee97cd1626..b5887940bef0cdbbf00dc0eaaf665529422bbdf4 100755 --- "a/subsystems/\345\212\250\347\224\273\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\345\212\250\347\224\273\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -138,49 +138,56 @@ UI动画通过task处理机制每个tick调用一下用户设置的callback函 ## 开发步骤 -1. 实现AnimatorCallback的回调函数。 - - ``` - class AnimatorCallbackDemo : public OHOS::AnimatorCallback { - public: - AnimatorCallbackDemo(int16_t startPos, int16_t endPos, uint16_t time) - : start_(startPos), end_(endPos), time_(time), curTime_(0) {} - - virtual void Callback(OHOS::UIView* view) - { - curTime_++; - int16_t pos = EasingEquation::CubicEaseIn(start_, end_, curTime_, time_); - view->Invalidate(); - view->SetPosition(pos, view->GetY()); - view->Invalidate(); - } - protected: - int16_t start_; - int16_t end_; - uint16_t time_; - uint16_t curTime_; - }; - ``` - -2. 将AnimatorCallback添加到Animator中。 - - ``` - UIImageView* image = new UIImageView(); - image->SetSrc("..\\config\\images\\A021_001.bin"); - image->SetPosition(0, 50); - AnimatorCallbackDemo* callback = new AnimatorCallbackDemo(0, 338, 60); - Animator* animator = new Animator(callback, image, 0, true); - ``` - -3. 将Animator添加到AnimatorManager中。 - - ``` - AnimatorManager::GetInstance()->Add(animator); - ``` - -4. 点击下图下方的按钮,检查对应的动画运行效果。 - - **图 1** 动画实现效果图 - ![](figures/动画实现效果图.gif "动画实现效果图") - - +1. 实现AnimatorCallback的回调函数。 + + ```c++ + class AnimatorCallbackDemo : public OHOS::AnimatorCallback { + public: + AnimatorCallbackDemo(int16_t startPos, int16_t endPos, uint16_t time) + : start_(startPos), end_(endPos), time_(time), curTime_(0) {} +<<<<<<< HEAD + +======= + +>>>>>>> e9c42d63d4344e99bafce5d1103487fb08edd7b5 + virtual void Callback(OHOS::UIView* view) + { + curTime_++; + int16_t pos = EasingEquation::CubicEaseIn(start_, end_, curTime_, time_); + view->Invalidate(); + view->SetPosition(pos, view->GetY()); + view->Invalidate(); + } + protected: + int16_t start_; + int16_t end_; + uint16_t time_; + uint16_t curTime_; + }; + ``` + +2. 将AnimatorCallback添加到Animator中。 + + ```c++ + UIImageView* image = new UIImageView(); + image->SetSrc("..\\config\\images\\A021_001.bin"); + image->SetPosition(0, 50); + AnimatorCallbackDemo* callback = new AnimatorCallbackDemo(0, 338, 60); + Animator* animator = new Animator(callback, image, 0, true); + ``` + +3. 将Animator添加到AnimatorManager中。 + + ```c++ + AnimatorManager::GetInstance()->Add(animator); + ``` + +4. 点击下图下方的按钮,检查对应的动画运行效果。 + + **图 1** 动画实现效果图 + ![](figures/动画实现效果图.gif "动画实现效果图") +<<<<<<< HEAD +======= + + +>>>>>>> e9c42d63d4344e99bafce5d1103487fb08edd7b5 diff --git "a/subsystems/\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" index 88904c0a43d843b2c6a732273a40d7fbbfd40e0a..3496c5ed617afe8545eed9a4f77d5d2bf9eeca68 100755 --- "a/subsystems/\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -89,7 +89,7 @@ UIViewGroup是容器类组件基类,实现增加、删除、插入等操作, 1. 构造button实例并设置坐标信息。 - ``` + ```c++ UILabelButton* btn1 = new UILabelButton(); btn1->SetPosition(0, 0, 100, 50); btn1->SetText("btn1"); @@ -105,14 +105,14 @@ UIViewGroup是容器类组件基类,实现增加、删除、插入等操作, 2. 构造UIViewGroup实例,并设置坐标信息。 - ``` + ```c++ UIViewGroup* group = new UIViewGroup(); group->SetPosition(0, 0, 300, 300); ``` 3. 使用Add方法添加Button实例到UIViewGroup。 - ``` + ```c++ group->Add(btn1); group->Add(btn2); group->Add(btn3); @@ -218,7 +218,7 @@ UIScrollView提供可滑动的容器类组件,子组件可在触摸事件驱 添加两个button子组件,并显示水平、垂直方向游标。 -``` +```c++ scrollView* scroll = new UIScrollView(); scroll->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); scroll->SetPosition(0,0, 200, 200); diff --git "a/subsystems/\345\270\203\345\261\200\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\345\270\203\345\261\200\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" index d23f985c3def90427381a8be45c2afc4494c3f62..c6460cbaaed7586bcb1995db3dc4a8cb8cbcb72d 100755 --- "a/subsystems/\345\270\203\345\261\200\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\345\270\203\345\261\200\345\256\271\345\231\250\347\261\273\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -59,15 +59,15 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 ## 开发步骤(水平滑动,不可循环) -1. 创建一个水平滑动的UISwipeView。 +1. 创建一个水平滑动的UISwipeView。 - ``` + ```c++ UISwipeView* swipe = new UISwipeView(UISwipeView::HORIZONTAL); ``` -2. 向UISwipeView中添加子组件。 +2. 向UISwipeView中添加子组件。 - ``` + ```c++ UILabelButton* button1 = new UILabelButton(); button1->SetPosition(0, 0, g_ButtonW, g_ButtonH); button1->SetText("button1"); @@ -82,48 +82,76 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 swipe->Add(button3); ``` -3. 检查实现效果,水平滑动,不可循环。 +3. 检查实现效果,水平滑动,不可循环。 **图 1** UISwipeView水平滑动效果图 - ![](figures/zh-cn_image_0000001053247975.gif) - ## 开发步骤(水平滑动,可循环) -1. 创建一个水平滑动的UISwipeView并添加子组件。 +1. 创建一个水平滑动的UISwipeView并添加子组件。 +<<<<<<< HEAD - ``` - UISwipeView* swipe = new UISwipeView(UISwipeView::HORIZONTAL); - UILabelButton* button1 = new UILabelButton(); - button1->SetPosition(0, 0, g_ButtonW, g_ButtonH); - button1->SetText("button1"); - swipe->Add(button1); - UILabelButton* button2 = new UILabelButton(); - button2->SetPosition(0, 0, g_ButtonW, g_ButtonH); - button2->SetText("button2"); - swipe->Add(button2); - UILabelButton* button3 = new UILabelButton(); - button3->SetPosition(0, 0, g_ButtonW, g_ButtonH); - button3->SetText("button3"); - swipe->Add(button3); - ``` + ```c++ + UISwipeView* swipe = new UISwipeView(UISwipeView::HORIZONTAL); + UILabelButton* button1 = new UILabelButton(); + button1->SetPosition(0, 0, g_ButtonW, g_ButtonH); + button1->SetText("button1"); + swipe->Add(button1); + UILabelButton* button2 = new UILabelButton(); + button2->SetPosition(0, 0, g_ButtonW, g_ButtonH); + button2->SetText("button2"); + swipe->Add(button2); + UILabelButton* button3 = new UILabelButton(); + button3->SetPosition(0, 0, g_ButtonW, g_ButtonH); + button3->SetText("button3"); + swipe->Add(button3); + ``` -2. 设置UISwipeView循环滑动。 +2. 设置UISwipeView循环滑动。 - ``` - swipe->SetLoopState(true); - ``` + ```c++ + swipe->SetLoopState(true); + ``` + +3. 检查实现效果,水平循环滑动。 + + **图 2** UISwipeView水平滑动循环效果图 +======= + + ```c++ + UISwipeView* swipe = new UISwipeView(UISwipeView::HORIZONTAL); + UILabelButton* button1 = new UILabelButton(); + button1->SetPosition(0, 0, g_ButtonW, g_ButtonH); + button1->SetText("button1"); + swipe->Add(button1); + UILabelButton* button2 = new UILabelButton(); + button2->SetPosition(0, 0, g_ButtonW, g_ButtonH); + button2->SetText("button2"); + swipe->Add(button2); + UILabelButton* button3 = new UILabelButton(); + button3->SetPosition(0, 0, g_ButtonW, g_ButtonH); + button3->SetText("button3"); + swipe->Add(button3); + ``` + +2. 设置UISwipeView循环滑动。 -3. 检查实现效果,水平循环滑动。 + ```c++ + swipe->SetLoopState(true); + ``` - **图 2** UISwipeView水平滑动循环效果图 - +3. 检查实现效果,水平循环滑动。 - ![](figures/zh-cn_image_0000001053207924.gif) + **图 2** UISwipeView水平滑动循环效果图 + ![](figures/zh-cn_image_0000001053207924.gif) +>>>>>>> e9c42d63d4344e99bafce5d1103487fb08edd7b5 + + ![](figures/zh-cn_image_0000001053207924.gif) + ## GridLayout ## 使用场景 @@ -161,9 +189,9 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 ## 开发步骤 -1. 构造GridLayout并设置位置、大小信息。 +1. 构造GridLayout并设置位置、大小信息。 - ``` + ```c++ GridLayout* layout_ = new GridLayout(); layout_->SetPosition(0, g_y, HROIZONTAL_RESOLUTION, 200); layout_->SetLayoutDirection(LAYOUT_HOR); @@ -171,9 +199,9 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 layout_->SetCols(2); ``` -2. 构造子组件button。 +2. 构造子组件button。 - ``` + ```c++ UILabelButton* bt1 = new UILabelButton(); bt1->SetPosition(0,0,100,50); bt1->SetText("bt1"); @@ -188,9 +216,9 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 bt4->SetText("bt4"); ``` -3. 添加子组件并调用LayoutChildren\(\)。 +3. 添加子组件并调用LayoutChildren\(\)。 - ``` + ```c++ layout_->Add(bt1); layout_->Add(bt2); layout_->Add(bt3); @@ -198,9 +226,7 @@ UISwipeView继承UIViewGroup,除提供容器类组件Add、Remove、Insert等 layout_->LayoutChildren(); ``` -4. 检查button组件布局效果如下图所示。 +4. 检查button组件布局效果如下图所示。 **图 3** 设置2\*2网格并添加4个button组件进行布局 ![](figures/设置2-2网格并添加4个button组件进行布局.png "设置2-2网格并添加4个button组件进行布局") - - diff --git "a/subsystems/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274.md" index c287580151bf1205443f0b4c620862a2367ac509..e9312d13bad013cc3db6c9a7db99449daf099f7c 100755 --- "a/subsystems/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\345\275\225\345\203\217\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -17,7 +17,7 @@ 1. 参考“拍照开发指导”中步骤1、步骤2、步骤3、步骤4。 2. 获取录像FrameConfig。 - ``` + ```c++ /* 从recorder获取surface */ Surface *surface = recorder_->GetSurface(0); surface->SetWidthAndHeight(1920, 1080); @@ -30,7 +30,7 @@ 3. 开启和停止录像。 - ``` + ```c++ stateCallback->camera_->TriggerLoopingCapture(*fc); // 开始录像 stateCallback->camera_->StopLoopingCapture(); // 结束录像 ``` diff --git "a/subsystems/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" index 82b18b5021d702dcc560e4197e885d624cfdf860..5b016379be687cbca93bcbd9fb915f9cab91bfb7 100755 --- "a/subsystems/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\346\213\215\347\205\247\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -252,7 +252,7 @@ 1. 实现设备状态回调的派生类,用户在设备状态发生变更(如新插入相机设备/相机掉线)时,自定义操作。 - ``` + ```c++ class SampleCameraDeviceCallback : public CameraDeviceCallback { void OnCameraStatus(std::string cameraId, int32_t status) override { @@ -263,7 +263,7 @@ 2. 实现帧事件回调的派生类,这里在拿到帧数据以后将其转存为文件。 - ``` + ```c++ static void SampleSaveCapture(const char *p, uint32_t size) { cout << "Start saving picture" << endl; @@ -307,7 +307,7 @@ 3. 实现相机状态回调的派生类,当相机状态发生变化(配置成功/失败,创建成功/失败\)时,自定义操作。 - ``` + ```c++ class SampleCameraStateMng : public CameraStateCallback { public: SampleCameraStateMng() = delete; @@ -333,7 +333,7 @@ 4. 创建CameraKit,用于创建和获取camera信息。 - ``` + ```c++ CameraKit *camKit = CameraKit::GetInstance(); list camList = camKit->GetCameraIds(); string camId; @@ -351,7 +351,7 @@ 5. 创建Camera实例。 - ``` + ```c++ EventHandler eventHdlr; // Create a thread to handle callback events SampleCameraStateMng CamStateMng(eventHdlr); @@ -360,7 +360,7 @@ 6. 根据[步骤1](#li378084192111)、[步骤2](#li8716104682913)、[步骤3](#li6671035102514)中的回调设计,camera实例创建成功后会进行配置操作,主流程中app需要设计同步机制。 - ``` + ```c++ void OnCreated(Camera &c) override { cout << "Sample recv OnCreate camera." << endl; diff --git "a/subsystems/\346\231\256\351\200\232\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\346\231\256\351\200\232\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" index 780046a453ab5598e888c4e188c742458b8b36b1..c6ff7756b7a58707e4e559956a5b7c573ae312c2 100755 --- "a/subsystems/\346\231\256\351\200\232\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\346\231\256\351\200\232\347\273\204\344\273\266\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -76,7 +76,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 实现点击事件。 - ``` + ```c++ class TestBtnOnClickListener : public OHOS::UIView::OnClickListener { bool OnClick(UIView& view, const ClickEvent& event) override { @@ -91,7 +91,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 2. 创建一个UIButton。 - ``` + ```c++ UIButton* button = new UIButton(); button->SetPosition(50, 50); button->SetWidth(100); @@ -100,7 +100,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 3. 给UIButton注册点击事件回调。 - ``` + ```c++ button->SetOnClickListener(new TestBtnOnClickListener()); ``` @@ -179,14 +179,14 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 创建一个UIImageView。 - ``` + ```c++ UIImageView* imageView = new UIImageView(); imageView->SetPosition(0, 30); ``` 2. 设置二进制格式的图片。 - ``` + ```c++ imageView->SetSrc("..\\config\\images\\A021_001.bin"); ``` @@ -200,20 +200,20 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 创建一个UIImageView。 - ``` + ```c++ UIImageView* imageView = new UIImageView(); imageView->SetPosition(0, 30); ``` 2. 设置图片。 - ``` + ```c++ imageView->SetSrc("..\\config\\images\\A021_001.bin"); ``` 3. 取消图片自适应,设置图片大小,平铺显示效果。 - ``` + ```c++ imageView->SetAutoEnable(false); imageView->Resize(454, 150); ``` @@ -359,7 +359,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 创建label,设置大小和位置信息。 - ``` + ```c++ UILabel* label = new UILabel(); label->SetPosition(x, y); label->Resize(width, height); @@ -367,13 +367,13 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 2. 设置字形信息。 - ``` + ```c++ label->SetFont("SourceHanSansSC-Regular.otf", 30); ``` 3. 设置文本数据。 - ``` + ```c++ label->SetText("label"); ``` @@ -386,7 +386,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 创建label,设置大小和位置信息。 - ``` + ```c++ UILabel* label = new UILabel(); label->SetPosition(x, y); label->Resize(width, height); @@ -394,13 +394,13 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 2. 设置字形信息。 - ``` + ```c++ label->SetFont("SourceHanSansSC-Regular.otf", 30); ``` 3. 设置背景颜色及透明度效果。 - ``` + ```c++ label->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); label->SetStyle(STYLE_BACKGROUND_OPA, 127); label->SetText("Label"); @@ -415,7 +415,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 创建label,设置大小和位置信息。 - ``` + ```c++ UILabel* label = new UILabel(); label->SetPosition(x, y); label->Resize(width, height); @@ -423,13 +423,13 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 2. 设置字形信息。 - ``` + ```c++ label->SetFont("SourceHanSansSC-Regular.otf", 30); ``` 3. 设置字体颜色和字间距效果。 - ``` + ```c++ label->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); label->SetStyle(STYLE_LETTER_SPACE, 5); label->SetText("Label"); @@ -446,7 +446,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 创建label,设置大小和位置信息。 - ``` + ```c++ UILabel* label = new UILabel(); label->SetPosition(x, y); label->Resize(width, height); @@ -454,13 +454,13 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 2. 设置字形信息。 - ``` + ```c++ label->SetFont("SourceHanSansSC-Regular.otf", 30); ``` 3. 设置字体颜色为Gray,组件大小自适应文本内容。 - ``` + ```c++ label->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); label->SetText("123\n567890"); @@ -477,7 +477,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 创建label,设置大小和位置信息。 - ``` + ```c++ UILabel* label = new UILabel(); label->SetPosition(x, y); label->Resize(width, height); @@ -485,13 +485,13 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 2. 设置字形信息。 - ``` + ```c++ label->SetFont("SourceHanSansSC-Regular.otf", 30); ``` 3. 设置换行模式为DOT模式 - ``` + ```c++ label->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); label->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); label->SetText("123567890"); @@ -508,7 +508,7 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 1. 创建label,设置大小和位置信息。 - ``` + ```c++ UILabel* label = new UILabel(); label->SetPosition(x, y); label->Resize(width, height); @@ -516,13 +516,13 @@ UIButton组件,提供可点击功能,同时可设置不同状态下样式。 2. 设置字形信息。 - ``` + ```c++ label->SetFont("SourceHanSansSC-Regular.otf", 30); ``` 3. 设置换行模式为滚动模式 - ``` + ```c++ label->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); label->SetStyle(STYLE_BACKGROUND_OPA, 127); label->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); diff --git "a/subsystems/\347\233\270\346\234\272\345\274\200\345\217\221\346\246\202\350\277\260.md" "b/subsystems/\347\233\270\346\234\272\345\274\200\345\217\221\346\246\202\350\277\260.md" index ea4bec5af6139bebd5f95dbaa5d21e24dcb20b83..63b65b50d8e4099a9d848733d638de5093f87877 100755 --- "a/subsystems/\347\233\270\346\234\272\345\274\200\345\217\221\346\246\202\350\277\260.md" +++ "b/subsystems/\347\233\270\346\234\272\345\274\200\345\217\221\346\246\202\350\277\260.md" @@ -89,25 +89,21 @@ 图形图像模块也通过Surface从Camera获取流资源,具体步骤详见[图形图像开发指导](图形图像概述.md)。 -- 相机运行流程 - 1. Camera创建流程 +- 相机运行流程 + 1. Camera创建流程 - 本进程通过CameraManager创建Camera实例,并从服务端绑定camera设备,创建成功后异步通知developer。类之间的时序图如下: + 本进程通过CameraManager创建Camera实例,并从服务端绑定camera设备,创建成功后异步通知developer。类之间的时序图如下: - **图 1** Camera创建时序图 - - - ![](figures/zh-cn_image_0000001054101094.png) + **图 1** Camera创建时序图 +![](figures/zh-cn_image_0000001054101094.png) 1. Camera录像/预览流程 - + 开发者首先通过CameraKit创建Camera,然后FrameConfig类对录像或者预览帧属性进行配置。录像/预览时序如下: - + **图 2** Camera录像/预览时序图 - - - ![](figures/zh-cn_image_0000001054421113.png) + ![](figures/zh-cn_image_0000001054421113.png) diff --git "a/subsystems/\351\237\263\350\247\206\351\242\221\345\275\225\345\210\266\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\351\237\263\350\247\206\351\242\221\345\275\225\345\210\266\345\274\200\345\217\221\346\214\207\345\257\274.md" index 887422c16434b77032e6568c877371bb6aaaefc4..001f34717e4adf84f108d1451e071a9d634f497e 100755 --- "a/subsystems/\351\237\263\350\247\206\351\242\221\345\275\225\345\210\266\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\351\237\263\350\247\206\351\242\221\345\275\225\345\210\266\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -226,13 +226,13 @@ 1. 创建Recorder实例。 - ``` + ```c++ Recorder *recorder = new Recorder(); ``` 2. 设置Recorder参数,包括设置音视频源信息,音视频编码格式,采样率,码率,视频宽高等信息。 - ``` + ```c++ int32_t sampleRate = 48000; int32_t channelCount = 1; AudioCodecFormat audioFormat = AAC_LC; @@ -262,19 +262,19 @@ 3. 准备录制,Recorder进行录制前的准备工作。 - ``` + ```c++ recorder->Prepare(); // 准备录制 ``` 4. 开始录制,Recorder会根据设置的音频源和视频源进行录制。 - ``` + ```c++ recorder->Start(); // 开始录制 ``` 5. 结束录制,释放资源。 - ``` + ```c++ recorder->Stop(); // 停止录制 recorder->Release(); // 释放录制资源 ``` diff --git "a/subsystems/\351\237\263\350\247\206\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\351\237\263\350\247\206\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md" index b2bad825d03e99eea53015a11e8556cd6cb0f764..274f05f38bf0b6f18fea35f0c8a4d4a2c8e658e5 100755 --- "a/subsystems/\351\237\263\350\247\206\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\351\237\263\350\247\206\351\242\221\346\222\255\346\224\276\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -294,9 +294,28 @@ ## 开发步骤 -1. 实现PlayerCallback回调,通过SetPlayerCallback函数进行绑定,用于事件处理。 +1. 实现PlayerCallback回调,通过SetPlayerCallback函数进行绑定,用于事件处理。 - ``` + ```c++ +<<<<<<< HEAD + class TestPlayerCallback : public PlayerCallback{ + void OnPlaybackComplete() override + { + //此处实现代码用于处理文件播放完成的事件 + } + void OnError(int32_t errorType, int32_t errorCode) override + { + //此处实现代码处理错误事件 + } + void OnInfo(int type, int extra) override + { + //此处实现代码处理普通事件 + } + void OnRewindToComplete() override + { + //此处实现代码处理进度控制完成的事件 + } +======= class TestPlayerCallback : public PlayerCallback{ void OnPlaybackComplete() override { @@ -314,13 +333,13 @@ { //此处实现代码处理进度控制完成的事件 } +>>>>>>> e9c42d63d4344e99bafce5d1103487fb08edd7b5 }; - ``` -2. 创建Player实例,设置播放源并开始播放。 +2. 创建Player实例,设置播放源并开始播放。 - ``` + ```c++ Player *player = new Player(); std::shared_ptr callback = std::make_shared(); player->SetPlayerCallback(callback);//设置player回调 @@ -332,20 +351,18 @@ player->Play();//开始播放 ``` -3. 根据场景需要进行播放控制。 +3. 根据场景需要进行播放控制。 - ``` + ```c++ player->SetVolume(lvolume, rvolume);//设置左右声道声音 player->EnableSingleLooping(true);//设置循环播放 player->Pause();//暂停 player->Play();//继续播放 ``` -4. 播放任务结束后,进行资源释放。 +4. 播放任务结束后,进行资源释放。 - ``` + ```c++ player->Stop(); //停止播放 player->Release();//释放资源 ``` - - diff --git "a/subsystems/\351\242\204\350\247\210\345\274\200\345\217\221\346\214\207\345\257\274.md" "b/subsystems/\351\242\204\350\247\210\345\274\200\345\217\221\346\214\207\345\257\274.md" index 31636ddf8df8499514b520f8597c000c4138fbcb..556a9c72e1effb4c3e1dbc869591056e3e0db3e6 100755 --- "a/subsystems/\351\242\204\350\247\210\345\274\200\345\217\221\346\214\207\345\257\274.md" +++ "b/subsystems/\351\242\204\350\247\210\345\274\200\345\217\221\346\214\207\345\257\274.md" @@ -17,7 +17,7 @@ 1. 参考“拍照开发指导”中步骤1、步骤2、步骤3、步骤4。 2. 设置预览显示的区域。 - ``` + ```c++ Surface *surface = Surface::CreateSurface(); /* 设置显示区域 */ surface->SetUserData("region_position_x", "480"); // 矩形左上角横坐标 @@ -30,7 +30,7 @@ 3. 开始和结束预览。 - ``` + ```c++ stateCallback->camera_->TriggerLoopingCapture(*fc); // start previewing stateCallback->camera_->StopLoopingCapture(); // stop previewing ``` diff --git "a/term/\346\234\257\350\257\255.md" "b/term/\346\234\257\350\257\255.md" index 4a23d8a8d7e25d608f98f5a962da74a22c7e9cc9..94536f8c4ad22b871a13ffad21a0a164dadcbf4e 100755 --- "a/term/\346\234\257\350\257\255.md" +++ "b/term/\346\234\257\350\257\255.md" @@ -2,112 +2,97 @@ ## A -- **Ability** +- **Ability** 应用的重要组成部分,是应用所具备能力的抽象。Ability分为两种类型,Feature Ability和Particle Ability。 - -- **AbilityForm** +- **AbilityForm** 表单,是Feature Ability的一种界面展示形式,用于嵌入到其他应用中并作为其界面的一部分显示,并支持基础的交互功能。 - -- **AbilitySlice** +- **AbilitySlice** 切片,是单个可视化界面及其交互逻辑的总和,是Feature Ability的组成单元。一个Feature Ability可以包含一组业务关系密切的可视化界面,每一个可视化界面对应一个AbilitySlice。 -- **ACE** +- **ACE** Ability Crossplatform Environment,跨平台元能力运行环境。 -- **AMS** +- **AMS** Ability Manager Service,元能力管理服务。 - ## B -- **BMS** +- **BMS** Bundle Manager Service,包管理服务。 - ## D -- **DevEco Studio for Embedded** +- **DevEco Studio for Embedded** 嵌入式设备开发IDE。 -- **DMS** +- **DMS** Distributed Manager Service,分布式管理服务。 -- **DV** +- **DV** Device Virtualization,设备虚拟化,通过虚拟化技术可以实现不同设备的能力和资源融合。 - ## F -- **FA** +- **FA** Feature Ability,元程序,代表有界面的Ability,用于与用户进行交互。 - ## H -- **HAP** +- **HAP** HarmonyOS Ability Package,一个HAP文件包含应用的所有内容,由代码、资源、三方库及应用配置文件组成,其文件后缀名为.hap。 -- **HCS** +- **HCS** HDF Configuration Source是HDF驱动框架的配置描述语言,是为了实现配置代码与驱动代码解耦,以及便于配置的管理而设计的一种Key-Value为主体的文本格式。 - -- **HC-GEN** +- **HC-GEN** HDF Configuration Generator是将配置文本转换为最终目标的工具,在HarmonyOS内核环境中可以将配置文件生成C语言的配置树源码,驱动通过直接调用C代码获取配置。 - -- **HDF** +- **HDF** HarmonyOS Driver Foundation,HarmonyOS驱动框架,提供统一外设访问能力和驱动开发、管理框架。 - ## I -- **IDN** +- **IDN** Intelligent Distributed Networking,是HarmonyOS特有的分布式组网能力单元。开发者可以通过IDN获取分布式网络内的设备列表以及注册分布式网络内设备在网状态变化信息。 - ## M -- **MSDP** +- **MSDP** Mobile Sensing Development Platform,移动感知平台。MSDP子系统提供两类核心能力:分布式融合感知和分布式设备虚拟化两大部分。 - - 分布式融合感知:借助HarmonyOS分布式能力,将各设备感知源进行汇总融合,对用户的空间状态、移动状态、手势、健康状态等进行精准感知,构建全场景泛在基础感知能力,支撑智慧生活新体验。 - - 分布式器件虚拟化:借助HarmonyOS分布式能力,构筑器件虚拟化平台,将外部设备的各类器件(如Camera、显示器、SPK/MIC等)虚拟化为本地设备的器件延伸使用。同时具备将自身器件共享给其他设备使用的能力。 - + - 分布式融合感知:借助HarmonyOS分布式能力,将各设备感知源进行汇总融合,对用户的空间状态、移动状态、手势、健康状态等进行精准感知,构建全场景泛在基础感知能力,支撑智慧生活新体验。 + - 分布式器件虚拟化:借助HarmonyOS分布式能力,构筑器件虚拟化平台,将外部设备的各类器件(如Camera、显示器、SPK/MIC等)虚拟化为本地设备的器件延伸使用。同时具备将自身器件共享给其他设备使用的能力。 ## P -- **PA** +- **PA** Particle Ability,元服务,代表无界面的Ability,主要为Feature Ability提供支持,例如作为后台服务提供计算能力,或作为数据仓库提供数据访问能力。 - ## S -- **SA** +- **SA** System Ability,即系统能力,是由OS提供的基础软件服务和硬件服务。 - -- **Super virtual device,超级虚拟终端** +- **Super virtual device,超级虚拟终端** 亦称超级终端,通过分布式技术将多个终端的能力进行整合,存放在一个虚拟的硬件资源池里,根据业务需要统一管理和调度终端能力,来对外提供服务。 - -