提交 86673b15 编写于 作者: N NEEN

!134 Docs Update 0924

* Description: update docs 0924
上级 03766390
文件模式从 100755 更改为 100644
# 组件开发
- [组件开发指南](组件开发指南.md)
- [概述](概述.md)
- [准备工作](准备工作.md)
- [组件开发](组件开发.md)
- [组件开发规范](组件开发规范.md)
- [概述](概述-0.md)
- [概述](概述.md)
- [组件构成](组件构成.md)
- [组件管理](组件管理.md)
- [组件版本](组件版本.md)
- [发行版](发行版.md)
- [环境变量说明](环境变量说明.md)
- [组件开发指南](组件开发指南.md)
- [概述](概述-0.md)
- [准备工作](准备工作.md)
- [组件开发](组件开发.md)
......@@ -54,15 +54,15 @@ login = https://hpm.harmonyos.com/hpm/auth/pk # hpm处理
loginUser = {your-account} # 配置hpm登录账号,发布组件必须
shellPath = C:\WINDOWS\System32\cmd.exe # hpm命令执行使用的shell
globalRepo = C:\Users\yourname\.global # 配置全局安装的组件存放路径
http_proxy = http://your-proxy-server:port # 配置HTTP代理
https_proxy = http://your-proxy-server:port # 配置HTTPS代理
http_proxy = http://your-proxy-server:port # 配置HTTP代理
https_proxy = http://your-proxy-server:port # 配置HTTPS代理
```
hpm-cli的命令介绍可以参考:[hpm操作命令](组件管理.md#table10510164515371)
## 下载OpenHarmony代码<a name="section102338221707"></a>
参考[《源码获取》](zh-cn_topic_0000001050769927.md)
参考[《源码获取》](../get-code/源码获取.md)
## 安装开发依赖的组件<a name="section19233183315020"></a>
......
# 概述<a name="ZH-CN_TOPIC_0000001051452141"></a>
本文档将介绍组件的基本概念以及如何按照规范定义组件。
## 定义<a name="section177563344911"></a>
OpenHarmony软件以组件\(bundle\)作为基本单元,从系统角度看,凡是运行在OpenHarmony上的软件都可以定义为组件;一般来讲,根据组件的应用范围,可以分为:
- 板级组件:如board、arch、mcu这些与设备硬件相关的组件。
- 系统组件:一组独立功能的集合,如内核、文件系统、框架等。
- 应用组件:直接面向用户提供服务的应用\(如wifi\_iot,ip\_camera\)
从形式上看,组件是为复用而生,一切可以复用的模块都可以定义为组件,可以分为:
- 源代码
- 二进制
- 代码片段
- 发行版
## 组件划分原则<a name="section2487162541016"></a>
原则上应尽可能划分为细颗粒度的组件,以满足最大限度的复用。主要考虑以下几点:
- 独立性:组件的功能应该相对独立,支持独立编译,可以单独对外提供接口和服务;
- 耦合性:如果组件必须依赖其他的组件,才能对外提供服务,应考虑和被依赖的组件合并为一个组件。
- 相关性:如果一组组件共同完成一项功能,且没有被其他组件依赖,未来也没有被依赖的可能,则可以考虑合并为一个组件。
## 组件依赖<a name="section185955409107"></a>
组件的依赖关系分为两种:必选依赖和可选依赖。
- 必选依赖:是指组件A在完成某个功能时,必须引入组件B,调用B的接口或服务配合才能完成。称B为A的必选依赖。
- 可选依赖:是在组件A在完成某个功能时,可以引入组件C,也可以引入组件D。C和D可以相互替换,称C和D为A的可选依赖。
# 概述<a name="ZH-CN_TOPIC_0000001051452100"></a>
本章节将简要介绍如何开发OpenHarmony组件和发行版,并通过命令行工具方式完成组件创建、开发、编译、烧录、调试等开发过程。
- 一个组件(bundle)通常和一个代码仓库对应,在代码的基础上增加bundle.json、README文件、LICENSE描述文件。
- 一个发行版(distribution)是由多个组件构成的。发行版中集合了一个完整系统的各种组件(如驱动、内核、框架、应用),可以用于设备的烧录。
**表 1** 组件和发行版的差异对比
<a name="table6287133615412"></a>
<table><thead align="left"><tr id="row17288183614415"><th class="cellrowborder" valign="top" width="16.24162416241624%" id="mcps1.2.4.1.1"><p id="p528818361545"><a name="p528818361545"></a><a name="p528818361545"></a>异同点</p>
</th>
<th class="cellrowborder" valign="top" width="33.31333133313331%" id="mcps1.2.4.1.2"><p id="p1288836247"><a name="p1288836247"></a><a name="p1288836247"></a>组件</p>
</th>
<th class="cellrowborder" valign="top" width="50.44504450445044%" id="mcps1.2.4.1.3"><p id="p112885362418"><a name="p112885362418"></a><a name="p112885362418"></a>发行版</p>
</th>
</tr>
</thead>
<tbody><tr id="row1728813361848"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p2010613564815"><a name="p2010613564815"></a><a name="p2010613564815"></a>应用场景</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p1910555184818"><a name="p1910555184818"></a><a name="p1910555184818"></a>面向功能特性开发</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p13871955484"><a name="p13871955484"></a><a name="p13871955484"></a>面向系统开发</p>
</td>
</tr>
<tr id="row676745614472"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p1028816365414"><a name="p1028816365414"></a><a name="p1028816365414"></a>内容</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p428812361042"><a name="p428812361042"></a><a name="p428812361042"></a>功能或特性的实现代码或二进制库</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p328817366417"><a name="p328817366417"></a><a name="p328817366417"></a>依赖的组件清单及编译构建脚本</p>
</td>
</tr>
<tr id="row95114356"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p184894513517"><a name="p184894513517"></a><a name="p184894513517"></a>完整程度</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p1951741155"><a name="p1951741155"></a><a name="p1951741155"></a>操作系统的一部分</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p20521542512"><a name="p20521542512"></a><a name="p20521542512"></a>一个完整操作系统版本</p>
</td>
</tr>
<tr id="row13581419518"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p859171059"><a name="p859171059"></a><a name="p859171059"></a>编译后结果</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p259201355"><a name="p259201355"></a><a name="p259201355"></a>组件包</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p459414519"><a name="p459414519"></a><a name="p459414519"></a>系统镜像</p>
</td>
</tr>
</tbody>
</table>
**图 1** 组件和发行版的构成<a name="fig85033524124"></a>
![](figures/zh-cn_image_0000001054663940.png)
# 概述<a name="ZH-CN_TOPIC_0000001051452100"></a>
本章节将简要介绍如何开发OpenHarmony组件和发行版,并通过命令行工具方式完成组件创建、开发、编译、烧录、调试等开发过程。
- 一个组件(bundle)通常和一个代码仓库对应,在代码的基础上增加bundle.json、README文件、LICENSE描述文件。
- 一个发行版(distribution)是由多个组件构成的。发行版中集合了一个完整系统的各种组件(如驱动、内核、框架、应用),可以用于设备的烧录。
**表 1** 组件和发行版的差异对比
<a name="table6287133615412"></a>
<table><thead align="left"><tr id="row17288183614415"><th class="cellrowborder" valign="top" width="16.24162416241624%" id="mcps1.2.4.1.1"><p id="p528818361545"><a name="p528818361545"></a><a name="p528818361545"></a>异同点</p>
</th>
<th class="cellrowborder" valign="top" width="33.31333133313331%" id="mcps1.2.4.1.2"><p id="p1288836247"><a name="p1288836247"></a><a name="p1288836247"></a>组件</p>
</th>
<th class="cellrowborder" valign="top" width="50.44504450445044%" id="mcps1.2.4.1.3"><p id="p112885362418"><a name="p112885362418"></a><a name="p112885362418"></a>发行版</p>
</th>
</tr>
</thead>
<tbody><tr id="row1728813361848"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p2010613564815"><a name="p2010613564815"></a><a name="p2010613564815"></a>应用场景</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p1910555184818"><a name="p1910555184818"></a><a name="p1910555184818"></a>面向功能特性开发</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p13871955484"><a name="p13871955484"></a><a name="p13871955484"></a>面向系统开发</p>
</td>
</tr>
<tr id="row676745614472"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p1028816365414"><a name="p1028816365414"></a><a name="p1028816365414"></a>内容</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p428812361042"><a name="p428812361042"></a><a name="p428812361042"></a>功能或特性的实现代码或二进制库</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p328817366417"><a name="p328817366417"></a><a name="p328817366417"></a>依赖的组件清单及编译构建脚本</p>
</td>
</tr>
<tr id="row95114356"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p184894513517"><a name="p184894513517"></a><a name="p184894513517"></a>完整程度</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p1951741155"><a name="p1951741155"></a><a name="p1951741155"></a>操作系统的一部分</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p20521542512"><a name="p20521542512"></a><a name="p20521542512"></a>一个完整操作系统版本</p>
</td>
</tr>
<tr id="row13581419518"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p859171059"><a name="p859171059"></a><a name="p859171059"></a>编译后结果</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p259201355"><a name="p259201355"></a><a name="p259201355"></a>组件包</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p459414519"><a name="p459414519"></a><a name="p459414519"></a>系统镜像</p>
</td>
</tr>
</tbody>
</table>
**图 1** 组件和发行版的构成<a name="fig85033524124"></a>
![](figures/zh-cn_image_0000001054663940.png)
# 概述<a name="ZH-CN_TOPIC_0000001051452141"></a>
本文档将介绍组件的基本概念以及如何按照规范定义组件。
## 定义<a name="section177563344911"></a>
OpenHarmony软件以组件\(bundle\)作为基本单元,从系统角度看,凡是运行在OpenHarmony上的软件都可以定义为组件;一般来讲,根据组件的应用范围,可以分为:
- 板级组件:如board、arch、mcu这些与设备硬件相关的组件。
- 系统组件:一组独立功能的集合,如内核、文件系统、框架等。
- 应用组件:直接面向用户提供服务的应用\(如wifi\_iot,ip\_camera\)
从形式上看,组件是为复用而生,一切可以复用的模块都可以定义为组件,可以分为:
- 源代码
- 二进制
- 代码片段
- 发行版
## 组件划分原则<a name="section2487162541016"></a>
原则上应尽可能划分为细颗粒度的组件,以满足最大限度的复用。主要考虑以下几点:
- 独立性:组件的功能应该相对独立,支持独立编译,可以单独对外提供接口和服务;
- 耦合性:如果组件必须依赖其他的组件,才能对外提供服务,应考虑和被依赖的组件合并为一个组件。
- 相关性:如果一组组件共同完成一项功能,且没有被其他组件依赖,未来也没有被依赖的可能,则可以考虑合并为一个组件。
## 组件依赖<a name="section185955409107"></a>
组件的依赖关系分为两种:必选依赖和可选依赖。
- 必选依赖:是指组件A在完成某个功能时,必须引入组件B,调用B的接口或服务配合才能完成。称B为A的必选依赖。
- 可选依赖:是在组件A在完成某个功能时,可以引入组件C,也可以引入组件D。C和D可以相互替换,称C和D为A的可选依赖。
# 组件开发指南<a name="ZH-CN_TOPIC_0000001053617944"></a>
- **[概述](概述.md)**
- **[概述](概述-0.md)**
- **[准备工作](准备工作.md)**
......
# 组件开发规范<a name="ZH-CN_TOPIC_0000001053017947"></a>
- **[概述](概述-0.md)**
- **[概述](概述.md)**
- **[组件构成](组件构成.md)**
......
......@@ -214,14 +214,14 @@ hpm dependencies
</td>
<td class="cellrowborder" valign="top" width="30.623062306230626%" headers="mcps1.2.4.1.2 "><p id="p9291492204"><a name="p9291492204"></a><a name="p9291492204"></a>hpm gen-keys</p>
</td>
<td class="cellrowborder" valign="top" width="48.42484248424842%" headers="mcps1.2.4.1.3 "><p id="p429249182012"><a name="p429249182012"></a><a name="p429249182012"></a>生成公钥/私钥对,将公钥配置到HPM服务端,可以实现hpm-cli</p>
<td class="cellrowborder" valign="top" width="48.42484248424842%" headers="mcps1.2.4.1.3 "><p id="p429249182012"><a name="p429249182012"></a><a name="p429249182012"></a>生成公钥/私钥对,将公钥配置到HPM服务端,可以实现hpm-cli 免密登录,发布组件。</p>
</td>
</tr>
<tr id="row3556450102011"><td class="cellrowborder" valign="top" width="20.95209520952095%" headers="mcps1.2.4.1.1 "><p id="p35561850172015"><a name="p35561850172015"></a><a name="p35561850172015"></a>生成第三方开源说明</p>
</td>
<td class="cellrowborder" valign="top" width="30.623062306230626%" headers="mcps1.2.4.1.2 "><p id="p1155625018209"><a name="p1155625018209"></a><a name="p1155625018209"></a>hpm gen-notice</p>
</td>
<td class="cellrowborder" valign="top" width="48.42484248424842%" headers="mcps1.2.4.1.3 "><p id="p11557175015205"><a name="p11557175015205"></a><a name="p11557175015205"></a>根据每个组件的说明,生成一份合并后的第三方开源说明的合并文件</p>
<td class="cellrowborder" valign="top" width="48.42484248424842%" headers="mcps1.2.4.1.3 "><p id="p11557175015205"><a name="p11557175015205"></a><a name="p11557175015205"></a>根据每个组件的说明,生成一份合并后的第三方开源说明的合并文件</p>
</td>
</tr>
</tbody>
......
此差异已折叠。
此差异已折叠。
# Bundle Development
- [Development Guidelines](development-guidelines.md)
- [Overview](overview.md)
- [Preparations](preparations.md)
- [Bundle Development](bundle-development.md)
- [Development Specifications](development-specifications.md)
- [Overview](overview-0.md)
- [Overview](overview.md)
- [Bundle Composition](bundle-composition.md)
- [Bundle Management](bundle-management.md)
- [Bundle Version](bundle-version.md)
- [Distribution](distribution.md)
- [Environment Variables](environment-variables.md)
- [Development Guidelines](development-guidelines.md)
- [Overview](overview-0.md)
- [Preparations](preparations.md)
- [Bundle Development](bundle-development.md)
......@@ -214,7 +214,7 @@ You can use the hpm-cli tool to manage the lifecycle of a bundle. The following
</td>
<td class="cellrowborder" valign="top" width="30.623062306230626%" headers="mcps1.2.4.1.2 "><p id="p9291492204"><a name="p9291492204"></a><a name="p9291492204"></a>hpm gen-keys</p>
</td>
<td class="cellrowborder" valign="top" width="48.42484248424842%" headers="mcps1.2.4.1.3 "><p id="p429249182012"><a name="p429249182012"></a><a name="p429249182012"></a>Generates a public-private key pair and configures the public key on the hpm server to enable <strong id="b139191811163315"><a name="b139191811163315"></a><a name="b139191811163315"></a>hpm-cli</strong>.</p>
<td class="cellrowborder" valign="top" width="48.42484248424842%" headers="mcps1.2.4.1.3 "><p id="p429249182012"><a name="p429249182012"></a><a name="p429249182012"></a>Generates a public-private key pair and configures the public key on the hpm server, achieving password-free <strong id="b139191811163315"><a name="b139191811163315"></a><a name="b139191811163315"></a>hpm-cli</strong> login for bundle publishing.</p>
</td>
</tr>
<tr id="row3556450102011"><td class="cellrowborder" valign="top" width="20.95209520952095%" headers="mcps1.2.4.1.1 "><p id="p35561850172015"><a name="p35561850172015"></a><a name="p35561850172015"></a>Generating third-party open source notice</p>
......
# Development Guidelines<a name="EN-US_TOPIC_0000001053617944"></a>
- **[Overview](overview.md)**
- **[Overview](overview-0.md)**
- **[Preparations](preparations.md)**
......
# Development Specifications<a name="EN-US_TOPIC_0000001053017947"></a>
- **[Overview](overview-0.md)**
- **[Overview](overview.md)**
- **[Bundle Composition](bundle-composition.md)**
......
# Overview<a name="EN-US_TOPIC_0000001051452141"></a>
This document describes the basic concepts of a bundle and how to define it in compliance with specifications.
## Definition<a name="section177563344911"></a>
OpenHarmony software is developed on a per-bundle basis. In terms of the operating system, all software running on OpenHarmony are bundles. Generally, bundles are classified into the following types based on their application scopes:
- Board-level bundles: device hardware-specific bundles, such as **board**, **arch**, and **mcu**
- System-level bundles: a set of bundles with independent features, such as the kernel, file system, and framework
- Application-level bundles: applications that provide services to users, such as **wifi\_iot** and **ip\_camera**
Bundles are designed for the reuse purpose. Any reusable modules can be defined as bundles. They are classified into the following types based on their forms:
- Source code
- Binary system
- Code snippet
- Distribution
## Bundle Division Principles<a name="section2487162541016"></a>
In principle, bundles should be grouped at a fine-grained granularity as much as possible to achieve maximum reuse. The following factors are taken into account regarding bundle division:
- Independence: Bundles provide relatively independent features and can be independently compiled. Each of them is capable of providing its own APIs and services for external systems.
- Coupling: If a bundle must depend on another bundle to provide services, they can be coupled to one bundle.
- Correlation: If a group of bundles jointly implement a feature, and if other bundles never depend on them, the group of bundles can be combined into one bundle.
## Bundle Dependency<a name="section185955409107"></a>
A bundle dependency can be mandatory or optional.
- Mandatory dependency: If bundle A must depend on bundle B to implement a feature, that is, the APIs or services specific to bundle B must be invoked, then bundle B is defined as the mandatory dependency of bundle A.
- Optional dependency: If either bundle C or bundle D is required for bundle A to implement a feature, and if bundle C and bundle D are interchangeable, then bundle C and bundle D are defined as optional dependencies of bundle A.
# Overview<a name="EN-US_TOPIC_0000001051452100"></a>
This document describes how to develop OpenHarmony bundles and distributions, and how to create, develop, and build code, as well as burn and debug devices by using a command line tool.
- A bundle usually maps onto a code repository, which is a code archive with the **bundle.json**, **README**, and **LICENSE** files.
- A distribution consists of multiple bundles. Each distribution integrates various bundles of a comprehensive system, such as the driver, kernel, framework, and applications. These bundles can be used for device burning.
**Table 1** Differences between a bundle and a distribution
<a name="table6287133615412"></a>
<table><thead align="left"><tr id="row17288183614415"><th class="cellrowborder" valign="top" width="16.24162416241624%" id="mcps1.2.4.1.1"><p id="p528818361545"><a name="p528818361545"></a><a name="p528818361545"></a>Aspect</p>
</th>
<th class="cellrowborder" valign="top" width="33.31333133313331%" id="mcps1.2.4.1.2"><p id="p1288836247"><a name="p1288836247"></a><a name="p1288836247"></a>Bundle</p>
</th>
<th class="cellrowborder" valign="top" width="50.44504450445044%" id="mcps1.2.4.1.3"><p id="p112885362418"><a name="p112885362418"></a><a name="p112885362418"></a>Distribution</p>
</th>
</tr>
</thead>
<tbody><tr id="row1728813361848"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p2010613564815"><a name="p2010613564815"></a><a name="p2010613564815"></a>Application scenario</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p1910555184818"><a name="p1910555184818"></a><a name="p1910555184818"></a>Feature-oriented</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p13871955484"><a name="p13871955484"></a><a name="p13871955484"></a>System-oriented</p>
</td>
</tr>
<tr id="row676745614472"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p1028816365414"><a name="p1028816365414"></a><a name="p1028816365414"></a>Content</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p428812361042"><a name="p428812361042"></a><a name="p428812361042"></a>Codes or a binary library for implementing features</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p328817366417"><a name="p328817366417"></a><a name="p328817366417"></a>List of dependent bundles as well as their compiling and building scripts</p>
</td>
</tr>
<tr id="row95114356"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p184894513517"><a name="p184894513517"></a><a name="p184894513517"></a>Integrity</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p1951741155"><a name="p1951741155"></a><a name="p1951741155"></a>A part of the operating system</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p20521542512"><a name="p20521542512"></a><a name="p20521542512"></a>An entire operating system</p>
</td>
</tr>
<tr id="row13581419518"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p859171059"><a name="p859171059"></a><a name="p859171059"></a>Compilation result</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p259201355"><a name="p259201355"></a><a name="p259201355"></a>Bundles</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p459414519"><a name="p459414519"></a><a name="p459414519"></a>System image</p>
</td>
</tr>
</tbody>
</table>
**Figure 1** Composition of bundles and distributions<a name="fig85033524124"></a>
![](figures/en-us_image_0000001054663940.png)
# Overview<a name="EN-US_TOPIC_0000001051452100"></a>
This document describes how to develop OpenHarmony bundles and distributions, and how to create, develop, and build code, as well as burn and debug devices by using a command line tool.
- A bundle usually maps onto a code repository, which is a code archive with the **bundle.json**, **README**, and **LICENSE** files.
- A distribution consists of multiple bundles. Each distribution integrates various bundles of a comprehensive system, such as the driver, kernel, framework, and applications. These bundles can be used for device burning.
**Table 1** Differences between a bundle and a distribution
<a name="table6287133615412"></a>
<table><thead align="left"><tr id="row17288183614415"><th class="cellrowborder" valign="top" width="16.24162416241624%" id="mcps1.2.4.1.1"><p id="p528818361545"><a name="p528818361545"></a><a name="p528818361545"></a>Aspect</p>
</th>
<th class="cellrowborder" valign="top" width="33.31333133313331%" id="mcps1.2.4.1.2"><p id="p1288836247"><a name="p1288836247"></a><a name="p1288836247"></a>Bundle</p>
</th>
<th class="cellrowborder" valign="top" width="50.44504450445044%" id="mcps1.2.4.1.3"><p id="p112885362418"><a name="p112885362418"></a><a name="p112885362418"></a>Distribution</p>
</th>
</tr>
</thead>
<tbody><tr id="row1728813361848"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p2010613564815"><a name="p2010613564815"></a><a name="p2010613564815"></a>Application scenario</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p1910555184818"><a name="p1910555184818"></a><a name="p1910555184818"></a>Feature-oriented</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p13871955484"><a name="p13871955484"></a><a name="p13871955484"></a>System-oriented</p>
</td>
</tr>
<tr id="row676745614472"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p1028816365414"><a name="p1028816365414"></a><a name="p1028816365414"></a>Content</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p428812361042"><a name="p428812361042"></a><a name="p428812361042"></a>Codes or a binary library for implementing features</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p328817366417"><a name="p328817366417"></a><a name="p328817366417"></a>List of dependent bundles as well as their compiling and building scripts</p>
</td>
</tr>
<tr id="row95114356"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p184894513517"><a name="p184894513517"></a><a name="p184894513517"></a>Integrity</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p1951741155"><a name="p1951741155"></a><a name="p1951741155"></a>A part of the operating system</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p20521542512"><a name="p20521542512"></a><a name="p20521542512"></a>An entire operating system</p>
</td>
</tr>
<tr id="row13581419518"><td class="cellrowborder" valign="top" width="16.24162416241624%" headers="mcps1.2.4.1.1 "><p id="p859171059"><a name="p859171059"></a><a name="p859171059"></a>Compilation result</p>
</td>
<td class="cellrowborder" valign="top" width="33.31333133313331%" headers="mcps1.2.4.1.2 "><p id="p259201355"><a name="p259201355"></a><a name="p259201355"></a>Bundles</p>
</td>
<td class="cellrowborder" valign="top" width="50.44504450445044%" headers="mcps1.2.4.1.3 "><p id="p459414519"><a name="p459414519"></a><a name="p459414519"></a>System image</p>
</td>
</tr>
</tbody>
</table>
**Figure 1** Composition of bundles and distributions<a name="fig85033524124"></a>
![](figures/en-us_image_0000001054663940.png)
# Overview<a name="EN-US_TOPIC_0000001051452141"></a>
This document describes the basic concepts of a bundle and how to define it in compliance with specifications.
## Definition<a name="section177563344911"></a>
OpenHarmony software is developed on a per-bundle basis. In terms of the operating system, all software running on OpenHarmony are bundles. Generally, bundles are classified into the following types based on their application scopes:
- Board-level bundles: device hardware-specific bundles, such as **board**, **arch**, and **mcu**
- System-level bundles: a set of bundles with independent features, such as the kernel, file system, and framework
- Application-level bundles: applications that provide services to users, such as **wifi\_iot** and **ip\_camera**
Bundles are designed for the reuse purpose. Any reusable modules can be defined as bundles. They are classified into the following types based on their forms:
- Source code
- Binary system
- Code snippet
- Distribution
## Bundle Division Principles<a name="section2487162541016"></a>
In principle, bundles should be grouped at a fine-grained granularity as much as possible to achieve maximum reuse. The following factors are taken into account regarding bundle division:
- Independence: Bundles provide relatively independent features and can be independently compiled. Each of them is capable of providing its own APIs and services for external systems.
- Coupling: If a bundle must depend on another bundle to provide services, they can be coupled to one bundle.
- Correlation: If a group of bundles jointly implement a feature, and if other bundles never depend on them, the group of bundles can be combined into one bundle.
## Bundle Dependency<a name="section185955409107"></a>
A bundle dependency can be mandatory or optional.
- Mandatory dependency: If bundle A must depend on bundle B to implement a feature, that is, the APIs or services specific to bundle B must be invoked, then bundle B is defined as the mandatory dependency of bundle A.
- Optional dependency: If either bundle C or bundle D is required for bundle A to implement a feature, and if bundle C and bundle D are interchangeable, then bundle C and bundle D are defined as optional dependencies of bundle A.
......@@ -54,15 +54,15 @@ login = https://hpm.harmonyos.com/hpm/auth/pk # Configure t
loginUser = {your-account} # Configure the account for HPM login, mandatory for publishing bundles.
shellPath = C:\WINDOWS\System32\cmd.exe # Configure the shell for running HPM commands.
globalRepo = C:\Users\yourname\.global # Configure the path for storing bundles that are installed globally.
http_proxy = http://your-proxy-server:port # Configure the HTTP proxy.
https_proxy = http://your-proxy-server:port # Configure the HTTPS proxy.
http_proxy = http://your-proxy-server:port # Configure the HTTP proxy.
https_proxy = http://your-proxy-server:port # Configure the HTTPS proxy.
```
For details about **hpm-cli** commands, see [HPM Commands](bundle-management.md#table10510164515371).
## Downloading OpenHarmony Code<a name="section102338221707"></a>
For details, see [Source Code Acquisition](../get-code/source-code-acquisition.md).
For details, see .
## Installing Dependent Bundles<a name="section19233183315020"></a>
......
此差异已折叠。
......@@ -47,7 +47,7 @@ You can download the source code or the corresponding solutions from the image l
</td>
<td class="cellrowborder" valign="top" width="24.759999999999998%" headers="mcps1.2.5.1.3 "><p id="p592912312511"><a name="p592912312511"></a><a name="p592912312511"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/wifiiot-1.0.tar.gz" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="34.1%" headers="mcps1.2.5.1.4 "><p id="p199296318252"><a name="p199296318252"></a><a name="p199296318252"></a><a href="http://tools.harmonyos.com/mirrors/os/1.0/wifiiot-1.0.tar.gz.sha256" target="_blank" rel="noopener noreferrer">SHA-256 Verification Code</a></p>
<td class="cellrowborder" valign="top" width="34.1%" headers="mcps1.2.5.1.4 "><p id="p199296318252"><a name="p199296318252"></a><a name="p199296318252"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/wifiiot-1.0.tar.gz.sha256" target="_blank" rel="noopener noreferrer">SHA-256 Verification Code</a></p>
</td>
</tr>
<tr id="row1293014352510"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.1 "><p id="p692917311258"><a name="p692917311258"></a><a name="p692917311258"></a>Hi3518 solutions (binary)</p>
......@@ -234,7 +234,7 @@ Add the bundle \(**@ohos/demo** as an example\) to your project as follows:
Method 1 \(recommended\): Use the **repo** tool to download source code.
```
repo init -u https://gitee.com/openharmony/manifest.git -b master
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
```
......
......@@ -2,64 +2,76 @@
## Acquiring Compilation Toolchain<a name="section18750162432511"></a>
Download the compilation toolchain from image sites listed in the following table. For details about how to install the compilation toolchain, see the **Environment Setup** section in **Getting Started** of the specific development guide.
The following table lists the compilation toolchain downloaded from an image site. For details about how to download and install all compilation tools, see the **Environment Setup** section in **Getting Started** of the specific development board.
**Table 1** Acquiring compilation toolchain
<a name="table167961324122511"></a>
<table><thead align="left"><tr id="row87941124202517"><th class="cellrowborder" valign="top" width="11.25%" id="mcps1.2.5.1.1"><p id="p77943248257"><a name="p77943248257"></a><a name="p77943248257"></a>Content</p>
<table><thead align="left"><tr id="row87941124202517"><th class="cellrowborder" valign="top" width="16.35%" id="mcps1.2.6.1.1"><p id="p12231193484318"><a name="p12231193484318"></a><a name="p12231193484318"></a>Development Board</p>
</th>
<th class="cellrowborder" valign="top" width="13.74%" id="mcps1.2.5.1.2"><p id="p879422415251"><a name="p879422415251"></a><a name="p879422415251"></a>Version Information</p>
<th class="cellrowborder" valign="top" width="10.93%" id="mcps1.2.6.1.2"><p id="p77943248257"><a name="p77943248257"></a><a name="p77943248257"></a>Content</p>
</th>
<th class="cellrowborder" valign="top" width="13.71%" id="mcps1.2.5.1.3"><p id="p1379420242252"><a name="p1379420242252"></a><a name="p1379420242252"></a>Site</p>
<th class="cellrowborder" valign="top" width="8.08%" id="mcps1.2.6.1.3"><p id="p879422415251"><a name="p879422415251"></a><a name="p879422415251"></a>Version Information</p>
</th>
<th class="cellrowborder" valign="top" width="61.3%" id="mcps1.2.5.1.4"><p id="p479442462518"><a name="p479442462518"></a><a name="p479442462518"></a>SHA-256 Verification Code</p>
<th class="cellrowborder" valign="top" width="7.95%" id="mcps1.2.6.1.4"><p id="p1379420242252"><a name="p1379420242252"></a><a name="p1379420242252"></a>Site</p>
</th>
<th class="cellrowborder" valign="top" width="56.69%" id="mcps1.2.6.1.5"><p id="p479442462518"><a name="p479442462518"></a><a name="p479442462518"></a>SHA-256 Verification Code</p>
</th>
</tr>
</thead>
<tbody><tr id="row47957244255"><td class="cellrowborder" valign="top" width="11.25%" headers="mcps1.2.5.1.1 "><p id="p20794162412258"><a name="p20794162412258"></a><a name="p20794162412258"></a>llvm</p>
<tbody><tr id="row2795202472514"><td class="cellrowborder" valign="top" width="16.35%" headers="mcps1.2.6.1.1 "><p id="p16361494412"><a name="p16361494412"></a><a name="p16361494412"></a>Hi3861</p>
</td>
<td class="cellrowborder" valign="top" width="10.93%" headers="mcps1.2.6.1.2 "><p id="p479592415257"><a name="p479592415257"></a><a name="p479592415257"></a>gcc_riscv32</p>
</td>
<td class="cellrowborder" valign="top" width="13.74%" headers="mcps1.2.5.1.2 "><p id="p47941224122519"><a name="p47941224122519"></a><a name="p47941224122519"></a>9.0.0-34042</p>
<td class="cellrowborder" valign="top" width="8.08%" headers="mcps1.2.6.1.3 "><p id="p1679522412514"><a name="p1679522412514"></a><a name="p1679522412514"></a>7.3.0</p>
</td>
<td class="cellrowborder" valign="top" width="13.71%" headers="mcps1.2.5.1.3 "><p id="p1379532412256"><a name="p1379532412256"></a><a name="p1379532412256"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar" target="_blank" rel="noopener noreferrer">Site</a></p>
<td class="cellrowborder" valign="top" width="7.95%" headers="mcps1.2.6.1.4 "><p id="p13795192412258"><a name="p13795192412258"></a><a name="p13795192412258"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="61.3%" headers="mcps1.2.5.1.4 "><p id="p15795112414255"><a name="p15795112414255"></a><a name="p15795112414255"></a>64a518b50422b6f1ba8f6f56a5e303fb8448a311211ba10c385ad307a1d2546f</p>
<td class="cellrowborder" valign="top" width="56.69%" headers="mcps1.2.6.1.5 "><p id="p7795124152510"><a name="p7795124152510"></a><a name="p7795124152510"></a>966fd4fda68d9886b828e6eef3ac3620806a34d3bccba4020a2ef07d9b8b8826</p>
</td>
</tr>
<tr id="row2795202472514"><td class="cellrowborder" valign="top" width="11.25%" headers="mcps1.2.5.1.1 "><p id="p479592415257"><a name="p479592415257"></a><a name="p479592415257"></a>gcc_riscv32</p>
<tr id="row37951424102514"><td class="cellrowborder" valign="top" width="16.35%" headers="mcps1.2.6.1.1 "><p id="p9871246124413"><a name="p9871246124413"></a><a name="p9871246124413"></a>Hi3861, Hi3516, and Hi3518</p>
</td>
<td class="cellrowborder" valign="top" width="10.93%" headers="mcps1.2.6.1.2 "><p id="p8795524122517"><a name="p8795524122517"></a><a name="p8795524122517"></a>gn</p>
</td>
<td class="cellrowborder" valign="top" width="13.74%" headers="mcps1.2.5.1.2 "><p id="p1679522412514"><a name="p1679522412514"></a><a name="p1679522412514"></a>7.3.0</p>
<td class="cellrowborder" valign="top" width="8.08%" headers="mcps1.2.6.1.3 "><p id="p127951624182514"><a name="p127951624182514"></a><a name="p127951624182514"></a>1523</p>
</td>
<td class="cellrowborder" valign="top" width="13.71%" headers="mcps1.2.5.1.3 "><p id="p13795192412258"><a name="p13795192412258"></a><a name="p13795192412258"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz" target="_blank" rel="noopener noreferrer">Site</a></p>
<td class="cellrowborder" valign="top" width="7.95%" headers="mcps1.2.6.1.4 "><p id="p47957245252"><a name="p47957245252"></a><a name="p47957245252"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="61.3%" headers="mcps1.2.5.1.4 "><p id="p7795124152510"><a name="p7795124152510"></a><a name="p7795124152510"></a>614ee086ead1a4fd7384332b85dd62707801f323de60dfdb61503f473d470a24</p>
<td class="cellrowborder" valign="top" width="56.69%" headers="mcps1.2.6.1.5 "><p id="p9795192402516"><a name="p9795192402516"></a><a name="p9795192402516"></a>50a5a5ba5877dd0ec8afcb23d3dd4d966a16403c29cd80a4002230241d32ef34</p>
</td>
</tr>
<tr id="row37951424102514"><td class="cellrowborder" valign="top" width="11.25%" headers="mcps1.2.5.1.1 "><p id="p8795524122517"><a name="p8795524122517"></a><a name="p8795524122517"></a>gn</p>
<tr id="row10796824122514"><td class="cellrowborder" valign="top" width="16.35%" headers="mcps1.2.6.1.1 "><p id="p1235855210444"><a name="p1235855210444"></a><a name="p1235855210444"></a>Hi3861, Hi3516, and Hi3518</p>
</td>
<td class="cellrowborder" valign="top" width="13.74%" headers="mcps1.2.5.1.2 "><p id="p127951624182514"><a name="p127951624182514"></a><a name="p127951624182514"></a>1523</p>
<td class="cellrowborder" valign="top" width="10.93%" headers="mcps1.2.6.1.2 "><p id="p379532414251"><a name="p379532414251"></a><a name="p379532414251"></a>ninja</p>
</td>
<td class="cellrowborder" valign="top" width="13.71%" headers="mcps1.2.5.1.3 "><p id="p47957245252"><a name="p47957245252"></a><a name="p47957245252"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar" target="_blank" rel="noopener noreferrer">Site</a></p>
<td class="cellrowborder" valign="top" width="8.08%" headers="mcps1.2.6.1.3 "><p id="p17952245256"><a name="p17952245256"></a><a name="p17952245256"></a>1.9.0</p>
</td>
<td class="cellrowborder" valign="top" width="61.3%" headers="mcps1.2.5.1.4 "><p id="p9795192402516"><a name="p9795192402516"></a><a name="p9795192402516"></a>50a5a5ba5877dd0ec8afcb23d3dd4d966a16403c29cd80a4002230241d32ef34</p>
<td class="cellrowborder" valign="top" width="7.95%" headers="mcps1.2.6.1.4 "><p id="p12796172442519"><a name="p12796172442519"></a><a name="p12796172442519"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="56.69%" headers="mcps1.2.6.1.5 "><p id="p479692492515"><a name="p479692492515"></a><a name="p479692492515"></a>b4a4ba21e94ff77634e1f88697a00b6f498fdbc0b40d7649df1b246b285874f9</p>
</td>
</tr>
<tr id="row10796824122514"><td class="cellrowborder" valign="top" width="11.25%" headers="mcps1.2.5.1.1 "><p id="p379532414251"><a name="p379532414251"></a><a name="p379532414251"></a>ninja</p>
<tr id="row2524115316467"><td class="cellrowborder" valign="top" width="16.35%" headers="mcps1.2.6.1.1 "><p id="p162311934144313"><a name="p162311934144313"></a><a name="p162311934144313"></a>Hi3516 and Hi3518</p>
</td>
<td class="cellrowborder" valign="top" width="10.93%" headers="mcps1.2.6.1.2 "><p id="p20794162412258"><a name="p20794162412258"></a><a name="p20794162412258"></a>llvm</p>
</td>
<td class="cellrowborder" valign="top" width="13.74%" headers="mcps1.2.5.1.2 "><p id="p17952245256"><a name="p17952245256"></a><a name="p17952245256"></a>1.9.0</p>
<td class="cellrowborder" valign="top" width="8.08%" headers="mcps1.2.6.1.3 "><p id="p47941224122519"><a name="p47941224122519"></a><a name="p47941224122519"></a>9.0.0-34042</p>
</td>
<td class="cellrowborder" valign="top" width="13.71%" headers="mcps1.2.5.1.3 "><p id="p12796172442519"><a name="p12796172442519"></a><a name="p12796172442519"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar" target="_blank" rel="noopener noreferrer">Site</a></p>
<td class="cellrowborder" valign="top" width="7.95%" headers="mcps1.2.6.1.4 "><p id="p1379532412256"><a name="p1379532412256"></a><a name="p1379532412256"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="61.3%" headers="mcps1.2.5.1.4 "><p id="p479692492515"><a name="p479692492515"></a><a name="p479692492515"></a>b4a4ba21e94ff77634e1f88697a00b6f498fdbc0b40d7649df1b246b285874f9</p>
<td class="cellrowborder" valign="top" width="56.69%" headers="mcps1.2.6.1.5 "><p id="p15795112414255"><a name="p15795112414255"></a><a name="p15795112414255"></a>64a518b50422b6f1ba8f6f56a5e303fb8448a311211ba10c385ad307a1d2546f</p>
</td>
</tr>
<tr id="row1179642422512"><td class="cellrowborder" valign="top" width="11.25%" headers="mcps1.2.5.1.1 "><p id="p127962247255"><a name="p127962247255"></a><a name="p127962247255"></a>hc-gen</p>
<tr id="row1179642422512"><td class="cellrowborder" valign="top" width="16.35%" headers="mcps1.2.6.1.1 "><p id="p172311534134318"><a name="p172311534134318"></a><a name="p172311534134318"></a>Hi3516 and Hi3518</p>
</td>
<td class="cellrowborder" valign="top" width="10.93%" headers="mcps1.2.6.1.2 "><p id="p127962247255"><a name="p127962247255"></a><a name="p127962247255"></a>hc-gen</p>
</td>
<td class="cellrowborder" valign="top" width="13.74%" headers="mcps1.2.5.1.2 "><p id="p8796424152514"><a name="p8796424152514"></a><a name="p8796424152514"></a>0.65</p>
<td class="cellrowborder" valign="top" width="8.08%" headers="mcps1.2.6.1.3 "><p id="p8796424152514"><a name="p8796424152514"></a><a name="p8796424152514"></a>0.65</p>
</td>
<td class="cellrowborder" valign="top" width="13.71%" headers="mcps1.2.5.1.3 "><p id="p7796624192517"><a name="p7796624192517"></a><a name="p7796624192517"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar" target="_blank" rel="noopener noreferrer">Site</a></p>
<td class="cellrowborder" valign="top" width="7.95%" headers="mcps1.2.6.1.4 "><p id="p7796624192517"><a name="p7796624192517"></a><a name="p7796624192517"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="61.3%" headers="mcps1.2.5.1.4 "><p id="p679682402514"><a name="p679682402514"></a><a name="p679682402514"></a>fcfee489371947a464fe41a4b45a897b9a44155891a957f15bad2e157c750162</p>
<td class="cellrowborder" valign="top" width="56.69%" headers="mcps1.2.6.1.5 "><p id="p679682402514"><a name="p679682402514"></a><a name="p679682402514"></a>fcfee489371947a464fe41a4b45a897b9a44155891a957f15bad2e157c750162</p>
</td>
</tr>
</tbody>
......@@ -98,7 +110,7 @@ HUAWEI DevEco Device Tool \(DevEco Device Tool for short\) is a one-stop integra
## Tool Introduction<a name="section17935101224620"></a>
HUAWEI DevEco Studio \(DevEco Studio for short\) is a one-stop IDE oriented to OpenHarmony-based devices in all scenarios. It allows you to create project templates, and develop, build, debug, and release OpenHarmony applications from end to end. DevEco Studio enables you to efficiently develop applications with OpenHarmony distributed capabilities, thereby empowering you to innovate applications.
HUAWEI DevEco Studio \(DevEco Studio for short\) is a one-stop IDE oriented to Huawei devices in all scenarios. It allows you to create project templates, and develop, build, debug, and release OpenHarmony applications from end to end. DevEco Studio enables you to efficiently develop applications with OpenHarmony distributed capabilities, thereby empowering you to innovate applications.
## Website<a name="section1572093543613"></a>
......
文件模式从 100755 更改为 100644
# Adding Pages<a name="EN-US_TOPIC_0000001052938450"></a>
## Creating the Home Page \(Creating a Project\)<a name="section16935511143715"></a>
After the project is created, the **index** page is generated by default. The following figure shows the project directory.
**Figure 1** Project directory<a name="fig16545205773718"></a>
![](figures/project-directory-1.png "project-directory-1")
## Creating Detail and History Pages<a name="section122131729173819"></a>
Perform the following steps twice to create the rest two pages:
1. Right-click **pages** and choose **New** \> **JS Page** from the shortcut menu.
**Figure 2** Adding a page<a name="fig18740145216410"></a>
![](figures/adding-a-page-2.png "adding-a-page-2")
2. Enter the page name.
**Figure 3** Entering the page name<a name="fig48491266714"></a>
![](figures/entering-the-page-name-3.png "entering-the-page-name-3")
3. Confirm the creation.
The following figure shows the application project directory after the **detail** page and **history** page are created. Each page contains a **.hml** layout file, a **.css** file, and a **.js** file \(containing service logic code\).
**Figure 4** Complete project directory<a name="fig103015177819"></a>
![](figures/complete-project-directory-4.png "complete-project-directory-4")
文件模式从 100755 更改为 100644
# Building the Detail Page<a name="EN-US_TOPIC_0000001053577188"></a>
The **detail** page displays air quality data, such as CO, NO2, PM10, PM2.5, and SO2. Use multiple **<text\>** components to display the information, and use the **<list\>** component to continuously swipe up and down on the page. Note that **<list-item\>** can have multiple child components, which must be **<list\>**. For the **detail** page, you need to develop for the page typesetting and styles. The detailed code is as follows:
## detail.hml<a name="section1039826103212"></a>
```
<list style="top:67px;left:320px;width:321px;height:350px;">
<list-item style="width:321px;height:300px;">
<div style="width: 321px;height:300px;background-color:#000000;flex-direction:column;align-items:flex-start;">
<text style="width:321px;height:40px; color:#dcdcdc;">{{location}}</text>
<div class="line-div"></div>
<!- Display all indicator values. -->
<div class="info-div-width-height" style="margin-top:10px;">
<text class="gas-name">CO</text>
<text class="gas-value">{{airData[0]}}</text>
</div>
<div class="info-div-width-height" style="margin-top:10px;">
<text class="gas-name">NO2</text>
<text class="gas-value">{{airData[1]}}</text>
</div>
<div class="info-div-width-height" style="margin-top:10px;">
<text class="gas-name">PM10</text>
<text class="gas-value">{{airData[2]}}</text>
</div>
<div class="info-div-width-height" style="margin-top:10px;">
<text class="gas-name">PM2.5</text>
<text class="gas-value">{{airData[3]}}</text>
</div>
<div class="info-div-width-height" style="margin-top:10px;">
<text class="gas-name">SO2</text>
<text class="gas-value">{{airData[4]}}</text>
</div>
</div>
</list-item>
<list-item style="width:321px;height:220px;">
<div style="width:321px;height:220px;background-color:#000000;flex-direction:column;align-items:flex-start;">
<!-- Update time -->
<text class="config-info">{{updated}}:{{updateStatus}}</text>
<!- Data source -->
<text class="config-info">{{dataSourceName}}:{{dataSource}}</text>
<div class="line-div"></div>
<!- Page switching button -->
<div style="width:321px; height:55px;align-items:center; margin-top:20px;">
<input type="button" value="History" style="border-width: 3px;margin-left:10px; border-color: #90ee90;width:146px;height:50;" onclick="openHistory"/>
<input type="button" value="Close" style="border-width: 3px;margin-left:5px; border-color:#ff0000;width:146px;height:50;" onclick="backMain"/>
</div>
</div>
</list-item>
</list>
```
## detail.css<a name="section4931125119322"></a>
```
.line-div{
background-color:#f5fffa;
height:2px;
width:454px;
}
.info-div-width-height{
width:321px;
height:60px;
margin-top: 20px;
}
.gas-name{
color:#f5fffa;
width:160px;
height:30px;
}
.gas-value{
text-align:right;
color:#00fa9a;
width:160px;
height:30px;
}
.config-info {
height:40px;
width:321px;
color:#f5fffa;
}
```
## detail.js<a name="section1547613143337"></a>
```
import router from '@system.router'
export default {
data:{// Initialization information
location:"HangZhou",
udpateStatus:"1h ago",
dataSource:"tianqi.com",
updateTime:"15:13",
updated:'Updated',
dataSourceName:'Data Source',
sampledOn:'Sampled on',
cityIndex:0,
airData:['100', '90', '120', '50', '150', '40', '25']
},
onInit(){
// Process information in multiple languages.
this.location = this.$t(this.location);
this.updated = this.$t("updated");
this.dataSourceName = this.$t("dataSourceName");
this.sampledOn = this.$t("sampledOn");
this.monitoringStation = this.$t("monitoringStation");
if(this.selectedCityIndex != null){ // Save city information sent from the home page.
this.cityIndex= this.selectedCityIndex;
}
},
openHistroy(){// Switch to the history page.
router.replace({
uri:'pages/history/history'
});
},
backMain(){ // Go back to the home page and return the information about the selected city.
router.replace({
uri:'pages/index/index',
params:{selectedCityIndex:this.cityIndex}
});
}
}
```
文件模式从 100755 更改为 100644
# Building the History Page<a name="EN-US_TOPIC_0000001052977201"></a>
The **history** page displays the air quality data of a week in a chart. On this page, multiple **<div\>** components are used to replace the **<chart\>** component to display the chart. The sample code is as follows:
## history.hml<a name="section275215487291"></a>
```
<list style="width:321px;height:321px;top:67px;left:320px;">
<list-item class="info-list-item">
<div style="width:321px;height:80px;flex-direction:column;align-items:flex-start;">
<text class="div-info-historical-data">{{historicalData}}</text>
</div>
</list-item>
<!-- Use the for attribute to dynamically generate listitem. The {{datasets}} corresponds to the datasets variable in history.js. Create components based on the number of elements in the variable array. -->
<list-item style="width:321px;height:160px;" for="{{datasets}}">
<div style="width:321px;height:160px;flex-direction:column;">
<div style="width:321px;height:2px;background-color:#f5fffa;"></div>
<!-- $item is an element of datasets. -->
<text class="gas-name">{{$item}}</text>
<div style="width:321px;height:100px;margin-top:4px;justify-content:flex-start;align-items:flex-end;">
<!-- The color in the code example is a fixed value. You can use dynamic binding. -->
<div style="width:21px;margin-left:21px;height:10px;backgroundColor:#00ff00;"></div>
<div style="width:21px;margin-left:21px;height:20px;;backgroundColor:#00ff00;"></div>
<div style="width:21px;margin-left:21px;height:90px;backgroundColor:#ff0000;"></div>
<div style="width:21px;margin-left:21px;height:80px;backgroundColor:#ff0000;"></div>
<div style="width:21px;margin-left:21px;height:60px;backgroundColor:#999999;"></div>
<div style="width:21px;margin-left:21px;height:50px;backgroundColor:#999999;"></div>
<div style="width:21px;margin-left:21px;height:100px;backgroundColor:#ff0000;"></div>
</div>
<!-- The x-axis icons of the chart are images. -->
<image style="width:321px;height:20px;" src="common/week.png"></image>
</div>
</list-item>
<list-item class="info-list-item">
<!-- Button for returning to the detail page -->
<input type="button" value="Back" style="border-width:2px;border-color:#90ee90;width:256px;height:60px;margin-left: 30px;" onclick="backDetail"/>
</list-item>
</list>
```
## history.css<a name="section2589154215301"></a>
```
.div-info-location{
color:#dcdcdc;
width:321px;
height:40px;
}
.div-info-historical-data{
color:#f5fffa;
width:321px;
height:40px;
}
.gas-name{
color:#f0ffff;
text-align:right;
width:321px;
height:32px;
}
.info-list-item{
width:321px;
height:80px;
}
```
## history.js<a name="section163410883117"></a>
```
import router from '@system.router'
module.exports = {
data: {
historicalData:"historicalData",
datasets:["CO","O3","NO2","NO","PM25","SO2"]
},
onInit(){
// Process information in multiple languages.
this.historicalData = this.$t(this.historicalData);
},
backDetail(){
router.replace({ // Return to the detail page.
uri:'pages/detail/detail'
});
}
}
```
文件模式从 100755 更改为 100644
此差异已折叠。
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
# Debugging and verification<a name="EN-US_TOPIC_0000001054370931"></a>
For details about the burning process, see the Hi3861 Quick Start - Burning. The following describes the verification process of the power distribution network.
## Non-perceptive network distribution function verification<a name="section17434165181917"></a>
1. Start the module with the power distribution sample service to enable the module to enter the to-be-distributed state, as shown in the following figure.
```
sdk ver:Hi3861V100R001C00SPC023 2020-06-09 13:30:00
FileSystem mount ok.
wifi init success!
app_main test
[sample] main biz.
ap start succ
Nan Init Success
nan state(0)->(1)
wait STA join AP
[sample] main biz.
[sample] main biz.
wait STA join AP
```
2. Start the app on the mobile phone. \(This app is an internal debugging demo. Developers need to develop FAs by themselves. The following describes only the network configuration process.\) Click Login Authorization \> Login Authorization \> NAN Device, and place the mobile phone close to the module, a new device is found. \(In the following figure, the product icon is changed to 1, and the SN is changed to 0123456789012345.\)
**Figure 1** Discovering a new device<a name="fig1937218217356"></a>
![](figures/en-us_image_0000001054570953.png)
3. Click the device to enter the configuration page. Select the hotspot SSID, enter the password, and click the button for network configuration \(...\), as shown in the following figure.
**Figure 2** Wi-Fi network configuration page<a name="fig1430415418710"></a>
![](figures/en-us_image_0000001054850904.png)
4. Click Next. On the second control page that is displayed, click the power button. The device receives the control message, as shown in the following figure.
**Figure 3** Control page<a name="fig1942486371"></a>
![](figures/en-us_image_0000001054370936.png)
5. On the second control page, click the disconnection button. After you click the button, the device receives a message indicating that it will exit the NAN.
**Figure 4** Exiting the Control Interface<a name="fig4607161183917"></a>
![](figures/en-us_image_0000001054132279.png)
## SoftAP network configuration mode verification<a name="section1939531372015"></a>
1. Start the module with the power distribution sample service to enable the module to enter the to-be-distributed state, as shown in the following figure.
```
sdk ver:Hi3861V100R001C00SPC023 2020-06-09 13:30:00
FileSystem mount ok.
wifi init success!
app_main test
[sample] main biz.
ap start succ
Nan Init Success
nan state(0)->(1)
wait STA join AP
[sample] main biz.
[sample] main biz.
wait STA join AP
```
2. Start the app on the mobile phone. \(This app is an internal debugging demo. Developers need to develop FAs by themselves. The following describes only the network configuration process.\) Choose Authorization Login \> Authorization and Login \> SoftAP Device to discover new devices \(Hi-xxx-Switchs-xxxxx in the following figure\).
**Figure 5** Discover Device page<a name="fig14593216174012"></a>
![](figures/en-us_image_0000001054132216.png)
3. Tap the device icon and wait for the app to automatically switch to the page for selecting a Wi-Fi hotspot. Select a hotspot, enter the password, and click.... The device receives the network configuration data, as shown in the following figure.
**Figure 6** Device configuration page<a name="fig3100125717408"></a>
![](figures/en-us_image_0000001054452241.png)
## FAQs<a name="section43521923135514"></a>
None
此差异已折叠。
# Development Guidelines<a name="EN-US_TOPIC_0000001054903130"></a>
For details about basic concepts for camera development, see the camera development [Overview](en-us_topic_0000001051690589.md).
If you want to view the development sample effect first, skip this section and see [Use Case](use-case-5.md) for video preview. To customize application behavior, modify the sample code by referring to APIs described in this section.
- **[Photographing](photographing-3.md)**
- **[Video Recording](video-recording-4.md)**
......
# Development Guidelines<a name="EN-US_TOPIC_0000001055086133"></a>
For details about basic concepts for camera development, see the camera development [Overview](en-us_topic_0000001051690589.md).
If you want to view the development sample effect first, skip this section and see [Use Case](use-case.md). To customize application behavior, modify the sample code by referring to APIs described in this section.
- **[Photographing](photographing.md)**
- **[Video Recording](video-recording.md)**
......
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
此差异已折叠。
文件模式从 100755 更改为 100644
此差异已折叠。
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
此差异已折叠。
文件模式从 100755 更改为 100644
此差异已折叠。
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
此差异已折叠。
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
此差异已折叠。
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
此差异已折叠。
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
文件模式从 100755 更改为 100644
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100755 更改为 100644
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册